Skip to content

Instantly share code, notes, and snippets.

@ReplayCoding
Created January 31, 2023 22:28
Show Gist options
  • Save ReplayCoding/2e139a764aa13abfbc6e9099bf21f9a5 to your computer and use it in GitHub Desktop.
Save ReplayCoding/2e139a764aa13abfbc6e9099bf21f9a5 to your computer and use it in GitHub Desktop.
discord krisp patcher
import sys
import lief
replacement_code = [
0x48, 0xC7, 0xC0, 0x01, 0x00, 0x00, 0x00, # mov rax, 0x1
0xC3 # ret
]
with open(sys.argv[1], "rb") as input_file, open(sys.argv[2], "wb") as output_file:
input_bytes = list(input_file.read())
input_file.seek(0)
krisp_module = lief.parse(input_file)
for symbol in krisp_module.symbols:
if "IsSignedByDiscord" in symbol.name:
signing_func_address = krisp_module.virtual_address_to_offset(symbol.value)
for i, b in enumerate(replacement_code):
input_bytes[i + signing_func_address] = b
output_file.write(bytes(input_bytes))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment