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)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.