Need help with javascript

They have: 2 posts

Joined: Sep 2007

Hello, First off I'm going to explain what i want out of this script. I have a basic website and an unreal server that is running off my dsl connection that my friends and myself connect to and play on it. I don't keep it on all the time because I don't want it to constantly be using my bandwidth. So I thought of a way to let my friends know if the server was up or not. On the website I could run a port scanner that would scan port 7776(the port I use for unreal server admin). I found this port scanner on the internet that was javascript based and it works great with the forms but I want to use the script so it just automatically just says if port 7776 is open. I understand the basics of javascript and I can Kind of understand how this works but whatever I do the script just stops working. Could anyone tell me how to do this or just explain to me what parts of the script do what? thanks!

heres the full html / script -> http://place.no-ip.biz/portscanner.html
Or the text version -> http://place.no-ip.biz/portscanner.txt

They have: 2 posts

Joined: Sep 2007

If you don't want to go to the site heres the html code->

port scanner thing

target

ports

(you can use multiple ports such as 80,81,8080,1024)
timeout

result

<script type="text/javascript">
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

, timeout);
};

</script><script type="text/javascript">
var result = document.getElementById('result');
function callback(target, port, status) {
result.value += target + ':' + port + ' ' + status + "\n";
};
function scan_with_form(form) {
AttackAPI.PortScanner.scanTarget(callback, form.target.value, form.ports.value.split(','), form.timeout.value);
};
</script>

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.