PHP Port Scanner

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.

You might also like...

Comments

 Gringod I was born. I lived. I got bored.... I found computers. I live again!!!

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match” - Bill Bryson