Skip to content

Commit c5f1a7f

Browse files
committed
FIXED:
- first packaging for easy integration in NiNaval TODO: - create NmapReport class doing: Parsed report diffs, exports, imports, convert, csv out, ... - add support for parsing os version and banner of port - add support for 'resume' capability - add event-like analysis and partial report handling - review thread management for NmapProcess
1 parent 65dc296 commit c5f1a7f

22 files changed

Lines changed: 84 additions & 5 deletions

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.1, 11/03/2013 -- First developement release packaged for Project Ninaval

LICENSE.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
This code is licensed under Creative Common "Attribution" license (CC-BY: http://creativecommons.org/licenses/by/3.0/).
2+
3+
You are free to:
4+
- Share: to copy, distribute and transmit the work
5+
- Remix: to adapt the work
6+
- and make commercial use of the work
7+
8+
Under the following conditions:
9+
- Attribution: You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
10+
11+
With the understanding that:
12+
Waiver: Any of the above conditions can be waived if you get permission from the copyright holder.
13+
Public Domain: Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
14+
Other Rights: In no way are any of the following rights affected by the license:
15+
Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
16+
The author's moral rights;
17+
Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
18+
19+
The full text is available here: http://creativecommons.org/licenses/by/3.0/legalcode

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include *.txt
2+
recursive-include docs *.txt

README.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
===========
2+
PY-NMAP
3+
===========
4+
5+
Py-Nmap is a set of librairies that enables you to easily:
6+
* launch Nmap scans
7+
* control event with a callback function
8+
* parse the results of scans
9+
* make use of the results
10+
* import/export scans results from XML files or created via the lib
11+
* make scan report diffs
12+
13+
Code sample:
14+
#!/usr/bin/env python
15+
import sys
16+
from libnmap import NmapProcess
17+
from libnmap import NmapParser, NmapHost
18+
19+
def main(argv):
20+
def mycallback(nmapscan=None, data=""):
21+
if nmapscan.is_running():
22+
print "Progress: %s %% - ETC: %s" % (nmapscan.progress, nmapscan.etc)
23+
24+
nm = NmapProcess("localhost", options="-sT", event_callback=mycallback)
25+
rc = nm.run()
26+
27+
if rc == 0:
28+
print "Scan started {0} {1}".format(nm.starttime, nm.nmap_version)
29+
print "Scan ended {0}: {1}".format(nm.endtime, nm.summary)
30+
31+
np = NmapParser(nm.stdout)
32+
np.parse()
33+
for h in np.get_hosts():
34+
plist = h.get_ports()
35+
for pno in plist:
36+
p = h.get_port(pno)
37+
print "Port: {0}/{1}: {2} ({3})".format(p['port'],
38+
p['protocol'], p['state'], p['name'])
39+
else:
40+
print "Error: {stderr}".format(stderr=nm.stderr)
41+
print "Result: {0}".format(nm.stdout)
42+
43+
if __name__ == '__main__':
44+
main(sys.argv[1:])

__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

libnmap/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
__author__ = 'Ronald Bister (mini.pelle@gmail.com'
2+
__version__ = '0.1'
3+
4+
from nmapprocess import *
5+
from nmapparser import *
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)