Re: [Nmap-scanner-general] Need a little help with example fromperldoc
Brought to you by:
perldork
From: Dukes C. <Cla...@HC...> - 2006-11-02 19:51:34
|
Hey Max, I grabbed it from the perldoc Nmap::Scanner Nmap::Scanner(3) =20 -----Original Message----- From: nma...@li... [mailto:nma...@li...] On Behalf Of Max Schubert Sent: Thursday, November 02, 2006 12:43 PM To: Nmap::Scanner list Subject: Re: [Nmap-scanner-general] Need a little help with example fromperldoc Hi Clayton, > my $hostname =3D $host->name(); ->name() should be ->hostname() :) Did you get your example code from one of the Nmap::Scanner examples? If so, which version of the module are you using? I do see one example that has incorrect code that I did not notice before, ftpscan.pl has a reference to a name() accessor. Please let me know if you found your example code in one of the example scripts, and if so, which one. Code fixed in CVS, credit for bringing up the problem given to you in the Changes file. Regards, Max On 11/2/06, Dukes Clayton <Cla...@hc...> wrote: > > > > > Trying to create a multi host scanner but I'm getting errors, can=20 > anyone help out here? > > #!/usr/bin/perl > use strict; > > $| =3D 1; > use Nmap::Scanner; > > open (FILE, $ARGV[0]); > my $count =3D 1; > my(@host_array) =3D <FILE>; # read file into list > my $total =3D (@host_array); > print "Checking $total hosts\n"; > @host_array =3D sort(@host_array); # sort the list > chomp (@host_array); > > if (@ARGV < 1){ > usage(); > } > sub usage { > print "Usage: synping.pl <hosts>\n"; > print "Example:\n"; > print "perl synping.pl hosts.txt\n"; > exit(-1); > } > > foreach my $hostname (@host_array) { > my $scanner =3D new Nmap::Scanner; > > $scanner->register_scan_started_event(\&scan_started); > $scanner->register_port_found_event(\&port_found); > $scanner->scan("-sS -p 22,23 -O $hostname"); # Scan for telnet=20 > or ssh > > } > sub scan_started { > my $self =3D shift; > my $host =3D shift; > > my $hostname =3D $host->name(); > my $addresses =3D join(',', map {$_->address()} $host->addresses()); > my $status =3D $host->status(); > > print "$hostname ($addresses) is $status\n"; > } > > sub port_found { > my $self =3D shift; > my $host =3D shift; > my $port =3D shift; > > my $name =3D $host->name(); > my $addresses =3D join(',', map {$_->addr()} = $host->addresses()); > > print "On host $name ($addresses), found ", > $port->state()," port ", > join('/',$port->protocol(),$port->portid()),"\n"; > > } > > > This returns: > Checking 2520 hosts > 2693<nmap-error> > <pid=3D"2142"/> > <cmdline=3D"'/usr/bin/nmap' -v -v -v -sS -p 22,23 -O=20 > 2811-x-f-h.vac.co.y.net -oX -"/> > <perl-msg>Can't locate object method "name" via package=20 > "Nmap::Scanner::Host" at ./synping.pl line 55. > </perl-msg> > <nmap-msg></nmap-msg> > </nmap-error> > > > > ---clueless :-) > ---------------------------------------------------------------------- > --- Using Tomcat but need to do more? Need to support web services,=20 > security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on=20 > Apache Geronimo > = http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 1216 > 42 > > _______________________________________________ > Nmap-scanner-general mailing list > Nma...@li... > https://lists.sourceforge.net/lists/listinfo/nmap-scanner-general > > > ------------------------------------------------------------------------ - 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 easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ Nmap-scanner-general mailing list Nma...@li... https://lists.sourceforge.net/lists/listinfo/nmap-scanner-general |