#!/usr/bin/env python3 """Apply the Slinky crackme patch to lib_beta_win_unpacked.devirt.bin. Patches validate() (VA 0x180001290, file offset 0x6AE) to return 0 (success) unconditionally, bypassing the VMProtect license check: original: 48 8D 0D AF ED 13 00 lea rcx,[0x180140064] ; -> VM calls patched: 31 C0 E9 22 00 00 00 xor eax,eax ; jmp 0x1800012D7 (epilogue) Result: any 32-character SLINKY_LICENSE key validates ("status: 0") and the DLL no longer unloads itself on failure. Usage: python crack_patch.py [output.bin] """ import hashlib import sys OFFSET = 0x6AE ORIG = bytes.fromhex("48 8D 0D AF ED 13 00") PATCH = bytes.fromhex("31 C0 E9 22 00 00 00") SRC_SHA256 = "a225f9b51903982fbb5a9f65a5f80f0964b71091b52f90199fd6cea85054ff4f" DST_SHA256 = "2a71d3850ed15d275850f6c20cfb689f886ee1ecf641a848e3c45edddccd2820" def main() -> int: if len(sys.argv) not in (2, 3): print(__doc__) return 1 src = sys.argv[1] dst = sys.argv[2] if len(sys.argv) == 3 else src.rsplit(".", 1)[0] + ".CRACKED.bin" with open(src, "rb") as f: data = bytearray(f.read()) digest = hashlib.sha256(data).hexdigest() if digest == DST_SHA256: print("input is already patched") return 0 if digest != SRC_SHA256: print(f"warning: input sha256 {digest} != expected {SRC_SHA256}") current = bytes(data[OFFSET : OFFSET + 7]) if current == PATCH: print("offset 0x6AE already patched") return 0 if current != ORIG: print(f"error: unexpected bytes at 0x{OFFSET:X}: {current.hex(' ')}") return 1 data[OFFSET : OFFSET + 7] = PATCH with open(dst, "wb") as f: f.write(data) out = hashlib.sha256(data).hexdigest() print(f"patched {src} -> {dst}") print(f"sha256: {out}") assert out == DST_SHA256, "patch produced unexpected digest" return 0 if __name__ == "__main__": sys.exit(main())