Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to scan entire subnet

Status
Not open for further replies.

Goku81

Programmer
Mar 27, 2001
34
US
I want to do work with my subnet here and I want to know how to do this, I am new to Perl and got the hang of FTP stuff in perl now but i want to do scans on whole subnet and need a way to basically do this algorithm

a = 255, b = 255, c = 255, d = 1;

while(d != 255)
do
connect->(a.b.c.d); // this being an IP address
d++;
done

How do I got about doing this???

 
I'm not sure about the connect part, but the loop would look something like this:
Code:
for ( $i = 1; $i < 255; $i++ ) {
   connect->(&quot;255.255.255.&quot;.$i);
}
or even:
Code:
foreach $i (1..255) {
   connect->(&quot;255.255.255.&quot;.$i);
}
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top