#!/usr/bin/perl
use strict;
use warnings;
use Socket;
use IO::Socket;

print "-------------------------------\n";
print "LP - Little PortScanner\n";
print "Coded by Kiki\n";
print "kiki[at]autistici[dot]org\n";
print "-------------------------------\n";

if (@ARGV < 4){
die "Usage: scan.pl host proto finish-port\n";
};

my $start = 0;
my $host = $ARGV[0];
my $proto = $ARGV[1];
my $finish = $ARGV[2] || 66535;

	if ($proto eq 'tcp'){
		
	for ($start=$finish; $start<=$finish; $start++){
	
		my $scan = IO::Socket::INET->new(PeerAddr=>"$host", PeerPort=>$start, Proto=>"tcp");
		if ($scan) { 

			print "$scan = Aperta\n";

		} else { 

			print "$scan = Chiusa\n"; 

		} 
	}
}


