Skip to content

Instantly share code, notes, and snippets.

@knot126
Created July 14, 2025 04:39
Show Gist options
  • Select an option

  • Save knot126/12598e0656f7e38854721c70e865d13a to your computer and use it in GitHub Desktop.

Select an option

Save knot126/12598e0656f7e38854721c70e865d13a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from pathlib import Path
from sys import argv
# I would rather do a symbol lookup, but this works too :P
uncrackedbytes = bytes([0xF3, 0x0F, 0x1E, 0xFA, 0x41, 0x54, 0x4C, 0x8D, 0x67, 0x58])
patch = b"\xb8\x01\x00\x00\x00\xc3"
binary = Path(argv[1]).read_bytes()
print(hex(binary.index(uncrackedbytes)))
binary = binary.replace(uncrackedbytes, patch + (len(uncrackedbytes) - len(patch)) * b"\x00")
Path(argv[1] + ".patched").write_bytes(binary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment