Listing 1, basic.pl:

#!/usr/bin/env perl

use Nmap::Parser;


my $NMAP_EXE = "/usr/local/bin/nmap ";
 
my $NMAP_ARGS = "-sT -p1-1024";

my $target_net = $ARGV[0];

my $np = new Nmap::Parser;

$np -> parsescan($NMAP_EXE, $NMAP_ARGS, $target_net);

print "Host information:\n";

foreach $host ($np -> get_host_objects()) {
	print "Hostname:\t" . $host -> hostname() . "\n";
	print "Address:\t" . $host -> ipv4_addr() . "\n";
	print "Open ports:\t" . (join ' ,', $host -> tcp_ports('open')) . "\n";
}

$np -> clean();

