forked from honze-net/nmap-bootstrap-xsl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nmap-bootstrap4.xsl
336 lines (335 loc) · 17 KB
/
nmap-bootstrap4.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<?xml version="1.0" encoding="utf-8"?>
<!--
Nmap Bootstrap XSL
Creative Commons BY-SA
Andreas Hontzia (@honze_net)
Migrated to Bootstrap 4 by Andreas Wiese
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<xsl:template match="/">
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>
<html lang="en">
<head>
<xsl:comment>generated with nmap-bootstrap4.xsl - version 1.0 (https://github.com/anwiese/nmap-bootstrap4-xsl)</xsl:comment>
<meta name="referrer" content="no-referrer"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"></link>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css" integrity="sha384-EkHEUZ6lErauT712zSr0DZ2uuCmi3DoQj6ecNdHQXpMpFNGAQ48WjfXCE5n20W+R" crossorigin="anonymous"></link>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js" integrity="sha384-L74JDRkaoB7PWnReNepwX6+kSckc13TJXrka4EerY9jxQxSDl0dTguSLcA7dEfq8" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js" integrity="sha384-dsXH1jw5mvdtskz6tkzogTCdKWJv4k12j2BOHq3okVzlZiIsQhQXSh0I86ggUPPf" crossorigin="anonymous"></script>
<style>
body {
font-size: 0.875rem;
position: relative;
}
body > .container {
padding: 6rem 0.5rem 0;
}
table {
font-size: 0.875rem !important;
line-height: 1 !important;
}
.card {
margin: 1rem 0rem;
}
.target:before {
content: "";
display: block;
padding-top: 2rem;
}
.dataTables_wrapper {
padding: 3px;
}
.footer {
padding: 2rem;
margin-top: 4rem;
bottom: 0;
width: 100%;
background-color: #f5f5f5;
}
@media only screen and (min-width:1900px) {
.container {
width: 1800px;
}
}
</style>
<title>Scan Report Nmap <xsl:value-of select="/nmaprun/@version"/> - Scanned at <xsl:value-of select="/nmaprun/@startstr"/></title>
</head>
<body data-spy="scroll" data-target="#navbar-report">
<nav id="navbar-report" class="navbar navbar-expand-md navbar-light fixed-top bg-light">
<a class="navbar-brand" href="#">Scan Report</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<ul class="nav">
<li class="nav-item">
<a class="nav-link" href="#scannedhosts">Scanned Hosts</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#onlinehosts">Online Hosts</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#openservices">Open Services</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="jumbotron">
<h1>Scan Report<br/><small>Nmap <xsl:value-of select="/nmaprun/@version"/></small></h1>
<pre><code><xsl:value-of select="/nmaprun/@args"/></code></pre>
<p class="lead">
<xsl:value-of select="/nmaprun/@startstr"/> – <xsl:value-of select="/nmaprun/runstats/finished/@timestr"/><br/>
<xsl:value-of select="/nmaprun/runstats/hosts/@total"/> hosts scanned.
<xsl:value-of select="/nmaprun/runstats/hosts/@up"/> hosts up.
<xsl:value-of select="/nmaprun/runstats/hosts/@down"/> hosts down.
</p>
<div class="progress">
<div class="progress-bar bg-success" style="width: 0%">
<xsl:attribute name="style">width:<xsl:value-of select="/nmaprun/runstats/hosts/@up div /nmaprun/runstats/hosts/@total * 100"/>%;</xsl:attribute>
<xsl:value-of select="/nmaprun/runstats/hosts/@up"/>
<span class="sr-only"></span>
</div>
<div class="progress-bar bg-danger" style="width: 0%">
<xsl:attribute name="style">width:<xsl:value-of select="/nmaprun/runstats/hosts/@down div /nmaprun/runstats/hosts/@total * 100"/>%;</xsl:attribute>
<xsl:value-of select="/nmaprun/runstats/hosts/@down"/>
<span class="sr-only"></span>
</div>
</div>
</div>
<h4 id="scannedhosts" class="target">Scanned Hosts<xsl:if test="/nmaprun/runstats/hosts/@down > 1024"><small> (offline hosts are hidden)</small></xsl:if></h4>
<div class="card">
<h6 class="card-header">Overview</h6>
<div class="card-body">
<div class="table-responsive">
<table id="table-overview" class="table dataTable" role="grid">
<thead>
<tr>
<th>State</th>
<th>Address</th>
<th>Hostname</th>
<th>TCP (open)</th>
<th>UDP (open)</th>
</tr>
</thead>
<tbody>
<xsl:choose>
<xsl:when test="/nmaprun/runstats/hosts/@down > 1024">
<xsl:for-each select="/nmaprun/host[status/@state='up']">
<tr>
<td><span class="badge badge-danger"><xsl:if test="status/@state='up'"><xsl:attribute name="class">badge badge-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:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="/nmaprun/host">
<tr>
<td><span class="badge badge-danger"><xsl:if test="status/@state='up'"><xsl:attribute name="class">badge badge-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:for-each>
</xsl:otherwise>
</xsl:choose>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('#table-overview').DataTable( {
"order": [[ 0, "desc" ]]
} );
} );
</script>
<h4 id="onlinehosts" class="target">Online Hosts</h4>
<xsl:for-each select="/nmaprun/host[status/@state='up']">
<div class="card">
<h6 class="card-header"><xsl:value-of select="address/@addr"/><xsl:if test="count(hostnames/hostname) > 0"> - <xsl:value-of select="hostnames/hostname/@name"/></xsl:if></h6>
<div class="card-body">
<xsl:if test="count(address) > 0">
<h6>Address</h6>
<ul>
<xsl:for-each select="address">
<li><xsl:value-of select="@addr"/>
<xsl:if test="@vendor != ''">
<xsl:text> - </xsl:text>
<xsl:value-of select="@vendor"/>
</xsl:if>
<span class="badge badge-secondary text-uppercase ml-1"><xsl:value-of select="@addrtype"/></span>
</li>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="count(hostnames/hostname) > 0">
<h6>Hostnames</h6>
<ul>
<xsl:for-each select="hostnames/hostname">
<li>
<xsl:value-of select="@name"/>
<span class="badge badge-secondary text-uppercase ml-1"><xsl:value-of select="@type"/></span></li>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="count(ports/port) > 0">
<h6>Ports</h6>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Port</th>
<th>Protocol</th>
<th>State</th>
<th>Service</th>
<th>Reason</th>
<th>Product</th>
<th>Version</th>
<th>Extra Info</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="ports/port">
<xsl:choose>
<xsl:when test="state/@state = 'open'">
<tr class="table-success">
<td title="Port"><xsl:value-of select="@portid"/></td>
<td title="Protocol"><xsl:value-of select="@protocol"/></td>
<td title="State"><xsl:value-of select="state/@state"/></td>
<td title="Service"><xsl:value-of select="service/@name"/></td>
<td title="Reason"><xsl:value-of select="state/@reason"/></td>
<td title="Product"><xsl:value-of select="service/@product"/></td>
<td title="Version"><xsl:value-of select="service/@version"/></td>
<td title="Extra Info"><xsl:value-of select="service/@extrainfo"/></td>
</tr>
</xsl:when>
<xsl:when test="state/@state = 'filtered'">
<tr class="table-warning">
<td title="Port"><xsl:value-of select="@portid"/></td>
<td title="Protocol"><xsl:value-of select="@protocol"/></td>
<td title="State"><xsl:value-of select="state/@state"/></td>
<td title="Service"><xsl:value-of select="service/@name"/></td>
<td title="Reason"><xsl:value-of select="state/@reason"/></td>
<td title="Product"><xsl:value-of select="service/@product"/></td>
<td title="Version"><xsl:value-of select="service/@version"/></td>
<td title="Extra Info"><xsl:value-of select="service/@extrainfo"/></td>
</tr>
</xsl:when>
<xsl:when test="state/@state = 'closed'">
<tr class="table-secondary">
<td title="Port"><xsl:value-of select="@portid"/></td>
<td title="Protocol"><xsl:value-of select="@protocol"/></td>
<td title="State"><xsl:value-of select="state/@state"/></td>
<td title="Service"><xsl:value-of select="service/@name"/></td>
<td title="Reason"><xsl:value-of select="state/@reason"/></td>
<td title="Product"><xsl:value-of select="service/@product"/></td>
<td title="Version"><xsl:value-of select="service/@version"/></td>
<td title="Extra Info"><xsl:value-of select="service/@extrainfo"/></td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr class="table-info">
<td title="Port"><xsl:value-of select="@portid"/></td>
<td title="Protocol"><xsl:value-of select="@protocol"/></td>
<td title="State"><xsl:value-of select="state/@state"/></td>
<td title="Service"><xsl:value-of select="service/@name"/></td>
<td title="Reason"><xsl:value-of select="state/@reason"/></td>
<td title="Product"><xsl:value-of select="service/@product"/></td>
<td title="Version"><xsl:value-of select="service/@version"/></td>
<td title="Extra Info"><xsl:value-of select="service/@extrainfo"/></td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</tbody>
</table>
</div>
</xsl:if>
<h6>Remote Operating System Detection</h6>
<xsl:if test="count(os/osmatch) = 0"><p>Unable to identify operating system.</p></xsl:if>
<ul>
<xsl:for-each select="os/portused">
<li>Used port: <xsl:value-of select="@portid" />/<xsl:value-of select="@proto" /><span class="badge badge-secondary ml-1"><xsl:value-of select="@state" /></span></li>
</xsl:for-each>
<xsl:for-each select="os/osmatch">
<li>OS match: <xsl:value-of select="@name" /><span class="badge badge-info ml-1"><xsl:value-of select="@accuracy" />%</span></li>
</xsl:for-each>
</ul>
<xsl:if test="count(hostscript/script) > 0">
<h6>Host Script</h6>
</xsl:if>
<xsl:for-each select="hostscript/script">
<h6><xsl:value-of select="@id"/></h6>
<pre><code><xsl:value-of select="@output"/></code></pre>
</xsl:for-each>
</div>
</div>
</xsl:for-each>
<h4 id="openservices" class="target">Open Services</h4>
<div class="card">
<h6 class="card-header">Overview</h6>
<div class="card-body">
<div class="table-responsive">
<table id="table-services" class="table dataTable" role="grid">
<thead>
<tr>
<th>Address</th>
<th>Port</th>
<th>Protocol</th>
<th>Service</th>
<th>Product</th>
<th>Version</th>
<th>CPE</th>
<th>Extra info</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="/nmaprun/host">
<xsl:for-each select="ports/port[state/@state='open']">
<tr>
<td><xsl:value-of select="../../address/@addr"/><xsl:if test="count(../../hostnames/hostname) > 0"> - <xsl:value-of select="../../hostnames/hostname/@name"/></xsl:if></td>
<td><xsl:value-of select="@portid"/></td>
<td><xsl:value-of select="@protocol"/></td>
<td><xsl:value-of select="service/@name"/></td>
<td><xsl:value-of select="service/@product"/></td>
<td><xsl:value-of select="service/@version"/></td>
<td><xsl:value-of select="service/cpe"/></td>
<td><xsl:value-of select="service/@extrainfo"/></td>
</tr>
</xsl:for-each>
</xsl:for-each>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('#table-services').DataTable();
});
</script>
</div>
<footer class="footer">
<div class="container">
<span class="text-muted">
Licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons BY-SA</a>.<br/>
Based on <a href="https://github.com/honze-net/nmap-bootstrap-xsl">Nmap Bootstrap XSL</a> by Andreas Hontzia (<a href="https://www.twitter.com/honze_net">@honze_net</a>).<br/>
Migrated to Bootstrap 4 by <a href="https://github.com/anwiese">Andreas Wiese</a>.<br/>
</span>
</div>
</footer>
</body>
</html>
</xsl:template>
</xsl:stylesheet>