<title> Port Scanning </title>
<form>
<label for= "Target" >target</label><br/>
<input type= "text" name= "target" value= "127.0.0.1"/><br/>
<label for= "Port" >port</label><br/>
<input type= "text" name= "port" value= "/><br/>"
<p>you can use sequence as well 80,81,8080</p>
<label for= "Timeout" >timeout</label><br/>
<input type= "text" name= "Timeout" value= "$"/><br/>
<label for= "Result" >result</label><br/>
<textarea id= "Result" name= "result" rows= "7" cols= "></textarea><br/>
<input class= "button" type= "button" value= "Scan" onclick= "Javascript:scan (this.form)"/>
</form>
<script>
var Attackapi = {
version:0.1,
Author: "Petko Petkov (architect)",
Homepage: "Http://www.gnucitizen.org"
};
Attackapi.portscanner = {};
AttackAPI.PortScanner.scanPort = function (callback, target, port, timeout) {
var timeout = (timeout = null)? 100:timeout;
var img = new Image ();
Img.onerror = function () {
if (!img) return;
img = undefined;
Callback (target, Port, "open");
};
Img.onload = Img.onerror;
IMG.SRC = "/http" + Target + ":" + port;
SetTimeout (function () {
if (!img) return;
img = undefined;
Callback (target, Port, "closed");
}, timeout);
};
AttackAPI.PortScanner.scanTarget = function (callback, target, ports, timeout)
{
for (index = 0; index < ports.length; index++)
AttackAPI.PortScanner.scanPort (callback, Target, Ports[index], timeout);
};
</script>
<script>
var result = document.getElementById ("result");
var callback = function (target, port, status) {
Result.value + + target + ":" + port + status + "\ n";
};
var scan = function (form) {
AttackAPI.PortScanner.scanTarget (Callback, Form.target.value, Form.port.value.split (","), Form.timeout.value);
};
</script>
Using JavaScript to scan ports