Annonce

Réduire
Aucune annonce.

[Bash][PHP] Script ports scanner

Réduire
X
 
  • Filtre
  • Heure
  • Afficher
Tout nettoyer
nouveaux messages

  • [Bash][PHP] Script ports scanner

    Voici un scanner de ports "de base". A améliorer !

    Code:
    #!/usr/bin/php
    #THC PortScanner
    #Syntax : [Target-IP] [start_port] [end_port]
    #example: php ./THC_PS.sh 103.21.08.112 1 200
    #This line will scan the target IP 103.21.08.112 from port 1 to 200
    
    #Scanner
    
    <?php
        error_reporting(0);
        $host = $_SERVER['argv'][1]; 
        $start = $_SERVER['argv'][2];  
        $end = $_SERVER['argv'][3];       
        $delay = 1;                        
        function USAGE() 
        	{
            print("PHP Port Scanner - Version: 1.0" . "\n");
            print("by \"THC\"" . "\n");
            print("\n");
            print("Usage: php {$_SERVER['argv'][0]} [hostname] [start_port] [end_port]" . "\n");
            print("\t" . "Example: php {$_SERVER['argv'][0]} google.com 1 150" . "\n\n");
            die();
            } 
        if($_SERVER['argc'] != 4) USAGE();
        for($i = $start; $i < $end; $i++) {
            $fp = fsockopen($host, $i, $errno, $errstr, $delay);
            if(getservbyport($i, 'tcp') == '') { $protocol = "unknown"; } else { $protocol = getservbyport($i, 'tcp'); }
            if($fp) 
            {
            	echo "port $i [$protocol] open on $host" . "\n";
            	fclose($fp);
            } 
            else 
            {
    #    Uncomment the next line if you want to see Closed ports too.
    #    echo "port $i [$protocol] open on $host" . "\n";
    } 
            	flush();
             }
    ?>
    sigpic

    Cyprium Download Link

    Plus j'étudie plus j'me rends compte que je n'sais rien.

    †|
Chargement...
X