-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport.html
More file actions
551 lines (528 loc) 路 25.5 KB
/
Copy pathreport.html
File metadata and controls
551 lines (528 loc) 路 25.5 KB
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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
{# templates/report.html #}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Shodan2DB - Attack Surface Assessment</title>
<!-- Official Latest Bulma CSS Core Framework -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css">
<!-- Standard Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css">
<!-- Client-side table sorting -->
<script src="https://unpkg.com/tablesort@5.6.0/dist/tablesort.min.js"></script>
<!-- Custom Layout Adjustments -->
<style>
body {
background-color: #f0f4f8 !important;
min-height: 100vh;
}
.navbar.shadow {
box-shadow: 0 4px 12px rgba(10, 10, 10, 0.05) !important;
}
.box {
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
border-radius: 8px !important;
border: 1px solid #e1e8ed !important;
}
/* Style des fiches d'h么tes - Correction de la visibilit茅 de l'ISP */
.host-banner {
background-color: #1a2530 !important;
color: #ffffff !important;
border-radius: 6px;
padding: 1.5rem;
}
.host-banner strong, .host-banner b {
color: #38ef7d !important; /* Vert n茅on pour l'ISP et la Ville */
}
.host-banner .title {
color: #ffffff !important;
}
.host-banner .subtitle {
color: #b0bec5 !important;
}
.border-vulnerability {
border-left: 6px solid #e74c3c !important;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.border-vulnerability:hover {
transform: translateY(-2px);
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08) !important;
}
.border-non-vulnerability {
border-left: 6px solid #2ecc71 !important;
}
.underline {
text-decoration: underline;
}
html {
scroll-behavior: smooth;
scroll-padding-top: 5rem;
}
.is-size-7 {
line-height: 1.4;
}
.table thead th {
background-color: #f8fafc !important;
color: #334155 !important;
font-weight: 600 !important;
}
.sortable-table thead th {
position: relative;
cursor: pointer;
padding-right: 2rem !important;
white-space: nowrap;
}
.sort-icon {
position: absolute;
right: 0.6rem;
top: 50%;
opacity: 0.65;
transform: translateY(-50%);
}
</style>
</head>
<body class="has-navbar-fixed-top">
<!-- Top Fixed Navigation Bar -->
<nav class="navbar is-fixed-top is-light shadow">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item has-text-weight-semibold" href="#top">
Shodan2DB
</a>
<button class="navbar-burger burger" type="button" data-target="navMenu" aria-label="Ouvrir le menu" aria-expanded="false">
<span></span>
<span></span>
<span></span>
</button>
</div>
<div id="navMenu" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" href="#vulns-list">Vulnerabilities</a>
<a class="navbar-item" href="#cve-list">CVE</a>
<a class="navbar-item" href="#all-list">All</a>
</div>
<div class="navbar-end">
<div class="navbar-item">
<p class="control has-icons-left">
<input class="input is-rounded" type="search" placeholder="Filter IP Address" id="searchbox" oninput="liveSearch()" onclick="this.value = ''; liveSearch();" autofocus>
<span class="icon is-medium is-left">
<i class="bi bi-search"></i>
</span>
</p>
</div>
</div>
</div>
</div>
</nav>
<!-- Main Container Target Layout -->
<div class="container is-fluid px-5 mt-5">
<div class="has-text-centered title is-1 py-4">
Attack Surface Assessment
</div>
<br>
<!-- KPI Metrics Dashboards -->
<nav class="level box py-4">
<div class="level-item has-text-centered">
<div>
<p class="heading">Hosts</p>
<p class="title has-text-info">{{ total_hosts }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Vulnerable Hosts</p>
<p class="title has-text-danger">{{ vulns_hosts | length }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Vulnerabilities</p>
<p class="title has-text-danger">{{ vulns | length }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Services</p>
<p class="title has-text-warning">{{ services | length }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Unique CVEs</p>
<p class="title has-text-primary">{{ cves | length }}</p>
</div>
</div>
</nav>
<!-- Global Hosts Summary Table -->
<p id="vulns-list" class="title is-3 is-spaced">Vulnerable Hosts</p>
<div class="table-container box">
<table class="table sortable-table is-hoverable is-bordered is-striped is-fullwidth">
<thead>
<tr class="is-selected">
<th>IP Address</th>
<th>Hostnames</th>
<th>ISP Provider</th>
<th>City Location</th>
<th>Tags</th>
<th>Vulns Count</th>
</tr>
</thead>
<tbody>
{% for host in vulns_hosts %}
<tr>
<td>
<a class="has-text-link has-text-weight-bold" href="#{{ host.ip }}">{{ host.ip }}</a>
</td>
<td>{{ host.hostnames or 'N/A' }}</td>
<td>{{ host.isp or 'N/A' }}</td>
<td>{{ host.city or 'N/A' }}</td>
<td>
{% if host.tags %}
{% for tag in host.tags.split() %}
<span class="tag is-info is-light">{{ tag }}</span>
{% endfor %}
{% else %}
<span class="has-text-grey-light">None</span>
{% endif %}
</td>
<td>
<span class="tag {% if host.nbvulns and host.nbvulns > 0 %}is-danger{% else %}is-success{% endif %} has-text-weight-bold">
{{ host.nbvulns or 0 }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Loop over each host to display sub-tables -->
{% for host in vulns_hosts %}
<section class="section box my-5 py-5 border-vulnerability">
<div id="{{ host.ip }}" class="host-banner mb-4">
<p>
<a href="https://www.shodan.io/host/{{ host.ip }}" target="_blank" rel="noopener" class="title is-4 has-text-white underline">
<i class="bi bi-hdd-network-fill mr-2"></i>{{ host.ip }}
</a>
<button class="button is-small is-ghost has-text-grey-light ml-2 copy-ip" type="button" data-ip="{{ host.ip }}" title="Copier l鈥檃dresse IP" aria-label="Copier {{ host.ip }}">
<span class="icon"><i class="bi bi-clipboard"></i></span>
</button>
<span class="tag is-danger is-light is-rounded is-medium is-pulled-right has-text-weight-bold">
{{ host.nbvulns or 0 }} Vulns
</span>
</p>
<p class="subtitle is-6 mt-1">{{ host.hostnames or 'No associated hostname' }}</p>
<div class="content pt-2" style="color: #ffffff !important;">
<p>
<strong>ISP :</strong> {{ host.isp or 'Unknown ISP' }}
<span class="mx-3">|</span>
<strong>City :</strong> {{ host.city or 'Unknown City' }}
{% if host.tags %}
<span class="mx-3">|</span> <strong>Tags :</strong>
{% for tag in host.tags.split() %}
<span class="tag is-small is-warning has-text-dark">{{ tag }}</span>
{% endfor %}
{% endif %}
</p>
</div>
</div>
<!-- Exposed Ports & Banners Section -->
<p class="subtitle is-5 mt-5"><i class="bi bi-cpu mr-2"></i>Exposed Ports & Services</p>
<div class="table-container">
<table class="table sortable-table is-hoverable is-bordered is-striped is-fullwidth">
<thead>
<tr>
<th>Service</th>
<th>Version</th>
<th>Port</th>
<th>Transport</th>
<th>Response</th>
</tr>
</thead>
<tbody>
{% set ns_services = namespace(has_services=false) %}
{% for service in services %}
{% if service.ip == host.ip %}
{% set ns_services.has_services = true %}
<tr>
<td><strong>{{ service.product or 'Generic Port Probe' }}</strong></td>
<td>{{ service.version or 'Undetermined' }}</td>
<td>
<a class="has-text-link" href="https://shodan.io{{ host.ip }}#{{ service.port }}" target="_blank" rel="noopener">
<span class="tag is-light is-info">{{ service.port }}</span>
</a>
</td>
<td><span class="is-uppercase">{{ service.transport }}</span></td>
<td>{{ service.data.splitlines() | first or 'No data available' }}</td>
</tr>
{% endif %}
{% endfor %}
{% if not ns_services.has_services %}
<tr><td colspan="4" class="has-text-centered has-text-grey-italic">No open services maps recorded inside database.</td></tr>
{% endif %}
</tbody>
</table>
</div>
<!-- CVEs Details Section -->
<p class="subtitle is-5 mt-4"><i class="bi bi-shield-slash-fill mr-2 has-text-danger"></i>Vulnerabilities</p>
<div class="table-container">
<table class="table sortable-table is-hoverable is-bordered is-fullwidth">
<thead>
<tr>
<th style="width: 15%">CVE ID</th>
<th style="width: 10%">CVSS Score</th>
<th>Vulnerability Summary Description</th>
</tr>
</thead>
<tbody>
{% set ns_vuln = namespace(has_vulns=false) %}
{% for vuln in vulns %}
{% if vuln.ip == host.ip %}
{% set ns_vuln.has_vulns = true %}
<tr>
<td>
<a class="has-text-danger has-text-weight-bold" href="https://nvd.nist.gov/vuln/detail/{{ vuln.cveid }}" target="_blank" rel="noopener">
{{ vuln.cveid }}
</a>
</td>
<td>
<span class="tag {{ 'is-danger' if vuln.cvss and vuln.cvss >= 7.0 else ('is-warning' if vuln.cvss and vuln.cvss >= 4.0 else 'is-info') }} has-text-weight-bold">
{{ vuln.cvss or 'N/A' }}
</span>
</td>
<td><p class="is-size-7">{{ vuln.summary or 'No public descriptions details synchronized.' }}</p></td>
</tr>
{% endif %}
{% endfor %}
{% if not ns_vuln.has_vulns %}
<tr><td colspan="3" class="has-text-centered has-text-grey-italic">No vulnerabilities stored for this host.</td></tr>
{% endif %}
</tbody>
</table>
</div>
</section>
{% endfor %}
<!-- Global Threat Distribution Index (CVE) -->
<p id="cve-list" class="title is-3 is-spaced mt-6">Global Threat Distribution Index (CVE)</p>
<div class="table-container box mb-6">
<table class="table sortable-table is-hoverable is-bordered is-striped is-fullwidth">
<thead>
<tr class="is-selected">
<th>Identified CVE ID</th>
<th>Exploited Host Count</th>
<th>CVSS Rating</th>
<th>Vulnerability Target Summary</th>
</tr>
</thead>
<tbody>
{% for cve in cves %}
<tr>
<td>
<a class="has-text-danger has-text-weight-bold" href="https://nvd.nist.gov/vuln/detail/{{ cve.cveid }}" target="_blank" rel="noopener">
{{ cve.cveid }}
</a>
</td>
<td>
<span class="tag is-dark has-text-weight-bold">{{ cve.count }} hosts affected</span>
</td>
<td>
<span class="tag {{ 'is-danger' if cve.cvss and cve.cvss >= 7.0 else ('is-warning' if cve.cvss and cve.cvss >= 4.0 else 'is-info') }} has-text-weight-bold">
{{ cve.cvss or 'N/A' }}
</span>
</td>
<td><p class="is-size-7">{{ cve.summary }}</p></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Complete inventory of hosts without reported vulnerabilities -->
<p id="all-list" class="title is-3 is-spaced mt-6">All Hosts</p>
<div class="table-container box mb-6">
<table class="table sortable-table is-hoverable is-bordered is-striped is-fullwidth">
<thead>
<tr class="is-selected">
<th>IP Address</th>
<th>Hostnames</th>
<th>ISP Provider</th>
<th>City Location</th>
<th>Tags</th>
</tr>
</thead>
<tbody>
{% for host in all_hosts %}
<tr>
<td>
<a class="has-text-link has-text-weight-bold" href="#{{ host.ip }}">{{ host.ip }}</a>
</td>
<td>{{ host.hostnames or 'N/A' }}</td>
<td>{{ host.isp or 'N/A' }}</td>
<td>{{ host.city or 'N/A' }}</td>
<td>
{% if host.tags %}
{% for tag in host.tags.split() %}
<span class="tag is-info is-light">{{ tag }}</span>
{% endfor %}
{% else %}
<span class="has-text-grey-light">None</span>
{% endif %}
</td>
</tr>
{% else %}
<tr><td colspan="6" class="has-text-centered has-text-grey">No non-vulnerable hosts recorded.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Services details for hosts without reported vulnerabilities -->
{% for host in all_hosts %}
<section class="section box my-5 py-5 border-non-vulnerability">
<div id="{{ host.ip }}" class="host-banner mb-4">
<p>
<a href="https://www.shodan.io/host/{{ host.ip }}" target="_blank" rel="noopener" class="title is-4 has-text-white underline">
<i class="bi bi-hdd-network-fill mr-2"></i>{{ host.ip }}
</a>
<button class="button is-small is-ghost has-text-grey-light ml-2 copy-ip" type="button" data-ip="{{ host.ip }}" title="Copier l鈥檃dresse IP" aria-label="Copier {{ host.ip }}">
<span class="icon"><i class="bi bi-clipboard"></i></span>
</button>
<span class="tag is-success is-light is-rounded is-medium is-pulled-right has-text-weight-bold">No Vulns</span>
</p>
<p class="subtitle is-6 mt-1">{{ host.hostnames or 'No associated hostname' }}</p>
<div class="content pt-2" style="color: #ffffff !important;">
<p>
<strong>ISP :</strong> {{ host.isp or 'Unknown ISP' }}
<span class="mx-3">|</span>
<strong>City :</strong> {{ host.city or 'Unknown City' }}
{% if host.tags %}
<span class="mx-3">|</span> <strong>Tags :</strong>
{% for tag in host.tags.split() %}
<span class="tag is-small is-warning has-text-dark">{{ tag }}</span>
{% endfor %}
{% endif %}
</p>
</div>
</div>
<p class="subtitle is-5 mt-5"><i class="bi bi-cpu mr-2"></i>Exposed Open Ports & Services</p>
<div class="table-container">
<table class="table sortable-table is-hoverable is-bordered is-striped is-fullwidth">
<thead>
<tr>
<th>Service</th>
<th>Version</th>
<th>Port</th>
<th>Transport</th>
<th>Response</th>
</tr>
</thead>
<tbody>
{% set ns_all_services = namespace(has_services=false) %}
{% for service in all_services %}
{% if service.ip == host.ip %}
{% set ns_all_services.has_services = true %}
<tr>
<td><strong>{{ service.product or 'Generic Port Probe' }}</strong></td>
<td>{{ service.version or 'Undetermined' }}</td>
<td><span class="tag is-light is-info">{{ service.port }}</span></td>
<td><span class="is-uppercase">{{ service.transport or 'Undetermined' }}</span></td>
<td>{{ (service.data or '').splitlines() | first or 'No data available' }}</td>
</tr>
{% endif %}
{% endfor %}
{% if not ns_all_services.has_services %}
<tr><td colspan="5" class="has-text-centered has-text-grey-italic">No open services recorded inside database.</td></tr>
{% endif %}
</tbody>
</table>
</div>
</section>
{% endfor %}
</div> <!-- Close Main Container (from Piece 1) -->
<!-- Interactive Client-Side Features -->
<script>
function copyIp(button) {
const ip = button.dataset.ip;
const icon = button.querySelector('i');
const copied = () => {
icon.className = 'bi bi-check2';
button.title = 'Adresse IP copi茅e';
window.setTimeout(() => {
icon.className = 'bi bi-clipboard';
button.title = 'Copier l鈥檃dresse IP';
}, 1500);
};
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(ip).then(copied);
return;
}
const textArea = document.createElement('textarea');
textArea.value = ip;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
textArea.remove();
copied();
}
document.addEventListener('click', event => {
const copyButton = event.target.closest('.copy-ip');
if (copyButton) copyIp(copyButton);
});
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.sortable-table').forEach(table => {
table.querySelectorAll('thead th').forEach(header => {
const sortIcon = document.createElement('i');
sortIcon.className = 'bi bi-arrow-down-up sort-icon';
sortIcon.title = 'Cliquer pour trier';
sortIcon.setAttribute('aria-label', 'Colonne triable');
header.appendChild(sortIcon);
});
new Tablesort(table);
});
});
/**
* Real-time search engine for the report.
* Filters the host sections and shifts focus dynamically.
*/
function liveSearch() {
const sections = document.querySelectorAll('.section');
const searchInput = document.getElementById("searchbox");
if (!searchInput) return;
const searchQuery = searchInput.value.toLowerCase().trim();
let firstVisibleCard = null;
sections.forEach(section => {
if (searchQuery === "" || section.innerText.toLowerCase().includes(searchQuery)) {
section.classList.remove("is-hidden");
// Identify the first matching host to focus on
if (!firstVisibleCard) {
firstVisibleCard = section;
}
} else {
section.classList.add("is-hidden");
}
});
// Smoothly refocus view on the first available record during active search
if (searchQuery !== "" && firstVisibleCard) {
firstVisibleCard.scrollIntoView({ behavior: 'auto', block: 'nearest' });
}
}
/**
* Mobile Responsive Burger Menu Handler.
*/
document.addEventListener('DOMContentLoaded', () => {
const navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
navbarBurgers.forEach(el => {
el.addEventListener('click', () => {
const targetId = el.dataset.target;
const targetMenu = document.getElementById(targetId);
if (targetMenu) {
const isActive = el.classList.toggle('is-active');
targetMenu.classList.toggle('is-active', isActive);
el.setAttribute('aria-expanded', String(isActive));
}
});
});
});
</script>
</body>
</html>