nmaplr - Nmap Log Reporter
use nmaplr;
my $nlr = nmaplr->new(
log => "sample.xml",
report => "report.txt"
);
$nlr->createReport();
$nlr->sendMail(
server => 'localhost',
from => 'email_1@localhost',
to => 'email_2@localhost'
);
nmaplr is a nmap log reporting tool which will print out a text format report of a nmap log in the XML format (by using the -oX option). The following is included in the report:
* scan start/end/duration times
* nmap command used
* verbose and debug levels used
* scan type
* listing of each IPs open ports and services
* sends the report (via the specified SMTP server) to and from the
specified email addresses
...and if specified in the nmap command used:
* fingerprints for each service scanned
* OS fingerprint details
These scan reports may be used in emails to system administrators or for personal keeping if you find them easier to read.
my $nlr = nmaplr->new(
log => "sample.xml",
report => "report.txt"
);
As can be seen here, there are only two instance variables that must be set: the log file being reported and the file to output the report to.
$nlr->createReport();
This method is fairly self-explanitory: it creates the report. This may 'croak' if there is a problem. Problems may be incorrect permissions to read the report, no write privileges to output and other such reasons.
$nlr->sendMail(
server => 'localhost',
from => 'email_1@localhost',
to => 'email_2@localhost'
);
All three parameters here are required and the method will 'croak' if one of these is not inputted. It is fairly self-explanitory what happens here: nmaplr connects to the SMTP server and sends the nmap log report from the email specified, to the email specified.
$nlr->sendMail(
server => 'localhost',
from => 'me@localhost',
to => ['person1@localhost', 'person2@localhost']
);
Similarly, you can specify multiple email addresses to send the report to. The list of email addresses is passed in via an anonymous array.
NOTE: this method can _ONLY_ be called after the createReport() method.
Luke Triantafyllidis <triple@aeoth.net>
Copyright (C) 2005 Luke Triantafyllidis
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
2004-06-29 1.0.1 initial release 2004-07-02 1.0.7 reports from XML format now rather than grepable 2004-07-03 1.0.8 bug fixes 2004-07-19 1.0.9 implemented Getopt::Long 2004-07-25 1.0.11 implemented Net::SMTP 2004-09-15 1.0.12 updated to work with nmap 3.70 2004-09-17 1.0.15 converted to module and a couple of recodes 2004-10-12 1.0.16 small bug fixes 2004-10-24 1.0.17 implemented Carp for better error handling, updated to work with nmap 3.75 2004-11-08 1.0.18 bug fixes for specific scan types, added sending to multiple email addresses at once 2004-12-14 1.0.19 small recodes 2005-03-15 1.0.20 can use anonymous array for multiple mail recipients, updated to work with nmap 3.81