-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathviewer.php
2286 lines (2094 loc) · 139 KB
/
viewer.php
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
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
$view = $_GET['view'] ?? '';
if ($view === "gesp-mode") {
include('gesp-mode.php');
die;
}
if ($view === "doom-scroll") {
include('doom-scroll.php');
die;
}
//Checking if the file requested via GET exists. If not, we send to a custom 404.
if (!file_exists($_GET['file'])) {
http_response_code(404);
include('404.html');
die();
}
//Opening the file that comes after profile/ via GET and then parsing it with json_decode to get a usable variable with the json info back.
$json_file = $_GET['file'];
$json = file_get_contents($json_file);
$json_data = json_decode($json, true);
$profile_name = pathinfo($json_file, PATHINFO_FILENAME);
$script_nonce = bin2hex(random_bytes(20));
// TODO: style the progress bars differently, and remove unsafe-inline!
header("Content-Security-Policy: default-src 'self'; connect-src 'self' https://spec-ify.com http://localhost:3000; style-src 'self' https://cdnjs.cloudflare.com https://fonts.googleapis.com 'unsafe-inline'; font-src https://cdnjs.cloudflare.com https://fonts.gstatic.com; script-src 'self' https://cdnjs.cloudflare.com https://cdn.datatables.net 'nonce-$script_nonce'; img-src 'self' data:;");
include('common.php');
// Grabs data from endoflife.date's api and checks it
$eoldata = json_decode(file_get_contents('https://endoflife.date/api/windows.json'), true);
$validversions = '';
$latestver = '';
$found10 = false;
$found11 = false;
// Set Latest Version
foreach ($eoldata as $eolitem) {
// Windows 10
if (!(bool) $eolitem['lts']
&& !str_contains($eolitem['cycle'], '-e')
&& str_contains($eolitem['cycle'], '10')
&& $found10 === false) {
$latestver = $latestver . $eolitem['latest'] . ' ';
$found10 = true;
}
// Windows 11
if (!(bool) $eolitem['lts']
&& !str_contains($eolitem['cycle'], '-e')
&& str_contains($eolitem['cycle'], '11')
&& $found11 == false) {
$latestver = $latestver . $eolitem['latest'] . ' ';
$found11 = true;
}
// Break out of loop
if ($found10 == true && $found11 == true) {
break;
}
}
foreach ($eoldata as $eolitem) {
if (!(bool) $eolitem['lts']
&& !str_contains($eolitem['cycle'], '-e')
&& strtotime($eolitem['support']) > time()) {
$validversions = $validversions . $eolitem['latest'] . ' ';
}
}
$thisBuildInt = (int) substr($json_data['BasicInfo']['Version'], 5);
$latestBuildInt = (int) substr($latestver, 5);
// EOL
$eoltext = '';
$os_insider = false;
if (strpos($validversions, $json_data['BasicInfo']['Version']) !== false) {
$eoltext = "Not EOL";
$eolcolor = "green";
} else if ($thisBuildInt > $latestBuildInt) {
$os_insider = true;
$eoltext = 'Insider';
$eolcolor = "green";
} else {
$eoltext = "EOL";
$eolcolor = "red";
}
// Up-to-Date-ness
$oscheck = '';
if (strpos($latestver, $json_data['BasicInfo']['Version']) !== false) {
$oscheck = 'Up-to-date';
$oscolor = "green";
} else {
$oscheck = 'Not Up-to-Date';
$oscolor = "red";
}
//The lines below are for the loop that calculates total RAM/CPU used.
//CPU doesn't work right now because we are not able to efficiently get the CPU usage of each running process.
$working_set = 0;
$cpu_percent = 0;
foreach ($json_data['System']['RunningProcesses'] as $process) {
$working_set += $process['WorkingSet']; // RAM
$cpu_percent += $process['WorkingSet']; // CPU
}
$ram_used = number_format($working_set / 1073741824, 2, '.', '');
$total_ram = 0;
if (isset($json_data['Hardware']['Ram'])){
//Don't ask me why this is an old fashioned for loop, I got carried away.
//Getting the total amount of RAM in the system.
$ram_sticks = safe_count($json_data['Hardware']['Ram']);
foreach ($json_data['Hardware']['Ram'] as $stick) {
$capacity = $stick['Capacity'];
if ($capacity != 0) {
$ram_size = floor($stick['Capacity'] / 1000);
$total_ram += $ram_size;
}
}
//Calculating how much of it is used
$ram_used_percent = round((float)$ram_used / (float)$total_ram * 100);
}
//Trimming the motherboard manufacturer string after the first space.
$motherboard = strtok($json_data['Hardware']['Motherboard']['Manufacturer'], " ");
//Basic string to time php function to take the generation date and turn it into a usable format.
$ds = strtotime($json_data['Meta']['GenerationDate']);
$test_time = timeConvert($json_data['BasicInfo']['Uptime']);
//Uservar paths split function
$paths = $json_data['System']['UserVariables']['Path'];
// Split the paths into an array using the semicolon as the delimiter
$path_array = explode(';', $paths);
//PUP check
include('lists.php');
// Set up the reference list
$referenceListInstalled = $json_data['System']['InstalledApps'];
$referenceListRunning = $json_data['System']['RunningProcesses'];
$pupsfoundInstalled = array();
foreach ($referenceListInstalled as $installed) {
foreach ($notableSoftwareList as $pups) {
preg_match('/\b(' . strtolower($pups) . ')\b/', strtolower($installed['Name']), $matches, PREG_OFFSET_CAPTURE);
if ($matches) {
array_push($pupsfoundInstalled, $installed['Name']);
}
}
}
$pupsfoundInstalled = array_unique($pupsfoundInstalled);
$pupsfoundRunning = array();
foreach ($referenceListRunning as $running) {
foreach ($notableSoftwareList as $pups) {
preg_match('/\b(' . strtolower($pups) . ')\b/', strtolower($running['ProcessName']), $matches, PREG_OFFSET_CAPTURE);
if ($matches) {
array_push($pupsfoundRunning, $running['ProcessName']);
}
}
}
$pupsfoundRunning = array_unique($pupsfoundRunning);
// Old PUP Filter
/*
$pupsfoundInstalled = array_filter($referenceListInstalled, function ($checkobj) use ($normalizedArray) {
foreach ($normalizedArray as $pup) {
if (str_contains(strtolower($checkobj['Name']), $pup)) {
return $checkobj;
}
}
});
$pupsfoundRunning = array_filter($referenceListRunning, function($checkobj) use ($normalizedArray){
foreach ($normalizedArray as $pup) {
if (str_contains(strtolower($checkobj['ProcessName']), $pup)) {
return $checkobj;
}
}
});
*/
?>
<!doctype html>
<html lang="en" data-mdb-theme="dark">
<meta content="text/html;charset=UTF-8" http-equiv="content-type" />
<head>
<meta charset="utf-8" />
<title>Profile <?= $profile_name ?> | Specified</title>
<meta content="width=device-width,initial-scale=1" name="viewport" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/5.0.0/mdb.dark.min.css" rel="stylesheet">
<link href="static/css/themes.css?v=2" rel="stylesheet">
<link href="static/css/main.css?v=2" rel="stylesheet">
<link href="static/css/tables.css" rel="stylesheet">
<!--This section is for the discord embed card. Need to expand upon it. -->
<meta name="og:title" content="<?= $json_data["BasicInfo"]["Hostname"] ?>" />
<meta name="og:site_name" content="Specify" />
<meta name="og:description" content="Generated on <?= $json_data["Meta"]["GenerationDate"] ?>" />
<meta name="og:type" content="data.specify_result" />
<link rel="shortcut icon" href="assets/specify-glass-dynamic.svg" />
<link rel="icon" href="assets/specify-glass-black-256x256.png" media="(prefers-color-scheme light)" />
<link rel="icon" href="assets/specify-glass-black-256x256.png" media="(prefers-color-scheme dark)" />
<script nonce="<?= $script_nonce ?>">
window.PROFILE_NAME = "<?= $profile_name ?>";
</script>
<!--This should be first to make sure the themes load on time-->
<script defer src="static/js/themes.js?v=2"></script>
<!--Konami Code for Dev Stuff-->
<script defer="defer" src="static/js/konami.js"></script>
<!--Table Rendering-->
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.2/jquery.slim.min.js"></script>
<script defer type="text/javascript" src="https://cdn.datatables.net/v/bs5/dt-1.13.1/sc-2.0.7/datatables.min.js"></script>
<!--UI Stuff-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/5.0.0/mdb.min.js" type="text/javascript"></script>
<!--Main Scripts-->
<script defer="defer" src="static/js/tables.js?v=1" type="module"></script>
<script defer="defer" src="static/js/main.js?v=2"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="blanket"></div>
<div id="main">
<!--$-->
<button type="button" class="btn btn-info btn-floating btn-lg" id="btn-back-to-top">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="#0d1113">
<!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc. -->
<path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2 160 448c0 17.7 14.3 32 32 32s32-14.3 32-32l0-306.7L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/>
</svg>
</button>
<header id="header-header">
<div id="header-logo">
<a class="logo" href="index.html">
<img src="assets/logo.png" height="25em">
</a>
</div>
<div id="header-buttons">
<button type="button" class="btn btn-info" id="collapse-toggle">Expand All</button>
<button type="button" class="btn btn-info" id="collapse-toggle-hide">Collapse All</button>
<a id="download" href="<?= $json_file ?>">
<button class="btn btn-info">View Raw JSON</button>
</a>
<?php
if (isset($json_data['System']['DumpZip'])) {
$dumplink = str_replace("\n", '', $json_data['System']['DumpZip']);
if (filter_var($dumplink, FILTER_VALIDATE_URL)) {
echo '<a id="download" href="' . $dumplink . '">
<button class="btn btn-info">Download Dumps</button>
</a>';
}
}
?>
</div>
<div id="style-toggles">
<select id="view-toggle" style="width: 12em;">
<option selected hidden>Select View</option>
<option value="doom-scroll">Doom Scroll</option>
<option value="gesp-mode">Legacy View</option>
</select>
<select title="mappings" id="mode-toggle" style="width: 12em;">
<optgroup label="Theme">
<option value="classic">Dark Mode</option>
<option value="k9-mode">K9's Dark Mode</option>
<option value="light-mode">Light Mode</option>
</optgroup>
</select>
</div>
</header>
<main>
<div class="specify">
<div class="controls">
<div class="textbox title">
<span>Profile <span id="filename"><?= $profile_name ?></span> created
<?= date("F j, Y, g:i a", $ds) ?>, runtime
<?= $json_data['Meta']['ElapsedTime'] . " ms," ?>
Under Specify Version <?= $json_data['Version'] ?>
</span>
</div>
<input class="searchbar" type="text" placeholder="Search..." id="searchbar-div">
</div>
<div id="main">
<div class="metadata-metadata expanded" id="info">
<div class="widgets-widgets widgets" id="hardware-widgets" data-hide="false">
<div class="widget widget-cpu hover" type="button" data-mdb-toggle="modal" data-mdb-target="#cpu-modal">
<h1>CPU</h1>
<div class="widget-values">
<div class="widget-value">
<div class="green">
<?= $json_data['Hardware']['Cpu']['Name'] ?>
</div>
<div>Callsign</div>
</div>
</div>
</div>
<div class="modal fade " id="cpu-modal" tabindex="-1" aria-labelledby="cpu-modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modal-label">CPU info</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table">
<tbody>
<tr>
<td>Name</td>
<td><?= $json_data['Hardware']['Cpu']['Name'] ?></td>
</tr>
<tr>
<td>Manufacturer</td>
<td><?= $json_data['Hardware']['Cpu']['Manufacturer'] ?></td>
</tr>
<tr>
<td>Socket Designation</td>
<td><?= $json_data['Hardware']['Cpu']['SocketDesignation'] ?></td>
</tr>
<tr>
<td>Current Clock Speed</td>
<td><?= $json_data['Hardware']['Cpu']['CurrentClockSpeed'] ?></td>
</tr>
<tr>
<td># of Enabled Cores</td>
<td><?= $json_data['Hardware']['Cpu']['NumberOfEnabledCore'] ?></td>
</tr>
<tr>
<td>Thread Count</td>
<td><?= $json_data['Hardware']['Cpu']['ThreadCount'] ?></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-body" id="cpu-info-table" style="display:none;">
<!-- This content is populated javascript side -->
<h6 class="modal-title" id="cpu-info-title">Database results for: ...</h6>
<table class="table">
<tbody id="fetched-cpu-info">
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" id="cpu-more-info-button">More Info</button>
<button type="button" class="btn btn-secondary" id="cpu-close-button" data-mdb-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="widget widget-ram hover" type="button" data-mdb-toggle="modal" data-mdb-target="#ram-modal">
<h1>Memory</h1>
<div class="widget-values" <?php
if (safe_count($json_data['Hardware']['Ram']) > 4) {
echo 'style="display: flex; flex-flow: row wrap;"';
}
?>>
<?php
$ram_sticks = safe_count($json_data['Hardware']['Ram']);
$ram_stick = 0;
if ($ram_sticks > 0){
for ($ram_stick; $ram_stick < $ram_sticks; $ram_stick++) {
$current_ram_stick = $ram_stick + 1;
$flex_basis = 100 / ($ram_sticks / 2) . '%';
if ($json_data['Hardware']['Ram'][$ram_stick]['Capacity'] != 0) {
$ram_size = floor($json_data['Hardware']['Ram'][$ram_stick]['Capacity'] / 1000);
echo '
<div class="widget-value" style="flex: 1 1 ' . $flex_basis . ';">
<div class="green">' . $ram_size . 'GB</div>
<div>DIMM' . $current_ram_stick . '</div>
</div>';
} else {
echo '
<div class="widget-value" style="flex: 1 1 ' . $flex_basis . ';">
<div style="color: rgb(215,27,27);">--</div>
<div>DIMM' . $current_ram_stick . '</div>
</div>';
}
if (safe_count($json_data['Hardware']['Ram']) > 4 && ($current_ram_stick % 4) == 0) {
echo '<div style="flex-basis: 100%;"></div>';
}
}
}
else {
echo '
<div class="widget-value">
<div class="red"> Error! </div>
<div>Error retrieving memory information.</div>
</div>';
}
?>
</div>
</div>
<div class="modal fade " id="ram-modal" tabindex="-1" aria-labelledby="ram-modal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modal-label">Memory info</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<h5>Physical Memory</h5>
<table class="table">
<thead>
<tr>
<th scope="col">DIMM</th>
<th scope="col">Manufacturer</th>
<th scope="col">Model</th>
<th scope="col">Speed</th>
<th scope="col">Capacity</th>
</tr>
</thead>
<tbody>
<?php
$ram_sticks = safe_count($json_data['Hardware']['Ram']);
$ram_stick = 0;
for ($ram_stick; $ram_stick < $ram_sticks; $ram_stick++) {
$ram_location = $json_data['Hardware']['Ram'][$ram_stick]['DeviceLocation'];
$ram_manufacturer = $json_data['Hardware']['Ram'][$ram_stick]['Manufacturer'];
$ram_part = $json_data['Hardware']['Ram'][$ram_stick]['PartNumber'];
$ram_speed = $json_data['Hardware']['Ram'][$ram_stick]['ConfiguredSpeed'];
$ram_size = floor($json_data['Hardware']['Ram'][$ram_stick]['Capacity']);
if ($ram_size == 0) {
echo '
<tr>
<td>' . $ram_location . '</td>
<td colspan="4" class="td-center">Not Detected</td>
</tr>
';
} else {
echo '
<tr>
<td>' . $ram_location . '</td>
<td>' . $ram_manufacturer . '</td>
<td>' . $ram_part . '</td>
<td>' . $ram_speed . 'MHz</td>
<td>' . $ram_size . 'MB</td>
</tr>
';
}
}
?>
</tbody>
</table>
<h5>Pagefile</h5>
<table class="table">
<tbody>
<tr>
<td>File Path</td>
<td> <?= $json_data['System']['PageFile']['Caption'] ?> </td>
</tr>
<tr>
<td>Allocated Base Size</td>
<td> <?= $json_data['System']['PageFile']['AllocatedBaseSize'] ?> MB</td>
</tr>
<tr>
<td>Current Usage</td>
<td> <?= $json_data['System']['PageFile']['CurrentUsage'] ?> MB</td>
</tr>
<tr>
<td>Peak Usage</td>
<td> <?= $json_data['System']['PageFile']['PeakUsage'] ?> MB</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-mdb-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="widget widget-board hover" type="button" data-mdb-toggle="modal" data-mdb-target="#board-modal">
<h1>Motherboard</h1>
<?php
if ($motherboard){
echo '
<div class="widget-values">
<div class="widget-value">
<div class="green">'
. $motherboard .
'</div>
<div>OEM</div>
</div>
<div class="widget-value">
<div class="green">'
. $json_data['Hardware']['Motherboard']['Product'] .
'
</div>
<div>Chipset</div>
</div>
</div>';
} else {
echo '
<div class="widget-value">
<div class="red"> Error! </div>
<div>Error retrieving motherboard information.</div>
</div>';
}
?>
</div>
<div class="modal fade" id="board-modal" tabindex="-1" aria-labelledby="board-modal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modal-label">Board Information</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table">
<thead>
</thead>
<tbody>
<tr>
<td>Motherboard Product</td>
<td><?= $motherboard ?> <?= $json_data['Hardware']['Motherboard']['Product'] ?></td>
</tr>
<tr>
<td>Motherboard Manufacturer</td>
<td><?=$json_data['Hardware']['Motherboard']['Manufacturer']?></td>
</tr>
<tr>
<td>BIOS Manufacturer</td>
<td><?= $json_data['Hardware']['BiosInfo'][0]['Manufacturer'] ?></td>
</tr>
<tr>
<td>Version</td>
<td><?= $json_data['Hardware']['BiosInfo'][0]['SMBIOSBIOSVersion'] ?></td>
</tr>
<tr>
<td>Release Date</td>
<?php
$biosdate = $json_data['Hardware']['BiosInfo'][0]['ReleaseDate'];
// Use the DateTime class to parse the date string
$datetime = DateTime::createFromFormat('YmdHis.uO', $biosdate);
if ($datetime) { // the one provided by the bios wasn't valid
// Format the date using the desired MMDDYYYY format
$formattedbiosdate = $datetime->format('m/d/Y');
} else {
$formattedbiosdate = "unknown";
}
?>
<td><?= $formattedbiosdate ?></td>
</tr>
<tr>
<td>Base</td>
<td><?= $json_data['Hardware']['BiosInfo'][0]['BIOSVersion'][2] ?></td>
</tr>
<tr>
<td>Serial Number</td>
<td><?= $json_data['Hardware']['BiosInfo'][0]['SerialNumber'] ?></td>
</tr>
<?php
$tpm_status = 'Disabled';
$tpm_manufacturer = "N/A";
$tpm_version = "N/A";
if (is_null($json_data['Security']['Tpm']) || !(bool) $json_data['Security']['Tpm']['IsEnabled_InitialValue']) {
} else {
$tpm_status = 'Enabled';
$tpm_manufacturer = $json_data['Security']['Tpm']['ManufacturerVersionInfo'] . ' ' . $json_data['Security']['Tpm']['ManufacturerVersion'];
$tpm_version = $json_data['Security']['Tpm']['SpecVersion'];
}
echo
'<tr>
<td>TPM Status</td>
<td>' . $tpm_status . '</td>
</tr>';
echo
'<tr>
<td>TPM Manufacturer</td>
<td>' . $tpm_manufacturer . '</td>
</tr>';
echo
'<tr>
<td>TPM Version</td>
<td>' . $tpm_version . '</td>
</tr>';
?>
</tbody>
</table>
<div style="display: none;" id="board-info-more-info">
<table class="table">
<tbody>
<?php
foreach ($json_data['Hardware']['BiosInfo'][0] as $key => $value) {
if ($key == 'BiosCharacteristics') {
$bcStringList = [];
foreach ($value as $characteristic) {
if (isset($biosCharacteristics[$characteristic])) {
$bcStringList[] = $biosCharacteristics[$characteristic];
}
}
echo '
<tr>
<td>' . $key . '</td>
<td>' . implode('<br/>', $bcStringList) . '</td>
</tr>
';
continue;
}
if ($key == 'BIOSVersion' || $key == 'ListOfLanguages') {
echo '
<tr>
<td>' . $key . '</td>
<td>' . safe_implode('<br/>', $value) . '</td>
</tr>
';
continue;
}
echo "
<tr>
<td>$key</td>
<td>$value</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" id="board-info-more-info-button">More Info</button>
<button type="button" class="btn btn-secondary" id="board-info-close" data-mdb-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="widget widget-gpu hover" type="button" data-mdb-toggle="modal" data-mdb-target="#gpu-modal">
<h1>GPU</h1>
<div class="widget-values">
<div class="widget-value">
<div class="green">
<?php
if (!isset($json_data['Hardware']['Monitors'])) {
echo $json_data['Hardware']['Gpu'][0]['Description'];
} else {
echo $json_data['Hardware']['Monitors'][0]['Name'];
}
?>
</div>
<div>Model</div>
</div>
</div>
</div>
<div class="modal fade" id="gpu-modal" tabindex="-1" aria-labelledby="gpu-modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modal-label">GPU and Monitor Info</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<?php
if (isset($json_data['Hardware']['Gpu'])) {
$html = '<h5> GPU Info </h5>
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">VRAM</th>
<th scope="col">Resolution</th>
<th scope="col">Refresh Rate</th>
</tr>
</thead>
<tbody>';
foreach ($json_data['Hardware']['Gpu'] as $gpu) {
$vram = $gpu['AdapterRAM'] / 1048576 . ' MB';
$res = $gpu['CurrentHorizontalResolution'] . ' x ' . $gpu['CurrentVerticalResolution'];
$refrate = $gpu['CurrentRefreshRate'] . 'Hz';
$html .= '<tr>
<td>' . $gpu['Description'] . '</td>
<td>' . $vram . '</td>
<td>' . $res . '</td>
<td>' . $refrate . '</td>
</tr>';
}
$html .= '</tbody>
</table>';
echo $html;
$html = '';
}
if (isset($json_data['Hardware']['Monitors'])) {
$html = '<h5> Monitor Info </h5>
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">VRAM</th>
<th scope="col">Mode</th>
<th scope="col">Monitor</th>
<th scope="col">Connection</th>
</tr>
</thead>
<tbody>';
foreach ($json_data['Hardware']['Monitors'] as $monitor) {
$html .= '<tr>
<td>' . $monitor['Name'] . '</td>
<td>' . $monitor['DedicatedMemory'] . '</td>
<td>' . $monitor['CurrentMode'] . '</td>
<td>' . $monitor['MonitorModel'] . '</td>
<td>' . $monitor['ConnectionType'] . '</td>
</tr>';
}
$html .= '</tbody>
</table>';
echo $html;
$html = '';
}
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-mdb-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="widget widget-os hover" type="button" data-mdb-toggle="modal" data-mdb-target="#os-modal">
<h1>Operating System</h1>
<div class="widget-values">
<div class="widget-value">
<div class="widget-value">
<span class="green">
<?= $json_data['BasicInfo']['Edition'] ?>
</span>
</div>
<div>
<?= $json_data['BasicInfo']['FriendlyVersion'] ?>
</div>
</div>
</div>
</div>
<div class="modal fade " id="os-modal" tabindex="-1" aria-labelledby="os-modal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modal-label">System Information</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table">
<thead>
</thead>
<tbody>
<?php
echo
'<tr>
<td>Edition</td>
<td>' . $json_data['BasicInfo']['Edition'] . '</td>
</tr>';
echo
'<tr>
<td>Version</td>
<td>' . $json_data['BasicInfo']['Version'] . '</td>
</tr>';
echo
'<tr>
<td>Friendly Version</td>
<td>' . $json_data['BasicInfo']['FriendlyVersion'] . '</td>
</tr>';
echo
'<tr>
<td>Install Date</td>
<td>' . $json_data['BasicInfo']['InstallDate'] . '</td>
</tr>';
echo
'<tr>
<td>Uptime</td>
<td>' . $json_data['BasicInfo']['Uptime'] . '</td>
</tr>';
echo
'<tr>
<td>Hostname</td>
<td>' . $json_data['BasicInfo']['Hostname'] . '</td>
</tr>';
echo
'<tr>
<td>Username</td>
<td>' . $json_data['BasicInfo']['Username'] . '</td>
</tr>';
echo
'<tr>
<td>Domain</td>
<td>' . $json_data['BasicInfo']['Domain'] . '</td>
</tr>';
if ($json_data['Security']['UacEnabled']) {
$uac_status = 'Enabled';
} else {
$uac_status = 'Disabled';
}
echo
'<tr>
<td>UAC Status</td>
<td>' . $uac_status . '</td>
</tr>';
echo
'<tr>
<td>UAC Level</td>
<td>' . $json_data['Security']['UacLevel'] . '</td>
</tr>';
echo
'<tr>
<td>Boot Mode</td>
<td>' . $json_data['BasicInfo']['BootMode'] . '</td>
</tr>';
echo
'<tr>
<td>Secure Boot</td>
<td>' . ((bool) $json_data['Security']['SecureBootEnabled'] ? 'Enabled' : 'Disabled') . '</td>
</tr>';
echo
'<tr>
<td>Boot State</td>
<td>' . $json_data['BasicInfo']['BootState'] . '</td>
</tr>';
echo
'<tr>
<td>TPM Status</td>
<td>' . $tpm_status . '</td>
</tr>';
echo
'<tr>
<td>Manufacturer Version</td>
<td>' . $tpm_manufacturer . '</td>
</tr>';
echo
'<tr>
<td>Version</td>
<td>' . $tpm_version . '</td>
</tr>';
?>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-mdb-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="widget widget-board hover" type="button" data-mdb-toggle="modal" data-mdb-target="#nic-modal">
<h1>NIC</h1>
<div class="widget-values">
<div class="widget-value">
<div class="green">
<?php
$adapterText = "Disconnected";
foreach ($json_data['Network']['Adapters'] as $adapter) {
if ((bool) $adapter['PhysicalAdapter'] && is_array($adapter['IPAddress']) && count($adapter['IPAddress']) > 0) {
$adapterText = $adapter['Description'];
break;
}
};
if ($adapter == "") {
foreach ($json_data['Network']['Adapters'] as $adapter) {
if ((bool) $adapter['PhysicalAdapter']) {
$adapterText = $adapter['Description'];
break;
}
};
}
echo $adapterText;
?>
</div>
</div>
</div>
</div>
<div class="modal fade " id="nic-modal" tabindex="-1" aria-labelledby="nic-modal" aria-hidden="true">
<div class="modal-dialog modal-fullscreen">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modal-label">NIC Information</h5>
<button type="button" class="btn-close" data-mdb-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<?php
foreach ($json_data["Network"]["Adapters"] as $nic) {
$table = '';
$gateways = '';
$dnsIPs = '';
$dnsSuffixes = '';
$ips = '';
$subnets = '';
if (is_array($nic["DefaultIPGateway"])) {
foreach ($nic["DefaultIPGateway"] as $gateway) {
$gateways .= $gateway . ' ';
}
}
if (is_array($nic["DNSServerSearchOrder"])) {
foreach ($nic["DNSServerSearchOrder"] as $dnsIP) {
$dnsIPs .= $dnsIP . ' ';
}
}
if (is_array($nic["DNSDomainSuffixSearchOrder"])) {
foreach ($nic["DNSDomainSuffixSearchOrder"] as $dnsSuffix) {
$dnsSuffixes .= $dnsSuffix . ' ';
}
}
if (is_array($nic["IPAddress"])) {
foreach ($nic["IPAddress"] as $ip) {
$ips .= $ip . ' ';
}
}
if (is_array($nic["IPSubnet"])) {
foreach ($nic["IPSubnet"] as $subnet) {
$subnets .= $subnet . ' ';
}
}
$table = '<table class="table nic">
<tr>
<td>#</td>
<td>' . $nic["InterfaceIndex"] . '</td>
</tr>
<tr>
<td>Name</td>
<td>' . $nic["Description"] . '</td>
</tr>
<tr>
<td>MAC</td>
<td>' . $nic["MACAddress"] . '</td>
</tr>
<tr>
<td>Gateway(s)</td>
<td>' . $gateways . '</td>
</tr>
<tr>
<td>DHCP State</td>
<td>' . $nic["DHCPEnabled"] . '</td>
</tr>
<tr>
<td>DHCP Lease Expiry</td>
<td>' . $nic["DHCPLeaseExpires"] . '</td>
</tr>
<tr>
<td>DHCP Lease Obtained</td>
<td>' . $nic["DHCPLeaseObtained"] . '</td>
</tr>
<tr>
<td>DHCP Server</td>
<td>' . $nic["DHCPServer"] . '</td>
</tr>