Skip to content

Instantly share code, notes, and snippets.

@cobra-tn
Created April 13, 2012 13:20
Show Gist options
  • Save cobra-tn/2376802 to your computer and use it in GitHub Desktop.
Save cobra-tn/2376802 to your computer and use it in GitHub Desktop.
Port Scanner [Perl Script]
#!/usr/bin/perl
use IO::Socket;
if(@ARGV != 3){
print "ρσят ѕ¢αηηєя ¢σ∂є∂ ву вℓα¢к ¢σвяα
υѕαgє : [min port] [max port] [host]
";
exit 1;
}
if($ARGV[0] > $ARGV[1]){
print "Error: min port is higher then max port\n";
exit 1;
}
for($i = $ARGV[0]; $i <= $ARGV[1]; ++$i){
$host = IO::Socket::INET->new(PeerAddr=>$ARGV[2],PeerPort=>$i,proto=>'tcp',Timeout=>1) and print "Port $i is open\n";
}
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment