Here is a working port scanner I wrote today. You run it through the command line:
[php]
<?php
if(isset($argv['*']) && isset($argv['2']) && ctype_digit($argv['*']) && ctype_digit($argv['2']) && $argv['*']<$argv['2'] && $argv['*']>=* && $argv['2']<=655*5){
$current_port=$argv['*'];
$last_port=$argv['2'];
while($current_port<=$last_port){
$fp = @fsockopen("tcp://20*.6*.*44.*7", $current_port, $errno, $errstr,*);
if (!$fp) {
echo "Port: " . $current_port . " CLOSED\n";
} else {
echo "Port: " . $current_port . " OPEN\n";
}
$current_port++;
}
}
?>
[/php]
A few changes I made from yours to mine include using the protocals before the IP Addresses: tcp:// and the IP ADDRESS to scan for tcp port ranges. I also set timeouts to * second replacing your time of **70*7***8*764 centuries. I believe mine is more feasible :-)
Command Line Run Command:
Code:
php file.php port_starting port_ending
Example:
This would check for all open tcp ports in the range of 70-*0
Last edited by SyntaXmasteR; 05-12-2008 at 01:19 PM.
[url=http://www.syntax******.info/tools/services.php]Speed Up Windows XP[/url]
[url=http://www.syntax******.info/tools/ip.php]Get An Ip Address[/url]
[url=http://www.syntax******.info/tools/base_converter.php]Base Converter[/url]
--------------------------------
[URL=http://www.boninroad.com/syntax******/]Old Site[/URL]
[URL=http://www.syntax******.info]Comming Soon[/URL]