📄 nmap.xsl
字号:
<xsl:element name="a"> <xsl:attribute name="name">runstats</xsl:attribute> </xsl:element> <h2>runstats</h2> <ul> <li><xsl:value-of select="$totaltime" /> sec. scanned</li> <li><xsl:value-of select="hosts/@total" /> host(s) scanned</li> <li><xsl:value-of select="hosts/@up" /> host(s) online</li> <li><xsl:value-of select="hosts/@down" /> host(s) offline</li> </ul> <ul> <li>nmap version: <xsl:value-of select="/nmaprun/@version" /></li> <li>xml output version: <xsl:value-of select="/nmaprun/@xmloutputversion" /></li> <li>nmap.xsl version: <xsl:value-of select="$nmap_xsl_version" /></li> </ul> <xsl:apply-templates/></xsl:template><!-- ............................................................ --><!-- host --><!-- ............................................................ --><xsl:template match="host"> <xsl:element name="a"> <xsl:attribute name="name"><xsl:value-of select="translate(address/@addr, '.', '_') " /></xsl:attribute> </xsl:element> <xsl:choose> <xsl:when test="status/@state = 'up'"> <h2 class="green"><xsl:value-of select="address/@addr"/> <xsl:if test="count(hostnames/hostname) > 0"> <xsl:for-each select="hostnames/hostname"> <xsl:sort select="@name" order="ascending" data-type="text"/> <xsl:text> / </xsl:text><xsl:value-of select="@name"/> </xsl:for-each> </xsl:if> <span class="status">(online)</span> </h2> </xsl:when> <xsl:otherwise> <h2 class="red"><xsl:value-of select="address/@addr"/> <xsl:if test="count(hostnames/hostname) > 0"> <xsl:for-each select="hostnames/hostname"> <xsl:sort select="@name" order="ascending" data-type="text"/> <xsl:text> / </xsl:text><xsl:value-of select="@name"/> </xsl:for-each> </xsl:if> <span class="status">(offline)</span></h2> </xsl:otherwise> </xsl:choose> <h3>ping results</h3> <ul><li><xsl:value-of select="status/@reason"/> <xsl:if test="status/@reasonsrc"> <xsl:text> from </xsl:text> <xsl:value-of select="status/@reasonsrc"/> </xsl:if></li></ul> <xsl:if test="count(address) > 0"> <h3>address</h3> <ul> <xsl:for-each select="address"> <li><xsl:value-of select="@addr"/> (<xsl:value-of select="@addrtype"/>)</li> </xsl:for-each> </ul> </xsl:if> <xsl:apply-templates/></xsl:template><!-- ............................................................ --><!-- hostnames --><!-- ............................................................ --><xsl:template match="hostnames"><xsl:if test="hostname/@name != ''"><h3>hostnames</h3><ul> <xsl:apply-templates/></ul></xsl:if></xsl:template><!-- ............................................................ --><!-- hostname --><!-- ............................................................ --><xsl:template match="hostname"><li><xsl:value-of select="@name"/> (<xsl:value-of select="@type"/>)</li></xsl:template><!-- ............................................................ --><!-- ports --><!-- ............................................................ --><xsl:template match="ports"><h3>ports</h3><xsl:for-each select="extraports"> <xsl:if test="@count > 0"> <p>The <xsl:value-of select="@count" /> ports scanned but not shown below are in state: <b><xsl:value-of select="@state" /></b></p> </xsl:if> <ul> <xsl:for-each select="extrareasons"> <xsl:if test="@count > 0"> <li><p><xsl:value-of select="@count" /> ports replied with: <b><xsl:value-of select="@reason" /></b></p></li> </xsl:if> </xsl:for-each> </ul></xsl:for-each><xsl:if test="count(port) > 0"> <table cellspacing="1"> <tr class="head"> <td colspan="2">Port</td> <td>State</td> <td>Service</td> <td>Reason</td> <td>Product</td> <td>Version</td> <td>Extra info</td> </tr> <xsl:apply-templates/> </table></xsl:if> </xsl:template><!-- ............................................................ --><!-- port --><!-- ............................................................ --><xsl:template match="port"> <xsl:choose> <xsl:when test="state/@state = 'open'"> <tr class="open"> <td><xsl:value-of select="@portid" /></td> <td><xsl:value-of select="@protocol" /></td> <td><xsl:value-of select="state/@state" /></td> <td><xsl:value-of select="service/@name" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="state/@reason"/> <xsl:if test="state/@reason_ip"> <xsl:text> from </xsl:text> <xsl:value-of select="state/@reason_ip"/> </xsl:if> </td> <td><xsl:value-of select="service/@product" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="service/@version" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="service/@extrainfo" /><xsl:text> </xsl:text></td> </tr> <xsl:for-each select="script"> <tr class="open"> <td></td> <td> <xsl:value-of select="@id"/> <xsl:text> </xsl:text> </td> <td colspan="5"> <xsl:value-of select="@output"/> <xsl:text> </xsl:text> </td> </tr> </xsl:for-each> </xsl:when> <xsl:when test="state/@state = 'filtered'"> <tr class="filtered"> <td><xsl:value-of select="@portid" /></td> <td><xsl:value-of select="@protocol" /></td> <td><xsl:value-of select="state/@state" /></td> <td><xsl:value-of select="service/@name" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="state/@reason"/> <xsl:if test="state/@reason_ip"> <xsl:text> from </xsl:text> <xsl:value-of select="state/@reason_ip"/> </xsl:if> </td> <td><xsl:value-of select="service/@product" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="service/@version" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="service/@extrainfo" /><xsl:text> </xsl:text></td> </tr> </xsl:when> <xsl:when test="state/@state = 'closed'"> <tr class="closed"> <td><xsl:value-of select="@portid" /></td> <td><xsl:value-of select="@protocol" /></td> <td><xsl:value-of select="state/@state" /></td> <td><xsl:value-of select="service/@name" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="state/@reason"/> <xsl:if test="state/@reason_ip"> <xsl:text> from </xsl:text> <xsl:value-of select="state/@reason_ip"/> </xsl:if> </td> <td><xsl:value-of select="service/@product" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="service/@version" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="service/@extrainfo" /><xsl:text> </xsl:text></td> </tr> </xsl:when> <xsl:otherwise> <tr> <td><xsl:value-of select="@portid" /></td> <td><xsl:value-of select="@protocol" /></td> <td><xsl:value-of select="state/@state" /></td> <td><xsl:value-of select="service/@name" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="state/@reason"/> <xsl:if test="state/@reason_ip"> <xsl:text> from </xsl:text> <xsl:value-of select="state/@reason_ip"/> </xsl:if> </td> <td><xsl:value-of select="service/@product" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="service/@version" /><xsl:text> </xsl:text></td> <td><xsl:value-of select="service/@extrainfo" /><xsl:text> </xsl:text></td> </tr> </xsl:otherwise> </xsl:choose></xsl:template><!-- ............................................................ --><!-- os --><!-- ............................................................ --><xsl:template match="os"> <h3>remote operating system guess</h3> <xsl:if test="count(osmatch) = 0"><p>Unable to identify operating system.</p></xsl:if> <ul> <xsl:apply-templates/> </ul></xsl:template><!-- ............................................................ --><!-- os portused --><!-- ............................................................ --><xsl:template match="portused"><li>used port <xsl:value-of select="@portid" />/<xsl:value-of select="@proto" /> (<xsl:value-of select="@state" />) </li></xsl:template><!-- ............................................................ --><!-- os match --><!-- ............................................................ --><xsl:template match="osmatch"><li>os match: <b><xsl:value-of select="@name" /> </b></li><li>accuracy: <xsl:value-of select="@accuracy" />%</li><li>reference fingerprint line number: <xsl:value-of select="@line" /></li></xsl:template><!-- ............................................................ --><!-- osfingerprint --><!-- ............................................................ --><xsl:template match="osfingerprint"> <br /><br /> <li>Cannot determine exact operating system. Fingerprint provided below.</li> <table cellspacing="1"> <tr class="head"> <td>Operating System fingerprint</td> </tr> <tr> <td><xsl:value-of select="@fingerprint" /></td> </tr> </table></xsl:template><!-- ............................................................ --><!-- Host Script Scan --><!-- ............................................................ --><xsl:template match="hostscript"> <table> <xsl:for-each select="script"> <tr class="open"> <td> <xsl:value-of select="@id"/> <xsl:text> </xsl:text> </td> <td> <xsl:value-of select="@output"/> <xsl:text> </xsl:text> </td> </tr> </xsl:for-each> </table></xsl:template><!-- ............................................................ --><!-- uptime --><!-- ............................................................ --><xsl:template match="uptime"><xsl:if test="@seconds != ''"><h3>system uptime</h3><ul><li>uptime: <xsl:value-of select="@seconds" /> sec</li><li>last reboot: <xsl:value-of select="@lastboot" /></li></ul></xsl:if></xsl:template><!-- ............................................................ --><!-- distance --><!-- ............................................................ --><xsl:template match="distance"><xsl:if test="@value != ''"><h3>network distance</h3><ul> <li>distance: <xsl:value-of select="@value" /> hops</li></ul></xsl:if></xsl:template><!-- ............................................................ --><!-- smurf --><!-- ............................................................ --><xsl:template match="smurf"><xsl:if test="@responses != ''"><h3>smurf responses</h3><ul><li><xsl:value-of select="@responses" /> responses counted</li></ul></xsl:if></xsl:template><!-- ............................................................ --><!-- tcpsequence --><!-- ............................................................ --><xsl:template match="tcpsequence"><xsl:if test="@values != ''"> <h3>tcpsequence</h3> <ul> <li>index: <xsl:value-of select="@index" /></li> <li>class: <xsl:value-of select="@class" /></li> <li>difficulty: <xsl:value-of select="@difficulty" /></li> <li>values: <xsl:value-of select="@values" /></li> </ul></xsl:if></xsl:template><!-- ............................................................ --><!-- traceroute --><!-- ............................................................ --><xsl:template match="trace"> <h3>traceroute</h3> <ul> <xsl:choose> <xsl:when test="@port"> <li>port: <xsl:value-of select="@port" /></li> </xsl:when> </xsl:choose> <li>proto: <xsl:value-of select="@proto" /></li> <xsl:for-each select="error"> <li>error: <xsl:value-of select="@errorstr"/></li> </xsl:for-each> </ul> <table cellspacing="1"> <tr class="head"> <td>Hop</td> <td>Rtt</td> <td>IP</td> <td>Host</td> </tr> <xsl:for-each select="hop"> <xsl:choose> <xsl:when test="@rtt = '--'"> <tr class="filtered"> <td><xsl:value-of select="@ttl" /></td> <td>--</td> <td><xsl:value-of select="@ipaddr" /></td> <td><xsl:value-of select="@host" /></td> </tr> </xsl:when> <xsl:when test="@rtt > 0"> <tr class="open"> <td><xsl:value-of select="@ttl" /></td> <td><xsl:value-of select="@rtt" /></td> <td><xsl:value-of select="@ipaddr" /></td> <td><xsl:value-of select="@host" /></td> </tr> </xsl:when> <xsl:otherwise> <tr class="closed"> <td><xsl:value-of select="@ttl" /></td> <td></td><td></td><td></td> </tr> </xsl:otherwise> </xsl:choose> </xsl:for-each> </table></xsl:template><!-- ............................................................ --><!-- ipidsequence --><!-- ............................................................ --><xsl:template match="ipidsequence"><xsl:if test="@values != ''"> <h3>ipidsequence</h3> <ul> <li>class: <xsl:value-of select="@class" /></li> <li>values: <xsl:value-of select="@values" /></li> </ul></xsl:if></xsl:template><!-- ............................................................ --><!-- tcptssequence --><!-- ............................................................ --><xsl:template match="tcptssequence"><xsl:if test="@values != ''"> <h3>tcptssequence</h3> <ul> <li>class: <xsl:value-of select="@class" /></li> <li>values: <xsl:value-of select="@values" /></li> </ul></xsl:if></xsl:template><!-- ............................................................ --></xsl:stylesheet>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -