postIt

        Post-It sticky notes with PasteBin sense

  • 02:39:00 am on March 1, 2010 | # | 0
    Tags: , , , ,

    Port scanner class. An example of usage is as follow where my IP is 192.168.1.10. The upper range for scanning isn’t alive: 192.168.1.11. I hide warnings due to open socket failure which will happen because the IP isn’t alive.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    <?php
    	ini_set( "display_errors", 0);
    	require_once("scanner.class.php");
    	$ip_address1 = "192.168.1.10";
    	$ip_address2 = "192.168.1.11";
    	$my_scanner = new PortScanner($ip_address1, $ip_address2);
     
    	$my_scanner->set_ports("80");
     
    	$results = $my_scanner->do_scan();
     
    	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";
    	  }
     
    ?>

    Results are as follow (it includes developerfusion.com port scan by default (?)):

    developerfusion.com

    15 : netstat : closed
    16 : N/A : closed
    17 : qotd : closed
    18 : msp : closed
    19 : chargen : closed
    20 : ftp-data : closed
    21 : ftp : closed
    22 : ssh : closed
    23 : telnet : closed
    24 : N/A : closed
    25 : smtp : open
    80 : www : open
    110 : pop3 : closed
    3306 : mysql : closed
    1337 : N/A : closed
    666 : N/A : closed

    xp-racy.local

    80 : www : open

    192.168.1.11

    80 : www : closed

     

  • Modified from Prologue theme by Automattic

Leave a Comment