Jump to content

PHP Port Checker Script


bugmenot

Recommended Posts

Hi, I am a network administrador of a High School and I want to make sure no torrent port is open in the lan. The router probably block every port, but I want to make sure all of them are closed. I looking something like uTorrent Port Checker to test port 1-12000, but I cant rip it off the php script and I have no idea of what is checking... Torrent is UDP or TCP protocol? Does anybody has any idea of a similar tool? I made a php script, but I'm looking for something lighter that would work just like the script of the utorrent port checker. Could you guys provide the source of that script?

Thanks in advance.

renatoplanilha@gmail.com

My beta php script (Not working too well):

<?php

function trace($obj)

{

print("<pre>");

print_r($obj);

print("</pre>");

}

/**

*

* @version $1.0$

* @copyright 2008

*/

$inicio = $_REQUEST["inicio"];

$t = file_get_contents("http://www.utorrent.com/testport.php?port=$inicio");

trace($t);

trace("<hr>");

flush();

?>

<script>

//clearTimeout(t);

t=setTimeout("window.location = 'test_port.php?inicio=<?=$inicio + 1?>'",1000);

</script>

Link to comment
Share on other sites

Thanks! With that script I made my own port checker! :D

Mine is in portuguese. Checkout!

http://www.erickxavier.com/test_port.php?inicio=8070&fim=8090

The translated script ready to go:

use test_port.php?first=FIRSTPORT*&last=LASTPORT

<?phpini_set('error_reporting', E_ALL);function trace($obj){    print("<pre>");    print_r($obj);    print("</pre>");}
$inicio = $_REQUEST["first"];$fim = $_REQUEST["last"];if (!$ip = getenv('HTTP_X_FORWARDED_FOR')){    $ip=getenv('REMOTE_ADDR');}trace('<span class="style1">YOUR IP: </span><span class="style2">'.$ip.'</span></br>');for($i=$first;$i<=$last;$i++){
    if (!@fsockopen($ip, (int)$i, $errno, $errstr, 10)){        trace("CLOSED: $i");    } else {        trace("OPENED: $i");    }    flush();}
?>
Link to comment
Share on other sites

This probably doesn't belong in the Feature Requests forum... so uh, moved to the General forum (and merged with your previous thread). Thanks :)

Edit: In retrospect, I'm not sure how wise it is to have a bugmenot account post scripts... It's a public account, so anyone can modify your script while we're not looking (so what looks like me "approving" of this currently-innocuous script might end up looking like me approving of a modified, malicious script by some other anonymous user). I don't mean that I don't trust you, but as this is the situation, I think I'll be copying the code into this post instead -- full credits to you, though, of course :P If you want, you can create a real account on your own, post the script, and I'll remove it from this post.

[sNIP]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Guest
This topic is now closed to further replies.
×
×
  • Create New...