|
1 | 1 | libnmap.process |
2 | 2 | =============== |
3 | 3 |
|
| 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 | + |
4 | 48 | Using libnmap.process |
5 | 49 | --------------------- |
6 | 50 |
|
@@ -67,3 +111,10 @@ NmapProcess methods |
67 | 111 | .. automodule:: libnmap.process |
68 | 112 | .. autoclass:: NmapProcess |
69 | 113 | :members: |
| 114 | + |
| 115 | +NmapTask methods |
| 116 | +------------------- |
| 117 | + |
| 118 | +.. automodule:: libnmap.process |
| 119 | +.. autoclass:: NmapTask |
| 120 | + :members: |
0 commit comments