Menu

beta 0.3 available

NmapWorker polls a jobDirectory, executes nmap and exports the results into a database.

NmapWorker searches a specified directory (see: nmapworker.ini) for .job files. It it finds any that match the
correct format (see: job_example.job) it creates jobs from it and executes nmap with the appropriate command line
parameters. The result is read and parsed and then passed to an exporter that stores the result in a database.
The default behavior is that NmapWorker immediately deletes the .job files it reads, so they are not to be processed
again. If deleting fails the job will not be processed. This way it is possible to run multiple instances of
NmapWorker that synchronize via the .job files.
This way another application can control NmapWorker and start scans by copying .job files into the jobDirectory;
however, it is possible to change NmapWorker's behavior to not delete the files, so you may set up static and
periodic scans.

.job files are processed FIFO considering the modification timestamp of the file. If NmapWorker is set to not delete
the files, their modification timestamp is updated instead, placing them at the end of the queue.

If NmapWorker is started with the command line option "-o" (once), it will quit when the jobDirectory is empty.

NmapWorker is designed in a modular way, consisting of four parts:
main engine calling the other modules and running nmap (NmapWorker.class.php)
job provider searching for, merging and parsing .job files.
parser parsing nmap output and generate objects we can work with
exporter storing the result somewhere

The parser is created by a factory that on the basis of the nmap version. For now (nmap version 5.21) the parser
works with nmap's XML output, but if the schema changes in the future it is easily possile to register new parsers
that implement the interface INmapOutputParser in the factory that understand the new schema.

The exporter may be replaced as well. Just create another implementation of IExporter that stores the result
somewhere other than in a database.
For the DatabaseExporter make sure to create the needed tables (see: create_tables_mysql.sql) prior to
running NmapWorker and set your database login in the config file.

Posted by Robin de Lall 2010-05-17

Log in to post a comment.