Skip to content

Commit 6be7a97

Browse files
committed
added documentation for NmapTask
1 parent 59eec29 commit 6be7a97

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ libnmap is a python toolkit for manipulating nmap. It currently offers the follo
1010
- parse: enables you to parse nmap reports or scan results (only XML so far) from a file, a string,...
1111
- report: enables you to manipulate a parsed scan result and de/serialize scan results in a json format
1212
- diff: enables you to see what changed between two scans
13-
- common: contains basic nmap objects like NmapHost and NmapService. It is to note that each object can be "diff()ed" with another similar object.
13+
- objects: contains basic nmap objects like NmapHost and NmapService. It is to note that each object can be "diff()ed" with another similar object.
1414
- plugins: enables you to support datastores for your scan results directly in the "NmapReport" object from report module
1515

1616
- mongodb: only plugin implemented so far, ultra basic, for POC purpose only

docs/process.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,50 @@
11
libnmap.process
22
===============
33

4+
Purpose of libnmap.process
5+
--------------------------
6+
7+
The purpose of this module is to enable the lib users to launch and control nmap scans. This module will consequently fire the nmap command following the specified parameters provided in the constructor.
8+
9+
It is to note that this module will not perform a full inline parsing of the data. Only specific events are parsed and exploitable via either a callback function defined by the user and provided in the constructor; either by running the process in the background and accessing the NmapProcess attributes will the scan is running.
10+
11+
To run an nmap scan, you need to:
12+
13+
- instanciate NmapProcess
14+
- call the run*() methods
15+
16+
Raw results of the scans will be available in the following properties:
17+
18+
- NmapProcess.stdout: string, XML output
19+
- NmapProcess.stderr: string, text error message from nmap process
20+
21+
Processing of events
22+
--------------------
23+
24+
While Nmap is running, some events are process and parsed. This would enable you to:
25+
26+
- evaluate estimated time to completion and progress in percentage
27+
- find out which task is running and how many nmap task have been executed
28+
- know the start time and nmap version
29+
30+
As you may know, depending on the nmap options you specified, nmap will execute several tasks like "DNS Resolve", "Ping Scan", "Connect Scan", "NSE scripts",... This is of course independent from libnmap but the lib is able to parse these tasks and will instanciate a NmapTask object for any task executed. The list of executed task is available via the following properties:
31+
32+
- NmapProcess.tasks: list of NmapTask object (executed nmap tasks)
33+
- NmapProcess.current_task: returns the currently running NmapTask
34+
35+
You will find below the list of attributes you can use when dealing with NmapTask:
36+
37+
- name: task name (check nmap documentation for the complete list)
38+
- etc: unix timestamp of estimated time to completion
39+
- progress: estimated percentage of task completion
40+
- percent: estimated percentage of task completion (same as progress)
41+
- remaining: estimated number of seconds to completion
42+
- status: status of the task ('started' or 'ended')
43+
- starttime: unix timestamp of when the task started
44+
- endtime: unix timestamp of when the task ended, 0 if not completed yet
45+
- extrainfo: extra information stored for specific tasks
46+
- updated: unix timestamp of last data update for this task
47+
448
Using libnmap.process
549
---------------------
650

@@ -67,3 +111,10 @@ NmapProcess methods
67111
.. automodule:: libnmap.process
68112
.. autoclass:: NmapProcess
69113
:members:
114+
115+
NmapTask methods
116+
-------------------
117+
118+
.. automodule:: libnmap.process
119+
.. autoclass:: NmapTask
120+
:members:

0 commit comments

Comments
 (0)