#!/usr/bin/perl use LWP::Simple; use Socket; $outdir = "/www/htdocs/scan"; chdir($outdir); $file = shift; open(FD,"<" . $file) || die "Could not open input file: $!"; while ($line = ) { chomp($line); $data = get("http://" . $line); if ( length($data) > 0 ) { $newip = gethostbyname($line); $newhost = gethostbyaddr($newip,AF_INET); $out = ""; if ($newhost ne "") { $out = "$newhost.html"; } else { $out = "$line.html"; } print "Writing data for $line to $out\n"; open (HTML,">" . $out) || die "Could not create HTML file: $!"; print HTML $data; close (HTML); } } close(FD);