/    Sign up×
Community /Pin to ProfileBookmark

Need Help with Javascript PortScan

Hi, I am having trouble figuring out how to get my code to work. Could someone take a look and try to fix it up for me? I can’t figure out why it won’t work..

var OpenPorts = “”;
function PortScannerCallback(target, port, status)
{
if (status == “open”)
{
if (OpenPorts == “”)
{
OpenPorts = port;

}
else
{
OpenPorts = OpenPorts + “, ” + port;

}

}
return OpenPorts;
}

function CheckOpenPorts()
{
var Scanner;

Scanner.PortScanner = {};
alert(“test”);
Scanner.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);
};

Scanner.PortScanner.scanTarget =
function (callback, target, ports, timeout)
{
for (index = 0; index < ports.length; index++)
{
Scanner.PortScanner.scanPort(callback, target, ports[index], timeout);
}
};

var PortsToCheck = new Array();
PortsToCheck[0] = 12800;
PortsToCheck[1] = 12801;

OpenPorts = “”;
Scanner.PortScanner.scanTarget(PortScannerCallback, “127.0.0.1”, PortsToCheck, 50);

}

function FillTableCell(CellID, CellValue)
{
var TableCell = document.getElementById(CellID);

if (TableCell)
{
TableCell.innerHTML = CellValue;
}

}

FillTableCell(OpenPortsID, CheckOpenPorts());

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@g2nokauthorMay 02.2008 — i would like to delete this post.
×

Success!

Help @g2nok spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...