This is a discussion on PHP Port Scanner within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi all, I am trying to find some code that I can use on my site to enable my visitors ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all,
I am trying to find some code that I can use on my site to enable my visitors to do a basic portscan of their computers. My site is a security site and I want to show my visitors that their machines might be wide open, or at least how to tell if they are protected. I have found several examples, some as basic as: <? $host = "[Some IP Address]"; for($i=0;$i<500;$i++) { $fp = fsockopen($host,$i,$errno,$errstr,1); if($fp) { echo "port " . $i . " open on " . $host . "\n"; fclose($fp); } else { echo "port " . $i . " closed on " . $host . "\n"; } flush(); } //end for ?> The problem, is it is really, really slow. Is there a faster way to do this? I think I need to find another solution that uses Threading. Any help would be appreciated Jay Calvert http://habaneronetworks.com |
|
|||
|
Hello,
on 02/06/2005 09:48 AM Jay Calvert said the following: > I am trying to find some code that I can use on my site to enable my > visitors to do a basic portscan of their computers. My site is a > security site and I want to show my visitors that their machines might > be wide open, or at least how to tell if they are protected. > > > I have found several examples, some as basic as: > > <? > $host = "[Some IP Address]"; > for($i=0;$i<500;$i++) { > $fp = fsockopen($host,$i,$errno,$errstr,1); > if($fp) > { > echo "port " . $i . " open on " . $host . "\n"; > fclose($fp); > } > else > { > echo "port " . $i . " closed on " . $host . "\n"; > } > flush(); > } //end for > ?> > > The problem, is it is really, really slow. Is there a faster way to do > this? I think I need to find another solution that uses Threading. > > Any help would be appreciated This class seems to do exactly what you want: http://www.phpclasses.org/portscanner -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html |
|
|||
|
Jay Calvert wrote:
> The problem, is it is really, really slow. Is there a faster way to do > this? I think I need to find another solution that uses Threading. > > Any help would be appreciated Take a look at: http://php.net/manual/en/ref.pcntl.php Regards, Johan Holst Nielsen www.phpgeek.dk |