Posted on 2005-06-01 18:14:07-07 by apersaud
Automagically parsing an nmap scan with Nmap-Parser

You can run an nmap scan and have the parser parse the information automagically. The only thing is that you cannot use '-oX', '-oN', or '-oG' as one of your arguments for the nmap command line options passed to parsescan().

use Nmap::Parser; my $np = new Nmap::Parser; #this is a simple example (no input checking done) my @hosts = @ARGV; #Get hosts from stdin #runs the nmap command with hosts and parses it at the same time $np->parsescan('nmap','-sS O -p 1-1023',@hosts); for my $host ($np->get_host_objects()){ #$host is an Nmap::Parser::Host object print $host->hostname."\n"; }
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.