Saving NSE reports in ElasticSearch
ElasticSearch is a distributed NoSQL database used for handling large amount of records. For Internet-wide scanning, it could be a good idea to store our results in an ElasticSearch instance. Nmap does not support exporting results directly into ElasticSearch; however, we can achieve this task with some help from xmlstarlet
.
The following recipe will show you how to generate JSON objects that can be inserted in an ElasticSearch instance.
Getting ready
For this task, we need to use a set of tools named xmlstarlet
to work with XML documents. In Debian-based systems, you may install it with the following command:
# apt-get install xmlstarlet
For other systems, visit the XMLStarlet official website for installation instructions at http://xmlstar.sourceforge.net/.
How to do it...
- Scan your target and save the output in the XML mode:
$nmap -sC -oX scanme.xml scanme.nmap.org
- Now run the following
xmlstarlet
command using as input the previously generated file (you may...