Repository navigation
Expand file tree
/
Copy pathNetDTL_Reference_Manual.html
More file actions
812 lines (731 loc) · 51.6 KB
/
Copy pathNetDTL_Reference_Manual.html
File metadata and controls
812 lines (731 loc) · 51.6 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
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NetDTL — Reference Manual</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&family=IBM+Plex+Sans:wght@300;400;600&display=swap');
:root {
--bg: #0f1117;
--surface: #181c27;
--border: #252b3b;
--accent: #58a6ff;
--accent-dim: #1a3a5c;
--text: #c9d1e0;
--text-muted: #5a6580;
--text-heading: #e8edf5;
--code-bg: #12161f;
--code-border: #1e2535;
--sidebar-w: 240px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
background: var(--bg);
color: var(--text);
font-family: 'IBM Plex Sans', sans-serif;
font-size: 14px;
line-height: 1.7;
display: flex;
min-height: 100vh;
}
nav {
position: fixed;
top: 0; left: 0;
width: var(--sidebar-w);
height: 100vh;
background: var(--surface);
border-right: 1px solid var(--border);
overflow-y: auto;
padding: 28px 0 40px;
z-index: 100;
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
}
nav .logo {
font-family: 'IBM Plex Mono', monospace;
font-size: 11px;
font-weight: 600;
color: var(--accent);
letter-spacing: 2px;
text-transform: uppercase;
padding: 0 20px 20px;
border-bottom: 1px solid var(--border);
margin-bottom: 16px;
line-height: 1.4;
}
nav .logo span {
display: block;
color: var(--text-muted);
font-size: 9px;
letter-spacing: 1px;
margin-top: 4px;
}
nav a {
display: block;
color: var(--text-muted);
text-decoration: none;
font-size: 12px;
padding: 5px 20px;
transition: color 0.15s, background 0.15s;
font-family: 'IBM Plex Mono', monospace;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
nav a:hover { color: var(--accent); background: rgba(88,166,255,0.06); }
nav a.active { color: var(--accent); }
nav a.nav-section-link {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
color: var(--text-muted);
padding: 14px 20px 4px;
opacity: 0.5;
cursor: pointer;
}
nav a.nav-section-link:hover { opacity: 1; background: none; }
main {
margin-left: var(--sidebar-w);
padding: 56px 64px 100px;
max-width: calc(var(--sidebar-w) + 860px);
width: 100%;
}
.main-logo {
display: block;
margin: 0 auto 36px;
height: 52px;
width: auto;
image-rendering: pixelated;
}
.doc-header {
margin-bottom: 48px;
padding-bottom: 32px;
border-bottom: 1px solid var(--border);
}
.doc-header h1 {
font-family: 'IBM Plex Mono', monospace;
font-size: 26px;
font-weight: 600;
color: var(--text-heading);
letter-spacing: -0.5px;
margin-bottom: 10px;
}
.doc-header h1 .accent { color: var(--accent); }
.meta-pills {
display: flex;
gap: 10px;
flex-wrap: wrap;
margin-top: 16px;
}
.pill {
font-family: 'IBM Plex Mono', monospace;
font-size: 11px;
padding: 3px 10px;
border-radius: 3px;
background: var(--code-bg);
border: 1px solid var(--code-border);
color: var(--text-muted);
}
.pill .k { color: var(--accent); margin-right: 4px; }
h2 {
font-family: 'IBM Plex Mono', monospace;
font-size: 13px;
font-weight: 600;
color: var(--accent);
text-transform: uppercase;
letter-spacing: 2px;
margin: 52px 0 20px;
padding-bottom: 10px;
border-bottom: 1px solid var(--border);
}
h3 {
font-family: 'IBM Plex Mono', monospace;
font-size: 13px;
font-weight: 600;
color: var(--text-heading);
margin: 32px 0 10px;
}
p { margin-bottom: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
font-family: 'IBM Plex Mono', monospace;
font-size: 12px;
background: var(--code-bg);
border: 1px solid var(--code-border);
border-radius: 3px;
padding: 1px 6px;
color: #93c5fd;
}
pre {
background: var(--code-bg);
border: 1px solid var(--code-border);
border-radius: 4px;
padding: 16px 20px;
margin: 14px 0 20px;
overflow-x: auto;
font-family: 'IBM Plex Mono', monospace;
font-size: 12px;
line-height: 1.6;
color: #93c5fd;
}
pre code { background: none; border: none; padding: 0; font-size: 12px; }
table {
width: 100%;
border-collapse: collapse;
margin: 16px 0 24px;
font-size: 13px;
}
thead tr { background: var(--code-bg); border-bottom: 1px solid var(--border); }
th {
font-family: 'IBM Plex Mono', monospace;
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1.5px;
color: var(--text-muted);
padding: 10px 14px;
text-align: left;
}
td {
padding: 9px 14px;
border-bottom: 1px solid var(--border);
vertical-align: top;
color: var(--text);
}
td:first-child {
font-family: 'IBM Plex Mono', monospace;
font-size: 12px;
color: var(--accent);
white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(88,166,255,0.03); }
ul {
list-style: none;
margin: 10px 0 16px;
padding-left: 0;
}
ul li {
padding: 3px 0 3px 20px;
position: relative;
font-size: 13px;
}
ul li::before {
content: '›';
position: absolute;
left: 4px;
color: var(--accent);
font-weight: 600;
}
.callout {
background: rgba(88,166,255,0.05);
border: 1px solid var(--accent-dim);
border-radius: 4px;
padding: 14px 18px;
margin: 16px 0;
font-size: 13px;
}
.callout strong { color: var(--accent); }
.warn {
background: rgba(210,153,34,0.07);
border: 1px solid rgba(210,153,34,0.25);
border-radius: 4px;
padding: 14px 18px;
margin: 16px 0;
font-size: 13px;
}
.warn strong { color: #d29922; }
.page-block {
background: var(--surface);
border: 1px solid var(--border);
border-left: 3px solid var(--accent-dim);
border-radius: 4px;
padding: 20px 24px;
margin: 24px 0;
}
.page-block h3 {
margin: 0 0 6px;
font-size: 14px;
color: var(--accent);
}
.page-block .file {
font-family: 'IBM Plex Mono', monospace;
font-size: 10px;
color: var(--text-muted);
letter-spacing: 1px;
margin-bottom: 10px;
}
.page-block .desc {
font-size: 13px;
color: var(--text);
margin-bottom: 12px;
}
.page-block .label {
font-family: 'IBM Plex Mono', monospace;
font-size: 10px;
text-transform: uppercase;
letter-spacing: 1px;
color: var(--text-muted);
margin-bottom: 4px;
margin-top: 14px;
}
strong { color: var(--text-heading); font-weight: 600; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
@media (max-width: 800px) {
nav { display: none; }
main { margin-left: 0; padding: 32px 24px 60px; }
}
</style>
</head>
<body>
<nav>
<div class="logo">NetDTL<span>Reference Manual v3.0</span></div>
<a class="nav-section-link" href="#contents">Contents</a>
<a href="#overview">Overview</a>
<a href="#requirements">Requirements</a>
<a href="#installation">Installation</a>
<a href="#configuration">Configuration</a>
<a href="#database">Database schema</a>
<a class="nav-section-link" href="#pages">Pages</a>
<a href="#page-index">index.php — Dashboard</a>
<a href="#page-inventory">inventory.php — Inventory</a>
<a href="#page-machine">machine.php — Machine</a>
<a href="#page-discovery">discovery.php — Discovery</a>
<a href="#page-scan">scan_stream.php — SSE stream</a>
<a href="#page-menu">menu.php — Diagnostics</a>
<a href="#page-patch">patch.php — Patch panel</a>
<a class="nav-section-link" href="#shared">Shared components</a>
<a href="#shared-db">db.php</a>
<a href="#shared-style">style.php</a>
<a href="#shared-topbar">topbar.php</a>
<a href="#shared-sidebar">sidebar.php</a>
<a class="nav-section-link" href="#other">Other</a>
<a href="#security">Security</a>
<a href="#limitations">Known limitations</a>
</nav>
<main>
<img class="main-logo" src="data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCABfAQ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me4hv85bVxmCo5l/Uh0EJW9JT1giCLGh5mbf+3cIW+VTHcR0NDzMzbT/P2EQLi58ZmD+5iD9pbUR6YYXOZfnciJ0yTbRwxR8aS41iM61BbjhIBJPVvjTjP3BtSzAymrOEqPMSkvPTxly05NKUloeDmG3TtFKVHeEEbgd5ECn5H2ZgHm17CPJvvMzHcwo7G3ijoaWSOoeGkuz+QRFRG5zgQEORSoC+ybddoax6oI3yP8zrbq7g+/X4zMdxCGh/mYTddbwef1qZ7iG8bTWsjPPBUcy/qQ5EEEggi243gjdX4onOSrA8gw89xEt/CHOh7mUrlruER6pmY7mLV0XchMX5W5gT2IK/VKFNykxSnJNCJF11TgWp1pYJC20i1mz03uRujKvt+oJ7dLHHICSOBH6qcUTw4Ehf/9k=" alt="NetDTL">
<div class="doc-header">
<h1><span class="accent">NetDTL</span> — Reference Manual</h1>
<p style="color:var(--text-muted);font-size:13px;margin-top:10px;">Complete reference for the NetDTL v3.0 agentless network inventory and diagnostic web application.</p>
<div class="meta-pills">
<span class="pill"><span class="k">version</span>3.0</span>
<span class="pill"><span class="k">stack</span>PHP 8.x / MySQL / Nmap</span>
<span class="pill"><span class="k">license</span>MIT</span>
<span class="pill"><span class="k">author</span>Didier DTL Morandi</span>
</div>
</div>
<!-- OVERVIEW -->
<h2 id="contents" style="display:none"></h2>
<h2 id="overview">Overview</h2>
<p>NetDTL is a self-hosted web application for agentless network discovery and inventory management on Windows infrastructure. It runs on a PHP/MySQL/Nmap stack (XAMPP or LAMP) and provides real-time scanning via Server-Sent Events, machine profiling, network diagnostics, and patch panel management — all through a dark-themed web interface with no external JavaScript dependencies.</p>
<p>The application is structured as a set of PHP pages, each responsible for one functional area, sharing a common database layer (<code>db.php</code>), a CSS stylesheet (<code>style.php</code>), and layout partials (<code>topbar.php</code>, <code>sidebar.php</code>).</p>
<!-- REQUIREMENTS -->
<h2 id="requirements">Requirements</h2>
<table>
<thead><tr><th>Component</th><th>Version</th><th>Notes</th></tr></thead>
<tbody>
<tr><td>PHP</td><td>8.x</td><td>Extensions required: <code>pdo_mysql</code>, <code>mbstring</code></td></tr>
<tr><td>MySQL / MariaDB</td><td>any recent</td><td>Used via PDO</td></tr>
<tr><td>Nmap</td><td>any recent</td><td>Must be accessible from the PHP process; path set via <code>NMAP_PATH</code></td></tr>
<tr><td>XAMPP or LAMP</td><td>—</td><td>Any standard PHP+MySQL server environment</td></tr>
<tr><td>PowerShell</td><td>5.1 / 7+</td><td>Required for WMI descriptions and local IP/service queries</td></tr>
</tbody>
</table>
<div class="callout"><strong>Windows note:</strong> When the web server runs on Windows, Nmap and PowerShell commands are invoked via <code>shell_exec</code>. The PHP process account must have sufficient privileges, and Nmap must be in the system PATH or its full path set in <code>db.php</code>.</div>
<!-- INSTALLATION -->
<h2 id="installation">Installation</h2>
<p>Deploy the application files to the web server document root (e.g. <code>htdocs/netdtl/</code> under XAMPP, or a dedicated virtual host).</p>
<h3>1. Create the database</h3>
<pre><code>CREATE DATABASE netdtl CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'netdtl'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON netdtl.* TO 'netdtl'@'localhost';
FLUSH PRIVILEGES;</code></pre>
<h3>2. Configure db.php</h3>
<p>Edit the constants at the top of <code>db.php</code> to match your environment. The database schema is created automatically on first run by <code>initDB()</code>.</p>
<h3>3. First run</h3>
<p>Open the application in a browser. <code>initDB()</code> will create all required tables if they do not exist. Log in with the credentials defined in <code>AUTH_USER</code> / <code>AUTH_PASS</code>.</p>
<!-- CONFIGURATION -->
<h2 id="configuration">Configuration</h2>
<p>All configuration lives in <code>db.php</code> as PHP constants. There is no separate config file.</p>
<table>
<thead><tr><th>Constant</th><th>Description</th></tr></thead>
<tbody>
<tr><td>DB_HOST</td><td>MySQL host, typically <code>localhost</code></td></tr>
<tr><td>DB_NAME</td><td>Database name</td></tr>
<tr><td>DB_USER</td><td>Database user</td></tr>
<tr><td>DB_PASS</td><td>Database password</td></tr>
<tr><td>AUTH_USER</td><td>HTTP Basic Auth username</td></tr>
<tr><td>AUTH_PASS</td><td>HTTP Basic Auth password (plaintext in current version)</td></tr>
<tr><td>NMAP_PATH</td><td>Full path to the Nmap binary, e.g. <code>C:/Program Files (x86)/Nmap/nmap.exe</code></td></tr>
<tr><td>DEFAULT_NETWORK</td><td>Pre-filled CIDR range shown on the discovery page</td></tr>
<tr><td>APP_VERSION</td><td>Version string displayed in the sidebar footer</td></tr>
</tbody>
</table>
<!-- DATABASE -->
<h2 id="database">Database Schema</h2>
<p>Tables are created automatically by <code>initDB()</code> in <code>db.php</code> using <code>CREATE TABLE IF NOT EXISTS</code>.</p>
<h3>machines</h3>
<p>Central inventory table. One row per IP address (unique key on <code>ip</code>).</p>
<table>
<thead><tr><th>Column</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td>id</td><td>INT AUTO_INCREMENT</td><td>Primary key</td></tr>
<tr><td>hostname</td><td>VARCHAR</td><td>Short hostname or IP if no name resolved</td></tr>
<tr><td>ip</td><td>VARCHAR(45)</td><td>IPv4 address — unique constraint</td></tr>
<tr><td>mac</td><td>VARCHAR(17)</td><td>MAC address in uppercase colon-separated format</td></tr>
<tr><td>vendor</td><td>VARCHAR</td><td>NIC manufacturer from Nmap OUI lookup</td></tr>
<tr><td>os</td><td>VARCHAR</td><td>OS string from Nmap detection or manual entry</td></tr>
<tr><td>switch_port</td><td>VARCHAR</td><td>Switch port label (e.g. <code>port1.0.3</code>), manually set</td></tr>
<tr><td>patch_port</td><td>VARCHAR</td><td>Patch panel port label (e.g. <code>B31</code>), manually set</td></tr>
<tr><td>open_ports</td><td>TEXT</td><td>Comma-separated list of open ports from last port scan</td></tr>
<tr><td>status</td><td>ENUM('up','down','unknown')</td><td>Current reachability status</td></tr>
<tr><td>last_ping_ms</td><td>INT</td><td>Average ping RTT in milliseconds from last ping</td></tr>
<tr><td>comment</td><td>TEXT</td><td>Free-form note; also populated by WMI / NetBIOS enrichment</td></tr>
<tr><td>first_seen</td><td>DATETIME</td><td>Set at INSERT, never updated</td></tr>
<tr><td>last_seen</td><td>DATETIME</td><td>Updated on every scan hit or ping</td></tr>
</tbody>
</table>
<h3>scan_history</h3>
<p>One row per completed discovery scan.</p>
<table>
<thead><tr><th>Column</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td>id</td><td>INT AUTO_INCREMENT</td><td>Primary key</td></tr>
<tr><td>scan_date</td><td>DATETIME</td><td>Timestamp of scan completion</td></tr>
<tr><td>network</td><td>VARCHAR</td><td>CIDR range that was scanned</td></tr>
<tr><td>hosts_up</td><td>INT</td><td>Number of hosts found up</td></tr>
<tr><td>hosts_down</td><td>INT</td><td>Stored as 0 in current version</td></tr>
<tr><td>duration_s</td><td>INT</td><td>Scan duration in seconds</td></tr>
</tbody>
</table>
<h3>diag_history</h3>
<p>Log of all diagnostic operations (ping, traceroute, DNS, port scan, OS detection).</p>
<table>
<thead><tr><th>Column</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td>id</td><td>INT AUTO_INCREMENT</td><td>Primary key</td></tr>
<tr><td>action</td><td>VARCHAR</td><td>Tool name: <code>ping</code>, <code>nmap</code>, <code>traceroute</code>, <code>dns</code>, <code>ports</code>, <code>infos</code>, <code>services</code>, <code>nmap_os</code></td></tr>
<tr><td>target</td><td>VARCHAR</td><td>IP, hostname, or CIDR that was targeted</td></tr>
<tr><td>result</td><td>TEXT</td><td>First 20 lines of command output</td></tr>
<tr><td>success</td><td>TINYINT</td><td>Always 1 in current version</td></tr>
<tr><td>created</td><td>DATETIME</td><td>Timestamp of the operation</td></tr>
</tbody>
</table>
<h3>patch_panel</h3>
<p>Physical patch panel ports, typically populated by import (CSV or direct SQL).</p>
<table>
<thead><tr><th>Column</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td>id</td><td>INT AUTO_INCREMENT</td><td>Primary key</td></tr>
<tr><td>prise</td><td>VARCHAR</td><td>Wall outlet label (e.g. <code>B31</code>) — unique</td></tr>
<tr><td>type</td><td>VARCHAR</td><td><code>RJ45</code>, <code>RJ11</code>, or other</td></tr>
<tr><td>entite</td><td>VARCHAR</td><td>Owning entity or department</td></tr>
<tr><td>local_name</td><td>VARCHAR</td><td>Room or location name</td></tr>
<tr><td>etage</td><td>VARCHAR</td><td>Floor</td></tr>
<tr><td>poste</td><td>VARCHAR</td><td>Workstation or desk reference</td></tr>
<tr><td>switch</td><td>VARCHAR</td><td>Switch name or identifier</td></tr>
<tr><td>port_switch</td><td>VARCHAR</td><td>Switch port (e.g. <code>port1.0.3</code>)</td></tr>
<tr><td>notes</td><td>TEXT</td><td>Free-form notes</td></tr>
</tbody>
</table>
<h3>patch_machines</h3>
<p>Many-to-many join between patch panel ports and machines (a port may serve multiple IPs).</p>
<table>
<thead><tr><th>Column</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td>id</td><td>INT AUTO_INCREMENT</td><td>Primary key</td></tr>
<tr><td>prise</td><td>VARCHAR</td><td>Foreign reference to <code>patch_panel.prise</code></td></tr>
<tr><td>machine_ip</td><td>VARCHAR</td><td>IP address of the machine at this port</td></tr>
<tr><td>hostname</td><td>VARCHAR</td><td>Hostname at time of association</td></tr>
</tbody>
</table>
<!-- PAGES -->
<h2 id="pages">Pages</h2>
<!-- index.php -->
<div class="page-block" id="page-index">
<h3>Dashboard</h3>
<div class="file">index.php</div>
<div class="desc">Entry point and overview page. Displays global inventory statistics, the 8 most recently seen machines, and the 5 most recent diagnostic operations.</div>
<div class="label">Access</div>
<p>Requires authentication via <code>requireAuth()</code>. Default landing page after login.</p>
<div class="label">Data queries</div>
<ul>
<li>Total machine count, counts by status (<code>up</code>, <code>down</code>, <code>unknown</code>)</li>
<li>Last scan: date, network, host count (from <code>scan_history</code>)</li>
<li>8 most recently seen machines ordered by <code>last_seen DESC</code></li>
<li>5 most recent <code>diag_history</code> entries</li>
</ul>
<div class="label">No POST actions</div>
<p>Read-only page. All actions (ping, add, delete) are on <code>inventory.php</code> and <code>machine.php</code>.</p>
</div>
<!-- inventory.php -->
<div class="page-block" id="page-inventory">
<h3>Inventory</h3>
<div class="file">inventory.php</div>
<div class="desc">Full machine list with search, status filtering, inline ping, manual add, delete, and CSV export. The primary management interface for the machines table.</div>
<div class="label">GET parameters</div>
<table>
<thead><tr><th>Parameter</th><th>Description</th></tr></thead>
<tbody>
<tr><td>q</td><td>Free-text search across hostname, IP, OS, comment</td></tr>
<tr><td>status</td><td>Filter by status: <code>up</code>, <code>down</code>, or <code>unknown</code></td></tr>
<tr><td>export=csv</td><td>Triggers CSV download of the full inventory (bypasses all filters)</td></tr>
</tbody>
</table>
<div class="label">POST actions</div>
<table>
<thead><tr><th>Field</th><th>Action</th></tr></thead>
<tbody>
<tr><td>add_machine</td><td>Inserts a new machine row. Required fields: <code>hostname</code>, <code>ip</code> (valid IP). Optional: <code>os</code>, <code>comment</code>, <code>switch_port</code>, <code>patch_port</code>.</td></tr>
<tr><td>delete_id</td><td>Deletes the machine with the given ID. Asks for confirmation via JavaScript before submission.</td></tr>
<tr><td>ping_id</td><td>Runs a ping against the machine's IP via <code>runPing()</code>, updates <code>status</code>, <code>last_ping_ms</code>, <code>last_seen</code>.</td></tr>
<tr><td>ping_all</td><td>Pings every machine in the inventory sequentially. Updates all status fields.</td></tr>
</tbody>
</table>
<div class="label">CSV export</div>
<p>Triggered by <code>?export=csv</code>. Outputs all machines ordered by <code>INET_ATON(ip)</code> (numerical IP sort). Columns: Hostname, IP, MAC, Vendor, Switch port, Patch port, OS, Status, Open ports, Ping (ms), Last seen, Comment. BOM prepended for Excel UTF-8 compatibility.</p>
<div class="callout"><strong>Server IP detection:</strong> The inventory page detects the web server's own IP via <code>$_SERVER['SERVER_ADDR']</code> and replaces its MAC field display with <em>ce PC</em> (italicised) to avoid confusion with Nmap's own MAC (which Nmap cannot read for the scanning machine itself).</div>
</div>
<!-- machine.php -->
<div class="page-block" id="page-machine">
<h3>Machine detail</h3>
<div class="file">machine.php</div>
<div class="desc">Per-machine profile page. Displays full network information, allows editing of OS, switch port, patch port and comment, and provides quick diagnostic actions. All diagnostic results are displayed in a terminal block and logged to <code>diag_history</code>.</div>
<div class="label">GET parameters</div>
<table>
<thead><tr><th>Parameter</th><th>Description</th></tr></thead>
<tbody>
<tr><td>id</td><td>Machine ID (integer). Redirects to <code>inventory.php</code> if not found.</td></tr>
</tbody>
</table>
<div class="label">POST actions</div>
<table>
<thead><tr><th>Field / value</th><th>Action</th></tr></thead>
<tbody>
<tr><td>save</td><td>Updates <code>os</code>, <code>switch_port</code>, <code>patch_port</code>, <code>comment</code> for the machine.</td></tr>
<tr><td>diag=ping</td><td>Runs ping via <code>runPing()</code>. Updates <code>status</code> and <code>last_ping_ms</code>.</td></tr>
<tr><td>diag=ports</td><td>Runs <code>nmap -p 21,22,23,25,80,110,143,443,445,3306,3389,5900,8080</code>. Updates <code>open_ports</code> in DB.</td></tr>
<tr><td>diag=traceroute</td><td>Runs <code>tracert</code> (Windows).</td></tr>
<tr><td>diag=dns</td><td>Runs <code>nslookup</code>.</td></tr>
<tr><td>diag=nmap_os</td><td>Runs <code>nmap -O --host-timeout 10s</code>. Extracts and saves <code>OS details</code> line to <code>machines.os</code>.</td></tr>
</tbody>
</table>
<div class="label">Terminal output rendering</div>
<p>Each output line is classified and colour-coded: lines matching <code>TTL</code>, <code>Reply</code>, or <code>open</code> are green; <code>timeout</code> / <code>unreachable</code> / <code>filtered</code> are amber; <code>error</code> / <code>failed</code> are red. A hidden <code><pre id="raw-output"></code> element holds the plain text for clipboard copy.</p>
<div class="warn"><strong>OS detection requires elevated privileges:</strong> <code>nmap -O</code> requires the PHP process to run as Administrator (Windows) or root (Linux).</div>
</div>
<!-- discovery.php -->
<div class="page-block" id="page-discovery">
<h3>Network discovery</h3>
<div class="file">discovery.php</div>
<div class="desc">Discovery page. The user enters a CIDR range, selects optional enrichment options, and starts a scan. Results are streamed in real time via Server-Sent Events from <code>scan_stream.php</code>. Discovered hosts are automatically upserted into the <code>machines</code> table.</div>
<div class="label">UI controls</div>
<table>
<thead><tr><th>Control</th><th>Description</th></tr></thead>
<tbody>
<tr><td>Network input</td><td>CIDR range (e.g. <code>192.168.1.0/24</code>). Pre-filled with <code>DEFAULT_NETWORK</code>.</td></tr>
<tr><td>Ports communs</td><td>If checked, runs an additional port scan on each discovered host (<code>?ports=1</code>).</td></tr>
<tr><td>Détection OS</td><td>Adds <code>-O</code> to the Nmap command (<code>?os=1</code>). Requires admin/root.</td></tr>
<tr><td>Identifier NetBIOS</td><td>Runs a second pass of <code>nbstat</code> queries after the main scan (<code>?nbstat=1</code>).</td></tr>
<tr><td>Descriptions WMI</td><td>Queries each up host via PowerShell WMI for OS description (<code>?wmi=1</code>).</td></tr>
</tbody>
</table>
<div class="label">SSE event flow</div>
<p>The page opens an <code>EventSource</code> connection to <code>scan_stream.php</code> with query parameters reflecting the selected options. Events are handled by <code>handleEvent(data)</code> in JavaScript.</p>
<table>
<thead><tr><th>Event type</th><th>Description</th></tr></thead>
<tbody>
<tr><td>line</td><td>Raw Nmap output line. Colour-classified and appended to the terminal block.</td></tr>
<tr><td>host_saved</td><td>A host has been upserted. Adds a row to the discovered hosts table in the UI.</td></tr>
<tr><td>mac</td><td>MAC address and vendor resolved for an IP. Updates the corresponding table row.</td></tr>
<tr><td>os</td><td>OS string detected. Updates the corresponding table row.</td></tr>
<tr><td>nbstat</td><td>NetBIOS name resolved. Updates the description column in the hosts table.</td></tr>
<tr><td>wmi</td><td>WMI description retrieved. Appended to the description column in the hosts table.</td></tr>
<tr><td>done</td><td>Scan complete. Updates stats (host count, duration), adds a row to the scan history table, completes the progress bar.</td></tr>
<tr><td>error</td><td>Fatal error from the server side. Closes the EventSource, displays the error message.</td></tr>
</tbody>
</table>
<div class="label">Scan history</div>
<p>The bottom of the page displays the 10 most recent <code>scan_history</code> entries. A new row is appended dynamically in JavaScript when the <code>done</code> event is received, without page reload.</p>
</div>
<!-- scan_stream.php -->
<div class="page-block" id="page-scan">
<h3>Discovery SSE endpoint</h3>
<div class="file">scan_stream.php</div>
<div class="desc">Server-Sent Events endpoint consumed exclusively by <code>discovery.php</code>. Executes Nmap, parses its output line by line, upserts machines into the database, and optionally runs NetBIOS and WMI enrichment passes. Not intended to be accessed directly.</div>
<div class="label">GET parameters</div>
<table>
<thead><tr><th>Parameter</th><th>Default</th><th>Description</th></tr></thead>
<tbody>
<tr><td>network</td><td>DEFAULT_NETWORK</td><td>CIDR range to scan. Validated by <code>isValidTarget()</code> before use.</td></tr>
<tr><td>ports</td><td>0</td><td>If <code>1</code>, runs a port scan on each discovered host after the ping sweep.</td></tr>
<tr><td>os</td><td>0</td><td>If <code>1</code>, uses <code>nmap -sS -O</code> instead of <code>nmap -sn</code>. Requires elevated privileges.</td></tr>
<tr><td>nbstat</td><td>0</td><td>If <code>1</code>, runs a NetBIOS pass after the main scan.</td></tr>
<tr><td>wmi</td><td>0</td><td>If <code>1</code>, queries WMI descriptions via PowerShell after the main scan.</td></tr>
</tbody>
</table>
<div class="label">Scan phases</div>
<ul>
<li><strong>Phase 1 — Nmap sweep:</strong> Runs <code>nmap -sn -R -T4</code> (or <code>-sS -O</code> if OS detection enabled) via <code>popen()</code>. Output is parsed line by line. On each <code>Nmap scan report for</code> line, the previous host (if any) is saved to the DB and a <code>host_saved</code> event is emitted. MAC addresses, vendors, and OS strings are extracted by regex and emitted as separate events.</li>
<li><strong>Phase 2 — NetBIOS (optional):</strong> Iterates all <code>status='up'</code> machines. For each, runs <code>nmap -sU -p 137 --script nbstat</code>. Extracts NetBIOS name, workgroup, and logged-in user. Updates hostname (if currently an IP) and comment in the DB.</li>
<li><strong>Phase 3 — WMI (optional):</strong> Iterates all <code>status='up'</code> machines. For each, runs a PowerShell <code>Get-WmiObject Win32_OperatingSystem</code> query. Stores the <code>Description</code> field in <code>machines.comment</code> if not already set.</li>
</ul>
<div class="label">Database upsert</div>
<p>The <code>saveMachineStream()</code> function uses <code>INSERT ... ON DUPLICATE KEY UPDATE</code> on the <code>ip</code> column. Existing values for MAC, vendor, and OS are preserved with <code>COALESCE(VALUES(col), col)</code> — a scan will not erase manually entered data with a null value.</p>
<div class="label">Encoding</div>
<p>Nmap output on Windows is typically CP850. Each line is converted to UTF-8 via <code>mb_convert_encoding($raw, 'UTF-8', 'CP850')</code> before being emitted as a JSON SSE payload.</p>
<div class="warn"><strong>Execution time:</strong> <code>set_time_limit(600)</code> is called. Large networks or slow hosts may approach this limit. Output buffering is disabled (<code>ob_end_flush()</code>) to ensure events are streamed as they arrive.</div>
</div>
<!-- menu.php -->
<div class="page-block" id="page-menu">
<h3>Network diagnostics</h3>
<div class="file">menu.php</div>
<div class="desc">General-purpose diagnostic terminal. The user selects a tool from the sidebar, enters a target, and submits the form. Results are displayed in a styled terminal block. All operations are logged to <code>diag_history</code>.</div>
<div class="label">Available tools</div>
<table>
<thead><tr><th>Tool (action value)</th><th>Command</th><th>Target</th></tr></thead>
<tbody>
<tr><td>ping</td><td><code>ping</code> via <code>runPing()</code></td><td>IP or hostname</td></tr>
<tr><td>nmap</td><td><code>nmap -sn</code></td><td>IP, hostname, or CIDR</td></tr>
<tr><td>traceroute</td><td><code>tracert</code></td><td>IP or hostname</td></tr>
<tr><td>dns</td><td><code>nslookup</code></td><td>IP or hostname</td></tr>
<tr><td>ports</td><td><code>nmap -p <ports></code></td><td>IP or hostname; port list configurable</td></tr>
<tr><td>infos</td><td>PowerShell <code>Get-NetIPAddress</code></td><td>Local machine (no target input)</td></tr>
<tr><td>services</td><td>PowerShell <code>Get-Service</code> (running only)</td><td>Local machine (no target input)</td></tr>
</tbody>
</table>
<div class="label">Output rendering</div>
<p>The <code>nmap</code> and <code>ports</code> tools render their output as structured HTML tables. All other tools render in a monospace terminal block with colour classification via <code>colorLine()</code>. A hidden <code><pre id="raw-output"></code> holds the plain text for clipboard copy.</p>
<div class="label">Ping statistics</div>
<p>When the <code>ping</code> tool is used, a stats row is shown above the terminal: packets sent, received, lost (%), and average latency. These are extracted by <code>parsePingStats()</code> in <code>db.php</code>.</p>
<div class="label">CSV export</div>
<p>When results are available, an export button appears. It POSTs <code>export=csv</code> and returns the raw output lines as a single-column CSV.</p>
<div class="label">Sidebar navigation</div>
<p>The sidebar links use <code>?tool=<action></code> query parameters. A JavaScript listener intercepts these clicks, injects the action value into the hidden form field, and submits the form to avoid page reload.</p>
<div class="callout"><strong>Target validation:</strong> Before executing, the target is passed through <code>isValidTarget()</code> (defined in <code>db.php</code>), which accepts IP addresses, hostnames, and CIDR ranges. The <code>infos</code> and <code>services</code> tools bypass target validation (they always target the local machine).</div>
</div>
<!-- patch.php -->
<div class="page-block" id="page-patch">
<h3>Patch panel</h3>
<div class="file">patch.php</div>
<div class="desc">Read-only view of the physical patch panel. Displays wall outlet records from the <code>patch_panel</code> table joined with associated machine IPs and hostnames from <code>patch_machines</code>. Supports filtering by switch, entity, and free-text search.</div>
<div class="label">GET parameters</div>
<table>
<thead><tr><th>Parameter</th><th>Description</th></tr></thead>
<tbody>
<tr><td>q</td><td>Free-text search across port label, room name, workstation, IP, hostname</td></tr>
<tr><td>switch</td><td>Filter by switch identifier</td></tr>
<tr><td>entite</td><td>Filter by entity / department</td></tr>
</tbody>
</table>
<div class="label">Data population</div>
<p>The <code>patch_panel</code> table is not populated by NetDTL itself. It is intended to be filled by external import (CSV, SQL script, or the NetDTL Installer's patch panel engine). The application provides the read and filter interface only.</p>
<div class="label">IP and hostname resolution</div>
<p>For each port, associated machines are retrieved from <code>patch_machines</code> via a <code>GROUP_CONCAT</code> join. Multiple IPs and hostnames per port are displayed as comma-separated lists.</p>
<div class="label">Badge colouring</div>
<p>Port types are colour-coded: RJ45 in blue, RJ11 in amber, unknown in grey. Entity badges are distinguished between local equipment (teal) and delegated (green) based on a case-insensitive match on the word <em>locale</em> in the entity name.</p>
</div>
<!-- SHARED COMPONENTS -->
<h2 id="shared">Shared Components</h2>
<div class="page-block" id="shared-db">
<h3>Database & helpers</h3>
<div class="file">db.php</div>
<div class="desc">Central include file. Defines all configuration constants, database connection, schema initialisation, authentication, and helper functions. Included at the top of every page.</div>
<div class="label">Key functions</div>
<table>
<thead><tr><th>Function</th><th>Description</th></tr></thead>
<tbody>
<tr><td>getDB()</td><td>Returns a singleton PDO connection. Throws on failure.</td></tr>
<tr><td>initDB()</td><td>Creates all tables if they do not exist.</td></tr>
<tr><td>requireAuth()</td><td>Sends a <code>WWW-Authenticate: Basic</code> challenge if credentials are absent or wrong. Exits on failure.</td></tr>
<tr><td>runCommand(string $cmd)</td><td>Executes a shell command via <code>shell_exec()</code>, converts encoding from CP850 to UTF-8, returns an array of non-empty lines.</td></tr>
<tr><td>runPing(string $ip)</td><td>Runs <code>ping -n 4</code> (Windows) or <code>ping -c 4</code> (Linux). Returns output lines.</td></tr>
<tr><td>parsePingStats(array $lines)</td><td>Parses ping output and returns <code>['sent', 'recv', 'lost_pct', 'avg_ms']</code>.</td></tr>
<tr><td>isValidTarget(string $t)</td><td>Returns <code>true</code> if <code>$t</code> is a valid IP, hostname, or CIDR range.</td></tr>
<tr><td>timeAgo(string $date)</td><td>Returns a human-readable relative time string (e.g. "3 minutes ago").</td></tr>
</tbody>
</table>
</div>
<div class="page-block" id="shared-style">
<h3>Stylesheet</h3>
<div class="file">style.php</div>
<div class="desc">Outputs a <code><link></code> tag for Google Fonts (IBM Plex Mono + IBM Plex Sans) and a full <code><style></code> block containing all shared CSS. Included in the <code><head></code> of every page via <code><?php include __DIR__ . '/style.php'; ?></code>.</div>
<div class="label">Design tokens (CSS variables)</div>
<table>
<thead><tr><th>Variable</th><th>Value</th><th>Usage</th></tr></thead>
<tbody>
<tr><td>--bg</td><td>#0d1117</td><td>Page background</td></tr>
<tr><td>--bg2</td><td>#161b22</td><td>Panels, sidebar, topbar</td></tr>
<tr><td>--bg3</td><td>#1c2230</td><td>Table headers, stat cards</td></tr>
<tr><td>--accent</td><td>#3fb950</td><td>Green — active states, "up" badges, success</td></tr>
<tr><td>--accent2</td><td>#58a6ff</td><td>Blue — links, IP addresses, port values</td></tr>
<tr><td>--warn</td><td>#d29922</td><td>Amber — warnings, unknown status, switch labels</td></tr>
<tr><td>--err</td><td>#f85149</td><td>Red — errors, "down" badges</td></tr>
<tr><td>--purple</td><td>#bc8cff</td><td>Patch panel port labels</td></tr>
<tr><td>--teal</td><td>#64c8c8</td><td>Local entity badges, infos/services history</td></tr>
<tr><td>--txt</td><td>#c9d1d9</td><td>Primary text</td></tr>
<tr><td>--txt2</td><td>#8b949e</td><td>Secondary / muted text</td></tr>
<tr><td>--txt3</td><td>#484f58</td><td>Placeholder / very muted text</td></tr>
<tr><td>--mono</td><td>IBM Plex Mono</td><td>All monospace content (IPs, ports, terminal)</td></tr>
<tr><td>--sans</td><td>IBM Plex Sans</td><td>Labels, badges, UI chrome</td></tr>
</tbody>
</table>
</div>
<div class="page-block" id="shared-topbar">
<h3>Top navigation bar</h3>
<div class="file">topbar.php</div>
<div class="desc">Renders the sticky top bar with the NetDTL logo, main navigation links (Dashboard, Inventory, Discovery, Patch panel, Diagnostics), and the currently authenticated username. Active state is set by comparing <code>basename($_SERVER['PHP_SELF'], '.php')</code> against each link's target. The Inventory link is also active when on <code>machine.php</code>.</div>
</div>
<div class="page-block" id="shared-sidebar">
<h3>Left sidebar</h3>
<div class="file">sidebar.php</div>
<div class="desc">Renders the fixed left navigation sidebar with two sections: Navigation (Dashboard, Inventory, Discovery, Patch panel) and Diagnostics (all seven tools). The version string from <code>APP_VERSION</code> and the PHP version are shown at the bottom. Active states follow the same logic as <code>topbar.php</code>; for diagnostic tool links, the active tool is read from <code>$action</code> (set in <code>menu.php</code>) or from <code>$_GET['tool']</code>.</div>
</div>
<!-- SECURITY -->
<h2 id="other" style="display:none"></h2>
<h2 id="security">Security</h2>
<p>NetDTL uses HTTP Basic Authentication implemented in <code>requireAuth()</code>. Credentials are stored in plain text in <code>db.php</code>. This is acceptable for a trusted local network deployment but should not be exposed to the public internet without additional protection (reverse proxy with TLS, IP filtering, etc.).</p>
<ul>
<li>All user-supplied values rendered in HTML are passed through <code>htmlspecialchars()</code>.</li>
<li>All database queries use PDO prepared statements with bound parameters.</li>
<li>Shell commands use <code>escapeshellarg()</code> on all user-supplied targets, validated beforehand by <code>isValidTarget()</code>.</li>
<li>The CIDR range in <code>scan_stream.php</code> is validated by <code>isValidTarget()</code> before being passed to Nmap.</li>
</ul>
<div class="warn"><strong>Credentials:</strong> The <code>AUTH_PASS</code> constant is stored in plaintext. Do not reuse a sensitive password. For production environments, consider replacing <code>requireAuth()</code> with session-based authentication or delegating authentication to the web server.</div>
<!-- LIMITATIONS -->
<h2 id="limitations">Known Limitations</h2>
<ul>
<li><strong>Windows-centric commands.</strong> Ping uses <code>ping -n 4</code> and traceroute uses <code>tracert</code>. On Linux, <code>runPing()</code> switches to <code>ping -c 4</code>, but <code>tracert</code> (menu.php) is not adapted — use <code>traceroute</code> manually on Linux.</li>
<li><strong>MAC address not available for the scanning machine itself.</strong> Nmap cannot read its own MAC. The inventory page detects this case and replaces the MAC field with a <em>ce PC</em> label.</li>
<li><strong>OS detection requires elevated privileges.</strong> <code>nmap -O</code> and <code>nmap -sS</code> require the web server process to run as Administrator (Windows) or root (Linux). Without elevation, these options silently return no OS data.</li>
<li><strong>WMI queries require network access and Windows target.</strong> The PowerShell WMI call in <code>scan_stream.php</code> only works against Windows machines that allow remote WMI, and only when the scanning server has appropriate credentials on the target.</li>
<li><strong>NetBIOS identification requires UDP 137.</strong> The <code>nbstat</code> Nmap script uses UDP port 137. Firewalls or Windows Firewall rules blocking this port will prevent NetBIOS name resolution.</li>
<li><strong>Patch panel data is not managed by the application.</strong> The <code>patch_panel</code> and <code>patch_machines</code> tables must be populated externally (e.g. via the NetDTL Installer's patch panel engine or direct SQL import).</li>
<li><strong>Single-user authentication.</strong> There is only one set of credentials. There is no role management or per-user audit trail.</li>
<li><strong>Scan duration limit.</strong> <code>set_time_limit(600)</code> limits scans to 10 minutes. Large or slow networks may exceed this.</li>
<li><strong><code>hosts_down</code> is always 0.</strong> The <code>scan_history.hosts_down</code> column is inserted as 0; hosts that do not respond are simply not added to the inventory during a scan.</li>
</ul>
<p> </p>
<a href="https://didiermorandi.com/netdtl/" target="_blank"><span style="color:yellow">NetDTL</span> Web site</a>
</main>
<script>
const sections = document.querySelectorAll('[id]');
const navLinks = document.querySelectorAll('nav a');
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
navLinks.forEach(a => a.classList.remove('active'));
const active = document.querySelector(`nav a[href="#${entry.target.id}"]`);
if (active) active.classList.add('active');
}
});
}, { rootMargin: '-20% 0px -70% 0px' });
sections.forEach(s => observer.observe(s));
</script>
</body>
</html>