Newer
Older
DirtyScripts / nmap-bootstrap.xsl
root on 10 Nov 2022 18 KB the big return update
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. Nmap Bootstrap XSL
  4. Creative Commons BY-SA
  5. This software must not be used by military or secret service organisations.
  6. Andreas Hontzia (@honze_net)
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  9. <xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat"/>
  10. <xsl:template match="/">
  11. <html lang="en">
  12. <head>
  13. <meta name="referrer" content="no-referrer"/>
  14. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/>
  15. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"/>
  16. <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap.min.css" type="text/css" integrity="sha384-VEpVDzPR2x8NbTDZ8NFW4AWbtT2g/ollEzX/daZdW/YvUBlbgVtsxMftnJ84k0Cn" crossorigin="anonymous"/>
  17. <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha384-fJU6sGmyn07b+uD1nMk7/iSb4yvaowcueiQhfVgQuD98rfva8mcr1eSvjchfpMrH" crossorigin="anonymous"></script>
  18. <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" integrity="sha384-rgWRqC0OFPisxlUvl332tiM/qmaNxnlY46eksSZD84t+s2vZlqGeHrncwIRX7CGp" crossorigin="anonymous"></script>
  19. <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap.min.js" integrity="sha384-7PXRkl4YJnEpP8uU4ev9652TTZSxrqC8uOpcV1ftVEC7LVyLZqqDUAaq+Y+lGgr9" crossorigin="anonymous"></script>
  20. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  21. <style>
  22. .target:before {
  23. content: "";
  24. display: block;
  25. height: 50px;
  26. margin: -20px 0 0;
  27. }
  28. @media only screen and (min-width:1900px) {
  29. .container {
  30. width: 1800px;
  31. }
  32. }
  33. .footer {
  34. margin-top:60px;
  35. padding-top:60px;
  36. width: 100%;
  37. height: 180px;
  38. background-color: #f5f5f5;
  39. }
  40. .clickable {
  41. cursor: pointer;
  42. }
  43. .panel-heading > h3:before {
  44. font-family: 'Glyphicons Halflings';
  45. content: "\e114"; /* glyphicon-chevron-down */
  46. padding-right: 1em;
  47. }
  48. .panel-heading.collapsed > h3:before {
  49. content: "\e080"; /* glyphicon-chevron-right */
  50. }
  51. </style>
  52. <title>Scan Report Nmap <xsl:value-of select="/nmaprun/@version"/></title>
  53. </head>
  54. <body>
  55. <nav class="navbar navbar-default navbar-fixed-top">
  56. <div class="container-fluid">
  57. <div class="navbar-header">
  58. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
  59. <span class="sr-only">Toggle navigation</span>
  60. <span class="icon-bar"></span>
  61. <span class="icon-bar"></span>
  62. <span class="icon-bar"></span>
  63. </button>
  64. <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-home"></span></a>
  65. </div>
  66. <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
  67. <ul class="nav navbar-nav">
  68. <li><a href="#scannedhosts">Scanned Hosts</a></li>
  69. <li><a href="#onlinehosts">Online Hosts</a></li>
  70. <li><a href="#openservices">Open Services</a></li>
  71. </ul>
  72. </div>
  73. </div>
  74. </nav>
  75. <div class="container">
  76. <div class="jumbotron">
  77. <h1>Scan Report<br/><small>Nmap <xsl:value-of select="/nmaprun/@version"/></small></h1>
  78. <pre style="white-space:pre-wrap; word-wrap:break-word;"><xsl:value-of select="/nmaprun/@args"/></pre>
  79. <p class="lead">
  80. <xsl:value-of select="/nmaprun/@startstr"/><xsl:value-of select="/nmaprun/runstats/finished/@timestr"/><br/>
  81. <xsl:value-of select="/nmaprun/runstats/hosts/@total"/> hosts scanned.
  82. <xsl:value-of select="/nmaprun/runstats/hosts/@up"/> hosts up.
  83. <xsl:value-of select="/nmaprun/runstats/hosts/@down"/> hosts down.
  84. </p>
  85. <div class="progress">
  86. <div class="progress-bar progress-bar-success" style="width: 0%">
  87. <xsl:attribute name="style">width:<xsl:value-of select="/nmaprun/runstats/hosts/@up div /nmaprun/runstats/hosts/@total * 100"/>%;</xsl:attribute>
  88. <xsl:value-of select="/nmaprun/runstats/hosts/@up"/>
  89. <span class="sr-only"></span>
  90. </div>
  91. <div class="progress-bar progress-bar-danger" style="width: 0%">
  92. <xsl:attribute name="style">width:<xsl:value-of select="/nmaprun/runstats/hosts/@down div /nmaprun/runstats/hosts/@total * 100"/>%;</xsl:attribute>
  93. <xsl:value-of select="/nmaprun/runstats/hosts/@down"/>
  94. <span class="sr-only"></span>
  95. </div>
  96. </div>
  97. </div>
  98. <h2 id="scannedhosts" class="target">Scanned Hosts<xsl:if test="/nmaprun/runstats/hosts/@down > 1024"><small> (offline hosts are hidden)</small></xsl:if></h2>
  99. <div class="table-responsive">
  100. <table id="table-overview" class="table table-striped dataTable" role="grid">
  101. <thead>
  102. <tr>
  103. <th>State</th>
  104. <th>Address</th>
  105. <th>Hostname</th>
  106. <th>TCP (open)</th>
  107. <th>UDP (open)</th>
  108. </tr>
  109. </thead>
  110. <tbody>
  111. <xsl:choose>
  112. <xsl:when test="/nmaprun/runstats/hosts/@down > 1024">
  113. <xsl:for-each select="/nmaprun/host[status/@state='up']">
  114. <tr>
  115. <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>
  116. <td><a><xsl:attribute name="href">#onlinehosts-<xsl:value-of select="translate(address/@addr, '.', '-')"/></xsl:attribute><xsl:value-of select="address/@addr"/></a></td>
  117. <td><xsl:value-of select="hostnames/hostname/@name"/></td>
  118. <td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/></td>
  119. <td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/></td>
  120. </tr>
  121. </xsl:for-each>
  122. </xsl:when>
  123. <xsl:otherwise>
  124. <xsl:for-each select="/nmaprun/host">
  125. <tr>
  126. <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>
  127. <td><a><xsl:attribute name="href">#onlinehosts-<xsl:value-of select="translate(address/@addr, '.', '-')"/></xsl:attribute><xsl:value-of select="address/@addr"/></a></td>
  128. <td><xsl:value-of select="hostnames/hostname/@name"/></td>
  129. <td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/></td>
  130. <td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/></td>
  131. </tr>
  132. </xsl:for-each>
  133. </xsl:otherwise>
  134. </xsl:choose>
  135. </tbody>
  136. </table>
  137. </div>
  138. <script>
  139. $(document).ready(function() {
  140. $('#table-overview').DataTable();
  141. });
  142. $('#table-overview').DataTable( {
  143. "lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ]
  144. });
  145. </script>
  146. <h2 id="onlinehosts" class="target">Online Hosts</h2>
  147. <xsl:for-each select="/nmaprun/host[status/@state='up']">
  148. <div class="panel panel-default">
  149. <div class="panel-heading clickable" data-toggle="collapse">
  150. <xsl:attribute name="id">onlinehosts-<xsl:value-of select="translate(address/@addr, '.', '-')"/></xsl:attribute>
  151. <xsl:attribute name="data-target">#<xsl:value-of select="translate(address/@addr, '.', '-')"/></xsl:attribute>
  152. <h3 class="panel-title"><xsl:value-of select="address/@addr"/><xsl:if test="count(hostnames/hostname) > 0"> - <xsl:value-of select="hostnames/hostname/@name"/></xsl:if></h3>
  153. </div>
  154. <div class="panel-body collapse in">
  155. <xsl:attribute name="id"><xsl:value-of select="translate(address/@addr, '.', '-')"/></xsl:attribute>
  156. <xsl:if test="count(hostnames/hostname) > 0">
  157. <h4>Hostnames</h4>
  158. <ul>
  159. <xsl:for-each select="hostnames/hostname">
  160. <li><xsl:value-of select="@name"/> (<xsl:value-of select="@type"/>)</li>
  161. </xsl:for-each>
  162. </ul>
  163. </xsl:if>
  164. <h4>Ports</h4>
  165. <div class="table-responsive">
  166. <table class="table table-bordered">
  167. <thead>
  168. <tr>
  169. <th>Port</th>
  170. <th>Protocol</th>
  171. <th>State<br/>Reason</th>
  172. <th>Service</th>
  173. <th>Product</th>
  174. <th>Version</th>
  175. <th>Extra Info</th>
  176. </tr>
  177. </thead>
  178. <tbody>
  179. <xsl:for-each select="ports/port">
  180. <xsl:choose>
  181. <xsl:when test="state/@state = 'open'">
  182. <tr class="success">
  183. <td title="Port"><xsl:value-of select="@portid"/></td>
  184. <td title="Protocol"><xsl:value-of select="@protocol"/></td>
  185. <td title="State / Reason"><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
  186. <td title="Service"><xsl:value-of select="service/@name"/></td>
  187. <td title="Product"><xsl:value-of select="service/@product"/></td>
  188. <td title="Version"><xsl:value-of select="service/@version"/></td>
  189. <td title="Extra Info"><xsl:value-of select="service/@extrainfo"/></td>
  190. </tr>
  191. <tr>
  192. <td colspan="7">
  193. <a><xsl:attribute name="href">https://nvd.nist.gov/vuln/search/results?form_type=Advanced&amp;cves=on&amp;cpe_version=<xsl:value-of select="service/cpe"/></xsl:attribute><xsl:value-of select="service/cpe"/></a>
  194. <xsl:for-each select="script">
  195. <h5><xsl:value-of select="@id"/></h5>
  196. <pre style="white-space:pre-wrap; word-wrap:break-word;"><xsl:value-of select="@output"/></pre>
  197. </xsl:for-each>
  198. </td>
  199. </tr>
  200. </xsl:when>
  201. <xsl:when test="state/@state = 'filtered'">
  202. <tr class="warning">
  203. <td><xsl:value-of select="@portid"/></td>
  204. <td><xsl:value-of select="@protocol"/></td>
  205. <td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
  206. <td><xsl:value-of select="service/@name"/></td>
  207. <td><xsl:value-of select="service/@product"/></td>
  208. <td><xsl:value-of select="service/@version"/></td>
  209. <td><xsl:value-of select="service/@extrainfo"/></td>
  210. </tr>
  211. </xsl:when>
  212. <xsl:when test="state/@state = 'closed'">
  213. <tr class="active">
  214. <td><xsl:value-of select="@portid"/></td>
  215. <td><xsl:value-of select="@protocol"/></td>
  216. <td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
  217. <td><xsl:value-of select="service/@name"/></td>
  218. <td><xsl:value-of select="service/@product"/></td>
  219. <td><xsl:value-of select="service/@version"/></td>
  220. <td><xsl:value-of select="service/@extrainfo"/></td>
  221. </tr>
  222. </xsl:when>
  223. <xsl:otherwise>
  224. <tr class="info">
  225. <td><xsl:value-of select="@portid"/></td>
  226. <td><xsl:value-of select="@protocol"/></td>
  227. <td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
  228. <td><xsl:value-of select="service/@name"/></td>
  229. <td><xsl:value-of select="service/@product"/></td>
  230. <td><xsl:value-of select="service/@version"/></td>
  231. <td><xsl:value-of select="service/@extrainfo"/></td>
  232. </tr>
  233. </xsl:otherwise>
  234. </xsl:choose>
  235. </xsl:for-each>
  236. </tbody>
  237. </table>
  238. </div>
  239. <xsl:if test="count(hostscript/script) > 0">
  240. <h4>Host Script</h4>
  241. </xsl:if>
  242. <xsl:for-each select="hostscript/script">
  243. <h5><xsl:value-of select="@id"/></h5>
  244. <pre style="white-space:pre-wrap; word-wrap:break-word;"><xsl:value-of select="@output"/></pre>
  245. </xsl:for-each>
  246. <xsl:if test="count(os/osmatch) > 0">
  247. <h4>OS Detection</h4>
  248. <xsl:for-each select="os/osmatch">
  249. <h5>OS details: <xsl:value-of select="@name"/> (<xsl:value-of select="@accuracy"/>%)</h5>
  250. <xsl:for-each select="osclass">
  251. Device type: <xsl:value-of select="@type"/><br/>
  252. Running: <xsl:value-of select="@vendor"/><xsl:text> </xsl:text><xsl:value-of select="@osfamily"/><xsl:text> </xsl:text><xsl:value-of select="@osgen"/> (<xsl:value-of select="@accuracy"/>%)<br/>
  253. OS CPE: <a><xsl:attribute name="href">https://nvd.nist.gov/vuln/search/results?form_type=Advanced&amp;cves=on&amp;cpe_version=<xsl:value-of select="cpe"/></xsl:attribute><xsl:value-of select="cpe"/></a>
  254. <br/>
  255. </xsl:for-each>
  256. <br/>
  257. </xsl:for-each>
  258. </xsl:if>
  259. </div>
  260. </div>
  261. </xsl:for-each>
  262. <h2 id="openservices" class="target">Open Services</h2>
  263. <div class="table-responsive">
  264. <table id="table-services" class="table table-striped dataTable" role="grid">
  265. <thead>
  266. <tr>
  267. <th>Address</th>
  268. <th>Port</th>
  269. <th>Protocol</th>
  270. <th>Service</th>
  271. <th>Product</th>
  272. <th>Version</th>
  273. <th>CPE</th>
  274. <th>Extra info</th>
  275. </tr>
  276. </thead>
  277. <tbody>
  278. <xsl:for-each select="/nmaprun/host">
  279. <xsl:for-each select="ports/port[state/@state='open']">
  280. <tr>
  281. <td><a>
  282. <xsl:attribute name="href">#onlinehosts-<xsl:value-of select="translate(../../address/@addr, '.', '-')"/></xsl:attribute><xsl:value-of select="../../address/@addr"/>
  283. <xsl:if test="count(../../hostnames/hostname) > 0"> - <xsl:value-of select="../../hostnames/hostname/@name"/></xsl:if></a></td>
  284. <td><xsl:value-of select="@portid"/></td>
  285. <td><xsl:value-of select="@protocol"/></td>
  286. <td><xsl:value-of select="service/@name"/></td>
  287. <td><xsl:value-of select="service/@product"/></td>
  288. <td><xsl:value-of select="service/@version"/></td>
  289. <td><xsl:value-of select="service/cpe"/></td>
  290. <td><xsl:value-of select="service/@extrainfo"/></td>
  291. </tr>
  292. </xsl:for-each>
  293. </xsl:for-each>
  294. </tbody>
  295. </table>
  296. </div>
  297. <script>
  298. $(document).ready(function() {
  299. $('#table-services').DataTable();
  300. $("a[href^='#onlinehosts-']").click(function(event){
  301. event.preventDefault();
  302. $('html,body').animate({scrollTop:($(this.hash).offset().top-60)}, 500);
  303. });
  304. });
  305. $('#table-services').DataTable( {
  306. "lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ]
  307. });
  308. </script>
  309. </div>
  310. <footer class="footer">
  311. <div class="container">
  312. <p class="text-muted">
  313. This report was generated with <a href="https://github.com/honze-net/nmap-bootstrap-xsl">Nmap Bootstrap XSL</a>.<br/>
  314. Licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons BY-SA</a>.<br/>
  315. Designed and built by Andreas Hontzia (<a href="https://www.twitter.com/honze_net">@honze_net</a>).<br/>
  316. </p>
  317. </div>
  318. </footer>
  319. </body>
  320. </html>
  321. </xsl:template>
  322. </xsl:stylesheet>
Buy Me A Coffee