-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREG-SEC-GPO.ps1
1945 lines (1470 loc) · 89.9 KB
/
REG-SEC-GPO.ps1
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
# Terms and Conditions:
# ******************************************************************************************************
# WARNING: AUDITING AND REPORTING REGISTRY VALUES AND GROUP POLICY CONFIGURATIONS
# ******************************************************************************************************
#This PowerShell script is designed to conduct audits and generate reports for registry values and Group Policy Object configurations. It will not make any modifications to the registry system or any GPO configurations.
#IMPORTANT:
#Even though this script does not intend to modify the registry or any Group Policy Object configurations, improper usage or misunderstanding of the script's output may lead to unintended consequences. It is crucial to thoroughly inspect and understand the script's actions before executing it.
#BEFORE EXECUTION:
#Consult with the Chief Information Security Officer (CISO), Chief Financial Officer (CFO), Chief Technology Officer (CTO), risk management personnel, compliance management personnel, system administrators, and other relevant parties in your organisation.
#Ensure that you have thoroughly reviewed and understood the script's actions and potential impact.
#DISCLAIMER:
#This script is a work in progress, created with the assistance of ChatGPT, and may contain bugs and/or vulnerabilities. Therefore, it should be used at your own discretion and risk. The creator of this script cannot be held responsible for any damages or issues caused by its execution.
#By running this script, you assume all risks and liabilities associated with auditing the registry system and Group Policy Object configurations. The creator of this script cannot be held responsible for any damages or issues caused by #its execution.
#DISCLAIMER:
#This script is provided as a free resource, without warranties or liabilities of any kind. The creator of this script makes no guarantee regarding its accuracy, reliability, or suitability for any specific purpose. By using this #script, you agree that the creator shall not be held liable for any direct, indirect, incidental, special, exemplary, or consequential damages arising from the use or inability to use this script.
#ADDITIONAL INFORMATION:
#The script is not a substitute for professional security and compliance assessments. It aids in auditing and reporting, but a comprehensive security review should be performed separately.
#Before executing this script, ensure that you have backups of critical data and registry configurations. In the event of any issues, you can restore the system to a known good state.
#The script may require administrative privileges to access registry and Group Policy configurations. Run it with appropriate permissions to avoid any limitations or errors.
#Always verify the script's integrity and authenticity before use. Use the latest version from a trusted source to avoid potential security risks.
#The script may interact with network resources or external systems for reporting. Ensure that it complies with your organisation's security policies and does not expose sensitive information.
#Regularly update and review the script to incorporate improvements, security patches, or updates from the community.
#Any feedback or suggestions to enhance the script's security and reliability are welcome and should be shared with the script's creator.
#Compliance with data protection regulations and other legal requirements is essential when using this script. Verify that it aligns with your organisation's legal obligations.
#The script may include optional parameters or configurations. Ensure that you understand their implications before enabling or disabling them.
#Consult with the relevant parties and obtain necessary permissions before proceeding. Ensure that you have thoroughly reviewed and understood the script's actions and potential impact before executing it.
#########################################################################################################################################################################################################
########################################################################## - Terms and Conditions User agreement prompt. - ##############################################################################
# Display the disclaimer to the user
function Show-Disclaimer {
$disclaimer = @"
Terms and Conditions:
******************************************************************************************************
WARNING: AUDITING AND REPORTING REGISTRY VALUES AND GROUP POLICY CONFIGURATIONS
******************************************************************************************************
This PowerShell script is designed to conduct audits and generate reports for registry values and Group Policy Object configurations. It will not make any modifications to the registry system or any GPO configurations.
IMPORTANT:
Even though this script does not intend to modify the registry or any Group Policy Object configurations, improper usage or misunderstanding of the script's output may lead to unintended consequences. It is crucial to thoroughly inspect and understand the script's actions before executing it.
BEFORE EXECUTION:
Consult with the Chief Information Security Officer (CISO), Chief Financial Officer (CFO), Chief Technology Officer (CTO), risk management personnel, compliance management personnel, system administrators, and other relevant parties in your organisation.
Ensure that you have thoroughly reviewed and understood the script's actions and potential impact.
DISCLAIMER:
This script is a work in progress, created with the assistance of ChatGPT, and may contain bugs and/or vulnerabilities. Therefore, it should be used at your own discretion and risk. The creator of this script cannot be held responsible for any damages or issues caused by its execution.
By running this script, you assume all risks and liabilities associated with auditing the registry system and Group Policy Object configurations. The creator of this script cannot be held responsible for any damages or issues caused by its execution.
DISCLAIMER:
This script is provided as a free resource, without warranties or liabilities of any kind. The creator of this script makes no guarantee regarding its accuracy, reliability, or suitability for any specific purpose. By using this script, you agree that the creator shall not be held liable for any direct, indirect, incidental, special, exemplary, or consequential damages arising from the use or inability to use this script.
ADDITIONAL INFORMATION:
The script is not a substitute for professional security and compliance assessments. It aids in auditing and reporting, but a comprehensive security review should be performed separately.
Before executing this script, ensure that you have backups of critical data and registry configurations. In the event of any issues, you can restore the system to a known good state.
The script may require administrative privileges to access registry and Group Policy configurations. Run it with appropriate permissions to avoid any limitations or errors.
Always verify the script's integrity and authenticity before use. Use the latest version from a trusted source to avoid potential security risks.
The script may interact with network resources or external systems for reporting. Ensure that it complies with your organisation's security policies and does not expose sensitive information.
Regularly update and review the script to incorporate improvements, security patches, or updates from the community.
Any feedback or suggestions to enhance the script's security and reliability are welcome and should be shared with the script's creator.
Compliance with data protection regulations and other legal requirements is essential when using this script. Verify that it aligns with your organisation's legal obligations.
The script may include optional parameters or configurations. Ensure that you understand their implications before enabling or disabling them.
Consult with the relevant parties and obtain necessary permissions before proceeding. Ensure that you have thoroughly reviewed and understood the script's actions and potential impact before executing it.
"@
Write-Host $disclaimer
}
# Prompt the user to read the disclaimer and confirm understanding
function Prompt-UserConfirmation {
Write-Host "
Do you agree to the terms and conditions of this script? (Type 'YES' to confirm)" -ForegroundColor Blue
$input = Read-Host
if ($input.ToUpper() -ne "YES") {
Write-Host "You must agree to the terms and conditions to proceed. Exiting script..." -ForegroundColor Red
Start-Sleep -Seconds 3
exit
}
}
# Call the functions to display the disclaimer and prompt user confirmation
Show-Disclaimer
Prompt-UserConfirmation
#########################################################################################################################################################################################################
########################################################################## - Show-off screen for tool. - ################################################################################################
$colors = @('Red', 'Yellow', 'Green', 'Cyan', 'Blue', 'Magenta')
$text = "
_____________________ ________ _____________________________ __________________ _____
\______ \_ _____// _____/ / _____/\_ _____/\_ ___ \ / _____/\______ \ / _ \
| _/| __)_/ \ ___ ______ \_____ \ | __)_ / \ \/ ______ / \ ___ | ___// | | \
| | \| \ \_\ \ /_____/ / \ | \\ \____ /_____/ \ \_\ \| | / |_| \
|____|_ /_______ /\______ / /_______ //_______ / \______ / \______ /|____| \_________/
\/ \/ \/ \/ \/ \/ \/
"
for ($i = 0; $i -lt $text.Length; $i++) {
$color = $colors[$i % $colors.Count]
$char = $text[$i]
Write-Host $char -ForegroundColor $color -NoNewline
}
Write-Host " REG-SEC-GPO v2.0 - P.O.C."
Write-Host "
Provided by:"
Write-Host "Jordan Albaladejo, Owner of:
"
Write-Host "Ingest services" -ForegroundColor Magenta
Write-Host "www.ingestservices.net" -ForegroundColor Blue
Write-Host "
With the help of ChatGPT.
" -ForegroundColor Green
#########################################################################################################################################################################################################
########################################################################## - Menu Choice - ##############################################################################################################
Write-Host ""
Write-Host "[1] REG (Registry Audit Tool)"
Write-Host "[2] SEC (Security Audit Tools)"
Write-Host "[3] GPO (Group Policy Objects Audit Tool)"
Write-Host ""
Write-Host ""
Write-Host "[i] Installer"
Write-Host "[r] Remover"
Write-Host "[a] About"
Write-Host "[x] Exit"
Write-Host ""
# Prompt user to run the following code.
$TopMenuChoice = Read-Host "Make your choice from the menu"
# # # # # # ################################################################# - Menu Choice 1 - ############################################################################################## # # # # #
if ($TopMenuChoice -eq '1') {
Write-Host "You have selected Registry Audit Tool." -ForegroundColor Green
Write-Host "Script is about to start. Please wait..."
Start-Sleep -Seconds 3
$TopMenuChoice1 = 'True'
}
# # # # # # ################################################################# - Menu Choice 2 - ############################################################################################## # # # # #
if ($TopMenuChoice -eq '2') {
Write-Host "You have selected Security Audit Tools." -ForegroundColor Green
Write-Host "Script is about to start. Please wait..."
Start-Sleep -Seconds 3
$TopMenuChoice2 = 'True'
}
# # # # # # ################################################################# - Menu Choice 3 - ############################################################################################## # # # # #
if ($TopMenuChoice -eq '3') {
Write-Host "You have selected Group Policy Objects Audit Tool." -ForegroundColor Green
Write-Host "Script is about to start. Please wait..."
Start-Sleep -Seconds 3
$TopMenuChoice3 = 'True'
}
# # # # # # ################################################################# - Menu Choice i - ############################################################################################## # # # # #
if ($TopMenuChoice -eq 'i') {
Write-Host "You have selected Installer." -ForegroundColor Green
Write-Host "Script is about to start. Please wait..."
Start-Sleep -Seconds 3
$TopMenuChoiceI = 'True'
}
# # # # # # ################################################################# - Menu Choice r - ############################################################################################## # # # # #
if ($TopMenuChoice -eq 'r') {
Write-Host "You have selected Remover." -ForegroundColor Green
Write-Host "Script is about to start. Please wait..."
Start-Sleep -Seconds 3
$TopMenuChoiceR = 'True'
}
# # # # # # ################################################################# - Menu Choice x- ############################################################################################### # # # # #
if ($TopMenuChoice -eq 'x') {
Write-Host "You have selected to exit." -ForegroundColor Red
Write-Host "About to exit. Please wait..."
Start-Sleep -Seconds 3
exit
}
# # # # # # ################################################################# - Menu Choice 1 - ############################################################################################## # # # # #
if ($TopMenuChoice -eq 'a') {
Write-Host "You have selected About." -ForegroundColor Green
Write-Host "Script is about to start. Please wait..."
Start-Sleep -Seconds 3
$TopMenuChoiceA = 'True'
}
if ($TopMenuChoiceI -eq 'True') {
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
########################################################################## - Ingest services - REG-SEC-GPO v2.0 - Installer - ###########################################################################
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
#########################################################################################################################################################################################################
########################################################################## - Terms and Conditions - #####################################################################################################
# Display the terms and ask for user agreement
function Show-TermsAndAskForAgreement {
$terms = @"
********************************************************************************
Terms and Conditions:
This script is a proof of concept, early in development, and has been created with the help of ChatGPT. The creator takes no responsibility for any code repercussions as this script is open source and provided as is, with no promises of any kind.
By typing 'AGREE' below, you acknowledge that you have read and understood the terms and agree to use the script at your own risk.
********************************************************************************
"@
Write-Output $terms
$userInput = Read-Host "Type 'AGREE' to proceed or any other key to exit."
if ($userInput -ne "AGREE") {
Write-Host "You did not agree to the terms. The script will now exit." -ForegroundColor Red
Start-Sleep -Seconds 3
exit
}
}
# Prompt user to agree to terms
Show-TermsAndAskForAgreement
Write-Host "You have agreed to the terms. The script will now proceed." -ForegroundColor Green
#########################################################################################################################################################################################################
########################################################################## - Checking if directory already present -#####################################################################################
$directoryPath = "C:\Program Files (x86)\Ingestservices"
# Check if the directory exists
if (Test-Path $directoryPath -PathType Container) {
Write-Host "The specified directory already exists." -ForegroundColor Red
Write-Host "Script about to exit. Please wait..." -ForegroundColor Red
Start-Sleep -Seconds 3
exit
}
# Prompt user to run the following code.
$choice = Read-Host "By proceeding, this script will create the file directory 'Ingestservices' and all dependencies in the C:/ drive, do you agree to proceed? (Y/N)"
#########################################################################################################################################################################################################
########################################################################## - IF (N) - ###################################################################################################################
if ($choice -eq 'N') {
Write-Host "You have selected not to proceed." -ForegroundColor Red
Write-Host "Script is about to exit. Please wait..."
Start-Sleep -Seconds 3
exit
}
#########################################################################################################################################################################################################
########################################################################## - IF (Y) - ###################################################################################################################
if ($choice -eq 'Y') {
Write-Host "You have agreed to proceed." -ForegroundColor Green
Write-Host "Script is about to proceed. Please wait..."
Start-Sleep -Seconds 3
#########################################################################################################################################################################################################
########################################################################## - Creating directory for tool. - #############################################################################################
# Creates directory if it does not exist.
Set-Location 'C:\Program Files (x86)'
md Ingestservices
Set-Location 'C:\Program Files (x86)\Ingestservices'
md REG-SEC-GPO
Set-Location 'C:\Program Files (x86)\Ingestservices\REG-SEC-GPO'
md Tapes
md Results
Set-Location 'C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Results'
md REGResults
md GPOResults
md SECResults
Set-Location 'C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Tapes'
md REGTapes
md GPOTapes
Write-Host "Folders created successfully!" -ForegroundColor Green
Write-Host "About to write out example tapes, Please wait..."
Start-Sleep -Seconds 5
#########################################################################################################################################################################################################
########################################################################## - Writing out Default registry tape. - #######################################################################################
$fileName = "input-Reg-Default"
$filePath = "C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Tapes\REGTapes\$fileName.csv"
# Create an example predefined data array
$data = @(
[PSCustomObject]@{
Name = "Disable TLS 1.0"
Path = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client"
Key = "Enabled"
Value = 0
Reason = "This will disable the use of outdated and insecure TLS (Transport Layer Security) version 1.0."
}
)
# Export the data to a CSV file
$data | Export-Csv -Path $filePath -NoTypeInformation
Write-Host "CSV file '$fileName.csv' created successfully!" -ForegroundColor Green
Write-Host "File path: $filePath"
Write-Host "Creation of default REG tape is complete." -ForegroundColor Green
Start-Sleep -Seconds 3
#########################################################################################################################################################################################################
########################################################################## - Writing out Default GPO tape. - ############################################################################################
$fileName = "input-GPO-Default"
$filePath = "C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Tapes\GPOTapes\$fileName.csv"
# Create your custom GPO tape csv array
$data = @(
[PSCustomObject]@{
Name = "Screensaver Timeout Setting"
Setting = "Software\Policies\Microsoft\Windows\Control Panel\Desktop\ScreenSaveTimeOut"
ExpectedValue = "900"
Reason = "This sets the screensaver timeout to 15 minutes."
}
)
# Export the data to a CSV file
$data | Export-Csv -Path $filePath -NoTypeInformation
Write-Host "CSV file '$fileName.csv' created successfully!" -ForegroundColor Green
Write-Host "File path: $filePath"
# Set PS location back to default
Set-Location 'C:\WINDOWS\System32'
Write-Host "Creation of default GPO tape is complete." -ForegroundColor Green
Start-Sleep -Seconds 3
Write-Host "Installation script is complete, about to exit. Please wait..."
Start-Sleep -Seconds 5
exit
}
}
if ($TopMenuChoiceR -eq 'True') {
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
########################################################################## - Ingest services - REG-SEC-GPO v2.0 - Remover - #############################################################################
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
#########################################################################################################################################################################################################
########################################################################## - Terms and Conditions - #####################################################################################################
# Display the terms and ask for user agreement
function Show-TermsAndAskForAgreement {
$terms = @"
********************************************************************************
Terms and Conditions:
This script is a proof of concept, early in development, and has been created with the help of ChatGPT. The creator takes no responsibility for any code repercussions as this script is open source and provided as is, with no promises of any kind.
By typing 'AGREE' below, you acknowledge that you have read and understood the terms and agree to use the script at your own risk.
********************************************************************************
"@
Write-Output $terms
$userInput = Read-Host "Type 'AGREE' to proceed or any other key to exit."
if ($userInput -ne "AGREE") {
Write-Host "You did not agree to the terms. The script will now exit." -ForegroundColor Red
Start-Sleep -Seconds 3
exit
}
}
# Prompt user to agree to terms
Show-TermsAndAskForAgreement
Write-Host "You have agreed to the terms. The script will now proceed." -ForegroundColor Green
#########################################################################################################################################################################################################
########################################################################## - Removing directory - #######################################################################################################
# Prompt for the directory path to remove
$directoryPath = "C:\Program Files (x86)\Ingestservices"
# Check if the directory exists
if (Test-Path $directoryPath -PathType Container) {
# Prompt the user to confirm deletion
$confirmation = Read-Host "Are you sure you want to remove the directory 'C:\Program Files (x86)\Ingestservices' and its contents? Type YES to proceed."
#########################################################################################################################################################################################################
########################################################################## - IF (Y/N) - ###################################################################################################################
if ($confirmation -eq "YES") {
# Remove the directory and its contents recursively
Remove-Item -Path $directoryPath -Recurse -Force
Write-Host "Directory and its contents removed successfully."
} else {
Write-Host "Removal process aborted. Directory and its contents are not removed."
Write-Host "Remover script is complete, about to exit. Please wait..."
Start-Sleep -Seconds 5
exit
}
} else {
Write-Host "The specified directory does not exist."
Write-Host "Remover script is complete, about to exit. Please wait..."
Start-Sleep -Seconds 5
exit
}
}
if ($TopMenuChoiceA -eq 'True') {
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
########################################################################## - Ingest services - REG-SEC-GPO v2.0 - About - ###############################################################################
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
function Animate-WriteHostWithColor {
param(
[string]$Text,
[int]$DelayMilliseconds = 5
)
$colors = @('Red', 'Yellow', 'Green', 'Cyan', 'Blue', 'Magenta')
$TextLength = $Text.Length
for ($i = 0; $i -lt $TextLength; $i++) {
$currentChar = $Text[$i]
$color = $colors[$i % $colors.Count]
$coloredChar = $currentChar | ForEach-Object { Write-Host $_ -ForegroundColor $color -NoNewline; Start-Sleep -Milliseconds $DelayMilliseconds }
}
Write-Host
}
# Example usage:
Animate-WriteHostWithColor -Text "This is the about area of:
_____________________ ________ _____________________________ __________________ _____
\______ \_ _____// _____/ / _____/\_ _____/\_ ___ \ / _____/\______ \ / _ \
| _/| __)_/ \ ___ ______ \_____ \ | __)_ / \ \/ ______ / \ ___ | ___// | | \
| | \| \ \_\ \ /_____/ / \ | \\ \____ /_____/ \ \_\ \| | / |_| \
|____|_ /_______ /\______ / /_______ //_______ / \______ / \______ /|____| \_________/
\/ \/ \/ \/ \/ \/ \/
"
function Animate-WriteHost {
param(
[string]$Text,
[int]$DelayMilliseconds = 5
)
$TextLength = $Text.Length
for ($i = 0; $i -lt $TextLength; $i++) {
$currentChar = $Text[$i]
Write-Host -NoNewline $currentChar
Start-Sleep -Milliseconds $DelayMilliseconds
}
Write-Host
}
# Example usage:
Animate-WriteHost -Text "
Special thanks to:
_______ __ __ _______ _______ _______ _______ _______
| || | | || _ || || || || |
| || |_| || |_| ||_ _|| ___|| _ ||_ _|
| || || | | | | | __ | |_| | | |
| _|| || | | | | || || ___| | |
| |_ | _ || _ | | | | |_| || | | |
|_______||__| |__||__| |__| |___| |_______||___| |___|
For helping assist with writing and editing of the PowerShell script.
__ __ __
______ _____ _/ |_ ____ _______ |__|| | __
\____ \ \__ \ \ __\ / _ \ \_ __ \ | || |/ /
| |_> > / __ \_ | | ( <_> ) | | \/ | || <
| __/ (____ / |__| \____/ |__| /\__| ||__|_ \
|__| \/ \______| \/.com
For providing text to ASCII generator.
Proudly Created by:
Jordan Albaladejo, Owner of Ingest services, We ingest, enabling your best. www.ingestservices.net
With the help of: ChatGPT.
..............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,************
.................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,***************
.....(@@@*...................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,**///**********
.....(@@&*................,,,,,,,,,,,,,,,,,,,,,,,,,,,,****,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*********&@@(**********
.....(@@&*......,,,,..,,*///**,,,,,,,,,,,,,**////**,*&@@@&/,,,,,,,*//((((/**,,,,,******////////*******/&@@(*******///
...../@@&*.....*@@@##@@@@@@@@@@&/,,,,,,,(@@@&%##&@@@@&*,,,,,,,,*#@@@@&&&@@@@%*******#@@@@@@@@@@%***#@@@@@@@@@@@&(////
...../@@&*.....*%@@&(*,,,,,,*%@@&(,,,,*@@@(,,,,,,,*%@@&*******#@@&/*******#@@@/***/%@&(*************//(&@@(//////////
...../@@&*....,,#@@%*,,,,,,,,/&@@(*,,,#@@&*,,,,****(@@&/*****#@@&*********/&@@%***/%@@&#/*************(&@&/****//////
.....(@@&*,,,,,,#@@%*,,,,,,,,*%@@(**,**@@@%*******(@@@(*****/&@@@@@@@@@@@@@@@@%*****(&@@@@@@%/********(&@&/***///////
,,,,,(@@&*,,,,,*#@@%*,,,,,***/&@@(******/&@@@@@@@@&%(*******/%@@%**********************//#%@@@@&/*****(&@@///////////
,,,,,(@@&/,,,,,*%@@%*********/&@@#*****/@@#******************(&@@%/*************************/%@@%/////(&@@(//////////
,,,,,#@@&/,,,,,*%@@%/********/&@@#*****(@@@@&%%####((/********/&@@@@%(///////(/***/((///////#@@@#//////%@@@%(////////
,,,,,#&&&/,,,**/%@@%/********(&@&#*****/%@@&&&&&@@@@@@@@&(******/(%&@@@@@@@@@&////(&@@@@@@@@@%#/////////(&@@@@@@#////
,,,,,,,,,,***************************/&@&/***********/&@@%/**////////////////////////////////////////////////////////
,,,,,,,,*****************************#@@%/****////////#@@#//////////////////////////////////(////////////////////////
,,,,,********************************/&@@&(/////////#&@&(/////////////////////#(/((((((/((((#((/(#(#((((/////////////
,,,****************************////////(%@@@@@@@@@@@&#////////////////////////(((/(((((//(//(/((((((((((/////////////
Find us on our socials:
YouTube: https://www.youtube.com/@ingestservices
Facebook: https://www.facebook.com/ingestservices/
Instagram: https://www.instagram.com/ingestservices/
Here is your AI easter egg.
(_ _) |_|
{o o} (o o)
/------\ / / | \
/ | || = \ \|/ / We milk cows, why not milk AI? It could be utterly delightful!
* /\..-/\ \_|_/
~~ ~~ | | |
"
Write-Host "Script about to exit. Please wait..."
Start-Sleep -Seconds 5
exit
}
if ($TopMenuChoice1 -eq 'True') {
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
########################################################################## - Ingest services - REG-SEC-GPO v2.0 - REG - #################################################################################
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
#########################################################################################################################################################################################################
########################################################################## - Show-off screen for tool. - ################################################################################################
$colors = @('Red', 'Yellow', 'Green', 'Cyan', 'Blue', 'Magenta')
$text = "
_____________________ ________
\______ \_ _____// _____/
| _/| __)_/ \ ___
| | \| \ \_\ \
|____|_ /_______ /\______ /
\/ \/ \/
"
for ($i = 0; $i -lt $text.Length; $i++) {
$color = $colors[$i % $colors.Count]
$char = $text[$i]
Write-Host $char -ForegroundColor $color -NoNewline
}
Write-Host " REG-SEC-GPO v2.0 - P.O.C."
Write-Host " Sub-Menu: REG" -ForegroundColor Green
Write-Host "
Provided by:"
Write-Host "Jordan Albaladejo, Owner of:
"
Write-Host "Ingest services" -ForegroundColor Magenta
Write-Host "www.ingestservices.net" -ForegroundColor Blue
Write-Host "
With the help of ChatGPT.
" -ForegroundColor Green
#########################################################################################################################################################################################################
########################################################################## - Menu Choice - ##############################################################################################################
Write-Host "
"
Write-Host "[1] Registry Audit Tool"
Write-Host "[x] Exit"
Write-Host "
"
# Prompt user to run the following code.
$REGMenuChoice = Read-Host "Make your choice from the menu"
# # # # # # ################################################################# - Menu Choice 1 - ############################################################################################## # # # # #
if ($REGMenuChoice -eq '1') {
Write-Host "You have selected Registry Audit Tool." -ForegroundColor Green
Write-Host "Script is about to start. Please wait..."
Start-Sleep -Seconds 3
$REGMenuChoice1 = 'True'
}
# # # # # # ################################################################# - Menu Choice x- ############################################################################################### # # # # #
if ($REGMenuChoice -eq 'x') {
Write-Host "You have selected to exit." -ForegroundColor Red
Write-Host "About to exit. Please wait..."
Start-Sleep -Seconds 3
exit
}
#########################################################################################################################################################################################################
########################################################################## - Ingest services - REG - Audit your custom REG tapes (CSV) ##################################################################
#########################################################################################################################################################################################################
if ($REGMenuChoice1 -eq 'True') {
#########################################################################################################################################################################################################
########################################################################## - Terms and Conditions - #####################################################################################################
# Display the terms and ask for user agreement
function Show-TermsAndAskForAgreement {
$terms = @"
********************************************************************************
Terms and Conditions:
This script is a proof of concept, early in development, and has been created with the help of ChatGPT. The creator takes no responsibility for any code repercussions as this script is open source and provided as is, with no promises of any kind.
By typing 'AGREE' below, you acknowledge that you have read and understood the terms and agree to use the script at your own risk.
********************************************************************************
"@
Write-Output $terms
$userInput = Read-Host "Type 'AGREE' to proceed or any other key to exit."
if ($userInput -ne "AGREE") {
Write-Host "You did not agree to the terms. The script will now exit." -ForegroundColor Red
Start-Sleep -Seconds 3
exit
}
}
# Prompt user to agree to terms
Show-TermsAndAskForAgreement
Write-Host "You have agreed to the terms. The script will now proceed." -ForegroundColor Green
#########################################################################################################################################################################################################
########################################################################## - Insert your tape (Input CSV). - ############################################################################################
# Input CSV cassette tape.
Write-Host "
Select your tape to play. Rock, Jazz, Pop or maybe Vaporwave?
" -ForegroundColor Magenta
$csvchoice = Read-Host "Press Enter for Default or enter the path to your CSV cassette tape file"
if ($csvchoice -eq '') {
$csvFile = Import-Csv -Path "C:/Program Files (x86)/Ingestservices/REG-SEC-GPO/Tapes/REGTapes/input-REG-Default.csv"
}
if ($csvchoice -ne '') {
$csvFile = Import-Csv -Path $csvchoice
}
#########################################################################################################################################################################################################
########################################################################## - Playing tape (Input CSV). - ################################################################################################
Write-Host "
.------------------------.
|\\//////// |
| \/ __ ______ __ |
| / \|\.....|/ \ |
| \__/|/_____|\__/ |
| A |
| REG - SEC - GPO |
| ________________ |
|___/_._o________o_._\___|
"
Write-Host " Playing tape...
" -ForegroundColor Magenta
# Create an empty array to store the registry items.
$registryItems = @()
# Iterate over the CSV rows and convert them to registry items.
foreach ($row in $csvFile) {
$registryItem = @{
"Name" = $row.Name
"Path" = $row.Path
"Key" = $row.Key
"Value" = $row.Value
"Reason" = $row.Reason
}
$registryItems += $registryItem
}
# Create an empty array to store the results.
$results = @()
#########################################################################################################################################################################################################
########################################################################## - REG auditing script. - #####################################################################################################
# Iterate over the registry values.
foreach ($registryItem in $registryItems) {
$registryName = $registryItem.Name
$path = $registryItem.Path
$key = $registryItem.Key
$expectedValue = $registryItem.Value
$reason = $registryItem.Reason
# Check if the registry key exists.
if (Test-Path -Path $path) {
# Check if the registry value exists.
if (Get-ItemProperty -Path $path -Name $key -ErrorAction SilentlyContinue) {
# Get the current value of the registry key.
$actualValue = (Get-ItemProperty -Path $path -Name $key -ErrorAction SilentlyContinue).$key
# Check if the actual value is null or an empty string.
if ([string]::IsNullOrEmpty($actualValue)) {
$result = "..x Path and key present, with no value."
$actualValue = "N/A"
}
# Check if the actual value matches the expected value.
elseif ($actualValue -eq $expectedValue) {
$result = "... Path and key, present with expected value."
}
else {
$result = "..x Path and key present, with different value."
}
}
else {
$result = ".xx Path present, Key not present."
$actualValue = "N/A"
}
}
else {
$result = "xxx Path and key not present."
$actualValue = "N/A"
}
# Create a custom object with the registry information, result, and reason.
$registryInfo = [PSCustomObject]@{
"Name" = $registryName
"Path" = $path
"Key" = $key
"Expected Value" = $expectedValue
"Actual Value" = $actualValue
"Result" = $result
"Reason" = $reason
}
# Add the registry information to the results array.
$results += $registryInfo
}
#########################################################################################################################################################################################################
########################################################################## - Exporting results to a CSV file. - #########################################################################################
# Export the results to a CSV file.
$results | Export-Csv -Path "C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Results\REGResults\output-REG-audit.csv" -NoTypeInformation
#########################################################################################################################################################################################################
########################################################################## - Exporting results to a HTML file. - #########################################################################################
# Function to read CSV files and convert data to an HTML table column
function ConvertTo-HTMLTableColumn {
param([string[]]$Rows)
$htmlColumn = ""
for ($i = 0; $i -lt $Rows.Count; $i++) {
$htmlColumn += "<td>$($Rows[$i])</td>"
}
return $htmlColumn
}
# Main script
$csvFilesPath = "C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Results\REGResults"
$outputFilePath = "C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Results\REGResults\output-REG-audit.html"
# List all CSV files in the CSVFiles directory
$csvFiles = Get-ChildItem -Path $csvFilesPath -Filter "*.csv"
# Initialize HTML content
$htmlContent = @"
<!DOCTYPE html>
<html>
<head>
<title>REG-SEC-GPO: Registry Auditing Results</title>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid black;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h1>REG-SEC-GPO: Registry Auditing Results</h1>
<table>
<tr>
"@
# Generate HTML table header using CSV headings
foreach ($csvFile in $csvFiles) {
$csvData = Import-Csv $csvFile.FullName
$headers = $csvData[0].PSObject.Properties.Name # Get the headings from the first row of the CSV
$htmlContent += ConvertTo-HTMLTableColumn -Rows $headers
}
$htmlContent += '</tr>'
# Get the maximum number of rows in all CSV files
$maxRows = ($csvData | Measure-Object).Count
# Generate HTML table rows
for ($i = 0; $i -lt $maxRows; $i++) {
$htmlContent += '<tr>'
foreach ($csvFile in $csvFiles) {
$csvData = Import-Csv $csvFile.FullName
$rowData = $csvData[$i].PSObject.Properties.Value # Get the data for the current row
foreach ($value in $rowData) {
$htmlContent += "<td>$value</td>"
}
}
$htmlContent += '</tr>'
}
# Finish HTML content
$htmlContent += @"
</table>
</body>
</html>
"@
# Save the HTML content to a file
$htmlContent | Out-File -FilePath $outputFilePath
#########################################################################################################################################################################################################
########################################################################## - Move results to a time/date folder. - ######################################################################################
# Create directory with current time and date
$directoryName = Get-Date -Format "dd_MM_yyyy__HH-mm-ss"
$destinationDirectory = "C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Results\REGResults\$directoryName"
New-Item -ItemType Directory -Path $destinationDirectory | Out-Null
# Move files to the destination directory
$filesToMove = Get-ChildItem -Path "C:\Program Files (x86)\Ingestservices\REG-SEC-GPO\Results\REGResults" -File
foreach ($file in $filesToMove) {
Move-Item -Path $file.FullName -Destination $destinationDirectory -Force
}
Write-Host "Your REG's has been ingested, audit report is located at $destinationDirectory" -ForegroundColor Green
Write-Host "The script is about to exit. Please wait..."
Start-Sleep -Seconds 5
exit
}
}
if ($TopMenuChoice2 -eq 'True') {
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
########################################################################## - Ingest services - REG-SEC-GPO v2.0 - SEC - #################################################################################
# # # # # # # # # # ################################################################################################################################################################# # # # # # # # # # #
#########################################################################################################################################################################################################
########################################################################## - Show-off screen for tool. - ################################################################################################
$colors = @('Red', 'Yellow', 'Green', 'Cyan', 'Blue', 'Magenta')
$text = "
_____________________________
/ _____/\_ _____/\_ ___ \
\_____ \ | __)_ / \ \/
/ \ | \\ \____
/_______ //_______ / \______ /
\/ \/ \/
"
for ($i = 0; $i -lt $text.Length; $i++) {
$color = $colors[$i % $colors.Count]
$char = $text[$i]
Write-Host $char -ForegroundColor $color -NoNewline
}
Write-Host " REG-SEC-GPO v2.0 - P.O.C."
Write-Host " Sub-Menu: SEC" -ForegroundColor Green
Write-Host "
Provided by:"
Write-Host "Jordan Albaladejo, Owner of:
"
Write-Host "Ingest services" -ForegroundColor Magenta
Write-Host "www.ingestservices.net" -ForegroundColor Blue
Write-Host "
With the help of ChatGPT.
" -ForegroundColor Green
#########################################################################################################################################################################################################
########################################################################## - Menu Choice - ##############################################################################################################
Write-Host "
"
Write-Host "[1] Wi-Fi Pass Audit Tool"
Write-Host "[2] PII, PCI and DSS Audit Tool"
Write-Host "[x] Exit"
Write-Host "
"
# Prompt user to run the following code.
$SECMenuChoice = Read-Host "Make your choice from the menu"