Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
1N3
GitHub Repository: 1N3/Sn1per
Path: blob/master/bin/nmap-bootstrap.xsl
2960 views
1
<?xml version="1.0" encoding="utf-8"?>
2
<!--
3
Nmap Bootstrap XSL
4
Creative Commons BY-SA
5
Andreas Hontzia (@honze_net)
6
-->
7
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
8
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat"/>
9
<xsl:template match="/">
10
<html lang="en">
11
<head>
12
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/>
13
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"/>
14
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap.min.css"/>
15
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
16
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
17
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap.min.js"></script>
18
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
19
<style>
20
.target:before {
21
content: "";
22
display: block;
23
height: 50px;
24
margin: -20px 0 0;
25
}
26
@media only screen and (min-width:1900px) {
27
.container {
28
width: 1800px;
29
}
30
}
31
.footer {
32
margin-top:60px;
33
padding-top:60px;
34
width: 100%;
35
height: 180px;
36
background-color: #f5f5f5;
37
}
38
</style>
39
<title>Scan Report Nmap <xsl:value-of select="/nmaprun/@version"/></title>
40
</head>
41
<body>
42
<nav class="navbar navbar-default navbar-fixed-top">
43
<div class="container-fluid">
44
<div class="navbar-header">
45
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
46
<span class="sr-only">Toggle navigation</span>
47
<span class="icon-bar"></span>
48
<span class="icon-bar"></span>
49
<span class="icon-bar"></span>
50
</button>
51
<a class="navbar-brand" href="#"><span class="glyphicon glyphicon-home"></span></a>
52
</div>
53
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
54
<ul class="nav navbar-nav">
55
<li><a href="#scannedhosts">Scanned Hosts</a></li>
56
<li><a href="#onlinehosts">Online Hosts</a></li>
57
<li><a href="#openservices">Open Services</a></li>
58
</ul>
59
</div>
60
</div>
61
</nav>
62
<div class="container">
63
<div class="jumbotron">
64
<h1>Scan Report<br/><small>Nmap <xsl:value-of select="/nmaprun/@version"/></small></h1>
65
<pre style="white-space:pre-wrap; word-wrap:break-word;"><xsl:value-of select="/nmaprun/@args"/></pre>
66
<p class="lead">
67
<xsl:value-of select="/nmaprun/@startstr"/> <xsl:value-of select="/nmaprun/runstats/finished/@timestr"/><br/>
68
<xsl:value-of select="/nmaprun/runstats/hosts/@total"/> hosts scanned.
69
<xsl:value-of select="/nmaprun/runstats/hosts/@up"/> hosts up.
70
<xsl:value-of select="/nmaprun/runstats/hosts/@down"/> hosts down.
71
</p>
72
<div class="progress">
73
<div class="progress-bar progress-bar-success" style="width: 0%">
74
<xsl:attribute name="style">width:<xsl:value-of select="/nmaprun/runstats/hosts/@up div /nmaprun/runstats/hosts/@total * 100"/>%;</xsl:attribute>
75
<xsl:value-of select="/nmaprun/runstats/hosts/@up"/>
76
<span class="sr-only"></span>
77
</div>
78
<div class="progress-bar progress-bar-danger" style="width: 0%">
79
<xsl:attribute name="style">width:<xsl:value-of select="/nmaprun/runstats/hosts/@down div /nmaprun/runstats/hosts/@total * 100"/>%;</xsl:attribute>
80
<xsl:value-of select="/nmaprun/runstats/hosts/@down"/>
81
<span class="sr-only"></span>
82
</div>
83
</div>
84
</div>
85
<h2 id="scannedhosts" class="target">Scanned Hosts<xsl:if test="/nmaprun/runstats/hosts/@down > 1024"><small> (offline hosts are hidden)</small></xsl:if></h2>
86
<div class="table-responsive">
87
<table id="table-overview" class="table table-striped dataTable" role="grid">
88
<thead>
89
<tr>
90
<th>State</th>
91
<th>Address</th>
92
<th>Hostname</th>
93
<th>TCP (open)</th>
94
<th>UDP (open)</th>
95
</tr>
96
</thead>
97
<tbody>
98
<xsl:choose>
99
<xsl:when test="/nmaprun/runstats/hosts/@down > 1024">
100
<xsl:for-each select="/nmaprun/host[status/@state='up']">
101
<tr>
102
<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>
103
<td><xsl:value-of select="address/@addr"/></td>
104
<td><xsl:value-of select="hostnames/hostname/@name"/></td>
105
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/></td>
106
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/></td>
107
</tr>
108
</xsl:for-each>
109
</xsl:when>
110
<xsl:otherwise>
111
<xsl:for-each select="/nmaprun/host">
112
<tr>
113
<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>
114
<td><xsl:value-of select="address/@addr"/></td>
115
<td><xsl:value-of select="hostnames/hostname/@name"/></td>
116
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/></td>
117
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/></td>
118
</tr>
119
</xsl:for-each>
120
</xsl:otherwise>
121
</xsl:choose>
122
</tbody>
123
</table>
124
</div>
125
<script>
126
$(document).ready(function() {
127
$('#table-overview').DataTable();
128
});
129
</script>
130
<h2 id="onlinehosts" class="target">Online Hosts</h2>
131
<xsl:for-each select="/nmaprun/host[status/@state='up']">
132
<div class="panel panel-default">
133
<div class="panel-heading">
134
<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>
135
</div>
136
<div class="panel-body">
137
<xsl:if test="count(hostnames/hostname) > 0">
138
<h4>Hostnames</h4>
139
<ul>
140
<xsl:for-each select="hostnames/hostname">
141
<li><xsl:value-of select="@name"/> (<xsl:value-of select="@type"/>)</li>
142
</xsl:for-each>
143
</ul>
144
</xsl:if>
145
<h4>Ports</h4>
146
<div class="table-responsive">
147
<table class="table table-bordered">
148
<thead>
149
<tr>
150
<th>Port</th>
151
<th>Protocol</th>
152
<th>State<br/>Reason</th>
153
<th>Service</th>
154
<th>Product</th>
155
<th>Version</th>
156
<th>Extra Info</th>
157
</tr>
158
</thead>
159
<tbody>
160
<xsl:for-each select="ports/port">
161
<xsl:choose>
162
<xsl:when test="state/@state = 'open'">
163
<tr class="success">
164
<td title="Port"><xsl:value-of select="@portid"/></td>
165
<td title="Protocol"><xsl:value-of select="@protocol"/></td>
166
<td title="State / Reason"><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
167
<td title="Service"><xsl:value-of select="service/@name"/></td>
168
<td title="Product"><xsl:value-of select="service/@product"/></td>
169
<td title="Version"><xsl:value-of select="service/@version"/></td>
170
<td title="Extra Info"><xsl:value-of select="service/@extrainfo"/></td>
171
</tr>
172
<tr>
173
<td colspan="7">
174
<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>
175
<xsl:for-each select="script">
176
<h5><xsl:value-of select="@id"/></h5>
177
<pre style="white-space:pre-wrap; word-wrap:break-word;"><xsl:value-of select="@output"/></pre>
178
</xsl:for-each>
179
</td>
180
</tr>
181
</xsl:when>
182
<xsl:when test="state/@state = 'filtered'">
183
<tr class="warning">
184
<td><xsl:value-of select="@portid"/></td>
185
<td><xsl:value-of select="@protocol"/></td>
186
<td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
187
<td><xsl:value-of select="service/@name"/></td>
188
<td><xsl:value-of select="service/@product"/></td>
189
<td><xsl:value-of select="service/@version"/></td>
190
<td><xsl:value-of select="service/@extrainfo"/></td>
191
</tr>
192
</xsl:when>
193
<xsl:when test="state/@state = 'closed'">
194
<tr class="active">
195
<td><xsl:value-of select="@portid"/></td>
196
<td><xsl:value-of select="@protocol"/></td>
197
<td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
198
<td><xsl:value-of select="service/@name"/></td>
199
<td><xsl:value-of select="service/@product"/></td>
200
<td><xsl:value-of select="service/@version"/></td>
201
<td><xsl:value-of select="service/@extrainfo"/></td>
202
</tr>
203
</xsl:when>
204
<xsl:otherwise>
205
<tr class="info">
206
<td><xsl:value-of select="@portid"/></td>
207
<td><xsl:value-of select="@protocol"/></td>
208
<td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
209
<td><xsl:value-of select="service/@name"/></td>
210
<td><xsl:value-of select="service/@product"/></td>
211
<td><xsl:value-of select="service/@version"/></td>
212
<td><xsl:value-of select="service/@extrainfo"/></td>
213
</tr>
214
</xsl:otherwise>
215
</xsl:choose>
216
</xsl:for-each>
217
</tbody>
218
</table>
219
</div>
220
<xsl:if test="count(hostscript/script) > 0">
221
<h4>Host Script</h4>
222
</xsl:if>
223
<xsl:for-each select="hostscript/script">
224
<h5><xsl:value-of select="@id"/></h5>
225
<pre style="white-space:pre-wrap; word-wrap:break-word;"><xsl:value-of select="@output"/></pre>
226
</xsl:for-each>
227
</div>
228
</div>
229
</xsl:for-each>
230
<h2 id="openservices" class="target">Open Services</h2>
231
<div class="table-responsive">
232
<table id="table-services" class="table table-striped dataTable" role="grid">
233
<thead>
234
<tr>
235
<th>Address</th>
236
<th>Port</th>
237
<th>Protocol</th>
238
<th>Service</th>
239
<th>Product</th>
240
<th>Version</th>
241
<th>CPE</th>
242
<th>Extra info</th>
243
</tr>
244
</thead>
245
<tbody>
246
<xsl:for-each select="/nmaprun/host">
247
<xsl:for-each select="ports/port[state/@state='open']">
248
<tr>
249
<td><xsl:value-of select="../../address/@addr"/><xsl:if test="count(../../hostnames/hostname) > 0"> - <xsl:value-of select="../../hostnames/hostname/@name"/></xsl:if></td>
250
<td><xsl:value-of select="@portid"/></td>
251
<td><xsl:value-of select="@protocol"/></td>
252
<td><xsl:value-of select="service/@name"/></td>
253
<td><xsl:value-of select="service/@product"/></td>
254
<td><xsl:value-of select="service/@version"/></td>
255
<td><xsl:value-of select="service/cpe"/></td>
256
<td><xsl:value-of select="service/@extrainfo"/></td>
257
</tr>
258
</xsl:for-each>
259
</xsl:for-each>
260
</tbody>
261
</table>
262
</div>
263
<script>
264
$(document).ready(function() {
265
$('#table-services').DataTable();
266
});
267
</script>
268
</div>
269
<footer class="footer">
270
<div class="container">
271
<p class="text-muted">
272
This report was generated with <a href="https://github.com/honze-net/nmap-bootstrap-xsl">Nmap Bootstrap XSL</a>.<br/>
273
Licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons BY-SA</a>.<br/>
274
Designed and built by Andreas Hontzia (<a href="https://www.twitter.com/honze_net">@honze_net</a>).<br/>
275
</p>
276
</div>
277
</footer>
278
</body>
279
</html>
280
</xsl:template>
281
</xsl:stylesheet>
282
283