This repository has been archived by the owner on May 14, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aabeling
committed
Aug 15, 2013
0 parents
commit 31b730d
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jsportscanner.js taken from http://www.gnucitizen.org/static/blog/2006/08/jsportscanner.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<html> | ||
<head> | ||
<script src="jsportscanner.js" type="text/javascript"></script> | ||
<script type="text/javascript"> | ||
<!-- | ||
|
||
function check() { | ||
var host = document.getElementById('host').value; | ||
var port = document.getElementById('port').value; | ||
AttackAPI.PortScanner.scanTarget(function(target,port,result) { | ||
alert(target + ":" + port + " " + result); | ||
}, host, [port], 1000); | ||
} | ||
--> | ||
</script> | ||
</head> | ||
<body> | ||
<form> | ||
Host: <input type="text" id="host" name="host" length="20" /> | ||
Port: <input type="text" id="port" name="port" length="6" /> | ||
<input type="submit" value="Check" onclick="check();return false" /> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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); | ||
}; |