home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / base / 05_common.mo / usr / share / nmap / nmap.xsl < prev   
Encoding:
Extensible Markup Language  |  2005-03-09  |  18.5 KB  |  622 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- =========================================================================
  3.             nmap.xsl stylesheet version 0.9a
  4.             last change: 2005-02-04
  5.             Benjamin Erb, http://www.benjamin-erb.de
  6. ==============================================================================
  7.     Copyright (c) 2004 Benjamin Erb
  8.     All rights reserved.
  9.  
  10.     Redistribution and use in source and binary forms, with or without
  11.     modification, are permitted provided that the following conditions
  12.     are met:
  13.     1. Redistributions of source code must retain the above copyright
  14.        notice, this list of conditions and the following disclaimer.
  15.     2. Redistributions in binary form must reproduce the above copyright
  16.        notice, this list of conditions and the following disclaimer in the
  17.        documentation and/or other materials provided with the distribution.
  18.     3. The name of the author may not be used to endorse or promote products
  19.        derived from this software without specific prior written permission.
  20.  
  21.     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  22.     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  23.     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24.     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  25.     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26.     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27.     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28.     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29.     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  30.     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ========================================================================== -->
  32. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  33. <xsl:output method="html" indent="yes" encoding="UTF-8" />
  34.  
  35. <!-- global variables      -->
  36. <!-- ............................................................ -->
  37. <xsl:variable name="nmap_xsl_version">0.9a</xsl:variable>
  38. <!-- ............................................................ -->
  39. <xsl:variable name="start"><xsl:value-of select="/nmaprun/@start" /></xsl:variable>
  40. <xsl:variable name="end"><xsl:value-of select="/nmaprun/runstats/finished/@time" /> </xsl:variable>
  41. <xsl:variable name="totaltime"><xsl:value-of select="/nmaprun/runstats/finished/@time -/nmaprun/@start" /></xsl:variable>
  42. <!-- ............................................................ -->
  43.  
  44.  
  45. <xsl:template match="/">
  46.     <xsl:apply-templates/>
  47. </xsl:template>
  48.  
  49.  
  50. <!-- root -->
  51. <!-- ............................................................ -->
  52. <xsl:template match="/nmaprun">
  53. <html>
  54. <head>
  55.  
  56. <xsl:comment>generated with nmap.xsl - version <xsl:value-of select="$nmap_xsl_version" /> by Benjamin Erb - http://www.benjamin-erb.de/nmap_xsl.php </xsl:comment>
  57.  
  58. <!-- embedded JavaScript for time conversion -->
  59. <script language="JavaScript" type="text/javascript" >
  60. function timestamp2date(stamp)
  61. {
  62.     var myDate = new Date(stamp * 1000);
  63.     dateStr = myDate.toGMTString();
  64.  
  65.     return dateStr;
  66. }
  67. </script>
  68.  
  69. <style type="text/css">
  70. /* stylesheet print */
  71. @media print
  72. {
  73.     #menu
  74.     {
  75.         display:none;
  76.     }
  77.  
  78.     h1
  79.     {
  80.         font-size: 13pt;
  81.         font-weight:bold;
  82.         margin:4pt 0pt 0pt 0pt;
  83.         padding:0;
  84.     }
  85.  
  86.     h2
  87.     {
  88.         font-size: 12pt;
  89.         font-weight:bold;
  90.         margin:3pt 0pt 0pt 0pt;
  91.         padding:0;
  92.     }
  93.     h3
  94.     {
  95.         font-size: 9pt;
  96.         font-weight:bold;
  97.         margin:1pt 0pt 0pt 20pt;
  98.         padding:0;
  99.     }
  100.  
  101.     p,ul
  102.     {
  103.         font-size: 9pt;
  104.         margin:1pt 0pt 8pt 40pt;
  105.         padding:0;
  106.         text-align:left;
  107.  
  108.     }
  109.  
  110.     li
  111.     {
  112.         font-size: 9pt;
  113.         margin:0;
  114.         padding:0;
  115.         text-align:left;
  116.  
  117.     }
  118.  
  119.     table
  120.     {
  121.         margin:1pt 0pt 8pt 40pt;
  122.         border:0px;
  123.         width:90%
  124.     }
  125.  
  126.     td
  127.     {
  128.         border:0px;
  129.         border-top:1px solid black;
  130.         font-size: 9pt;
  131.     }
  132.  
  133.     .head td
  134.     {
  135.         border:0px;
  136.         font-weight:bold;
  137.         font-size: 9pt;
  138.     }
  139.  
  140.  
  141. }
  142.  
  143. /* stylesheet screen */
  144. @media screen
  145. {
  146.     body
  147.     {
  148.         margin: 0px;
  149.         background-color: #FFFFFF;
  150.         color: #000000;
  151.         text-align: center;
  152.     }
  153.  
  154.     #container
  155.     {
  156.         text-align:left;
  157.         margin: 0px auto;
  158.         width: 90%;
  159.     }
  160.  
  161.     h1
  162.     {
  163.         font-family: Verdana, Helvetica, sans-serif;
  164.         font-weight:bold;
  165.         font-size: 16pt;
  166.         color: #000000;
  167.         background-color:#87CEFA;
  168.         margin:10px 0px 0px 0px;
  169.         padding:5px 4px 5px 4px;
  170.         width: 100%;
  171.         border:1px solid black;
  172.         text-align: left;
  173.     }
  174.  
  175.     h1 a
  176.     {
  177.         font-family: Verdana, Helvetica, sans-serif;
  178.         font-weight:bold;
  179.         font-size: 16pt;
  180.         color: #000000;
  181.         background-color:#87CEFA;
  182.     }
  183.  
  184.     h2
  185.     {
  186.         font-family: Verdana, Helvetica, sans-serif;
  187.         font-weight:bold;
  188.         font-size: 12pt;
  189.         color: #000000;
  190.         margin:10px 0px 0px 0px;
  191.         padding:4px;
  192.         width: 100%;
  193.         border:1px solid black;
  194.         background-color:#F0F8FF;
  195.         text-align: left;
  196.     }
  197.  
  198.     h2.green
  199.     {
  200.         color: #000000;
  201.         background-color:#CCFFCC;
  202.         border-color:#006400;
  203.     }
  204.  
  205.     h2.red
  206.     {
  207.         color: #000000;
  208.         background-color:#FFCCCC;
  209.         border-color:#8B0000;
  210.     }
  211.  
  212.     h3
  213.     {
  214.         font-family: Verdana, Helvetica, sans-serif;
  215.         font-weight:bold;
  216.         font-size: 10pt;
  217.         color:#000000;
  218.         background-color: #FFFFFF;
  219.         width: 75%;
  220.         text-align: left;
  221.     }
  222.  
  223.     p
  224.     {
  225.         font-family: Verdana, Helvetica, sans-serif;
  226.         font-size: 10pt;
  227.         color:#000000;
  228.         background-color: #FFFFFF;
  229.         width: 75%;
  230.         text-align: left;
  231.     }
  232.  
  233.     p i
  234.     {
  235.         font-family: "Courier New", Courier, mono;
  236.         font-size: 8pt;
  237.         color:#000000;
  238.         background-color: #CCCCCC;
  239.     }
  240.  
  241.     ul
  242.     {
  243.         font-family: Verdana, Helvetica, sans-serif;
  244.         font-size: 10pt;
  245.         color:#000000;
  246.         background-color: #FFFFFF;
  247.         width: 75%;
  248.         text-align: left;
  249.     }
  250.  
  251.     a
  252.     {
  253.         font-family: Verdana, Helvetica, sans-serif;
  254.         text-decoration: none;
  255.         font-size: 10pt;
  256.         color:#000000;
  257.         font-weight:bold;
  258.         background-color: #FFFFFF;
  259.         color: #000000;
  260.     }
  261.  
  262.     a:hover
  263.     {
  264.         text-decoration: underline;
  265.     }
  266.  
  267.     table
  268.     {
  269.         width: 80%;
  270.         border:0px;
  271.         color: #000000;
  272.         background-color: #000000;
  273.         margin:10px;
  274.     }
  275.  
  276.     tr
  277.     {
  278.         vertical-align:top;
  279.         font-family: Verdana, Helvetica, sans-serif;
  280.         font-size: 10pt;
  281.         color:#000000;
  282.         background-color: #D1D1D1;
  283.     }
  284.  
  285.     tr.head
  286.     {
  287.         background-color: #E1E1E1;
  288.         color: #000000;
  289.         font-weight:bold;
  290.     }
  291.  
  292.     tr.open
  293.     {
  294.         background-color: #CCFFCC;
  295.         color: #000000;
  296.     }
  297.  
  298.     tr.filtered
  299.     {
  300.         background-color: #FFDDBB;
  301.         color: #000000;
  302.     }
  303.  
  304.     tr.closed
  305.     {
  306.         background-color: #FFCCCC;
  307.         color: #000000;
  308.     }
  309.  
  310.     #menu li
  311.     {
  312.         display         : inline;
  313.         margin          : 0;
  314.         margin-right    : 10px;
  315.         padding         : 0;
  316.         list-style-type : none;
  317.     }
  318. }
  319. </style>
  320.     <title>nmap report</title>
  321. </head>
  322.  
  323. <body>
  324.     <div id="container">
  325.     <h1>nmap scan report - scan @
  326.     <xsl:call-template name="timestamp">
  327.         <xsl:with-param name="stamp"><xsl:value-of select="$start" /></xsl:with-param>
  328.     </xsl:call-template>
  329.     </h1>
  330.     <ul id="menu">
  331.         <li><a href="#scansummary">scan summary</a></li>
  332.         <li><a href="#scaninfo">scan info</a></li>
  333.  
  334.       <xsl:for-each select="host">
  335.       <li>
  336.         <xsl:element name="a">
  337.             <xsl:attribute name="href">#<xsl:value-of select="translate(address/@addr, '.', '_') " /></xsl:attribute>
  338.             <xsl:attribute name="target">_self</xsl:attribute>
  339.             <xsl:value-of select="address/@addr"/>
  340.         </xsl:element>
  341.       </li>
  342.       </xsl:for-each>
  343.             <li><a href="#runstats">runstats</a></li>
  344.     </ul>
  345.  
  346.     <xsl:element name="a">
  347.         <xsl:attribute name="name">scansummary</xsl:attribute>
  348.     </xsl:element>
  349.     <h2>scan summary</h2>
  350.     <p>
  351.     <xsl:value-of select="@scanner"/> was initiated at
  352.     <xsl:call-template name="timestamp">
  353.         <xsl:with-param name="stamp"><xsl:value-of select="$start" /></xsl:with-param>
  354.     </xsl:call-template> with these arguments:<br/>
  355.     <i><xsl:value-of select="@args" /></i><br/>
  356.     The process stopped at
  357.     <xsl:call-template name="timestamp">
  358.         <xsl:with-param name="stamp"><xsl:value-of select="$end" /></xsl:with-param>
  359.     </xsl:call-template>.
  360.     <xsl:choose>
  361.         <xsl:when test="debugging/@level = '0'">Debbuging was disabled, </xsl:when>
  362.         <xsl:otherwise>Debugging was enabeld, </xsl:otherwise>
  363.     </xsl:choose>
  364.     the verbosing level was <xsl:value-of select="verbose/@level" />.
  365.  
  366.     </p>
  367.     <xsl:apply-templates/>
  368.     </div>
  369. </body>
  370. </html>
  371. </xsl:template>
  372. <!-- ............................................................ -->
  373.  
  374. <!-- scaninfo -->
  375. <!-- ............................................................ -->
  376. <xsl:template match="scaninfo">
  377.     <xsl:element name="a">
  378.         <xsl:attribute name="name">scaninfo</xsl:attribute>
  379.     </xsl:element>
  380.  
  381.     <h2>scan info</h2>
  382.     <ul>
  383.         <li><xsl:value-of select="@type" />-scan</li>
  384.         <li><xsl:value-of select="@numservices" /><xsl:text> </xsl:text><xsl:value-of select="@protocol" /> services scanned</li>
  385.     </ul>
  386.     <xsl:apply-templates/>
  387. </xsl:template>
  388. <!-- ............................................................ -->
  389.  
  390. <!-- runstats -->
  391. <!-- ............................................................ -->
  392. <xsl:template match="runstats">
  393.     <xsl:element name="a">
  394.         <xsl:attribute name="name">runstats</xsl:attribute>
  395.     </xsl:element>
  396.  
  397.     <h2>runstats</h2>
  398.     <ul>
  399.         <li><xsl:value-of select="$totaltime" /> sec. scanned</li>
  400.         <li><xsl:value-of select="hosts/@total" /> host(s) scanned</li>
  401.         <li><xsl:value-of select="hosts/@up" /> host(s) online</li>
  402.         <li><xsl:value-of select="hosts/@down" /> host(s) offline</li>
  403.     </ul>
  404.     <xsl:apply-templates/>
  405. </xsl:template>
  406. <!-- ............................................................ -->
  407.  
  408. <!-- host -->
  409. <!-- ............................................................ -->
  410. <xsl:template match="host">
  411.     <xsl:element name="a">
  412.         <xsl:attribute name="name"><xsl:value-of select="translate(address/@addr, '.', '_') " /></xsl:attribute>
  413.     </xsl:element>
  414.  
  415.     <xsl:choose>
  416.         <xsl:when test="status/@state = 'up'"><h2 class="green"><xsl:value-of select="address/@addr"/> (online)</h2></xsl:when>
  417.         <xsl:otherwise><h2 class="red"><xsl:value-of select="address/@addr"/> (offline)</h2></xsl:otherwise>
  418.     </xsl:choose>
  419.     <xsl:apply-templates/>
  420.  
  421.  
  422. </xsl:template>
  423. <!-- ............................................................ -->
  424.  
  425. <!-- hostnames -->
  426. <!-- ............................................................ -->
  427. <xsl:template match="hostnames">
  428. <xsl:if test="hostname/@name != ''"><h3>hostnames</h3><ul>    <xsl:apply-templates/></ul></xsl:if>
  429. </xsl:template>
  430. <!-- ............................................................ -->
  431.  
  432. <!-- hostname -->
  433. <!-- ............................................................ -->
  434. <xsl:template match="hostname">
  435. <li><xsl:value-of select="@name"/> ( <xsl:value-of select="@type"/> )</li>
  436. </xsl:template>
  437. <!-- ............................................................ -->
  438.  
  439. <!-- ports -->
  440. <!-- ............................................................ -->
  441. <xsl:template match="ports">
  442. <h3>ports</h3>
  443. <xsl:for-each select="extraports">
  444.     <xsl:if test="@count > 0">
  445.         <p>The <xsl:value-of select="@count" /> ports scanned but not shown below are in state: <b><xsl:value-of select="@state" /></b></p>
  446.     </xsl:if>
  447. </xsl:for-each>
  448.     <table cellspacing="1">
  449.     <tr class="head">
  450.         <td colspan="2">Port</td>
  451.         <td>State</td>
  452.         <td>Service</td>
  453.         <td>Product</td>
  454.         <td>Version</td>
  455.         <td>Extra info</td>
  456.     </tr>
  457.     <xsl:apply-templates/>
  458.     </table>
  459. </xsl:template>
  460. <!-- ............................................................ -->
  461.  
  462. <!-- port -->
  463. <!-- ............................................................ -->
  464. <xsl:template match="port">
  465.     <xsl:choose>
  466.         <xsl:when test="state/@state = 'open'">
  467.             <tr class="open">
  468.                 <td><xsl:value-of select="@portid" /></td>
  469.                 <td><xsl:value-of select="@protocol" /></td>
  470.                 <td><xsl:value-of select="state/@state" /></td>
  471.                 <td><xsl:value-of select="service/@name" /><xsl:text> </xsl:text></td>
  472.                 <td><xsl:value-of select="service/@product" /><xsl:text> </xsl:text></td>
  473.                 <td><xsl:value-of select="service/@version" /><xsl:text> </xsl:text></td>
  474.                 <td><xsl:value-of select="service/@extrainfo" /><xsl:text> </xsl:text></td>
  475.             </tr>
  476.         </xsl:when>
  477.         <xsl:when test="state/@state = 'filtered'">
  478.             <tr class="filtered">
  479.                 <td><xsl:value-of select="@portid" /></td>
  480.                 <td><xsl:value-of select="@protocol" /></td>
  481.                 <td><xsl:value-of select="state/@state" /></td>
  482.                 <td><xsl:value-of select="service/@name" /><xsl:text> </xsl:text></td>
  483.                 <td><xsl:value-of select="service/@product" /><xsl:text> </xsl:text></td>
  484.                 <td><xsl:value-of select="service/@version" /><xsl:text> </xsl:text></td>
  485.                 <td><xsl:value-of select="service/@extrainfo" /><xsl:text> </xsl:text></td>
  486.             </tr>
  487.         </xsl:when>
  488.         <xsl:when test="state/@state = 'closed'">
  489.             <tr class="closed">
  490.                 <td><xsl:value-of select="@portid" /></td>
  491.                 <td><xsl:value-of select="@protocol" /></td>
  492.                 <td><xsl:value-of select="state/@state" /></td>
  493.                 <td><xsl:value-of select="service/@name" /><xsl:text> </xsl:text></td>
  494.                 <td><xsl:value-of select="service/@product" /><xsl:text> </xsl:text></td>
  495.                 <td><xsl:value-of select="service/@version" /><xsl:text> </xsl:text></td>
  496.                 <td><xsl:value-of select="service/@extrainfo" /><xsl:text> </xsl:text></td>
  497.             </tr>
  498.         </xsl:when>
  499.         <xsl:otherwise>
  500.             <tr>
  501.                 <td><xsl:value-of select="@portid" /></td>
  502.                 <td><xsl:value-of select="@protocol" /></td>
  503.                 <td><xsl:value-of select="state/@state" /></td>
  504.                 <td><xsl:value-of select="service/@name" /><xsl:text> </xsl:text></td>
  505.                 <td><xsl:value-of select="service/@product" /><xsl:text> </xsl:text></td>
  506.                 <td><xsl:value-of select="service/@version" /><xsl:text> </xsl:text></td>
  507.                 <td><xsl:value-of select="service/@extrainfo" /><xsl:text> </xsl:text></td>
  508.             </tr>
  509.         </xsl:otherwise>
  510.     </xsl:choose>
  511. </xsl:template>
  512. <!-- ............................................................ -->
  513.  
  514. <!-- os -->
  515. <!-- ............................................................ -->
  516. <xsl:template match="os">
  517. <xsl:if test="osmatch/@name != ''"><h3>remote operating system guess</h3></xsl:if>
  518. <ul>
  519.     <xsl:apply-templates/>
  520. </ul>
  521. </xsl:template>
  522. <!-- ............................................................ -->
  523.  
  524. <!-- os portused -->
  525. <!-- ............................................................ -->
  526. <xsl:template match="portused">
  527. <li>used port <xsl:value-of select="@portid" />/<xsl:value-of select="@proto" /> (<xsl:value-of select="@state" />)  </li>
  528. </xsl:template>
  529. <!-- ............................................................ -->
  530.  
  531. <!-- os match -->
  532. <!-- ............................................................ -->
  533. <xsl:template match="osmatch">
  534. <li>os match: <b><xsl:value-of select="@name" /> </b></li>
  535. <li>accuracy: <xsl:value-of select="@accuracy" />%</li>
  536. </xsl:template>
  537. <!-- ............................................................ -->
  538.  
  539. <!-- uptime -->
  540. <!-- ............................................................ -->
  541. <xsl:template match="uptime">
  542. <xsl:if test="@seconds != ''"><h3>system uptime</h3></xsl:if>
  543. <ul>
  544. <li>uptime: <xsl:value-of select="@seconds" /> sec</li>
  545. <li>last reboot: <xsl:value-of select="@lastboot" /></li>
  546. </ul>
  547. </xsl:template>
  548. <!-- ............................................................ -->
  549.  
  550. <!-- smurf -->
  551. <!-- ............................................................ -->
  552. <xsl:template match="smurf">
  553. <xsl:if test="@responses != ''"><h3>smurf responses</h3></xsl:if>
  554. <ul>
  555. <li><xsl:value-of select="@responses" /> responses counted</li>
  556. </ul>
  557. </xsl:template>
  558. <!-- ............................................................ -->
  559.  
  560. <!-- tcpsequence -->
  561. <!-- ............................................................ -->
  562. <xsl:template match="tcpsequence">
  563. <xsl:if test="@values != ''">
  564.     <h3>tcpsequence</h3>
  565.     <ul>
  566.         <li>index: <xsl:value-of select="@index" /></li>
  567.         <li>class: <xsl:value-of select="@class" /></li>
  568.         <li>difficulty: <xsl:value-of select="@difficulty" /></li>
  569.         <li>values: <xsl:value-of select="@values" /></li>
  570.     </ul>
  571. </xsl:if>
  572. </xsl:template>
  573. <!-- ............................................................ -->
  574.  
  575. <!-- ipidsequence -->
  576. <!-- ............................................................ -->
  577. <xsl:template match="ipidsequence">
  578. <xsl:if test="@values != ''">
  579.     <h3>ipidsequence</h3>
  580.     <ul>
  581.         <li>class: <xsl:value-of select="@class" /></li>
  582.         <li>values: <xsl:value-of select="@values" /></li>
  583.     </ul>
  584. </xsl:if>
  585. </xsl:template>
  586. <!-- ............................................................ -->
  587.  
  588. <!-- tcptssequence -->
  589. <!-- ............................................................ -->
  590. <xsl:template match="tcptssequence">
  591. <xsl:if test="@values != ''">
  592.     <h3>tcptssequence</h3>
  593.     <ul>
  594.         <li>class: <xsl:value-of select="@class" /></li>
  595.         <li>values: <xsl:value-of select="@values" /></li>
  596.     </ul>
  597. </xsl:if>
  598. </xsl:template>
  599. <!-- ............................................................ -->
  600.  
  601.  
  602. <!-- Timestamp Conversion -->
  603. <!-- ............................................................ -->
  604. <xsl:template name="timestamp">
  605.     <xsl:param name="stamp" />
  606.     <xsl:choose>
  607.         <!-- Prevent Firefox / Transformiix from running docuement.write() -->
  608.         <xsl:when test="system-property('xsl:vendor')!='Transformiix'">
  609.             <script language="JavaScript" type="text/javascript" >
  610.             <xsl:comment>
  611.             document.write(timestamp2date(<xsl:value-of select="$stamp"/>));
  612.             </xsl:comment>
  613.             </script>        
  614.         </xsl:when>
  615.  
  616.         <xsl:otherwise><xsl:value-of select="$stamp"/></xsl:otherwise>
  617.     </xsl:choose>
  618.     
  619. </xsl:template>
  620. <!-- ............................................................ -->
  621.  
  622. </xsl:stylesheet>