Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Edited 2001-05-04 by tilly to make the title unique###### use Socket; open (HOST, ">>hosts.txt") || die "can't open hosts\n"; for ($i = 0; $i< 256; $i++) { for ($j = 0; $j< 256; $j++) { for ($k = 0; $k< 256; $k++) { for ($l = 0; $l< 256; $l++) { $iaddr = inet_aton("$i.$j.$k.$l"); # or whatever addre +ss $name = gethostbyaddr($iaddr, AF_INET); chomp $name; print "$i.$j.$k.$l\t$name\n"; print HOST "$i.$j.$k.$l\t$name\n"; } } } } close HOST;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid - not printing) Re: gethostbyaddr
by Ovid (Cardinal) on May 04, 2001 at 19:43 UTC | |
by Anonymous Monk on May 04, 2001 at 21:00 UTC | |
by mincus (Chaplain) on May 07, 2001 at 02:59 UTC | |
|
Re: gethostbyaddr question
by mattr (Curate) on May 07, 2001 at 16:47 UTC | |
|
Re: gethostbyaddr question
by petdance (Parson) on May 07, 2001 at 02:51 UTC |