Re: [Nmap-scanner-general] encoding problem
Brought to you by:
perldork
From: Max <nm...@we...> - 2006-05-02 17:49:38
|
If all you need is XML output from the module for a quick parse or one-off / infrequently used script, my module is probably not as useful as Nmap::Parser :) or just using the greppable output from nmap in a shell pipeline or using a straight XML to hash-of-hashes module like XML::Simple. Why? The point of my module is to make it easy to maintain a long running, larger program that needs nmap functionality; by creating classes from the XML output you get a more maintainable program .. Nmap::Scanner gives you a tighter software 'contract' between your program and nmap, which will help keep code that uses nmap in a larger perl program readable and maintainable (in my opinion). For a one off, or quick 'grep' type scripts, Nmap::Scanner is probably more effort to implement in a program than it is worth :). I encourage you all to use this module, but I am not going to pretend :p that this is the best ever module for working with nmap *or* that it is *the* module to use in all situations requiring nmap. I also understand that I need to update this module soon to work 100% with the nmap 4.0.x release. Will do that within the next week or two. Thank you to all of you who have tried this module, use this module, and for all of the feedback (negative and positive) about the module. Regards, Max On 5/2/06, Brandon Bennett <be...@gm...> wrote: > I had the exact same issue and gave up on Nmap::Scanner and just used > XML::Simple. Here is the code below. > > use XML::Simple; > use Data::Dumer; > > $nmap =3D "\"c:\\Program Files\\nmap\\nmap.exe\" -v -v -v -sS -p 22-23 > -O -A -oX -"; > > $xml =3D new XML::Simple; > $output =3D `$nmap $ip`; > $data =3D $xml->XMLin($output); > > Dumper($xml); > > > -------------------------------------------------------------------------= -------------------------- > > H:\>"c:\Program Files\Nmap\nmap.exe" -V > > Nmap version 4.01 ( http://www.insecure.org/nmap ) > > -------------------------------------------------------------------------= --------------------------- > > H:\>perl -v > > This is perl, v5.8.8 built for MSWin32-x86-multi-thread > (with 21 registered patches, see perl -V for more detail) > > Copyright 1987-2006, Larry Wall > > Binary build 816 [255195] provided by ActiveState http://www.ActiveState.= com > Built Mar 1 2006 18:00:52 > -------------------------------------------------------------------------= ----------------------------- > > On 5/1/06, Jack Coates <ja...@mo...> wrote: > > windows xp > > C:\Documents and Settings\Jack Coates>perl -v > > > > This is perl, v5.8.8 built for MSWin32-x86-multi-thread > > (with 25 registered patches, see perl -V for more detail) > > > > Copyright 1987-2006, Larry Wall > > > > Binary build 817 [257965] provided by ActiveState > > http://www.ActiveState.com > > Built Mar 20 2006 17:54:25 > > > > C:\Documents and Settings\Jack Coates>nmap -V > > > > Nmap version 4.01 ( http://www.insecure.org/nmap ) > > > > thanks for looking at it! > > > > > > On 5/1/06, Max < nm...@we...> wrote: > > > > > > Hi Jack, > > > > > > Please reply with the version of nmap, Windows, and perl you are usin= g and > > I will be happy to see if I can recreate and come up with a fix for thi= s > > problem. > > > > > > Thank you for using the module, sorry you have run into this issue. > > > > > > Regards, > > > > > > Max > > > > > > > > > > > > On 5/1/06, Jack Coates <ja...@mo...> wrote: > > > > > > > > Hi, > > > > > > > > Thanks for this module, I've been struggling with Nmap-Parser-XML a= nd > > this looks much more promising. However, I'm having some trouble gettin= g it > > to work. > > > > > > > > Script: > > > > use Nmap::Scanner; > > > > my $scanner =3D new Nmap::Scanner; > > > > $scanner->tcp_syn_scan; > > > > $scanner->add_scan_port('1-100'); > > > > $scanner->guess_os(); > > > > $scanner->add_target(' 172.16.252.1'); > > > > my $results =3D $scanner->scan(); > > > > my $xml =3D $results->as_xml(); > > > > print $xml; > > > > exit 0; > > > > > > > > Result: > > > > Unable to recognise encoding of this document at > > C:/Perl/site/lib/XML/SAX/PurePerl/EncodingDetect.pm line > > 96. > > > > <nmap-error> > > > > <pid=3D"1168"/> > > > > <cmdline=3D"'C:\Program Files\Nmap\nmap.exe' -v -v -v -sS -p 1-10= 0 -O > > -oX - 172.16.252.1"/> > > > > <perl-msg>Document requires an element [Ln: 1, Col: 0] > > > > </perl-msg> > > > > <nmap-msg></nmap-msg> > > > > </nmap-error> > > > > > > > > I get the feeling that this is probably something simple, but STFW = and > > RTFM aren't turning anything up yet... everything I've read implies tha= t > > PurePerl is the right parser to use. However, since installing this par= ser > > PPM throws the same encoding error, so it looks like it's horked. Advic= e, > > please? > > > > > > > > thanks, > > > > > > > > -- > > > > "I spent all me tin with the ladies drinking gin, > > > > So across the Western ocean I must wander" -- traditional > > > > > > > > > > > > > > -- > > "I spent all me tin with the ladies drinking gin, > > So across the Western ocean I must wander" -- traditional > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job ea= sier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmdlnk&kid=120709&bid&3057&dat=121642 > _______________________________________________ > Nmap-scanner-general mailing list > Nma...@li... > https://lists.sourceforge.net/lists/listinfo/nmap-scanner-general > |