Saving NSE reports in Elasticsearch
Elasticsearch is a distributed NoSQL database used for handling large amounts 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 into 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 XML mode:
$nmap -sC -oX scanme.xml scanme.nmap.org
- Now run the following
xmlstarlet
command using as...