Link to home
Start Free TrialLog in
Avatar of siliconite
siliconite

asked on

socket problemo

i have decided to make a socket probe to test myyyyyy security and i am trying to make it quiker
this is my code so-far:

#!c:\program files\active perl\bin\perl\
use IO::Socket;
#this is the connection bit and if it cannot connect to the port or the port is #closed then it makes fail equal to could not whatever.
# build TCP socket connection attempt
$host = "80.4.249.49";
$first = 1;
$second = 30;
open(DAT,">ports.dat") || die("Cannot Open File:$!");
print "hello this is a port scanner made by me myself and i\n";
try();



sub try
{
$porter=$first;
while ($porter<=$second)
{
 $fail="connected to host on";
$socket= IO::Socket::INET->new(PeerAddr => $host,
                                   PeerPort => $porter,
                                   Proto    => "tcp",
                                   Timeout  => 5)
     or $fail="could not connect to the host on port";
if ($fail eq "connected to host on")
{
print DAT "$fail $porter\n";
}

print "$fail $porter\n";
$porter++
}
}


how can i multi thread it so that it does ...say...20 port scans at once all on different ports.
thanks in advance
cheers
Avatar of prady_21
prady_21

Use fork(); if u prefer

Is this the full code?????
Avatar of siliconite

ASKER

yea it is the full code could you tell me how to use fork
ASKER CERTIFIED SOLUTION
Avatar of prady_21
prady_21

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i am sorry, the second part is the sending side, which i have termed as receiving side.
cheers mate thnaks so much for youre time.
here r the points