d.shankar Posted September 11, 2007 Share Posted September 11, 2007 I have this port scanner code in PHP. It is ultimately dead slow ... Is it how it works ?? Cant it be remodified ? <?php $host = "www.google.com"; $start = 0; $end = 65535; for($current = $start; $current <= $end; $current++) { $service = getservbyport($current, "tcp"); $result = @fsockopen($host, $current); if($result) { echo $current." Port is <font color=\"green\"><b>OPEN</b></font><br>"; flush(); } else { echo $current." Port is <font color=\"red\"><b>CLOSED</b></font><br>"; flush(); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/68841-port-scan/ Share on other sites More sharing options...
MadTechie Posted September 11, 2007 Share Posted September 11, 2007 scanning all ports will always be slow!, you could shorten the timeout but then you could get some bad results Quote Link to comment https://forums.phpfreaks.com/topic/68841-port-scan/#findComment-346042 Share on other sites More sharing options...
d.shankar Posted September 11, 2007 Author Share Posted September 11, 2007 oh thanks MT.. after long time we meet. you are doing gr8 job here. ;D Quote Link to comment https://forums.phpfreaks.com/topic/68841-port-scan/#findComment-346044 Share on other sites More sharing options...
MadTechie Posted September 11, 2007 Share Posted September 11, 2007 play with the timeout see what happens but slow servers will seam to have closed ports when their just slow! $timeout = 30; //change this $fp = fsockopen($host, $current, $errno, $errstr, $timeout); Quote Link to comment https://forums.phpfreaks.com/topic/68841-port-scan/#findComment-346060 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.