Skip to content

Instantly share code, notes, and snippets.

@malwareslayer
Last active July 16, 2024 09:51
Show Gist options
  • Save malwareslayer/15e18e00eaf9e9641eff72c3a96f8c2f to your computer and use it in GitHub Desktop.
Save malwareslayer/15e18e00eaf9e9641eff72c3a96f8c2f to your computer and use it in GitHub Desktop.
Repatching Anti Decompile
import marshal
import struct
import imp
import dis
import time
from types import CodeType
with open("compiled.pyc", "rb") as file:
magic = file.read(4)
timestamps = file.read(4)
content = file.read()
obj = marshal.loads(content)
__init__ = str(bytearray([100, 1, 0, 124, 0, 0, 95, 0, 0, 100, 2, 0, 124, 0, 0, 95, 1, 0, 120, 99, 0, 116, 2, 0, 124, 0, 0, 106, 0, 0, 131, 1, 0, 68, 93, 82, 0, 125, 1, 0, 116, 3, 0, 106, 4, 0, 100, 3, 0, 131, 1, 0, 1, 124, 0, 0, 4, 106, 1, 0, 100, 4, 0, 55, 2, 95, 1, 0, 116, 5, 0, 106, 6, 0, 106, 7, 0, 100, 5, 0, 116, 8, 0, 124, 0, 0, 106, 1, 0, 131, 1, 0, 23, 131, 1, 0, 1, 116, 5, 0, 106, 6, 0, 106, 9, 0, 131, 0, 0, 1, 113, 34, 0, 87, 100, 6, 0, 71, 72, 100, 0, 0, 83]))
__init__ = CodeType(
obj.co_consts[3].co_consts[0].co_argcount,
obj.co_consts[3].co_consts[0].co_nlocals,
obj.co_consts[3].co_consts[0].co_stacksize,
obj.co_consts[3].co_consts[0].co_flags,
__init__,
obj.co_consts[3].co_consts[0].co_consts,
obj.co_consts[3].co_consts[0].co_names,
obj.co_consts[3].co_consts[0].co_varnames,
obj.co_consts[3].co_consts[0].co_filename,
obj.co_consts[3].co_consts[0].co_name,
obj.co_consts[3].co_consts[0].co_firstlineno,
obj.co_consts[3].co_consts[0].co_lnotab,
obj.co_consts[3].co_consts[0].co_freevars,
obj.co_consts[3].co_consts[0].co_cellvars
)
EzzKun = str(bytearray([101, 0, 0, 90, 1, 0, 100, 0, 0, 132, 0, 0, 90, 2, 0, 82, 83]))
EzzKun = CodeType(
obj.co_consts[3].co_argcount,
obj.co_consts[3].co_nlocals,
obj.co_consts[3].co_stacksize,
obj.co_consts[3].co_flags,
EzzKun,
(__init__, ),
obj.co_consts[3].co_names,
obj.co_consts[3].co_varnames,
obj.co_consts[3].co_filename,
obj.co_consts[3].co_name,
obj.co_consts[3].co_firstlineno,
obj.co_consts[3].co_lnotab,
obj.co_consts[3].co_freevars,
obj.co_consts[3].co_cellvars
)
__main__ = str(bytearray([100, 0, 0, 100, 1, 0, 108, 0, 0, 90, 0, 0, 100, 0, 0, 100, 1, 0, 108, 1, 0, 90, 1, 0, 100, 2, 0, 100, 4, 0, 100, 3, 0, 132, 0, 0, 131, 0, 0, 89, 90, 2, 0, 121, 11, 0, 101, 2, 0, 131, 0, 0, 1, 87, 110, 17, 0, 4, 101, 3, 0, 107, 10, 0, 114, 79, 0, 1, 1, 1, 110, 1, 0, 88, 100, 1, 0, 83]))
__main__ = CodeType(
obj.co_argcount,
obj.co_nlocals,
obj.co_stacksize,
obj.co_flags,
__main__,
(-1, None, 'EzzKun', EzzKun, (), ),
obj.co_names,
obj.co_varnames,
obj.co_filename,
obj.co_name,
obj.co_firstlineno,
obj.co_lnotab,
obj.co_freevars,
obj.co_cellvars
)
with open("main.pyc", "wb") as file:
file.write(imp.get_magic()) # Header Python Object Serializer
file.write(struct.pack("<L", int(time.time()))) # Timestamp After Header Python Object Serializer
marshal.dump(__main__, file)
@JustAHackers
Copy link

Bang coba tes compile gw bang

Yang repo brain_game

Lemah sih compile buatan gw sendiri soalnya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment