Library code snippets
PHP Port Scanner
By gringod, published on 05 Sep 2003
Page 2 of 3
- Using The Scanner Class
- Displaying the results
- Conclusion
Displaying the results
The following is an example of the way in which the results of the port scanner can be displayed:
foreach($results as $ip=>$ip_results) {
echo gethostbyaddr($ip)."\n<blockquote>\n";
foreach($ip_results as $port=>$port_results) {
echo "\t".$port." : ".$port_results['pname']." : ";
if ($port_results['status']==1){echo "open";}
else {echo "closed";}echo "<br>\n";
}
echo "</blockquote>\n\n";
}
This code quite simply loops through the results, printing the host name, followed by an indented report of each scanned port.
Given the structured nature of the returned results, they could just as easily be displayed in a table, sent as an email, or even writen to a log file.
Related articles
Related discussion
-
Create this kind of website
by maidentv (1 replies)
-
PHP London July Meetup
by webdeveloperit (1 replies)
-
Binary Studio | software development outsourcing Ukraine
by shane124 (4 replies)
-
SOFTWARE PHP WORK
by synctel (0 replies)
-
London PHP / MySQL Superstar needed!
by gatewaytechnolabs (1 replies)
Related podcasts
-
EarthClassMail.com - Moving from LAMP to .NET 3.5
Scott chats with Matt Davis, architect at EarthClassMail.com, about their move from a LAMP stack (Linux/Apache/mysql/PHP) to .NET 3.5. What's working, what's not, and what kinds of issues are they running into as their architect their solution.
Events coming up
-
Dec
3
The Auckland PHP December meetup
Auckland, New Zealand
Topic: Magento E-Commerce platform Speaker: Robert Popovic, LERO9, Robert is the Technical Director and co-founder of LERO9. Robert attended the Electrotechnical Faculty at The University of Belgrade where he graduated with a Masters in Computer Science and Information Technology. Robert has worked exclusively in the field of web and software development throughout his career.
HI
I unzipped the script and run it, but I got errors.
and it's not so fast as indicated ???!!!
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of fsockopen(). If you would like to enable call-time pass-by-reference, you can set allowcalltimepassreference to true in your INI file. However, future versions may not support this any longer. in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of fsockopen(). If you would like to enable call-time pass-by-reference, you can set allowcalltimepassreference to true in your INI file. However, future versions may not support this any longer. in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:15 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:16 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:17 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:18 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:19 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:20 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:22 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:23 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:24 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:110 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:3306 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:1337 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
Warning: fsockopen(): unable to connect to 216.26.163.133:666 in c:\easyphp\www\wwwvbwebcoukshow30883fportscanner\scanner.class.php on line 103
www.vbweb.co.uk
15 : netstat : closed
16 : N/A : closed
17 : qotd : closed
18 : N/A : closed
19 : chargen : closed
20 : ftp-data : closed
21 : ftp : open
22 : N/A : closed
23 : telnet : closed
24 : N/A : closed
25 : smtp : open
80 : N/A : open
110 : pop3 : closed
3306 : N/A : closed
1337 : N/A : closed
666 : N/A : closed
where to correct ( which .INI file ??)
I would prefer to let my setting as they are and correct in the script itself.
Is there anyway to pass an external parameter to such script ??? (call it from another PHP one)
Good idea, full interest
Happy new year
This thread is for discussions of PHP Port Scanner.