Advertisement
Guest User

dsfghj

a guest
May 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.23 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <!-- =========================================================================
  3. nmap.xsl stylesheet version 0.9c
  4. last change: 2010-12-28
  5. Benjamin Erb, http://www.benjamin-erb.de
  6. ==============================================================================
  7. Copyright (c) 2004-2006 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
  34. method="html"
  35. indent="yes"
  36. encoding="UTF-8"
  37. doctype-public="-//W3C//DTD HTML 4.01//EN"
  38. doctype-system="http://www.w3.org/TR/html4/strict.dtd"
  39.  
  40. />
  41.  
  42. <!-- global variables -->
  43. <!-- ............................................................ -->
  44. <xsl:variable name="nmap_xsl_version">0.9c</xsl:variable>
  45. <!-- ............................................................ -->
  46. <xsl:variable name="start"><xsl:value-of select="/nmaprun/@startstr" /></xsl:variable>
  47. <xsl:variable name="end"><xsl:value-of select="/nmaprun/runstats/finished/@timestr" /> </xsl:variable>
  48. <xsl:variable name="totaltime"><xsl:value-of select="/nmaprun/runstats/finished/@time -/nmaprun/@start" /></xsl:variable>
  49. <xsl:key name="portstatus" match="@state" use="."/>
  50. <!-- ............................................................ -->
  51.  
  52.  
  53. <xsl:template match="/">
  54. <xsl:apply-templates/>
  55. </xsl:template>
  56.  
  57.  
  58. <!-- root -->
  59. <!-- ............................................................ -->
  60. <xsl:template match="/nmaprun">
  61. <html>
  62. <head>
  63.  
  64.  
  65. <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>
  66.  
  67. <style type="text/css">
  68. /* stylesheet print */
  69. @media print
  70. {
  71. #menu {
  72. display:none;
  73. }
  74.  
  75. body {
  76. font-family: Verdana, Helvetica, sans-serif;
  77. }
  78.  
  79. h1 {
  80. font-size: 13pt;
  81. font-weight:bold;
  82. margin:4pt 0pt 0pt 0pt;
  83. padding:0;
  84. }
  85.  
  86. h2 {
  87. font-size: 12pt;
  88. font-weight:bold;
  89. margin:3pt 0pt 0pt 0pt;
  90. padding:0;
  91. }
  92.  
  93. h3, a:link, a:visited {
  94. font-size: 9pt;
  95. font-weight:bold;
  96. margin:1pt 0pt 0pt 20pt;
  97. padding:0;
  98. text-decoration: none;
  99. color: #000000;
  100. }
  101.  
  102. p,ul {
  103. font-size: 9pt;
  104. margin:1pt 0pt 8pt 40pt;
  105. padding:0;
  106. text-align:left;
  107. }
  108.  
  109. li {
  110. font-size: 9pt;
  111. margin:0;
  112. padding:0;
  113. text-align:left;
  114. }
  115.  
  116. table {
  117. margin:1pt 0pt 8pt 40pt;
  118. border:0px;
  119. width:90%
  120. }
  121.  
  122. td {
  123. border:0px;
  124. border-top:1px solid black;
  125. font-size: 9pt;
  126. }
  127.  
  128. .head td {
  129. border:0px;
  130. font-weight:bold;
  131. font-size: 9pt;
  132. }
  133. .noprint { display: none; }
  134. }
  135.  
  136. /* stylesheet screen */
  137. @media screen
  138. {
  139. body {
  140. font-family: Verdana, Helvetica, sans-serif;
  141. margin: 0px;
  142. background-color: #FFFFFF;
  143. color: #000000;
  144. text-align: center;
  145. }
  146.  
  147. #container {
  148. text-align:left;
  149. margin: 10px auto;
  150. width: 90%;
  151. }
  152.  
  153. h1 {
  154. font-family: Verdana, Helvetica, sans-serif;
  155. font-weight:bold;
  156. font-size: 14pt;
  157. color: #FFFFFF;
  158. background-color:#2A0D45;
  159. margin:10px 0px 0px 0px;
  160. padding:5px 4px 5px 4px;
  161. width: 100%;
  162. border:1px solid black;
  163. text-align: left;
  164. }
  165.  
  166. h2 {
  167. font-family: Verdana, Helvetica, sans-serif;
  168. font-weight:bold;
  169. font-size: 11pt;
  170. color: #000000;
  171. margin:30px 0px 0px 0px;
  172. padding:4px;
  173. width: 100%;
  174. background-color:#F0F8FF;
  175. text-align: left;
  176. }
  177.  
  178. h2.green {
  179. color: #000000;
  180. background-color:#CCFFCC;
  181. border-color:#006400;
  182. }
  183.  
  184. h2.red {
  185. color: #000000;
  186. background-color:#FFCCCC;
  187. border-color:#8B0000;
  188. }
  189.  
  190. h3 {
  191. font-family: Verdana, Helvetica, sans-serif;
  192. font-weight:bold;
  193. font-size: 10pt;
  194. color:#000000;
  195. background-color: #FFFFFF;
  196. width: 75%;
  197. text-align: left;
  198. }
  199.  
  200. p {
  201. font-family: Verdana, Helvetica, sans-serif;
  202. font-size: 8pt;
  203. color:#000000;
  204. background-color: #FFFFFF;
  205. width: 75%;
  206. text-align: left;
  207. }
  208.  
  209. p i {
  210. font-family: Verdana, Helvetica, sans-serif;
  211. font-size: 8pt;
  212. color:#000000;
  213. background-color: #CCCCCC;
  214. }
  215.  
  216. ul {
  217. font-family: Verdana, Helvetica, sans-serif;
  218. font-size: 8pt;
  219. color:#000000;
  220. background-color: #FFFFFF;
  221. width: 75%;
  222. text-align: left;
  223. }
  224.  
  225. a {
  226. font-family: Verdana, Helvetica, sans-serif;
  227. text-decoration: none;
  228. font-size: 8pt;
  229. color:#000000;
  230. font-weight:bold;
  231. background-color: #FFFFFF;
  232. color: #000000;
  233. }
  234.  
  235. li a {
  236. font-family: Verdana, Helvetica, sans-serif;
  237. text-decoration: none;
  238. font-size: 10pt;
  239. color:#000000;
  240. font-weight:bold;
  241. background-color: #FFFFFF;
  242. color: #000000;
  243. }
  244.  
  245. a:hover {
  246. text-decoration: underline;
  247. }
  248.  
  249. a.up {
  250. color:#006400;
  251. }
  252.  
  253. table {
  254. width: 80%;
  255. border:0px;
  256. color: #000000;
  257. background-color: #000000;
  258. margin:10px;
  259. }
  260.  
  261. tr {
  262. vertical-align:top;
  263. font-family: Verdana, Helvetica, sans-serif;
  264. font-size: 8pt;
  265. color:#000000;
  266. background-color: #FFFFFF;
  267. }
  268.  
  269. tr.head {
  270. background-color: #E1E1E1;
  271. color: #000000;
  272. font-weight:bold;
  273. }
  274.  
  275. tr.open {
  276. background-color: #CCFFCC;
  277. color: #000000;
  278. }
  279.  
  280. tr.script {
  281. background-color: #EFFFF7;
  282. color: #000000;
  283. }
  284.  
  285. tr.filtered {
  286. background-color: #F2F2F2;
  287. color: #000000;
  288. }
  289.  
  290. tr.closed {
  291. background-color: #F2F2F2;
  292. color: #000000;
  293. }
  294.  
  295. td {
  296. padding:2px;
  297. }
  298.  
  299. #menu li {
  300. display : inline;
  301. margin : 0;
  302. /*margin-right : 10px;*/
  303. padding : 0;
  304. list-style-type : none;
  305. }
  306.  
  307. #menubox {
  308. position: fixed;
  309. bottom: 0px;
  310. right: 0px;
  311. width: 120px;
  312. }
  313.  
  314.  
  315. <![CDATA[
  316. /* This section handle's IE's refusal to honor the fixed CSS attribute */
  317.  
  318. * html div#menubox {
  319. position: absolute;
  320. top:expression(eval(
  321. document.compatMode && document.compatMode=='CSS1Compat') ?
  322. documentElement.scrollTop+(documentElement.clientHeight-this.clientHeight)
  323. : document.body.scrollTop +(document.body.clientHeight-this.clientHeight));
  324. }
  325. /* This fixes the jerky effect when scrolling in IE*/
  326. * html,* html body {
  327. background: #fff url(nosuchfile) fixed;
  328. }
  329.  
  330. ]]>
  331.  
  332. .up {
  333. color: #000000;
  334. background-color:#CCFFCC;
  335. }
  336.  
  337. .down {
  338. color:#626262;
  339. background-color: #F2F2F2;
  340. }
  341.  
  342. .print_only { display: none; }
  343. .hidden { display: none; }
  344. .unhidden { display: block; }
  345.  
  346. }
  347. </style>
  348.  
  349. <title>Nmap Scan Report - Scanned at <xsl:value-of select="$start" /></title>
  350.  
  351.  
  352. <script type="text/javascript">
  353.  
  354. <![CDATA[
  355.  
  356. function toggle(divID) {
  357. var item = document.getElementById(divID);
  358. if (item) {
  359. item.className=(item.className=='hidden')?'unhidden':'hidden';
  360. }
  361. }
  362.  
  363. function togglePorts(tableID,portState) {
  364. var table = document.getElementById(tableID);
  365. var tbody = table.getElementsByTagName("tbody")[0];
  366. var rows = tbody.getElementsByTagName("tr");
  367. for (var i=0; i < rows.length; i++) {
  368. var value = rows[i].getElementsByTagName("td")[2].firstChild.nodeValue;
  369. if (value == portState) {
  370. rows[i].style.display = (rows[i].style.display == 'none')?'':'none';
  371. }
  372. }
  373. }
  374.  
  375. function toggleAll(portState) {
  376. var allTables = document.getElementsByTagName("table");
  377. for (var c=0; c < allTables.length; c++) {
  378. if (allTables[c].id != "") {
  379. togglePorts(allTables[c].id, portState)
  380. }
  381. }
  382. }
  383.  
  384. function init (){
  385. toggleAll('closed');
  386. toggleAll('filtered');
  387. }
  388.  
  389. window.onload = init;
  390.  
  391. ]]>
  392.  
  393. </script>
  394.  
  395. </head>
  396.  
  397. <body>
  398. <a name="top" />
  399. <div id="container">
  400.  
  401. <h1>Nmap Scan Report - Scanned at <xsl:value-of select="$start" /></h1>
  402.  
  403. <ul id="menu">
  404. <li><a href="#scansummary">Scan Summary</a></li>
  405.  
  406. <xsl:if test="prescript/script/@id">
  407. <li>
  408. <xsl:text> | </xsl:text>
  409. <a href="#prescript">Pre-Scan Script Output</a>
  410. </li>
  411. </xsl:if>
  412.  
  413. <xsl:for-each select="host">
  414. <xsl:sort select="substring ( address/@addr, 1, string-length ( substring-before ( address/@addr, '.' ) ) )* (256*256*256) + substring ( substring-after ( address/@addr, '.' ), 1, string-length ( substring-before ( substring-after ( address/@addr, '.' ), '.' ) ) )* (256*256) + substring ( substring-after ( substring-after ( address/@addr, '.' ), '.' ), 1, string-length ( substring-before ( substring-after ( substring-after ( address/@addr, '.' ), '.' ), '.' ) ) ) * 256 + substring ( substring-after ( substring-after ( substring-after ( address/@addr, '.' ), '.' ), '.' ), 1 )" order="ascending" data-type="number"/>
  415.  
  416. <li>
  417. <xsl:text> | </xsl:text>
  418. <xsl:element name="a">
  419. <xsl:attribute name="href">#host_<xsl:value-of select="translate(address/@addr, '.', '_') " /></xsl:attribute>
  420. <xsl:attribute name="class">
  421. <xsl:choose>
  422. <xsl:when test="status/@state = 'up'">up</xsl:when>
  423. <xsl:otherwise>down</xsl:otherwise>
  424. </xsl:choose>
  425. </xsl:attribute>
  426.  
  427. <xsl:variable name="var_address" select="address/@addr" />
  428. <xsl:if test="count(hostnames/hostname) > 0">
  429. <xsl:for-each select="hostnames">
  430. <xsl:choose>
  431.  
  432. <xsl:when test="hostname/@type='user'">
  433. <xsl:value-of select="hostname/@name"/>
  434. (<xsl:value-of select="$var_address"/>)
  435. </xsl:when>
  436.  
  437. <xsl:otherwise>
  438. <xsl:for-each select="hostname/@name[hostname/@type='PTR']"/>
  439. <xsl:value-of select="hostname/@name"/> (<xsl:value-of select="$var_address"/>)
  440. </xsl:otherwise>
  441.  
  442. </xsl:choose>
  443. </xsl:for-each>
  444. </xsl:if>
  445.  
  446. <xsl:if test="count(hostnames/hostname) = 0">
  447. <xsl:value-of select="address/@addr"/>
  448. </xsl:if>
  449. </xsl:element>
  450.  
  451.  
  452. </li>
  453. </xsl:for-each>
  454.  
  455. <xsl:if test="postscript/script/@id">
  456. <li> <xsl:text> | </xsl:text> <a href="#postscript">Post-Scan Script Output</a> </li>
  457. </xsl:if>
  458. </ul>
  459.  
  460. <xsl:element name="a">
  461. <xsl:attribute name="name">scansummary</xsl:attribute>
  462. </xsl:element>
  463.  
  464. <hr class="print_only" />
  465.  
  466. <h2>Scan Summary</h2>
  467.  
  468. <p>
  469. Nmap <xsl:value-of select="@version" /> was initiated at <xsl:value-of select="$start" /> with these arguments:<br/>
  470. <i><xsl:value-of select="@args" /></i><br/>
  471. </p>
  472. <p>
  473. Verbosity: <xsl:value-of select="verbose/@level" />; Debug level <xsl:value-of select="debugging/@level" />
  474. </p>
  475.  
  476. <p>
  477. <xsl:value-of select="/nmaprun/runstats/finished/@summary" />
  478. </p>
  479.  
  480. <xsl:apply-templates select="prescript"/>
  481.  
  482. <xsl:apply-templates select="host">
  483. <xsl:sort select="substring ( address/@addr, 1, string-length ( substring-before ( address/@addr, '.' ) ) )* (256*256*256) + substring ( substring-after ( address/@addr, '.' ), 1, string-length ( substring-before ( substring-after ( address/@addr, '.' ), '.' ) ) )* (256*256) + substring ( substring-after ( substring-after ( address/@addr, '.' ), '.' ), 1, string-length ( substring-before ( substring-after ( substring-after ( address/@addr, '.' ), '.' ), '.' ) ) ) * 256 + substring ( substring-after ( substring-after ( substring-after ( address/@addr, '.' ), '.' ), '.' ), 1 )" order="ascending" data-type="number"/>
  484. </xsl:apply-templates>
  485.  
  486. <xsl:apply-templates select="postscript"/>
  487.  
  488. </div>
  489.  
  490. <div id="menubox" class="noprint">
  491. <a href="#top"><small>Go to top</small></a> <br />
  492. <a href="javascript:toggleAll('closed');"><small>Toggle Closed Ports</small></a><br />
  493. <a href="javascript:toggleAll('filtered');"><small>Toggle Filtered Ports</small></a>
  494. </div>
  495. </body>
  496. </html>
  497. </xsl:template>
  498. <!-- ............................................................ -->
  499.  
  500. <!-- host -->
  501. <!-- ............................................................ -->
  502. <xsl:template match="host">
  503.  
  504. <hr class="print_only" />
  505.  
  506. <xsl:variable name="var_address" select="address/@addr" />
  507.  
  508. <xsl:element name="a">
  509. <xsl:attribute name="name">host_<xsl:value-of select="translate(address/@addr, '.', '_') " /></xsl:attribute>
  510. </xsl:element>
  511.  
  512. <xsl:choose>
  513.  
  514. <xsl:when test="status/@state = 'up'">
  515. <h2 class="up"><xsl:value-of select="address/@addr"/>
  516.  
  517. <xsl:if test="count(hostnames/hostname) > 0">
  518. <xsl:for-each select="hostnames/hostname">
  519. <xsl:sort select="@name" order="ascending" data-type="text"/>
  520. <xsl:text> / </xsl:text><xsl:value-of select="@name"/>
  521. </xsl:for-each>
  522. </xsl:if>
  523.  
  524. <span class="print_only">(online)</span>
  525. </h2>
  526.  
  527. </xsl:when>
  528.  
  529. <xsl:otherwise>
  530. <h2 class="down"><xsl:value-of select="address/@addr"/>
  531.  
  532. <xsl:if test="count(hostnames/hostname) > 0">
  533. <xsl:for-each select="hostnames/hostname">
  534. <xsl:sort select="@name" order="ascending" data-type="text"/>
  535. <xsl:text> / </xsl:text><xsl:value-of select="@name"/>
  536. </xsl:for-each>
  537. </xsl:if>
  538.  
  539. <xsl:element name="a">
  540. <xsl:attribute name="href">javascript:toggle('hostblock_<xsl:value-of select="$var_address"/>');</xsl:attribute>
  541. <xsl:attribute name="class">host_down</xsl:attribute>
  542. <span class="noprint"><small> (click to expand)</small></span>
  543. </xsl:element>
  544. <span class="print_only">(offline)</span></h2>
  545. </xsl:otherwise>
  546.  
  547. </xsl:choose>
  548.  
  549.  
  550. <xsl:element name="div">
  551. <xsl:attribute name="id">hostblock_<xsl:value-of select="$var_address"/></xsl:attribute>
  552. <xsl:choose>
  553.  
  554. <xsl:when test="status/@state = 'up'">
  555. <xsl:attribute name="class">unhidden</xsl:attribute>
  556. </xsl:when>
  557.  
  558. <xsl:otherwise>
  559. <xsl:attribute name="class">hidden</xsl:attribute>
  560. </xsl:otherwise>
  561. </xsl:choose>
  562.  
  563.  
  564. <xsl:if test="count(address) > 0">
  565. <h3>Address</h3>
  566.  
  567. <ul>
  568. <xsl:for-each select="address">
  569. <li><xsl:value-of select="@addr"/>
  570. <xsl:if test="@vendor">
  571. <xsl:text> - </xsl:text>
  572. <xsl:value-of select="@vendor"/>
  573. <xsl:text> </xsl:text>
  574. </xsl:if>
  575. (<xsl:value-of select="@addrtype"/>)
  576. </li>
  577. </xsl:for-each>
  578. </ul>
  579. </xsl:if>
  580.  
  581.  
  582. <xsl:apply-templates/>
  583.  
  584. <br />
  585.  
  586. <xsl:element name="a">
  587. <xsl:attribute name="href">javascript:toggle('metrics_<xsl:value-of select="$var_address"/>');</xsl:attribute>
  588. Misc Metrics <span class="noprint"><small> (click to expand)</small></span>
  589. </xsl:element>
  590.  
  591.  
  592. <xsl:element name="div">
  593. <xsl:attribute name="id">metrics_<xsl:value-of select="$var_address"/></xsl:attribute>
  594. <xsl:attribute name="class">hidden</xsl:attribute>
  595.  
  596. <table cellspacing="1">
  597. <tr class="head">
  598. <td>Metric</td>
  599. <td>Value</td>
  600. </tr>
  601.  
  602. <tr>
  603. <td>Ping Results</td>
  604. <td><xsl:value-of select="status/@reason"/>
  605. <xsl:if test="status/@reasonsrc">
  606. <xsl:text> from </xsl:text>
  607. <xsl:value-of select="status/@reasonsrc"/>
  608. </xsl:if>
  609. </td>
  610. </tr>
  611.  
  612. <xsl:if test="uptime/@seconds != ''">
  613. <tr>
  614. <td>System Uptime</td>
  615. <td><xsl:value-of select="uptime/@seconds" /> seconds (last reboot: <xsl:value-of select="uptime/@lastboot" />)
  616. </td>
  617. </tr>
  618. </xsl:if>
  619.  
  620. <xsl:if test="distance/@value != ''">
  621. <tr>
  622. <td>Network Distance</td>
  623. <td><xsl:value-of select="distance/@value" /> hops</td>
  624. </tr>
  625. </xsl:if>
  626.  
  627.  
  628. <xsl:if test="tcpsequence/@index != ''">
  629. <tr>
  630. <td>TCP Sequence Prediction</td>
  631. <td>Difficulty=<xsl:value-of select="tcpsequence/@index" /> (<xsl:value-of select="tcpsequence/@difficulty" />)</td>
  632. </tr>
  633. </xsl:if>
  634.  
  635. <xsl:if test="ipidsequence/@class != ''">
  636. <tr>
  637. <td>IP ID Sequence Generation</td>
  638. <td><xsl:value-of select="ipidsequence/@class" /></td>
  639. </tr>
  640. </xsl:if>
  641.  
  642. </table>
  643. </xsl:element>
  644.  
  645. </xsl:element>
  646.  
  647. </xsl:template>
  648. <!-- ............................................................ -->
  649.  
  650.  
  651.  
  652. <!-- hostnames -->
  653. <!-- ............................................................ -->
  654. <xsl:template match="hostnames">
  655. <xsl:if test="hostname/@name != ''"><h3>Hostnames</h3><ul> <xsl:apply-templates/></ul></xsl:if>
  656. </xsl:template>
  657. <!-- ............................................................ -->
  658.  
  659. <!-- hostname -->
  660. <!-- ............................................................ -->
  661. <xsl:template match="hostname">
  662. <li><xsl:value-of select="@name"/> (<xsl:value-of select="@type"/>)</li>
  663. </xsl:template>
  664. <!-- ............................................................ -->
  665.  
  666. <!-- ports -->
  667. <!-- ............................................................ -->
  668. <xsl:template match="ports">
  669. <xsl:variable name="var_address" select="../address/@addr" />
  670. <h3>Ports</h3>
  671. <xsl:for-each select="extraports">
  672. <xsl:if test="@count > 0">
  673. <p>The <xsl:value-of select="@count" /> ports scanned but not shown below are in state: <b><xsl:value-of select="@state" /></b></p>
  674. </xsl:if>
  675.  
  676. <ul>
  677. <xsl:for-each select="extrareasons">
  678. <xsl:if test="@count > 0">
  679. <li><p><xsl:value-of select="@count" /> ports replied with: <b><xsl:value-of select="@reason" /></b></p></li>
  680. </xsl:if>
  681. </xsl:for-each>
  682. </ul>
  683. </xsl:for-each>
  684.  
  685. <xsl:if test="count(port) > 0">
  686.  
  687.  
  688. <xsl:for-each select="port/state/@state[generate-id()=generate-id(key('portstatus',.))]" />
  689. <xsl:variable name="closed_count" select="count(port/state[@state='closed'])" />
  690. <xsl:variable name="filtered_count" select="count(port/state[@state='filtered'])" />
  691.  
  692.  
  693. <xsl:element name="table">
  694. <xsl:attribute name="id">porttable_<xsl:value-of select="$var_address"/></xsl:attribute>
  695. <xsl:attribute name="cellspacing">1</xsl:attribute>
  696.  
  697. <tr class="head">
  698. <td colspan="2">Port</td>
  699. <td>State
  700. <xsl:element name="a">
  701. <xsl:attribute name="href">javascript:togglePorts('porttable_<xsl:value-of select="$var_address"/>','closed');</xsl:attribute>
  702. <span class="noprint"><small> (toggle closed [<xsl:value-of select="$closed_count"/>] </small></span>
  703. </xsl:element>
  704. <xsl:element name="a">
  705. <xsl:attribute name="href">javascript:togglePorts('porttable_<xsl:value-of select="$var_address"/>','filtered');</xsl:attribute>
  706. <span class="noprint"><small> | filtered [<xsl:value-of select="$filtered_count"/>])</small></span>
  707. </xsl:element>
  708. </td>
  709. <td>Service</td>
  710. <td>Reason</td>
  711. <td>Product</td>
  712. <td>Version</td>
  713. <td>Extra info</td>
  714. </tr>
  715.  
  716. <xsl:apply-templates/>
  717. </xsl:element>
  718. </xsl:if>
  719. </xsl:template>
  720. <!-- ............................................................ -->
  721.  
  722. <!-- port -->
  723. <!-- ............................................................ -->
  724. <xsl:template match="port">
  725.  
  726. <xsl:choose>
  727. <xsl:when test="state/@state = 'open'">
  728. <tr class="open">
  729. <td><xsl:value-of select="@portid" /></td>
  730. <td><xsl:value-of select="@protocol" /></td>
  731. <td><xsl:value-of select="state/@state" /></td>
  732. <td><xsl:value-of select="service/@name" /><xsl:text>&#xA0;</xsl:text></td>
  733. <td><xsl:value-of select="state/@reason"/>
  734. <xsl:if test="state/@reason_ip">
  735. <xsl:text> from </xsl:text>
  736. <xsl:value-of select="state/@reason_ip"/>
  737. </xsl:if>
  738. </td>
  739. <td><xsl:value-of select="service/@product" /><xsl:text>&#xA0;</xsl:text></td>
  740. <td><xsl:value-of select="service/@version" /><xsl:text>&#xA0;</xsl:text></td>
  741. <td><xsl:value-of select="service/@extrainfo" /><xsl:text>&#xA0;</xsl:text></td>
  742. </tr>
  743.  
  744. <xsl:for-each select="script">
  745. <tr class="script">
  746. <td></td>
  747. <td><xsl:value-of select="@id"/> <xsl:text>&#xA0;</xsl:text></td>
  748. <td colspan="6">
  749. <pre><xsl:value-of select="@output"/> <xsl:text>&#xA0;</xsl:text></pre>
  750. </td>
  751. </tr>
  752.  
  753. </xsl:for-each>
  754. </xsl:when>
  755.  
  756. <xsl:when test="state/@state = 'filtered'">
  757. <tr class="filtered">
  758. <td><xsl:value-of select="@portid" /></td>
  759. <td><xsl:value-of select="@protocol" /></td>
  760. <td><xsl:value-of select="state/@state" /></td>
  761. <td><xsl:value-of select="service/@name" /><xsl:text>&#xA0;</xsl:text></td>
  762. <td><xsl:value-of select="state/@reason"/>
  763. <xsl:if test="state/@reason_ip">
  764. <xsl:text> from </xsl:text>
  765. <xsl:value-of select="state/@reason_ip"/>
  766. </xsl:if>
  767. </td>
  768. <td><xsl:value-of select="service/@product" /><xsl:text>&#xA0;</xsl:text></td>
  769. <td><xsl:value-of select="service/@version" /><xsl:text>&#xA0;</xsl:text></td>
  770. <td><xsl:value-of select="service/@extrainfo" /><xsl:text>&#xA0;</xsl:text></td>
  771. </tr>
  772. </xsl:when>
  773.  
  774. <xsl:when test="state/@state = 'closed'">
  775. <tr class="closed">
  776. <td><xsl:value-of select="@portid" /></td>
  777. <td><xsl:value-of select="@protocol" /></td>
  778. <td><xsl:value-of select="state/@state" /></td>
  779. <td><xsl:value-of select="service/@name" /><xsl:text>&#xA0;</xsl:text></td>
  780. <td><xsl:value-of select="state/@reason"/>
  781. <xsl:if test="state/@reason_ip">
  782. <xsl:text> from </xsl:text>
  783. <xsl:value-of select="state/@reason_ip"/>
  784. </xsl:if>
  785. </td>
  786. <td><xsl:value-of select="service/@product" /><xsl:text>&#xA0;</xsl:text></td>
  787. <td><xsl:value-of select="service/@version" /><xsl:text>&#xA0;</xsl:text></td>
  788. <td><xsl:value-of select="service/@extrainfo" /><xsl:text>&#xA0;</xsl:text></td>
  789. </tr>
  790. </xsl:when>
  791.  
  792. <xsl:otherwise>
  793. <tr>
  794. <td><xsl:value-of select="@portid" /></td>
  795. <td><xsl:value-of select="@protocol" /></td>
  796. <td><xsl:value-of select="state/@state" /></td>
  797. <td><xsl:value-of select="service/@name" /><xsl:text>&#xA0;</xsl:text></td>
  798. <td><xsl:value-of select="state/@reason"/>
  799. <xsl:if test="state/@reason_ip">
  800. <xsl:text> from </xsl:text>
  801. <xsl:value-of select="state/@reason_ip"/>
  802. </xsl:if>
  803. </td>
  804. <td><xsl:value-of select="service/@product" /><xsl:text>&#xA0;</xsl:text></td>
  805. <td><xsl:value-of select="service/@version" /><xsl:text>&#xA0;</xsl:text></td>
  806. <td><xsl:value-of select="service/@extrainfo" /><xsl:text>&#xA0;</xsl:text></td>
  807. </tr>
  808. </xsl:otherwise>
  809.  
  810. </xsl:choose>
  811. </xsl:template>
  812. <!-- ............................................................ -->
  813.  
  814. <!-- os -->
  815. <!-- ............................................................ -->
  816. <xsl:template match="os">
  817. <h3>Remote Operating System Detection</h3>
  818.  
  819. <xsl:if test="count(osmatch) = 0"><p>Unable to identify operating system.</p></xsl:if>
  820.  
  821. <ul>
  822. <xsl:for-each select="portused">
  823. <li>Used port: <b><xsl:value-of select="@portid" />/<xsl:value-of select="@proto" /> </b> (<b><xsl:value-of select="@state" /></b>) </li>
  824. </xsl:for-each>
  825.  
  826. <xsl:for-each select="osmatch">
  827. <li>OS match: <b><xsl:value-of select="@name" /> </b> (<b><xsl:value-of select="@accuracy" />%</b>)</li>
  828. </xsl:for-each>
  829. </ul>
  830.  
  831. <xsl:apply-templates select="osfingerprint"/>
  832.  
  833. </xsl:template>
  834. <!-- ............................................................ -->
  835.  
  836.  
  837. <!-- osfingerprint -->
  838. <!-- ............................................................ -->
  839. <xsl:template match="osfingerprint">
  840.  
  841. <xsl:variable name="var_address" select="../../address/@addr" />
  842.  
  843. <xsl:choose>
  844. <xsl:when test="count(../osmatch)=0">
  845.  
  846. <ul>
  847. <li>Cannot determine exact operating system. Fingerprint provided below.</li>
  848. <li>If you know what OS is running on it, see https://nmap.org/submit/</li>
  849. </ul>
  850. <table cellspacing="1">
  851. <tr class="head">
  852. <td>Operating System fingerprint</td>
  853. </tr>
  854. <tr>
  855. <td><pre><xsl:value-of select="@fingerprint" /></pre></td>
  856. </tr>
  857. </table>
  858.  
  859. </xsl:when>
  860.  
  861. <xsl:otherwise>
  862. <ul>
  863. <li class="noprint">OS identified but the fingerprint was requested at scan time.
  864.  
  865. <xsl:element name="a">
  866. <xsl:attribute name="href">javascript:toggle('osblock_<xsl:value-of select="$var_address"/>');</xsl:attribute>
  867. <span class="noprint"><small> (click to expand)</small></span>
  868. </xsl:element>
  869. </li>
  870. </ul>
  871.  
  872. <xsl:element name="div">
  873. <xsl:attribute name="id">osblock_<xsl:value-of select="$var_address"/></xsl:attribute>
  874. <xsl:attribute name="class">hidden</xsl:attribute>
  875.  
  876. <table class="noprint" cellspacing="1">
  877. <tr class="head">
  878. <td>Operating System fingerprint</td>
  879. </tr>
  880. <tr>
  881. <td><pre><xsl:value-of select="@fingerprint" /></pre></td>
  882. </tr>
  883. </table>
  884.  
  885. </xsl:element>
  886.  
  887. </xsl:otherwise>
  888.  
  889. </xsl:choose>
  890.  
  891. </xsl:template>
  892. <!-- ............................................................ -->
  893.  
  894. <!-- Pre-Scan script -->
  895. <!-- ............................................................ -->
  896. <xsl:template match="prescript">
  897.  
  898. <hr class="print_only" />
  899.  
  900. <xsl:element name="a">
  901. <xsl:attribute name="name">prescript</xsl:attribute>
  902. </xsl:element>
  903.  
  904. <h2>Pre-Scan Script Output</h2>
  905.  
  906. <table>
  907. <tr class="head">
  908. <td>Script Name</td>
  909. <td>Output</td>
  910. </tr>
  911. <xsl:for-each select="script">
  912.  
  913. <tr class="script">
  914. <td>
  915. <xsl:value-of select="@id"/> <xsl:text>&#xA0;</xsl:text>
  916. </td>
  917. <td>
  918. <pre>
  919. <xsl:value-of select="@output"/> <xsl:text></xsl:text>
  920. </pre>
  921. </td>
  922. </tr>
  923.  
  924. </xsl:for-each>
  925. </table>
  926. </xsl:template>
  927. <!-- ............................................................ -->
  928.  
  929. <!-- Post-Scan script -->
  930. <!-- ............................................................ -->
  931. <xsl:template match="postscript">
  932.  
  933. <hr class="print_only" />
  934.  
  935. <xsl:element name="a">
  936. <xsl:attribute name="name">postscript</xsl:attribute>
  937. </xsl:element>
  938.  
  939. <h2>Post-Scan Script Putput</h2>
  940.  
  941. <table>
  942. <tr class="head">
  943. <td>Script Name</td>
  944. <td>Output</td>
  945. </tr>
  946.  
  947. <xsl:for-each select="script">
  948. <tr class="script">
  949. <td>
  950. <xsl:value-of select="@id"/> <xsl:text>&#xA0;</xsl:text>
  951. </td>
  952. <td>
  953. <pre>
  954. <xsl:value-of select="@output"/> <xsl:text></xsl:text>
  955. </pre>
  956. </td>
  957. </tr>
  958.  
  959. </xsl:for-each>
  960. </table>
  961. </xsl:template>
  962. <!-- ............................................................ -->
  963.  
  964.  
  965. <!-- Host Script Scan -->
  966. <!-- ............................................................ -->
  967. <xsl:template match="hostscript">
  968. <h3>Host Script Output</h3>
  969.  
  970. <table>
  971. <tr class="head">
  972. <td>Script Name</td>
  973. <td>Output</td>
  974. </tr>
  975.  
  976. <xsl:for-each select="script">
  977. <tr class="script">
  978. <td>
  979. <xsl:value-of select="@id"/> <xsl:text>&#xA0;</xsl:text>
  980. </td>
  981. <td>
  982. <pre>
  983. <xsl:value-of select="@output"/> <xsl:text>&#xA0;</xsl:text>
  984. </pre>
  985. </td>
  986. </tr>
  987. </xsl:for-each>
  988.  
  989. </table>
  990. </xsl:template>
  991. <!-- ............................................................ -->
  992.  
  993. <!-- smurf -->
  994. <!-- ............................................................ -->
  995. <xsl:template match="smurf">
  996. <xsl:if test="@responses != ''"><h3>Smurf Responses</h3>
  997. <ul>
  998. <li><xsl:value-of select="@responses" /> responses counted</li>
  999. </ul>
  1000. </xsl:if>
  1001. </xsl:template>
  1002. <!-- ............................................................ -->
  1003.  
  1004.  
  1005. <!-- traceroute -->
  1006. <!-- ............................................................ -->
  1007.  
  1008. <xsl:template match="trace">
  1009. <xsl:if test="@port">
  1010. <xsl:variable name="var_address" select="../address/@addr" />
  1011.  
  1012.  
  1013.  
  1014. <xsl:element name="a">
  1015. <xsl:attribute name="href">javascript:toggle('trace_<xsl:value-of select="$var_address"/>');</xsl:attribute>
  1016. Traceroute Information <span class="noprint"><small> (click to expand)</small></span>
  1017. </xsl:element>
  1018.  
  1019. <xsl:element name="div">
  1020. <xsl:attribute name="id">trace_<xsl:value-of select="$var_address"/></xsl:attribute>
  1021. <xsl:attribute name="class">hidden</xsl:attribute>
  1022.  
  1023.  
  1024. <xsl:choose>
  1025. <xsl:when test="@port">
  1026. <ul><li>Traceroute data generated using port <xsl:value-of select="@port" />/<xsl:value-of select="@proto" /></li></ul>
  1027. </xsl:when>
  1028. </xsl:choose>
  1029.  
  1030. <table cellspacing="1">
  1031. <tr class="head">
  1032. <td>Hop</td>
  1033. <td>Rtt</td>
  1034. <td>IP</td>
  1035. <td>Host</td>
  1036. </tr>
  1037. <xsl:for-each select="hop">
  1038. <xsl:choose>
  1039. <xsl:when test="@rtt = '--'">
  1040. <tr class="filtered">
  1041. <td><xsl:value-of select="@ttl" /></td>
  1042. <td>--</td>
  1043. <td><xsl:value-of select="@ipaddr" /></td>
  1044. <td><xsl:value-of select="@host" /></td>
  1045. </tr>
  1046. </xsl:when>
  1047.  
  1048. <xsl:when test="@rtt > 0">
  1049. <tr class="open">
  1050. <td><xsl:value-of select="@ttl" /></td>
  1051. <td><xsl:value-of select="@rtt" /></td>
  1052. <td><xsl:value-of select="@ipaddr" /></td>
  1053. <td><xsl:value-of select="@host" /></td>
  1054. </tr>
  1055. </xsl:when>
  1056.  
  1057. <xsl:otherwise>
  1058. <tr class="closed">
  1059. <td><xsl:value-of select="@ttl" /></td>
  1060. <td></td><td></td><td></td>
  1061. </tr>
  1062. </xsl:otherwise>
  1063. </xsl:choose>
  1064. </xsl:for-each>
  1065. </table>
  1066. </xsl:element>
  1067.  
  1068. </xsl:if>
  1069. </xsl:template>
  1070. <!-- ............................................................ -->
  1071. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement