Simple python script for importing Nmap results to a Neo4j Graph Database.
First, run a nmap scan in your network. Save the results with the greppable flag (-oG
).
sudo nmap 192.168.1.1/24 --top-ports=100 -oG nmap_results
Now start your Neo4j instance and run the nmap-to-neo4j.py
script.
python3 nmap-to-neo4j.py -p neo4j_password -f nmap_results --attacking-host kali-beta --attacking-ip 10.0.0.2
- Neo4j Community Edition (tested on 4.4.4)
- Python3
- Python virtualenv (recommended)
virtualenv venv
pip3 install -r requirements
Neo4j is complicated at times, but this tool is super simple. I generally recommend a few of the following queries:
match (a:Port) return a
match (a:Host) return a
MATCH (p:Port)-[:OPEN]->(h:Host) where h.host = "192.168.1.18" return p,h
MATCH (p:Port)-[]->(h) WHERE p.port = '88' return p,h
Here is a Cheat Sheet for Cypher you can refer to in case you want to learn more.