-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathRUN-INSIDE-VM.ps1
More file actions
2906 lines (2430 loc) · 140 KB
/
RUN-INSIDE-VM.ps1
File metadata and controls
2906 lines (2430 loc) · 140 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
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
try {
if ($Host.UI.SupportsVirtualTerminal) {
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
}
} catch {
}
$isAdministrator = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdministrator) {
Write-Warning "Administrator privileges are required for this script."
Write-Host "Attempting to re-launch with elevated privileges..." -ForegroundColor Yellow
try {
$scriptPath = $MyInvocation.MyCommand.Path
$arguments = "& '$scriptPath' $args"
Start-Process powershell.exe -ArgumentList $arguments -Verb RunAs -ErrorAction Stop
Exit
}
catch {
Write-Host "[ERROR] Failed to elevate." -ForegroundColor Red
Write-Host "Please start a PowerShell session as an Administrator and run the script manually." -ForegroundColor Red
if ($Host.UI.RawUI.KeyAvailable) { $Host.UI.RawUI.FlushInputBuffer() }
Write-Host "Press any key to exit..."
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null
Exit
}
}
Write-Host "Successfully running with Administrator privileges." -ForegroundColor Green
Add-Type @"
using System;
using System.Runtime.InteropServices;
namespace Win32 {
public class User32 {
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
}
}
"@ -ErrorAction SilentlyContinue
$Global:restartRequired = $false
$Global:logPath = ""
$Global:UserChoices = @{}
function Get-YesNoChoice {
param(
[string]$Question,
[string]$Default = "N",
[string]$HelpMessage = "",
[string]$SettingName = ""
)
$choices = @(
[System.Management.Automation.Host.ChoiceDescription]::new("&Yes", "Apply this change.")
[System.Management.Automation.Host.ChoiceDescription]::new("&No", "Skip this change.")
)
$defaultChoiceIndex = if ($Default -eq "Y") { 0 } else { 1 }
Write-Host "`n? [ACTION] " -ForegroundColor White -NoNewline
Write-Host "$Question" -ForegroundColor Cyan
if ($HelpMessage) {
Write-Host " > $HelpMessage" -ForegroundColor Gray
}
$decision = $Host.UI.PromptForChoice("", "", $choices, $defaultChoiceIndex)
if ($SettingName) {
$Global:UserChoices[$SettingName] = ($decision -eq 0)
}
return $decision -eq 0
}
function Get-RandomString {
param ([int]$Length = 10)
$charSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray()
-join ($charSet | Get-Random -Count $Length)
}
function Start-ScriptLogging {
param (
[string]$LogPath = "$env:USERPROFILE\Documents\CloakBox_Log.txt"
)
Start-Transcript -Path $LogPath -Append -Force
Write-Host "`n# ===========================================================" -ForegroundColor Magenta
Write-Host "# CLOAKBOX - VM EVASION & HARDENING SUITE" -ForegroundColor Magenta
Write-Host "# Execution Time: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor Magenta
Write-Host "# System: $([System.Environment]::OSVersion.VersionString)" -ForegroundColor Magenta
Write-Host "# ===========================================================" -ForegroundColor Magenta
return $LogPath
}
function New-RestorePoint {
Write-Host "`n # ================== CREATING SYSTEM RESTORE POINT ==================" -ForegroundColor Magenta
$srService = Get-Service -Name "swprv" -ErrorAction SilentlyContinue
if ($srService.Status -ne "Running") {
Start-Service -Name "swprv" -ErrorAction SilentlyContinue
}
$systemDrive = $env:SystemDrive
$volumeInfo = vssadmin list volumes | Select-String -Pattern "Volume path:\s+$systemDrive\\"
if ($volumeInfo) {
try {
Enable-ComputerRestore -Drive $systemDrive -ErrorAction SilentlyContinue
$restorePointName = "Before CloakBox Script - $(Get-Date -Format 'yyyy-MM-dd HH:mm')"
Checkpoint-Computer -Description $restorePointName -RestorePointType "APPLICATION_INSTALL" -ErrorAction Stop
Write-Host " # [OK] System Restore Point created: '$restorePointName'" -ForegroundColor Green
return $true
}
catch {
Write-Host " # [WARN] Failed to create a restore point: $($_.Exception.Message)" -ForegroundColor Yellow
return $false
}
}
else {
Write-Host " # [WARN] System Restore is not enabled for drive $systemDrive" -ForegroundColor Yellow
return $false
}
}
function Set-EnhancedDefenderSettings {
Write-Host "`n # ================== CONFIGURING DEFENDER ADVANCED SETTINGS ==================" -ForegroundColor Magenta
try {
Get-MpPreference -ErrorAction Stop | Out-Null
Set-MpPreference -MAPSReporting Advanced -ErrorAction SilentlyContinue
Set-MpPreference -DisableBlockAtFirstSeen $false -ErrorAction SilentlyContinue
Set-MpPreference -EnableNetworkProtection Enabled -ErrorAction SilentlyContinue
try {
Set-ProcessMitigation -PolicyFilePath "$env:windir\schemas\CodeIntegrity\ExploitProtectionSettings.xml" -ErrorAction SilentlyContinue
} catch {
Write-Host " # [WARN] Could not set exploit protection policy: $($_.Exception.Message)" -ForegroundColor Yellow
}
$asrRules = @{
'BE9BA2D9-53EA-4CDC-84E5-9B1EEEE46550' = 'Enabled'
'D4F940AB-401B-4EFC-AADC-AD5F3C50688A' = 'Enabled'
'3B576869-A4EC-4529-8536-B80A7769E899' = 'Enabled'
'D3E037E1-3EB8-44C8-A917-57927947596D' = 'Enabled'
'5BEB7EFE-FD9A-4556-801D-275E5FFC04CC' = 'Enabled'
}
foreach ($rule in $asrRules.Keys) {
try {
Add-MpPreference -AttackSurfaceReductionRules_Ids $rule -AttackSurfaceReductionRules_Actions $asrRules[$rule] -ErrorAction SilentlyContinue
} catch {
Write-Host " # [WARN] Could not set ASR rule $rule`: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
Write-Host " # [OK] Advanced Windows Defender settings applied." -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Windows Defender service is not available or properly configured." -ForegroundColor Yellow
Write-Host " # [WARN] Error: $($_.Exception.Message)" -ForegroundColor Yellow
Write-Host " # [INFO] Skipping Windows Defender configuration." -ForegroundColor Yellow
}
}
function Set-EnhancedFirewallSettings {
Write-Host "`n # ================== CONFIGURING SECURE FIREWALL SETTINGS ==================" -ForegroundColor Magenta
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
Set-NetFirewallProfile -Profile Domain,Public,Private -DefaultInboundAction Block
Set-NetFirewallProfile -Profile Domain,Public,Private -DefaultOutboundAction Allow
Set-NetFirewallProfile -Profile Public -NotifyOnListen False
Set-NetFirewallProfile -Profile Public -LogBlocked True -LogAllowed True
Write-Host " # [OK] Secure firewall settings applied." -ForegroundColor Green
}
function Set-ControlledFolderAccess {
Write-Host "`n # ================== ENABLING CONTROLLED FOLDER ACCESS ==================" -ForegroundColor Magenta
try {
$defenderModuleAvailable = $null -ne (Get-Command -Name "Set-MpPreference" -ErrorAction SilentlyContinue)
if ($defenderModuleAvailable) {
Write-Host " # [INFO] Setting 'EnableControlledFolderAccess' to 'Enabled'..." -ForegroundColor Yellow
try {
Set-MpPreference -EnableControlledFolderAccess Enabled -ErrorAction Stop
Write-Host " # [OK] Controlled Folder Access is now enabled." -ForegroundColor Green
return $true
}
catch {
Write-Host " # [WARN] Could not enable Controlled Folder Access: $($_.Exception.Message)" -ForegroundColor Yellow
try {
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows Defender\Windows Defender Exploit Guard\Controlled Folder Access"
if (!(Test-Path $registryPath)) {
New-Item -Path $registryPath -Force | Out-Null
}
Set-ItemProperty -Path $registryPath -Name "EnableControlledFolderAccess" -Value 1 -Type DWord -Force
Write-Host " # [OK] Controlled Folder Access enabled via registry." -ForegroundColor Green
return $true
}
catch {
Write-Host " # [ERROR] Failed to set via registry: $($_.Exception.Message)" -ForegroundColor Red
return $false
}
}
}
else {
Write-Host " # [INFO] Windows Defender cmdlets not available in this environment." -ForegroundColor Yellow
Write-Host " # [INFO] Attempting to enable Controlled Folder Access via registry..." -ForegroundColor Yellow
try {
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows Defender\Windows Defender Exploit Guard\Controlled Folder Access"
if (!(Test-Path $registryPath)) {
New-Item -Path $registryPath -Force | Out-Null
}
Set-ItemProperty -Path $registryPath -Name "EnableControlledFolderAccess" -Value 1 -Type DWord -Force
Write-Host " # [OK] Controlled Folder Access enabled via registry." -ForegroundColor Green
return $true
}
catch {
Write-Host " # [WARN] Windows Defender appears to be disabled or not installed in this environment." -ForegroundColor Yellow
Write-Host " # [INFO] Controlled Folder Access cannot be enabled." -ForegroundColor Yellow
return $false
}
}
}
catch {
Write-Host " # [ERROR] An unexpected error occurred: $($_.Exception.Message)" -ForegroundColor Red
return $false
}
}
function Set-ApplicationWhitelisting {
Write-Host "`n # ================== CONFIGURING APPLICATION WHITELISTING ==================" -ForegroundColor Magenta
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Host " # [ERROR] Administrator rights required for AppLocker configuration" -ForegroundColor Red
return $false
}
$edition = (Get-WmiObject -class Win32_OperatingSystem).Caption
if ($edition -match "Home|IoT|Mobile") {
Write-Host " # [INFO] AppLocker is not supported on Windows $edition" -ForegroundColor Yellow
Write-Host " # [INFO] Using Software Restriction Policies instead" -ForegroundColor Yellow
$srPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Safer\CodeIdentifiers"
if (!(Test-Path $srPath)) {
New-Item -Path $srPath -Force | Out-Null
}
Set-ItemProperty -Path $srPath -Name "DefaultLevel" -Value 262144 -Type DWord -Force
Set-ItemProperty -Path $srPath -Name "PolicyScope" -Value 1 -Type DWord -Force
Set-ItemProperty -Path $srPath -Name "ExecutableTypes" -Value ".exe;.com;.bat;.cmd;.scr;.pif;.ps1;.vbs;.js" -Type String -Force
Write-Host " # [OK] Software Restriction Policy configured as alternative" -ForegroundColor Green
$Global:restartRequired = $true
return $true
}
$appLockerSvc = Get-Service -Name "AppIDSvc" -ErrorAction SilentlyContinue
if (!$appLockerSvc) {
Write-Host " # [WARN] AppLocker service not found. Trying to create registry entries instead." -ForegroundColor Yellow
$appLockerPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\SrpV2"
if (!(Test-Path $appLockerPath)) {
New-Item -Path $appLockerPath -Force | Out-Null
New-Item -Path "$appLockerPath\Exe" -Force | Out-Null
New-Item -Path "$appLockerPath\Msi" -Force | Out-Null
New-Item -Path "$appLockerPath\Script" -Force | Out-Null
}
Set-ItemProperty -Path "$appLockerPath\Exe" -Name "EnforcementMode" -Value 1 -Type DWord -Force
Set-ItemProperty -Path "$appLockerPath\Msi" -Name "EnforcementMode" -Value 1 -Type DWord -Force
Set-ItemProperty -Path "$appLockerPath\Script" -Name "EnforcementMode" -Value 1 -Type DWord -Force
Write-Host " # [OK] AppLocker registry configured" -ForegroundColor Green
$Global:restartRequired = $true
return $true
}
$rulesDir = "$env:windir\System32\AppLocker"
if (!(Test-Path $rulesDir)) {
New-Item -Path $rulesDir -ItemType Directory -Force | Out-Null
}
try {
$execRules = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule("Everyone", "ReadAndExecute", "Allow")
$acl = Get-Acl -Path "$env:windir"
$acl.AddAccessRule($execRules)
Set-Acl -Path "$env:windir" -AclObject $acl
Write-Host " # [OK] Added ReadAndExecute permissions for Everyone to Windows directory" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not set ACL for Windows directory: $($_.Exception.Message)" -ForegroundColor Yellow
}
try {
Write-Host " # [INFO] Configuring Application Identity service..." -ForegroundColor Yellow
Set-Service -Name "AppIDSvc" -StartupType Automatic -ErrorAction Stop
Start-Service -Name "AppIDSvc" -ErrorAction SilentlyContinue
Write-Host " # [OK] Application Identity service enabled" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Couldn't configure service: $($_.Exception.Message)" -ForegroundColor Yellow
Write-Host " # [INFO] Trying registry modification instead..." -ForegroundColor Yellow
try {
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\AppIDSvc" -Name "Start" -Value 2 -Type DWord -Force
Write-Host " # [OK] Service configured via registry" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Couldn't modify service registry: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
if (Get-Command -Name "New-AppLockerPolicy" -ErrorAction SilentlyContinue) {
Write-Host " # [INFO] Using PowerShell AppLocker cmdlets to configure policy..." -ForegroundColor Yellow
try {
$exeRules = New-AppLockerPolicy -FileInformation (Get-ChildItem -Path "$env:WINDIR\*.exe" -Recurse | Get-AppLockerFileInformation) -RuleType Publisher, Hash, Path -User "Everyone" -RuleNamePrefix "Windows"
Set-AppLockerPolicy -PolicyObject $exeRules -Merge
Write-Host " # [OK] AppLocker policy configured via PowerShell" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Error setting AppLocker policy via PowerShell: $($_.Exception.Message)" -ForegroundColor Yellow
Write-Host " # [INFO] Falling back to registry method..." -ForegroundColor Yellow
}
}
Write-Host " # [INFO] Setting AppLocker enforcement via registry..." -ForegroundColor Yellow
& $env:windir\System32\reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\SrpV2\Exe" /v "EnforcementMode" /t REG_DWORD /d 1 /f
& $env:windir\System32\reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\SrpV2\Msi" /v "EnforcementMode" /t REG_DWORD /d 1 /f
& $env:windir\System32\reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\SrpV2\Script" /v "EnforcementMode" /t REG_DWORD /d 1 /f
Write-Host " # [OK] AppLocker configured in audit mode. Check Event Viewer > Applications and Services Logs > Microsoft > Windows > AppLocker for results." -ForegroundColor Green
$Global:restartRequired = $true
return $true
}
function Set-BIOSSecurityRecommendations {
Write-Host "`n # ================== BIOS SECURITY RECOMMENDATIONS ==================" -ForegroundColor Magenta
$biosRecommendations = @(
"Enable UEFI Boot Mode (disable Legacy/CSM)",
"Enable Secure Boot",
"Set a BIOS/UEFI password",
"Disable booting from external devices when not needed",
"Enable TPM",
"Enable memory protection features like NX/XD",
"Disable unused devices (serial/parallel ports, etc.)",
"Enable Virtualization Technology (VT-x/AMD-V) only if needed for VMs"
)
Write-Host " # The following BIOS settings are recommended for security:" -ForegroundColor Yellow
foreach ($rec in $biosRecommendations) {
Write-Host " - $rec" -ForegroundColor Cyan
}
Write-Host "`n # [NOTE] These settings must be configured in your system BIOS/UEFI setup." -ForegroundColor Yellow
Write-Host " # To access BIOS/UEFI, typically press F1, F2, F10, F12, or Del during startup," -ForegroundColor Yellow
Write-Host " # depending on your computer manufacturer." -ForegroundColor Yellow
}
function Set-AdvancedVMEvasion {
Write-Host "`n # ================== APPLYING ADVANCED VM EVASION ==================" -ForegroundColor Magenta
Write-Host " # [INFO] Applying MAC address spoofing..." -ForegroundColor Yellow
$macSuccess = Set-RandomMacAddress
if (-not $macSuccess) {
Write-Host " # [INFO] Trying alternative MAC address approach..." -ForegroundColor Yellow
$adapters = Get-NetAdapter | Where-Object Status -eq 'Up'
foreach ($adapter in $adapters) {
try {
$adapterInfo = Get-NetAdapter | Where-Object { $_.Name -eq $adapter.Name } | Select-Object -First 1
$adapterId = $adapterInfo.InterfaceGuid
$macHex = ('{0:X}' -f (Get-Random -Maximum 0xFFFFFFFFFFFF)).PadLeft(12, "0")
$macHex = $macHex -replace '^(.)(.)', ('$1' + (Get-Random -InputObject 'A','E','2','6')) -replace '\$', ''
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"
$netAdapters = Get-ChildItem -Path $registryPath -ErrorAction SilentlyContinue
foreach ($netAdapter in $netAdapters) {
try {
$instanceId = (Get-ItemProperty -Path $netAdapter.PSPath -ErrorAction SilentlyContinue).NetCfgInstanceId
if ($instanceId -eq $adapterId) {
Set-ItemProperty -Path $netAdapter.PSPath -Name "NetworkAddress" -Value $macHex -Type String -Force
Write-Host " # [OK] Applied MAC address $macHex to adapter $($adapter.Name) via registry" -ForegroundColor Green
$adapter | Restart-NetAdapter -ErrorAction SilentlyContinue
break
}
}
catch {
}
}
}
catch {
Write-Host " # [WARNING] Could not set MAC address for $($adapter.Name): $_" -ForegroundColor Yellow
}
}
}
Write-Host " # [INFO] Modifying WMI class information to hide VM artifacts..." -ForegroundColor Yellow
$modelData = @(
"Alienware Aurora R12",
"Dell XPS 8940",
"HP Omen 30L",
"Lenovo Legion Tower 5i",
"ASUS ROG Strix G15",
"MSI Aegis RS"
)
$modelName = $modelData | Get-Random
try {
$computerSystem = Get-WmiObject -Class Win32_ComputerSystem
$computerSystem.Manufacturer = "Dell Inc."
$computerSystem.Model = $modelName
$computerSystem.Put() | Out-Null
Write-Host " # [OK] Modified ComputerSystem WMI data" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not modify ComputerSystem WMI data: $($_.Exception.Message)" -ForegroundColor Yellow
}
try {
$biosRegistryPath = "HKLM:\HARDWARE\DESCRIPTION\System\BIOS"
if (Test-Path $biosRegistryPath) {
$serialNumber = (Get-RandomString -Length 10).ToUpper()
$biosVersion = "2.5.$((Get-Random -Minimum 1000 -Maximum 9999).ToString())"
Set-ItemProperty -Path $biosRegistryPath -Name "BIOSVendor" -Value "Dell Inc." -Type String -Force
Set-ItemProperty -Path $biosRegistryPath -Name "BIOSVersion" -Value $biosVersion -Type String -Force
Set-ItemProperty -Path $biosRegistryPath -Name "SystemManufacturer" -Value "Dell Inc." -Type String -Force
Set-ItemProperty -Path $biosRegistryPath -Name "SystemProductName" -Value $modelName -Type String -Force
Set-ItemProperty -Path $biosRegistryPath -Name "BIOSReleaseDate" -Value "06/01/2024" -Type String -Force
Set-ItemProperty -Path $biosRegistryPath -Name "SystemFamily" -Value "Dell System" -Type String -Force
Set-ItemProperty -Path $biosRegistryPath -Name "SystemSKU" -Value "09A2" -Type String -Force
Set-ItemProperty -Path $biosRegistryPath -Name "SerialNumber" -Value $serialNumber -Type String -Force
Write-Host " # [OK] Modified BIOS data via registry" -ForegroundColor Green
}
}
catch {
Write-Host " # [WARN] Could not modify BIOS data via registry: $($_.Exception.Message)" -ForegroundColor Yellow
try {
$altBiosPath = "HKLM:\HARDWARE\DESCRIPTION\System"
Set-ItemProperty -Path $altBiosPath -Name "SystemBiosVersion" -Value "Dell Inc. $biosVersion" -Type MultiString -Force
Set-ItemProperty -Path $altBiosPath -Name "VideoBiosVersion" -Value "Dell Video BIOS" -Type MultiString -Force
Write-Host " # [OK] Modified alternate BIOS data via registry" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not modify alternate BIOS data: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
Write-Host " # [INFO] Removing registry VM artifacts..." -ForegroundColor Yellow
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters" -Name "PhysicalHostName" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters" -Name "VirtualMachineName" -ErrorAction SilentlyContinue
$vmRegistryPaths = @(
"HKLM:\SYSTEM\ControlSet001\Services\vmdebug",
"HKLM:\SYSTEM\ControlSet001\Services\vmmouse",
"HKLM:\SYSTEM\ControlSet001\Services\VMTools",
"HKLM:\SYSTEM\ControlSet001\Services\VMMEMCTL",
"HKLM:\SYSTEM\ControlSet001\Services\vmware",
"HKLM:\SYSTEM\ControlSet001\Services\vmci",
"HKLM:\SYSTEM\ControlSet001\Services\vboxguest",
"HKLM:\SYSTEM\ControlSet001\Services\VBoxService",
"HKLM:\SYSTEM\CurrentControlSet\Services\vmdebug",
"HKLM:\SYSTEM\CurrentControlSet\Services\vmmouse",
"HKLM:\SYSTEM\CurrentControlSet\Services\VMTools",
"HKLM:\SYSTEM\CurrentControlSet\Services\VMMEMCTL",
"HKLM:\SYSTEM\CurrentControlSet\Services\vmware",
"HKLM:\SYSTEM\CurrentControlSet\Services\vmci",
"HKLM:\SYSTEM\CurrentControlSet\Services\vboxguest",
"HKLM:\SYSTEM\CurrentControlSet\Services\VBoxService"
)
foreach ($path in $vmRegistryPaths) {
if (Test-Path $path) {
try {
Remove-Item -Path $path -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " # [OK] Removed registry path: $path" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not remove registry path: $path" -ForegroundColor Yellow
}
}
}
Write-Host " # [INFO] Performing advanced memory artifact cleanup..." -ForegroundColor Yellow
$signature = @"
[DllImport("psapi.dll")]
public static extern int EmptyWorkingSet(IntPtr hProcess);
[DllImport("kernel32.dll")]
public static extern IntPtr GetCurrentProcess();
[DllImport("kernel32.dll")]
public static extern bool SetProcessWorkingSetSize(IntPtr hProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize);
"@
try {
Add-Type -MemberDefinition $signature -Name MemoryUtils -Namespace CleanupTools -ErrorAction Stop
$vmProcesses = @(
"VirtualBoxVM", "VBoxSVC", "VBoxTray", "VBoxHeadless",
"vmtoolsd", "vm3dservice", "vmacthlp", "VMwareTray", "VMwareService"
)
foreach ($processName in $vmProcesses) {
$processes = Get-Process -Name $processName -ErrorAction SilentlyContinue
if ($processes) {
foreach ($process in $processes) {
try {
Write-Host " # [INFO] Clearing memory for VM process: $processName" -ForegroundColor Yellow
[CleanupTools.MemoryUtils]::EmptyWorkingSet($process.Handle) | Out-Null
}
catch {
}
}
}
}
$currentProcess = [CleanupTools.MemoryUtils]::GetCurrentProcess()
[CleanupTools.MemoryUtils]::SetProcessWorkingSetSize($currentProcess, -1, -1) | Out-Null
Write-Host " # [OK] Memory artifact cleanup completed" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Memory cleanup functions unavailable: $_" -ForegroundColor Yellow
}
Write-Host " # [INFO] Removing VM-specific temporary files..." -ForegroundColor Yellow
$vmTempPaths = @(
"$env:TEMP\VBox*",
"$env:TEMP\vmware*",
"$env:LOCALAPPDATA\Temp\VBox*",
"$env:LOCALAPPDATA\Temp\vmware*",
"$env:WINDIR\Temp\VBox*",
"$env:WINDIR\Temp\vmware*",
"$env:WINDIR\Prefetch\VBOX*",
"$env:WINDIR\Prefetch\VMWARE*"
)
foreach ($path in $vmTempPaths) {
if (Test-Path -Path $path) {
try {
$files = Get-ChildItem -Path $path -Force -ErrorAction SilentlyContinue
$fileCount = ($files | Measure-Object).Count
if ($fileCount -gt 0) {
Write-Host " # [INFO] Removing $fileCount temporary files: $path" -ForegroundColor Yellow
$files | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
}
}
catch {
}
}
}
Write-Host " # [INFO] Applying CPU information spoofing..." -ForegroundColor Yellow
$cpuNames = @(
"Intel(R) Core(TM) i7-11700K CPU @ 3.60GHz",
"Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz",
"AMD Ryzen 9 5900X 12-Core Processor",
"AMD Ryzen 7 5800X 8-Core Processor",
"Intel(R) Core(TM) i5-12600K CPU @ 3.70GHz"
)
$cpuName = $cpuNames | Get-Random
try {
$cpuPath = "HKLM:\HARDWARE\DESCRIPTION\System\CentralProcessor\0"
Set-ItemProperty -Path $cpuPath -Name "ProcessorNameString" -Value $cpuName -Type String -Force
Write-Host " # [OK] Applied CPU name: $cpuName" -ForegroundColor Green
$cores = Get-Random -Minimum 6 -Maximum 17
$threads = $cores * 2
Set-ItemProperty -Path $cpuPath -Name "~MHz" -Value (Get-Random -Minimum 3400 -Maximum 5000) -Type DWord -Force
}
catch {
Write-Host " # [WARN] Could not modify CPU information: $_" -ForegroundColor Yellow
}
Write-Host " # [INFO] Creating realistic desktop environment..." -ForegroundColor Yellow
$commonApps = @(
@{ Name = "Chrome"; Path = "C:\Program Files\Google\Chrome\Application\chrome.exe" },
@{ Name = "Word"; Path = "C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE" },
@{ Name = "Spotify"; Path = "C:\Users\$env:USERNAME\AppData\Roaming\Spotify\Spotify.exe" },
@{ Name = "Steam"; Path = "C:\Program Files (x86)\Steam\steam.exe" }
)
$desktopPath = [System.Environment]::GetFolderPath("Desktop")
foreach ($app in $commonApps) {
$shortcutPath = Join-Path $desktopPath "$($app.Name).lnk"
if (!(Test-Path $shortcutPath)) {
try {
$WshShell = New-Object -ComObject WScript.Shell
$shortcut = $WshShell.CreateShortcut($shortcutPath)
$shortcut.TargetPath = $app.Path
$shortcut.Save()
Write-Host " # [INFO] Created desktop shortcut for $($app.Name)" -ForegroundColor Yellow
}
catch {
}
}
}
Write-Host " # [INFO] Performing final cleanup..." -ForegroundColor Yellow
Clear-DnsClientCache
Remove-Item -Path "$env:LOCALAPPDATA\CrashDumps\*.dmp" -Force -ErrorAction SilentlyContinue
[System.GC]::Collect()
Write-Host " # [OK] Advanced VM evasion techniques applied successfully" -ForegroundColor Green
}
function Set-ProcessTimingMasking {
Write-Host "`n # ================== APPLYING PROCESS & TIMING MASKING ==================" -ForegroundColor Magenta
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Value 0 -Type DWord -Force
Write-Host " # [INFO] Modifying performance counter behavior..." -ForegroundColor Yellow
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib" -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib" -Name "Disable Performance Counters" -Value 1 -Type DWord -Force
Write-Host " # [OK] Process and timing masking applied." -ForegroundColor Green
}
function Set-AdditionalAntiDetection {
Write-Host "`n # ================== ADDITIONAL ANTI-DETECTION FIXES ==================" -ForegroundColor Magenta
Write-Host " # [INFO] Applying additional anti-detection fixes..." -ForegroundColor Yellow
Write-Host " # [INFO] Fixing power capabilities detection..." -ForegroundColor Yellow
try {
powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e 2>$null
Write-Host " # [OK] Activated balanced power scheme." -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not set power scheme: $($_.Exception.Message)" -ForegroundColor Yellow
}
$powerKeys = @(
"HKLM:\SYSTEM\CurrentControlSet\Control\Power",
"HKLM:\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes"
)
foreach ($key in $powerKeys) {
if (Test-Path $key) {
Set-ItemProperty -Path $key -Name "HibernateEnabled" -Value 1 -Type DWord -ErrorAction SilentlyContinue
}
}
try {
powercfg /hibernate on 2>$null
Write-Host " # [OK] Hibernate enabled." -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not enable hibernate." -ForegroundColor Yellow
}
Write-Host " # [OK] Power capabilities fixed." -ForegroundColor Green
Write-Host " # [INFO] Fixing GPU capabilities detection..." -ForegroundColor Yellow
$gpuRegPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000"
if (Test-Path $gpuRegPath) {
Set-ItemProperty -Path $gpuRegPath -Name "DriverDesc" -Value "NVIDIA GeForce GTX 1660" -ErrorAction SilentlyContinue
Set-ItemProperty -Path $gpuRegPath -Name "ProviderName" -Value "NVIDIA" -ErrorAction SilentlyContinue
Set-ItemProperty -Path $gpuRegPath -Name "HardwareInformation.AdapterString" -Value "NVIDIA GeForce GTX 1660" -ErrorAction SilentlyContinue
Set-ItemProperty -Path $gpuRegPath -Name "HardwareInformation.BiosString" -Value "Version 90.16.35.00.08" -ErrorAction SilentlyContinue
Set-ItemProperty -Path $gpuRegPath -Name "HardwareInformation.ChipType" -Value "GeForce GTX 1660" -ErrorAction SilentlyContinue
Set-ItemProperty -Path $gpuRegPath -Name "HardwareInformation.DacType" -Value "Integrated RAMDAC" -ErrorAction SilentlyContinue
Set-ItemProperty -Path $gpuRegPath -Name "HardwareInformation.MemorySize" -Value 0x180000000 -Type QWord -ErrorAction SilentlyContinue
Write-Host " # [OK] GPU capabilities fixed." -ForegroundColor Green
}
else {
Write-Host " # [WARN] GPU registry path not found." -ForegroundColor Yellow
}
Write-Host " # [INFO] Fixing display detection..." -ForegroundColor Yellow
Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Enum\PCI" -ErrorAction SilentlyContinue | ForEach-Object {
$devicePath = $_.PSPath
$deviceDesc = Get-ItemProperty -Path $devicePath -Name "DeviceDesc" -ErrorAction SilentlyContinue
if ($deviceDesc.DeviceDesc -like "*VirtualBox*" -or $deviceDesc.DeviceDesc -like "*VBox*") {
Set-ItemProperty -Path $devicePath -Name "DeviceDesc" -Value "NVIDIA GeForce GTX 1660" -ErrorAction SilentlyContinue
Write-Host " # [OK] Fixed VBox display reference in: $devicePath" -ForegroundColor Green
}
}
Write-Host " # [OK] Display detection fixed." -ForegroundColor Green
Write-Host " # [INFO] Removing hypervisor traces..." -ForegroundColor Yellow
$servicesToDisable = @(
"VBoxService",
"VBoxMouse",
"VBoxGuest",
"VBoxSF",
"VBoxVideo"
)
foreach ($service in $servicesToDisable) {
$svc = Get-Service -Name $service -ErrorAction SilentlyContinue
if ($svc) {
Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
Set-Service -Name $service -StartupType Disabled -ErrorAction SilentlyContinue
Write-Host " # Disabled: $service" -ForegroundColor Gray
}
}
Write-Host " # [OK] Hypervisor traces removed." -ForegroundColor Green
$Global:restartRequired = $true
Write-Host " # [OK] Additional anti-detection fixes applied successfully." -ForegroundColor Green
}
function Set-RandomMachineGuid {
Write-Host "`n # ================== SPOOFING MACHINE GUID ==================" -ForegroundColor Magenta
try {
$newGuid = [guid]::NewGuid().ToString()
Write-Host " # [INFO] Generating new random MachineGuid: $newGuid" -ForegroundColor Yellow
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Cryptography' -Name 'MachineGuid' -Type String -Value $newGuid -Force
Write-Host " # [OK] MachineGuid successfully changed." -ForegroundColor Green
return $true
}
catch {
Write-Host " # [ERROR] Failed to change MachineGuid: $($_.Exception.Message)" -ForegroundColor Red
return $false
}
}
function Set-EnhancedInstallDateTime {
Write-Host "`n # ================== SPOOFING INSTALL DATE & TIME ==================" -ForegroundColor Magenta
try {
$randomDate = Get-Random -Minimum ([datetime]'2011-01-01').Ticks -Maximum (([datetime]'2022-12-31').Ticks) | ForEach-Object {[datetime]$_}
$unixTimestamp = [int]($randomDate.ToUniversalTime() - [datetime]'1970-01-01').TotalSeconds
$ldapFileTime = [int64](($unixTimestamp + 11644473600) * 1e7)
Write-Host " # [INFO] Setting install date to: $($randomDate.ToString('yyyy-MM-dd')) ($unixTimestamp)" -ForegroundColor Yellow
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
Set-ItemProperty -Path $regPath -Name "InstallDate" -Value $unixTimestamp -Force
Set-ItemProperty -Path $regPath -Name "InstallTime" -Value $ldapFileTime -Force
$timeService = Get-Service w32time -ErrorAction SilentlyContinue
if ($timeService -and $timeService.Status -ne "Disabled") {
Write-Host " # [INFO] Configuring Windows Time service with public NTP servers..." -ForegroundColor Yellow
try {
if ($timeService.Status -ne "Running") {
Start-Service w32time -ErrorAction Stop
}
w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org" /update -ErrorAction SilentlyContinue
try {
Restart-Service w32time -Force -ErrorAction Stop
w32tm /resync -ErrorAction SilentlyContinue | Out-Null
Write-Host " # [OK] Windows Time service configured successfully" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not restart Windows Time service: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
catch {
Write-Host " # [WARN] Windows Time service could not be started: $($_.Exception.Message)" -ForegroundColor Yellow
Write-Host " # [INFO] Proceeding without time synchronization" -ForegroundColor Yellow
}
}
else {
Write-Host " # [INFO] Windows Time service is not available or disabled, skipping time configuration" -ForegroundColor Yellow
try {
$currentDate = Get-Date
$year = $currentDate.Year
$month = $currentDate.Month
$day = $currentDate.Day
$hour = Get-Random -Minimum 8 -Maximum 18
$minute = Get-Random -Minimum 0 -Maximum 60
$second = Get-Random -Minimum 0 -Maximum 60
$newDate = Get-Date -Year $year -Month $month -Day $day -Hour $hour -Minute $minute -Second $second
Set-Date -Date $newDate -ErrorAction SilentlyContinue
Write-Host " # [INFO] System time set to: $newDate" -ForegroundColor Yellow
}
catch {
Write-Host " # [WARN] Could not set system time directly: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
Write-Host " # [OK] Install date/time settings successfully modified." -ForegroundColor Green
return $true
}
catch {
Write-Host " # [ERROR] Failed to spoof install date/time: $($_.Exception.Message)" -ForegroundColor Red
return $false
}
}
function Set-RandomMacAddress {
Write-Host "`n # ================== SPOOFING MAC ADDRESS ==================" -ForegroundColor Magenta
try {
$newMac = ('{0:X}' -f (Get-Random -Maximum 0xFFFFFFFFFFFF)).PadLeft(12, "0") -replace '^(.)(.)', ('$1' + (Get-Random -InputObject 'A','E','2','6')) -replace '\$', ''
$adapters = Get-NetAdapter | Where-Object {$_.Status -eq "Up"}
if ($adapters.Count -eq 0) {
Write-Host " # [WARN] No active network adapters found." -ForegroundColor Yellow
return $false
}
foreach ($adapter in $adapters) {
Write-Host " # [INFO] Changing MAC address of '$($adapter.Name)' to $newMac..." -ForegroundColor Yellow
try {
Set-NetAdapter -Name $adapter.Name -MacAddress $newMac -Confirm:$false
Write-Host " # [OK] MAC address successfully changed for adapter '$($adapter.Name)'." -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Failed to change MAC for adapter '$($adapter.Name)': $($_.Exception.Message)" -ForegroundColor Yellow
}
}
$Global:restartRequired = $true
return $true
}
catch {
Write-Host " # [ERROR] MAC address spoofing failed: $($_.Exception.Message)" -ForegroundColor Red
return $false
}
}
function Set-VBoxDllPatching {
Write-Host "`n # ================== PATCHING VBOX DLL ARTIFACTS ==================" -ForegroundColor Magenta
$vboxDlls = @(
"$env:windir\System32\VBoxHook.dll",
"$env:windir\System32\VBoxMRXNP.dll",
"$env:windir\System32\VBoxService.exe",
"$env:windir\System32\VBoxTray.exe",
"$env:windir\System32\VBoxControl.exe"
)
foreach ($dll in $vboxDlls) {
if (Test-Path $dll) {
try {
$extension = [System.IO.Path]::GetExtension($dll)
$newName = [System.IO.Path]::GetDirectoryName($dll) + "\" + (Get-RandomString -Length 8) + $extension
Write-Host " # [INFO] Found VBox artifact: $dll" -ForegroundColor Yellow
Write-Host " # [INFO] Renaming to: $newName" -ForegroundColor Yellow
$procName = [System.IO.Path]::GetFileNameWithoutExtension($dll)
Stop-Process -Name $procName -Force -ErrorAction SilentlyContinue
Move-Item -Path $dll -Destination $newName -Force
Write-Host " # [OK] Successfully renamed VBox artifact" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not rename $dll`: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
}
Write-Host " # [INFO] Looking for VBox window classes..." -ForegroundColor Yellow
$vboxClassNames = @("VBoxTrayToolWndClass", "VBoxTrayToolWnd")
foreach ($className in $vboxClassNames) {
try {
$handle = [Win32.User32]::FindWindow($className, $null)
if ($handle -ne 0) {
Write-Host " # [INFO] Found VBox window class: $className" -ForegroundColor Yellow
Write-Host " # [INFO] Hiding window of class $className" -ForegroundColor Yellow
[Win32.User32]::ShowWindow($handle, 0) | Out-Null
}
}
catch {
}
}
Write-Host " # [OK] VBox DLL patching completed" -ForegroundColor Green
}
function Set-CPUInfoSpoofing {
Write-Host "`n # ================== SPOOFING CPU INFORMATION ==================" -ForegroundColor Magenta
$cpuModels = @(
"Intel(R) Core(TM) i9-12900K CPU @ 3.20GHz",
"AMD Ryzen 9 5950X 16-Core Processor",
"Intel(R) Core(TM) i7-11700K CPU @ 3.60GHz",
"AMD Ryzen 7 5800X 8-Core Processor",
"Intel(R) Core(TM) i5-12600K CPU @ 3.70GHz"
)
$randomCpuModel = $cpuModels | Get-Random
Write-Host " # [INFO] Setting CPU model to: $randomCpuModel" -ForegroundColor Yellow
$regPath = "HKLM:\HARDWARE\DESCRIPTION\System\CentralProcessor\0"
Set-ItemProperty -Path $regPath -Name "ProcessorNameString" -Value $randomCpuModel -Force
$coreCount = Get-Random -Minimum 8 -Maximum 17
Write-Host " # [INFO] Setting CPU core count to: $coreCount" -ForegroundColor Yellow
try {
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name "NUMBER_OF_PROCESSORS" -Value $coreCount.ToString() -Force
[System.Environment]::SetEnvironmentVariable("NUMBER_OF_PROCESSORS", $coreCount.ToString(), "Machine")
Write-Host " # [OK] CPU information spoofing complete" -ForegroundColor Green
}
catch {
Write-Host " # [WARN] Could not completely spoof CPU information: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
function Remove-HypervisorMemoryArtifacts {
Write-Host "`n # ================== REMOVING HYPERVISOR MEMORY ARTIFACTS ==================" -ForegroundColor Magenta
$vmStrings = @{
"VBOX" = "DELL";
"VMware" = "INTEL", "DELL";
"Virtual" = "Physical";
"innotek GmbH" = "Dell Inc.";
"VirtualBox" = "DellDesktop";
}
Write-Host " # [INFO] Checking loaded modules for VM strings..." -ForegroundColor Yellow
$modules = Get-Process -Id $PID | ForEach-Object { $_.Modules }
$vmModules = $modules | Where-Object {
$name = $_.ModuleName
$vmStrings.Keys | Where-Object { $name -match $_ }
}
if ($vmModules) {
Write-Host " # [WARN] Found VM-related modules loaded in this process:" -ForegroundColor Yellow
$vmModules | ForEach-Object {
Write-Host " # - $($_.ModuleName): $($_.FileName)" -ForegroundColor Yellow
}
Write-Host " # [INFO] These cannot be unloaded but their presence has been noted" -ForegroundColor Yellow
} else {
Write-Host " # [OK] No VM-related modules found in current process" -ForegroundColor Green
}
$tempDir = [System.IO.Path]::GetTempPath()
$vmTempFiles = Get-ChildItem -Path $tempDir -File -ErrorAction SilentlyContinue |
Where-Object { $fileName = $_.Name; $vmStrings.Keys | Where-Object { $fileName -match $_ } }
if ($vmTempFiles) {
Write-Host " # [INFO] Found VM-related temporary files, removing..." -ForegroundColor Yellow
$vmTempFiles | ForEach-Object {
try {
Remove-Item -Path $_.FullName -Force
Write-Host " # - Removed: $($_.Name)" -ForegroundColor Green
} catch {
Write-Host " # - Failed to remove: $($_.Name)" -ForegroundColor Yellow
}
}
}
Write-Host " # [OK] Memory artifact cleanup completed" -ForegroundColor Green
}
function Set-AntiAnalysisTechniques {
Write-Host "`n # ================== APPLYING ANTI-ANALYSIS TECHNIQUES ==================" -ForegroundColor Magenta
Write-Host " # [INFO] Disabling Windows Error Reporting..." -ForegroundColor Yellow
try {
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Value 1 -Type DWord -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "DontSendAdditionalData" -Value 1 -Type DWord -Force
Write-Host " # [OK] Windows Error Reporting disabled" -ForegroundColor Green
} catch {