Hier noch einmal der Quelltext:
<form>
Ziel: <br>
<input type="text" name="host" value="www.ceilers-it.de"> (Domainname oder IP-Adresse) <br>
Ports: <br>
<input type="text" name="ports" value="80"> (Es kann auch eine Reihe von Ports angegeben werden, z.B. 80,81,8080,1024)<br>
Timeout: <br>
<input type="text" name="timeout" value="1000"> (Der Timeout-Wert muss evtl. erhöht werden) <br>
Ergebnis: <br>
<textarea id="ergebnis" name="ergebnis" rows="7" cols="50"></textarea><br>
<input class="button" type="button" value="scan" onClick="javascript:scanne(this.form)">
</form>
<script>
PortScanner = {};
PortScanner.scanPort = function (callback, host, port, timeout) {
var timeout = (timeout == null)?100:timeout;
var img = new Image();
img.onerror = function () {
if (!img) return;
img = undefined;
callback(host, port, 'open');
};
img.onload = img.onerror;
img.src = 'http://' + host + ':' + port;
setTimeout(function () {
if (!img) return;
img = undefined;
callback(host, port, 'closed');
}, timeout);
};
PortScanner.scanHost = function (callback, host, ports, timeout)
{
for (index = 0; index < ports.length; index++)
PortScanner.scanPort(callback, host, ports[index], timeout);
};
var ergebnis = document.getElementById('ergebnis');
function callback(host, port, status) {
ergebnis.value += host + ':' + port + ' ' + status + "\n";
};
function scanne(form) {
PortScanner.scanHost(callback, form.host.value, form.ports.value.split(','), form.timeout.value);
};
</script>