I Want to add thread to this Script!

Discussion in 'Programming' started by polaris, Jun 6, 2007.

  1. #1
    hello


    I have a script like this and I want to add threads to this to do the scanning object faster

    Can anyone help me?
    #!/usr/bin/perl
    use IO::Socket;
    
    $timeout = 5;
    $from = $ARGV[1];
    $to = $ARGV[2];
    $host = $ARGV[0];
    if (@ARGV < 3)
    {
    	usage();
    	exit()
    }
    while($from != $to + 1)
    {
    	$socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>$host, PeerPort=>$from,Timeout=>$timeout);
    	if($socket)
    	{
    		print $from ." is open.\n";
    	}
    	
    	$from++;
    }
    
    sub usage()
    {
    print 'Iron\'s PortScanner - Visit IronWarez.info for more scripts
    Usage:
    perl portscan.pl host FROM TO
    Example:
    perl portscan.pl 127.0.0.1 1 2000
    ';
    }
    Code (markup):
     
    polaris, Jun 6, 2007 IP