The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

DESCRIPTION

This class holds the results from a scan. Results include a host list (Nmap::Scanner::HostList) instance and an instance of Nmap::Scanner::NmapRun, which contains information about the scan. There are several methods in this class used by the scanner to populate the result set; the only three that will be of interest to most programmers are:

get_host_list()

Returns an instance of Nmap::Scanner::HostList that can be iterated through to get the host objects found by the search.

Example (Assumes scanner instance is named $scanner):

my $results = $scanner->scan();

my $host_list = $results->get_host_list();

while (my $host = $host_list->get_next()) {

print "Found host named: " . $host->hostname() . "\n";
.. etc ..

}

as_xml()

Returns the results as a well-formed XML document.

Example (Assumes scanner instance is named $scanner):

my $results = $scanner->scan();

print $results->as_xml();

nmap_run()

Returns the Nmap::Scanner::NmapRun instance with information about the scan itself.

See the examples/ directory in the distribution for more examples.