PHP Port Scanner

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 ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-06-2005
Jay Calvert
 
Posts: n/a
Default PHP Port Scanner

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
Reply With Quote
  #2 (permalink)  
Old 02-06-2005
Manuel Lemos
 
Posts: n/a
Default Re: PHP Port Scanner

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
Reply With Quote
  #3 (permalink)  
Old 02-07-2005
Johan Holst Nielsen
 
Posts: n/a
Default Re: PHP Port Scanner

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:18 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0