mrschyte / nmap-converter Goto Github PK
View Code? Open in Web Editor NEWPython script for converting nmap reports into XLS
License: BSD 2-Clause "Simplified" License
Python script for converting nmap reports into XLS
License: BSD 2-Clause "Simplified" License
Traceback (most recent call last):
File "nmap-converter.py", line 143, in
main(reports, workbook)
File "nmap-converter.py", line 119, in main
sheet_func(workbook, sheet, report)
File "nmap-converter.py", line 24, in generate_summary
sheet.write(sheet.lastrow + 1, idx, summary_bodyitem)
File "nmap-converter.py", line 14, in
"Scan Type": lambda report: report.scan_type,
File "/usr/lib/python2.7/site-packages/libnmap/objects/report.py", line 113, in scan_type
return self._scaninfo['type']
KeyError: 'type'
I have installed this on Kali Linux on windows and I get this error when trying to exec the nmap file:
└─$ nmap-converter.py
-bash: nmap-converter.py: command not found
┌──(gavin㉿PC17411)-[]]
└─$ sudo pip install python-libnmap
[sudo] password for gavin:
Requirement already satisfied: python-libnmap in /usr/local/lib/python3.9/dist-packages (0.7.2)
┌──(gavin㉿PC17411)-[
└─$
The script work fine I'want to know if is possible to add at "EXTRA" a multiline output, because if one port scanned give multi output itnst readable.
Can you/I solve it?
Thanks
Looking to modify your script to include Mac-addresses. Cant seem to find out if that variable has been defined? Any ideas. Thanks.
So I am running nmap from an instance of Ubuntu with the Windows Subsystem for Linux (WSL) and I have followed all the directions, when I run my command:
python3 nmap-converter.py -0 name_of_the_file_to_be_created.xlsx name_of_the_nmap_scan.xml
this is what I get back
(venv) user@my_pc:~$python3 nmap-converter.py -o name_of_the_file_to_be_created.xlsx name_of_the_nmap_scan.xml
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/libnmap/parser.py", line 101, in _parse_xml
root = ET.fromstring(nmap_data)
File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1320, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "nmap-converter.py", line 220, in <module>
parsed = NmapParser.parse_fromfile(report)
File "/usr/local/lib/python3.8/dist-packages/libnmap/parser.py", line 213, in parse_fromfile
rval = cls.parse(fdata, data_type, incomplete)
File "/usr/local/lib/python3.8/dist-packages/libnmap/parser.py", line 47, in parse
nmapobj = cls._parse_xml(nmap_data, incomplete)
File "/usr/local/lib/python3.8/dist-packages/libnmap/parser.py", line 104, in _parse_xml
raise NmapParserException(emsg)
libnmap.parser.NmapParserException: Wrong XML structure: cannot parse data: not well-formed (invalid token): line 1, column 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/libnmap/parser.py", line 101, in _parse_xml
root = ET.fromstring(nmap_data)
File "/usr/lib/python3.8/xml/etree/ElementTree.py", line 1320, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "nmap-converter.py", line 222, in <module>
parsed = NmapParser.parse_fromfile(report, incomplete=True)
File "/usr/local/lib/python3.8/dist-packages/libnmap/parser.py", line 213, in parse_fromfile
rval = cls.parse(fdata, data_type, incomplete)
File "/usr/local/lib/python3.8/dist-packages/libnmap/parser.py", line 47, in parse
nmapobj = cls._parse_xml(nmap_data, incomplete)
File "/usr/local/lib/python3.8/dist-packages/libnmap/parser.py", line 104, in _parse_xml
raise NmapParserException(emsg)
libnmap.parser.NmapParserException: Wrong XML structure: cannot parse data: not well-formed (invalid token): line 1, column 1
This is using the output of my nmap command which was this:
nmap xxx.xxx.xxx.xxx/xx -o /home/user/name_of_the_nmap_scan.xml
Please tell me what I did worng.
Hello I've tried to pass to a xls a xml file but the nmap result is with a "-sn" option (no port scan)
I've excecuted the following command;
nmap -sn script=whois-domain -iL targets.txt -oA nmap/nmap_targets
There is no issue in the resulting xml,
but when I try to pass the xml to xls this is the following error (I thing it has to do with the fact that can make a summary sheet, because there are no ports)
>python nmap-converter-master\nmap-converter.py "location\nmap_whoisdomain.xml" -o test.xls
Traceback (most recent call last):
File "nmap-converter-master\nmap-converter.py", line 186, in <module>
main(reports, workbook)
File "nmap-converter-master\nmap-converter.py", line 161, in main
sheet_func(workbook, sheet, report)
File "nmap-converter-master\nmap-converter.py", line 55, in generate_summary
sheet.write(sheet.lastrow + 1, idx, summary_body[item](report))
File "nmap-converter-master\nmap-converter.py", line 45, in <lambda>
"Scan Type": lambda report: report.scan_type,
File "D:\Programas\Python\Python37\lib\site-packages\libnmap\objects\report.py", line 113, in scan_type
return self._scaninfo['type']
KeyError: 'type'
sudo -H pip install -r requirements.txt
Requirement already satisfied: python-libnmap in /Library/Python/3.7/site-packages (from -r requirements.txt (line 1)) (0.7.0)
Requirement already satisfied: XlsxWriter in /Library/Python/3.7/site-packages (from -r requirements.txt (line 2)) (1.2.8)
./nmap-converter.py -h
Traceback (most recent call last):
File "./nmap-converter.py", line 3, in
from libnmap.parser import NmapParser, NmapParserException
ImportError: No module named libnmap.parser
Any idea?
I have also tried pip3 and I have some issues.
Thank you.
I am getting the below errors when I try to run the xml to xls converter.
File "./nmap-converter.py", line 228, in
main(reports, workbook)
File "./nmap-converter.py", line 203, in main
sheet_func(workbook, sheet, report)
File "./nmap-converter.py", line 157, in generate_results
module = ServiceModule(host, service)
File "./nmap-converter.py", line 33, in init
super(ServiceModule, self).init(host)
TypeError: super() argument 1 must be type, not classobj
┗━(Run “touch /.hushlogin” to hide this message)]
┌──(gavin㉿PC17411)-[
└─$ python3
Python 3.9.7 (default, Sep 24 2021, 09:43:00)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
nmap-converter.py
Traceback (most recent call last):
File "", line 1, in
NameError: name 'nmap' is not defined
i've done pip install XlsxWriter and python-libnmap and when i try to convert my xml and enter the command ./nmap-converter.py xxxxxx.xml -o xxxxxx.xls it says nmap-converter.py: no file or folder of this type
How do i install this ?
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.