#!/usr/bin/python3
from nmap_scan.NmapArgs import NmapArgs from nmap_scan.NmapScanMethods import NmapScanMethods from nmap_scan.Scanner import Scanner args = NmapArgs(['192.168.0.1/24']) scanner = Scanner(args) def callback_method(report, scan_method): filename = { NmapScanMethods.TCP: 'tcp', NmapScanMethods.UDP: 'udp', } report.save('reports/scan-' + filename.get(scan_method) + '.xml') report.save_html('reports/scan-' + filename.get(scan_method) + '.html') report.save_json('reports/scan-' + filename.get(scan_method) + '.json') scanner.scan_udp_background(callback_method) scanner.scan_tcp_background(callback_method) # Do other stuff here scanner.wait_all()
#!/usr/bin/python3
from nmap_scan.MultiScanner import MultiScanner from nmap_scan.MultiScannerConfiguration import MultiScannerConfiguration from nmap_scan.NmapArgs import NmapArgs from nmap_scan.NmapScanMethods import NmapScanMethods args = NmapArgs(['192.168.0.0/24']) args2 = NmapArgs(['192.168.1.0/24']) def callback_method(ip, report, scan_method): filename = { NmapScanMethods.TCP: 'tcp', NmapScanMethods.UDP: 'udp', } report.save('reports/' + ip + '_' + filename.get(scan_method) + '.xml') report.save_html('reports/' + ip + '_' + filename.get(scan_method) + '.html') report.save_json('reports/' + ip + '_' + filename.get(scan_method) + '.json') configs = [ MultiScannerConfiguration(nmap_args=args, scan_methods=[NmapScanMethods.TCP, NmapScanMethods.UDP], callback_method=callback_method), MultiScannerConfiguration(nmap_args=args2, scan_methods=[NmapScanMethods.TCP], callback_method=callback_method), ] scanner = MultiScanner(configs) scanner.scan_background() # Do other stuff here reports = scanner.get_reports()
#!/usr/bin/python3
import logging logging.basicConfig(level=logging.DEBUG, filename='debug.log')
<!ATTLIST script id CDATA #REQUIRED - output CDATA #REQUIRED + output CDATA #IMPLIED >