Managing port scan results with Dr. Portscan
Installation and Commissioning
The following installation description assumes that the delta reporter, the output agents, and the database are installed on the same machine. The scanners may run on different systems as long as they are capable of transferring their scan results to the central delta-reporting instance.
The current version of Dr. Portscan [1] is available from a Git repository. As an alternative to downloading from your web browser, you can retrieve the complete repository as follows:
git clone git://git.lrz.de/DrPortScan.git
The preconditions for running the simplest installation variant are SQLite3, Perl, and the following Perl modules, which you can install via CPAN along with their dependencies: DBI, XML::LibXML, XML::Validate, Socket, DateTime, DateTime::Format::Strptime, File::Basename, File::Copy, File::Find, Curses::UI, Net::DNS::Resolver, NetAddr::IP.
To launch the install, call the setup.pl
script, which checks to see whether the required Perl modules are in place. If the modules are not in place, you will see an error message stating which modules you need to install. Additionally, the script handles the task of creating the directory structure for the input and output files, which is also necessary for running Dr. Portscan. To create and initialize an SQLite database, call the create_db.sh
script. After creating the database, the script also registers a number of test scanners, which you can use as templates for your own scanner definitions. If you prefer not to use this option, you can manage the scanners later on using the configuration.pl
script. In addition to listing the scanners currently registered in the database, this script also lets you enter new scanners and modify or remove existing scanners.
Scanning
Consider the following example, which relies on the standard scanning tool Nmap. Dr. Portscan already comes with a preconfigured Nmap input agent. For an Nmap scan with detailed XML output, use the following command:
nmap -oX /<path>/<to>/<file>/nmap-xml_scanner_timestamp.xml <IPrange>
If Dr. Portscan does not provide a matching input agent, you need to develop an agent for your own scanner software; you can use the existing template as the basis for your development.
You need to transfer the scan output to the Dr. Portscan input folder on the central machine. The output filename must follow a specific pattern to help identify the input agent responsible for processing the file. You also need to state which scanner the file came from and when the scan was performed. The scanner ID is the same as the ID used to register the scanner with the centralized database, and the date must use the YYYYMMDDHHMMSS format; thus, the filename looks like this: <input-agent>_<scanner>_<date>.*
.
It isn't important how the files make their way from the external scanners to the central delta reporting instance. If you want to restrict access to the delta reporting system, you can use rsync
as a cronjob to retrieve new scan results.
Delta Reporting
The central component in Dr. Portscan is the delta reporting instance. The input-watcher.pl
script checks to see whether new scan results are available for processing. The files are first sorted chronologically; then, the script finds the matching input agent, calls the agent to convert the files to a uniform data format, and sends the results to the delta reporter for ongoing processing. If this processing completes without error, the file is moved to the old
directory; otherwise, it is moved to failed
. (To make sure the input watcher script is run at regular intervals, create a cronjob.)
The delta reporter now compares the current results with those of the previous scan and enters the results in the database. The output agents then modify this output for further use. A first step in a typical application is the xml-out.pl
output agent, which outputs the detected changes as an XML document. You can then convert the document to a plain-text version using the xml2plaintex.pl
script and mail the results as needed. Alternatively, you can convert the XML document to HTML and view the results in a browser.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)