aphex has asked for the wisdom of the Perl Monks concerning the following question:

I'm coding a little app to find idle hosts using nmap, but I recieve SIGSEGV errors. I'm not sure if this is my fault or nmaps fault.
#!/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; } }
root@me root# ./idlesearch
Idlescan zombie 52.7.124.210 (52.7.124.210) port 80 cannot be used because it has not returned any of our probes -- perhaps it is down or firewalled. QUITTING! caught SIGSEGV signal, cleaning up
Idlescan zombie 164.248.128.208 (164.248.128.208) port 80 cannot be used because it has not returned any of our probes -- perhaps it is down or firewalled. QUITTING! caught SIGSEGV signal, cleaning up

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

    Perhaps it's my bleary eyes not working this morning, but I can't quite see what the Perl question is. I also don't think it's especially ethical to be using random hosts on the internet to conceal your attempts at port scanning others...