aphex has asked for the wisdom of the Perl Monks concerning the following question:
root@me root# ./idlesearch#!/usr/bin/perl -w use strict; my $ip; my $goodhosts = 0; my $marker = 0; while ($goodhosts != 10 ) { #used to pick a random ip address open(GETHOST, "nmap -iR 1 -sL |") || die "fix your code\n"; while (<GETHOST>) { chomp; if ($_ =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/) { $ip = $1; } } close(GETHOST); #test for idleness open(IDLERESULT, "nmap -P0 -sI $ip whatever.ip |") || die "bad code\n" +; while (<IDLERESULT>) { chomp; if (m/completed/) { $marker = 1; } } close(IDLERESULT); if ($marker == 1) { $goodhosts = $goodhosts + 1; system("echo $ip >> idle_hosts"); $marker = 0; } }
Here is my box
uname -a
Linux 2.6.3-27mdk #1 Tue May 31 21:48:42 MDT 2005 i686 unknown unknown GNU/Linux
And here is perl
perl -v
This is perl, v5.8.3 built for i386-linux-thread-multi
And here is nmap
nmap -version
nmap version 3.93 ( http://www.insecure.org/nmap/ )
Thanks for any help.
Mike
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SIGSEGV errors
by puploki (Hermit) on Sep 17, 2005 at 10:15 UTC |