Código
#!usr/bin/perl #ScanPort 0.6 #Coded By Doddy H #Examples #perl scan.pl -target localhost -option fast #perl scan.pl -target localhost -option full -parameters 1-100 use IO::Socket; use Getopt::Long; GetOptions( "-target=s" => \$target, "-option=s" => \$opcion, "-parameters=s" => \$parameters ); head(); unless ($target) { sintax(); } else { if ( $opcion eq "fast" ) { scanuno($target); } if ( $opcion eq "full" and $parameters ) { if ( $parameters =~ /(.*)-(.*)/ ) { my $start = $1; my $end = $2; scandos( $target, $start, $end ); } } } copyright(); sub scanuno { my %ports = ( "21" => "ftp", "22" => "ssh", "25" => "smtp", "80" => "http", "110" => "pop3", "3306" => "mysql" ); if ( new IO::Socket::INET( PeerAddr => $_[0], PeerPort => $port, Proto => "tcp", Timeout => 0.5 ) ) { print "[+] Port Found : " . $port . " [Service] : " . $ports{$port} . "\n"; } } } sub scandos { for my $port ( $_[1] .. $_[2] ) { if ( new IO::Socket::INET( PeerAddr => $_[0], PeerPort => $port, Proto => "tcp", Timeout => 0.5 ) ) { } } } sub head { } sub copyright { } sub sintax { "\n[+] sintax : $0 -target <target> -option fast/full -parameters <1-9999>\n"; } # The End ?