cooperlees / nmapscanner Goto Github PK
View Code? Open in Web Editor NEWWrap NMAP and scan port dumping data to arbitrary data stores
License: BSD 2-Clause "Simplified" License
Wrap NMAP and scan port dumping data to arbitrary data stores
License: BSD 2-Clause "Simplified" License
Repro with --nmap-timeout 1
This also breaks echo-back (can't see what I am typing) to my terminal until I reset. Need to check if this is a tmux thing or breaks stuff generically.
On timeout we won't have valid XML so we can skip parsing.
Full output of testing:
jdp@shelly:~/github/nmapscanner$ sudo /tmp/tn/bin/python3.9 nmapscanner.py 192.168.45.0/24 --nmap-timeout 1
[2022-03-21 17:16:33,052] INFO: Adding 192.168.45.0/24 scans to run queue (nmapscanner.py:164)
[2022-03-21 17:16:33,053] INFO: 192.168.45.0/24 - '/usr/bin/nmap -Pn -sS -oX /tmp/nmapscanner_run_20220321171633/192.168.45.0_24_TCP 192.168.45.0/24' starting (nmapscanner.py:133)
[2022-03-21 17:16:33,053] INFO: Running 1 nmap scans (nmapscanner.py:180)
[2022-03-21 17:16:34,120] ERROR: 192.168.45.0/24 - '['/usr/bin/nmap', '-Pn', '-sS', '-oX', '/tmp/nmapscanner_run_20220321171633/192.168.45.0_24_TCP', '192.168.45.0/24']' FAILED: Command '['/usr/bin/nmap', '-Pn', '-sS', '-oX', '/tmp/nmapscanner_run_20220321171633/192.168.45.0_24_TCP', '192.168.45.0/24']' timed out after 1 seconds (nmapscanner.py:137)
[2022-03-21 17:16:34,120] INFO: 192.168.45.0/24 - '/usr/bin/nmap -Pn -sU -oX /tmp/nmapscanner_run_20220321171633/192.168.45.0_24_UDP 192.168.45.0/24' starting (nmapscanner.py:133)
[2022-03-21 17:16:35,184] ERROR: 192.168.45.0/24 - '['/usr/bin/nmap', '-Pn', '-sU', '-oX', '/tmp/nmapscanner_run_20220321171633/192.168.45.0_24_UDP', '192.168.45.0/24']' FAILED: Command '['/usr/bin/nmap', '-Pn', '-sU', '-oX', '/tmp/nmapscanner_run_20220321171633/192.168.45.0_24_UDP', '192.168.45.0/24']' timed out after 1 seconds (nmapscanner.py:137)
[2022-03-21 17:16:35,185] INFO: 0 / 1 (0%) nmap scans succeeded (1 failed) (nmapscanner.py:191)
Traceback (most recent call last):
File "/tmp/tn/lib/python3.9/site-packages/libnmap/parser.py", line 101, in _parse_xml
root = ET.fromstring(nmap_data)
File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 1350, in XML
return parser.close()
xml.etree.ElementTree.ParseError: no element found: line 7, column 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jdp/github/nmapscanner/nmapscanner.py", line 304, in <module>
main()
File "/tmp/tn/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/tmp/tn/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/tmp/tn/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/tmp/tn/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/tmp/tn/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/jdp/github/nmapscanner/nmapscanner.py", line 300, in main
ctx.exit(write_to_json_files(output_path))
File "/home/jdp/github/nmapscanner/nmapscanner.py", line 206, in write_to_json_files
json_results = get_nmap_result(afile)
File "/home/jdp/github/nmapscanner/nmapscanner.py", line 46, in get_nmap_result
nmap_report = NmapParser.parse_fromfile(str(nmap_xml_file))
File "/tmp/tn/lib/python3.9/site-packages/libnmap/parser.py", line 213, in parse_fromfile
rval = cls.parse(fdata, data_type, incomplete)
File "/tmp/tn/lib/python3.9/site-packages/libnmap/parser.py", line 47, in parse
nmapobj = cls._parse_xml(nmap_data, incomplete)
File "/tmp/tn/lib/python3.9/site-packages/libnmap/parser.py", line 104, in _parse_xml
raise NmapParserException(emsg)
libnmap.parser.NmapParserException: Wrong XML structure: cannot parse data: no element found: line 7, column 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.