All pastes #415668 Raw Edit

Someone

public text v1 · immutable
#415668 ·published 2007-03-29 19:53 UTC
rendered paste body
#!/usr/bin/perl -w

use IO::Socket;
use Socket;
use IO::Select; 

print "\nHost/IP you want to scan: ";
             my $end=5000;
             my $hostip="localhost";

             my (@aberta, %portes);
			for ($x=0; $x <=$end; $x++)
			{
                my $scansock = IO::Socket::INET->new(PeerAddr => $hostip, PeerPort => $x, Proto => 'tcp', Timeout => 4);
                if ($scansock) {
                   push (@aberta, $x);
                   $scansock->close;
                }
             }

             if (@aberta) {
               foreach $z (@aberta) { print "$z\n" }
             } else {
                 print "\nNo open ports found\n";
             }