After you make a port scan with NMAP with the option -oX or -oA, you will have the export in .xml format. However Excel doesn't import it as is.
In order to have each host/ip on a separate Excel row, we need to convert it to CSV.
In this guide we will explain how to have the following columns:
- Hostname
- IP Address
- Protocol
- Port
- Service
- State
Requirements to convert NMAP XML to CSV
- You need to work on Windows OS
- MSXLS
- Microsoft Excel
Instructions
- Download the MSXLS tool here
- Create a file called nmaptemplate.xsl with the following code:
host,address,protocol,port,service,state,
,,
,
,
,
,
- Make sure that the MSXSL.exe and the nmaptemplate.xsl are in the same folder where the NMAP xml output file is. For example in c:\
- Open CMD and run cd c:\
- Then run the following command
msxsl output.txt.xml nmap.xsl -o nmap-out.csv
- The CSV file is created in the same directory
If you get the following error:
Line: 1
Column: 1
Invalid at the top level of the document.
- Replace {} with <> in the .xsl file
If you have questions or comments feel free to contact me or leave a comment below
Leave a comment