Un simple scanner port hecho en Perl.
#!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"
);
print "\n[+] Scanning $_[0]\n\n\n";
for my $port ( keys %ports ) {
if (
new IO::Socket::INET(
PeerAddr => $_[0],
PeerPort => $port,
Proto => "tcp",
Timeout => 0.5
)
)
{
print "[+] Port Found : " . $port
. " [Service] : "
. $ports{$port} . "\n";
}
}
print "\n\n[+] Scan Finished\n"; }
sub scandos {
print "\n[+] Scanning $_[0]\n\n\n";
for my $port ( $_[1] .. $_[2] ) {
if (
new IO::Socket::INET(
PeerAddr => $_[0],
PeerPort => $port,
Proto => "tcp",
Timeout => 0.5
)
)
{
print "[+] Port Found : $port\n"; }
}
print "\n\n[+] Scan Finished\n"; }
sub head {
print "\n-- == ScanPort 0.6 == --\n\n"; }
sub copyright {
print "\n\n-- == (C) Doddy Hackman 2012 == --\n\n"; }
sub sintax {
"\n[+] sintax : $0 -target <target> -option fast/full -parameters <1-9999>\n";
}
# The End ?