Skip to content

Commit

Permalink
Introduction of "hideofflinehosts" parameter
Browse files Browse the repository at this point in the history
You can hide offline hosts from the "Scanned Hosts" section by defining hideofflinehosts as 1 via your XSLT processor.
Example: `xsltproc --param hideofflinehosts 1 -o output.html nmap-bootstrap.xsl input.xml`
  • Loading branch information
honze-net authored Sep 4, 2018
1 parent 902ca5e commit 5a38587
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions nmap-bootstrap.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Andreas Hontzia (@honze_net)
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat"/>
<!-- Define URL parameters -->
<xsl:param name="url"/>
<xsl:param name="hideofflinehosts" value="0"/>
<!-- Begin document -->
<xsl:template match="/">
<html lang="en">
<head>
Expand Down Expand Up @@ -82,7 +86,8 @@ Andreas Hontzia (@honze_net)
</div>
</div>
</div>
<h2 id="scannedhosts" class="target">Scanned Hosts</h2>
<h2 id="scannedhosts" class="target">Scanned Hosts<xsl:if test="$hideofflinehosts=1"><small> (offline hosts are hidden)</small></xsl:if>
</h2>
<div class="table-responsive">
<table id="table-overview" class="table table-striped dataTable" role="grid">
<thead>
Expand All @@ -96,13 +101,15 @@ Andreas Hontzia (@honze_net)
</thead>
<tbody>
<xsl:for-each select="/nmaprun/host">
<tr>
<td><span class="label label-danger"><xsl:if test="status/@state='up'"><xsl:attribute name="class">label label-success</xsl:attribute></xsl:if><xsl:value-of select="status/@state"/></span></td>
<td><xsl:value-of select="address/@addr"/></td>
<td><xsl:value-of select="hostnames/hostname/@name"/></td>
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/></td>
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/></td>
</tr>
<xsl:if test="($hideofflinehosts!=1) or (status/@state='up')">
<tr>
<td><span class="label label-danger"><xsl:if test="status/@state='up'"><xsl:attribute name="class">label label-success</xsl:attribute></xsl:if><xsl:value-of select="status/@state"/></span></td>
<td><xsl:value-of select="address/@addr"/></td>
<td><xsl:value-of select="hostnames/hostname/@name"/></td>
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/></td>
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</tbody>
</table>
Expand Down

0 comments on commit 5a38587

Please sign in to comment.