Dnmap
dnmap is a framework to distribute nmap scans among several clients. It reads an already created file with nmap commands and send those commands to each client connected to it.
The framework use a client/server architecture. The server knows what to do and the clients do it. All the logic and statistics are managed in the server. Nmap output is stored on both server and client.
Usually you would want this if you have to scan a large group of hosts and you have several different internet connections (or friends that want to help you)
The framework use a client/server architecture. The server knows what to do and the clients do it. All the logic and statistics are managed in the server. Nmap output is stored on both server and client.
Usually you would want this if you have to scan a large group of hosts and you have several different internet connections (or friends that want to help you)
Connection topology
dnmap use a classical client/server architecture. The server reads the commands from an external file and send them to the clients.
Basic usage
- Put some nmap commands on a file like commands.txt
- Start the dnmap_server
./dnmap_server -f commands.txt - Start any number of clients
./dnmap_client -s <server-ip> -a <alias>
The server will start to give nmap commands to the clients and results will be stored on both sides.
Features of the framework
- Clients can be run on any computer on Internet. Do not have to be on a local cluster or anything.
- It uses the TLS protocol for encryption.
dnmap server features
- If the server gets down, clients continue trying to connect until the server gets back online.
- If the server gets down, when you put it up again it will send commands starting from the last command given before the shutdown. You do not need to remember where it was.
- You can add new commands to the original file without having to stop the server. The server will read them automatically.
- If some client goes down, the server will remember which command it was executing and it will re-schedule it for later.
- It will store every detail of the operations in a log file.
- It shows real time statistics about the operation of each client, including:
- - Number of commands executed
- - Last time seen
- - Uptime
- - Version of the client
- - If the client is being run as root or not.
- - It calculates the amount of commands executed per minute
- - The historic average of the amount of commands executed per minute
- - The status of the client (Online, Offline, Executing or Storing)
- You can choose which port to use. Defaults to 46001
- Only the Online clients are shown in the running stats.
dnmap client features
- If the server gets down, it keeps connecting to it until it gets up again.
- Strip strange characters from the command sent by the server. Tries to avoid command injection vulns.
- It only executes the nmap command. It deletes the command send by the server and changes it by the known and trusted nmap binary on the system.
- You can select an alias for your user.
- You can change which port the client connects to.
- If the command sent by the server does not have a -oA option, the client add it anyway to the command, so it will always have a local copy of the output.
Sample dnmap server output
=| MET:5:43:32.837276 | Amount of Online clients: 2 |=
Clients connected
-----------------
Alias #Commands Last Time Seen (time ago) UpTime Version Euid RunCmdXMin AvrCmdXMin Status
test1 765 Mar 11 21:35:02 ( 0'12") 4h 6m 0.3 0 5.2 4.6 Executing
test2 698 Mar 11 21:34:59 ( 0'14") 5h43m 0.3 0 2.0 3.2 Executing
(Here MET means Mission Elapsed Time (http://en.wikipedia.org/wiki/Mission_Elapsed_Time).)
Security
This framework is NOT intended to be secure or to be used by people you do not trust. As the client will execute any nmap command you send, the client is trusting you. This was created so your friends can help you in the scan, or to use all your computers at the same time.
The client does not need to be run as root, but be aware that most nmap scan types need the client to be run as root. If some of your clients are not root, you can still send them TCP connect type of scans for example. But this should be done by you in the nmap commands file.
About the file commands creation
Nmap is a great tool and it can manage large scans quite well. It is not wise to send only one port and one host to each of your clients. You would want to send at least one host with a lot of ports to each client. Or one different network to each client. If you divide the commands too much the distributed scan will be slower that one unique computer.
Example commands in the file that are OK:
nmap -sS -p22 192.168.1.0/24 -v -n -oA 192.168.1.0
nmap -sS -p22 192.168.2.0/24 -v -n -oA 192.168.3.0
nmap -sS -p22 192.168.3.0/24 -v -n -oA 192.168.4.0
nmap -sP -p22 192.168.3.0/24 -v -n -oA 192.168.4.0
nmap -sS --top-ports 100 192.168.3.3 -v -n -oA 192.168.3.3.top100
nmap -sS --top-ports 100 192.168.3.4 -v -n -oA 192.168.3.4.top100
nmap -sS --top-ports 100 192.168.3.5 -v -n -oA 192.168.3.5.top100
Example commands in the file you should avoid:
nmap -sS -p22 192.168.1.1 -v -n -oA 192.168.1.1
nmap -sS -p22 192.168.1.2 -v -n -oA 192.168.1.2
nmap -sS -p22 192.168.1.3 -v -n -oA 192.168.1.3
Dnmap-charms
Philippe Blondin (pblondin) from https://github.com/pblondin, has created a juju configuration to use dnmap on the cloud. Thanks a lot philippe for your time and effort!
You can find his code in:https://github.com/pblondin/dnmap-charms
You can find his code in:https://github.com/pblondin/dnmap-charms
Ubuntu
Thanks to Alessio Pascolini, now dnmap can be found as .deb packages for Ubuntu
You can found them here!
https://launchpad.net/~alessio.pascolini/+archive/bb-ppa/+build/4077607
Thanks Alessio!
You can found them here!
https://launchpad.net/~alessio.pascolini/+archive/bb-ppa/+build/4077607
Thanks Alessio!
References
Thanks to a lot of people, dnmap has been referenced several times. We really appreciate this! thanks a lot!
- Mariano nuñez dicroce give a talk in BlackHat about SAP and used dnmap, the talk is here.
- Verónica Valeros write a very nice article about dnmap here.
- Some repercusions about the blackhat talk here.
- Paulino Calderón has given a talk in guadalajaraCon, and has talked about dnmap. You can find the pdf here.
- Paulino has also wrote a book about nmap that includes dnmap: http://books.google.com.ar/books?id=OXpzPr1C4o4C&pg=PT400&lpg=PT400&dq=dnmap&source=bl&ots=MEndZBCNaX&sig=IQ8Cm-1W8COCpqC7qB7T36m_Po8&hl=es-419&sa=X&ei=BRX4UNOMJIO-8AS_goHoCw&redir_esc=y
- In guadalajaraCon they also made public a version of dnmap here.
- Dnmap is now on Backtrack live-dvd! thanks a lot!
- A short video of the guadalajaraCon talk is in http://www.youtube.com/watch?v=HzqHiiNWi28
- Also in seclist.us and also seclist.us here.
- Also in ecurityxploit.blogger.de
- Also in hackplayers.com
- Also in http://www.pentestit.com/dnmap-distributed-nmap-framework/
- Update in http://www.pentestit.com/update-dnmap-v06/
- Also in http://www.n0where.net/2012/03/dnmap-v06.html
- Also in http://pythontutorial.co/dnmap-2/
- Also in http://raidersec.blogspot.com.ar/2013/01/distributed-port-scanning-creating-nmap.html
- Also in http://hacknode.blogspot.com.ar/2012/09/backtrack-5-r3-parte-1.html
- Also in http://www.tricktodesign.com/2012/10/backtrack-key-to-hacking-part-1.html
- Also in http://resources.infosecinstitute.com/tag/dnmap/
- Also in http://seclist.us/2012/03/update-dnmap-v0-6-distributed-nmap-framework.html
- Also in http://www.tuicool.com/articles/raimMz
- Also in http://bloggers.com/post/dnmap-v0-6-distributed-nmap-framwork-5891628
- Also in paulino calderon github fork: https://github.com/cldrn/dnmap
- Also in http://n0where.net/dnmap-v0-6/
- Also in a public repository of a university of Namibia: http://download.polytechnic.edu.na/pub4/download.sourceforge.net/pub/sourceforge/d/project/dn/dnmap/
- Also in http://www.hongkexy.com/index.php/archives/4595
- Also in http://www.crazyws.fr/securite/dnmap-un-framework-pour-du-nmap-distribue-9TOF7.html
- Also in http://ie.archive.ubuntu.com/download.sourceforge.net/pub/sourceforge/d/project/dn/dnmap/
- Also in http://love-linux.eklablog.fr/dnmap-a60908521
- Also in http://securityxploit.blogger.de/20120319/
- Also in http://buhosec.com/SecNews/?author=69&paged=8