[Perl] ScanPort 0.5

Iniciado por BigBear, 3 Diciembre 2011, 16:33 PM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Simple scanner port en perl

Código (perl) [Seleccionar]

#!usr/bin/perl
#ScanPort 0.5
#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] : ".$port." [Service] : ".$ports{$port}."\n";
}
}
print "\n\n[+] Scan Finish\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] : $port\n";
}
}
print "\n\n[+] Scan Finish\n";
}

sub head {
print "-- == ScanPort 0.5 == --\n\n";
}

sub copyright {
print "\n\n(C) Doddy Hackman 2011\n\n";
}

sub sintax {
print "\n[+] sintax : $0 -target target -option fast/full -parameters 1-9999\n";
}


# The End ?