Dnmap-client and Dnmap-server

Description

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)

Connection topology

dnmap use a classical client/server architecture. The server reads the commands from an external file and send them to the clients.

Picture Dnmap-client and Dnmap-server

dnmap connection schema

FEATURES OF DNMAP SERVER 

  1. If the server gets down, clients continue trying to connect until the server gets back online.
  2. 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.
  3. You can add new commands to the original file without having to stop the server. The server will read them automatically.
  4. If some client goes down, the server will remember which command it was executing and it will re-schedule it for later.
  5. It will store every detail of the operations in a log file.
  6. 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.

FEATURES OF DNMAP CLIENT 

  • 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.

  • If the server sends a min-rate parameter, it is striped out.

  • You can control the nmap scanning rate regarthless of servers sent parameters.

  • Tell the server if you are root or not, so it can change the nmap commands accordingly.

Example with Commands 

First of all start dnmap server by executing this command:

 

cyborg@cyborg:~$ sudo dnmap_server
[sudo] password for cyborg: 
+----------------------------------------------------------------------+
| dnmap_server Version 0.6                                             |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or    |
| (at your option) any later version.                                  |
|                                                                      |
| Author: Garcia Sebastian, [email protected]                          |
| www.mateslab.com.ar                                                  |
+----------------------------------------------------------------------+

usage: dnmap_server.py <options>
options:
  -f, --nmap-commands        Nmap commands file
  -p, --port        TCP port where we listen for connections.
  -L, --log-file        Log file. Defaults to /var/log/dnmap_server.conf.
  -l, --log-level       Log level. Defaults to info.
  -v, --verbose_level         Verbose level. Give a number between 1 and 5. Defaults to 1. Level 0 means be quiet.
  -t, --client-timeout         How many time should we wait before marking a client Offline. We still remember its values just in case it cames back.
  -s, --sort         	Field to sort the statical value. You can choose from: Alias, #Commands, UpTime, RunCmdXMin, AvrCmdXMin, Status
  -P, --pem-file         pem file to use for TLS connection. By default we use the server.pem file provided with the server in the current directory.

dnmap_server uses a '<nmap-commands-file-name>.dnmaptrace' file to know where it must continue reading the nmap commands file. If you want to start over again,
just delete the '<nmap-commands-file-name>.dnmaptrace' file

CREATE TEXT FILE

  • To create text file use gedit .
  • Command syntax : gedit <file name >
  • Command used : gedit commands.txt
Once you press enter , it will open your file in gedit  .

ENTER NMAP COMMANDS ON COMMAND FILE

dnmap command Dnmap-client and Dnmap-server

  • In this example , we  simply enter two nmap commands .

 

Now run dnmap_server command with nmap command file

Ex  –  dnmap_server  -f commands.txt

After running this command our server started up and waiting for clients.

 

cyborg@cyborg:~$ sudo dnmap_server -f  '/home/cyborg/commands.txt' 
+----------------------------------------------------------------------+
| dnmap_server Version 0.6                                             |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or    |
| (at your option) any later version.                                  |
|                                                                      |
| Author: Garcia Sebastian, [email protected]                          |
| www.mateslab.com.ar                                                  |
+----------------------------------------------------------------------+

=| MET:0:00:00.000894 | Amount of Online clients: 0 |=
=| MET:0:00:05.005986 | Amount of Online clients: 0 |=
=| MET:0:00:10.005557 | Amount of Online clients: 0 |=
=| MET:0:00:15.005109 | Amount of Online clients: 0 |=
=| MET:0:00:20.004581 | Amount of Online clients: 0 |=
=| MET:0:00:25.000930 | Amount of Online clients: 0 |=
=| MET:0:00:30.005489 | Amount of Online clients: 0 |=
=| MET:0:00:35.005285 | Amount of Online clients: 0 |=
=| MET:0:00:40.005833 | Amount of Online clients: 0 |=

 

Note :  path of file may vary .

Now time to start dnmap_client

 

cyborg@cyborg:~$ sudo dnmap_client
[sudo] password for cyborg: 
+----------------------------------------------------------------------+
| dnmap Client Version 0.6                                             |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or    |
| (at your option) any later version.                                  |
|                                                                      |
| Author: Garcia Sebastian, [email protected]                          |
| www.mateslab.com.ar                                                  |
+----------------------------------------------------------------------+

usage: dnmap_client.py <options>
options:
  -s, --server-ip        IP address of dnmap server.
  -p, --server-port      Port of dnmap server. Dnmap port defaults to 46001
  -a, --alias      Your name alias so we can give credit to you for your help. Optional
  -d, --debug      Debuging.
  -m, --max-rate      Force nmaps commands to use at most this rate. Useful to slow nmap down. Adds the --max-rate parameter.

 

 

Here simple we need to provide server address for our client to connect to the server, and start running commands.

 

cyborg@cyborg:~$ sudo dnmap_client -s 192.168.1.8
+----------------------------------------------------------------------+
| dnmap Client Version 0.6                                             |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or    |
| (at your option) any later version.                                  |
|                                                                      |
| Author: Garcia Sebastian, [email protected]                          |
| www.mateslab.com.ar                                                  |
+----------------------------------------------------------------------+

Client Started...
Nmap output files stored in 'nmap_output' directory...
Starting connection...
Client connected succesfully...
Waiting for more commands....
+ No -oA given. We add it anyway so not to lose the results. Added -oA 19228287
	Command Executed: nmap -sS 192.168.1.4 -oA 19228287 

 

 

192.168.1.8 is cyborg ‘s IP

have done now just back on the server, we see the following status:

 

=| MET:0:01:20.005465 | Amount of Online clients: 0 |=
=| MET:0:01:25.005016 | Amount of Online clients: 0 |=
=| MET:0:01:30.005569 | Amount of Online clients: 0 |=
+ Client ID connected: 192.168.1.8:58435 (Anonymous)
=| MET:0:01:35.000930 | Amount of Online clients: 1 |=
Clients connected
-----------------
Alias          	#Commands	Last Time Seen	(time ago)	UpTime		Version	IsRoot	RunCmdXMin	AvrCmdXMin	Status
Anonymous      	1		Aug 31 15:49:25 ( 0' 4")	 0h 0m		0.6	True	       0.0	      0.0	Executing

=| MET:0:01:40.005090 | Amount of Online clients: 1 |=
Clients connected
-----------------
Alias          	#Commands	Last Time Seen	(time ago)	UpTime		Version	IsRoot	RunCmdXMin	AvrCmdXMin	Status
Anonymous      	1		Aug 31 15:49:25 ( 0' 9")	 0h 0m		0.6	True	       0.0	      0.0	Executing

=| MET:0:01:45.005279 | Amount of Online clients: 1 |=
Clients connected
-----------------
Alias          	#Commands	Last Time Seen	(time ago)	UpTime		Version	IsRoot	RunCmdXMin	AvrCmdXMin	Status
Anonymous      	1		Aug 31 15:49:25 ( 0'14")	 0h 0m		0.6	True	       0.0	      0.0	Executing

=| MET:0:01:50.005412 | Amount of Online clients: 1 |=
Clients connected
-----------------
Alias          	#Commands	Last Time Seen	(time ago)	UpTime		Version	IsRoot	RunCmdXMin	AvrCmdXMin	Status
Anonymous      	1		Aug 31 15:49:25 ( 0'19")	 0h 0m		0.6	True	       0.0	      0.0	Executing

DNMAP OUTPUT 

 

cyborg@cyborg:~$ sudo ls /pentest/scanners/dnmap/nmap_output/
19228287.nmap  19228287.xml
0 Comments

Leave a reply

CONTACT US

We're are building as a community and a team. Be a part of it.

Sending

©2017 Ztrela Knowledge Solutions Pvt. Ltd

Log in with your credentials

Forgot your details?