Skip navigation.
Home
unix forever

Nmap: a stylesheet to display hosts regarding a given port status

For a long time now, nmap can save the result of test in a XML file, which can be very useful to parse the data. Though, nmap itself comes only with one XSTL (transformation) file to transform the XML in a HTML file. You'll find here a small XSLT to display the hosts regarding the state of a given protocol/port.

Download the attached file, save it locally, and then edit it the following lines:


<xsl:variable name="port_id">23</xsl:variable>
<xsl:variable name="port_proto">tcp</xsl:variable>
<xsl:variable name="port_status">open</xsl:variable>

This is the filter definition. One you edit the file, just use the following command:


% xstlproc 'file.xsl' 'nmap file.xml'


The following hosts have port tcp/23 opened:


address: 10.42.24.5
address: 10.42.24.9
address: 10.42.24.10
address: 10.42.24.17
address: 10.42.24.44
address: 10.42.24.61
address: 10.42.24.67
address: 10.42.24.73

That's all ! very simple, but very useful (at least for me).

AttachmentSize
Simple NMAP transformation2.85 KB

download the xslt

Sorry, anonymous users was not able to download attached files. You have now permission to download it.