Skip to content

Instantly share code, notes, and snippets.

@malwareslayer
Created June 6, 2020 16:53
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 struct
import time
import dis
from types import CodeType
with open("anti_decompile.pyc", "rw+b") as file:
magic = file.read(4)
timestamps = file.read(4)
content = file.read()
serialize = marshal.loads(content)
__init__opcode_patched = [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__code_patched = str(bytearray(__init__opcode_patched))
__init__ = CodeType(
serialize.co_consts[3].co_consts[0].co_argcount,
serialize.co_consts[3].co_consts[0].co_nlocals,
serialize.co_consts[3].co_consts[0].co_stacksize,
serialize.co_consts[3].co_consts[0].co_flags,
__init__code_patched,
serialize.co_consts[3].co_consts[0].co_consts,
serialize.co_consts[3].co_consts[0].co_names,
serialize.co_consts[3].co_consts[0].co_varnames,
serialize.co_consts[3].co_consts[0].co_filename,
serialize.co_consts[3].co_consts[0].co_name,
serialize.co_consts[3].co_consts[0].co_firstlineno,
serialize.co_consts[3].co_consts[0].co_lnotab,
serialize.co_consts[3].co_consts[0].co_freevars,
serialize.co_consts[3].co_consts[0].co_cellvars
)
EzzKun_opcode_patched = [101, 0, 0, 90, 1, 0, 100, 0, 0, 132, 0, 0, 90, 2, 0, 82, 83]
EzzKun_code_patched = str(bytearray(EzzKun_opcode_patched))
EzzKun = CodeType(
serialize.co_consts[3].co_argcount,
serialize.co_consts[3].co_nlocals,
serialize.co_consts[3].co_stacksize,
serialize.co_consts[3].co_flags,
EzzKun_code_patched,
(__init__, ),
serialize.co_consts[3].co_names,
serialize.co_consts[3].co_varnames,
serialize.co_consts[3].co_filename,
serialize.co_consts[3].co_name,
serialize.co_consts[3].co_firstlineno,
serialize.co_consts[3].co_lnotab,
serialize.co_consts[3].co_freevars,
serialize.co_consts[3].co_cellvars
)
opcode_patched = [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]
code_patched = str(bytearray(opcode_patched))
anti_decompile = CodeType(
serialize.co_argcount,
serialize.co_nlocals,
serialize.co_stacksize,
serialize.co_flags,
code_patched,
(-1, None, 'EzzKun', EzzKun, (), ),
serialize.co_names,
serialize.co_varnames,
serialize.co_filename,
serialize.co_name,
serialize.co_firstlineno,
serialize.co_lnotab,
serialize.co_freevars,
serialize.co_cellvars
)
with open("anti_decompile.patched.pyc", "rw+b") as file:
magic = imp.get_magic()
file.write(magic)
timestamps = struct.pack("<L", int(time.time()))
file.write(timestamps)
marshal.dump(anti_decompile, 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