Skip to content

Instantly share code, notes, and snippets.

@geniiii
Last active February 24, 2020 07:37
Show Gist options
  • Save geniiii/ad9c14e5f34c64be957f59fa736c1c64 to your computer and use it in GitHub Desktop.
Save geniiii/ad9c14e5f34c64be957f59fa736c1c64 to your computer and use it in GitHub Desktop.
Ripcord patches
# -*- coding: utf-8 -*-
# patches ripcord so that you may send messages in rate limited channels
# and see deleted messages
# blah blah blah use at your own risk
import codecs
import sys
filename_in = "Ripcord.exe"
filename_out = "RipcordPatched.exe"
patches = {
"DELETED_MESSAGE_PATCH_1": ("4883F8FF742C488B", "4883F8FFEB2C488B"),
"DELETED_MESSAGE_PATCH_2": ("418D5607488D", "418D5608488D"),
"DELETED_MESSAGE_PATCH_3": ("00488D4C2448E940", "00488D4C2448EB03"),
"DELETED_MESSAGE_PATCH_4": ("5B64656C657465645D0000", "5B64656C657465645D2000"),
"COOLDOWN_PATCH": ("84C00F94C184C9", "9090B1009084C9")
}
def patch(filename):
if not filename.replace("\"", "").endswith(filename_in):
print("WARNING |", filename, "does not match ", filename_in, "!")
with open(filename, 'rb') as infile:
byteContent = bytearray(infile.read())
for key, patchSig in patches.items():
try:
beforeBytes = codecs.decode(patchSig[0], 'hex_codec')
if not beforeBytes in byteContent:
print("ERROR | Could not find pattern for patch", key, "! (Wrong version or architecture?)")
continue
afterBytes = codecs.decode(patchSig[1], 'hex_codec')
byteContent = byteContent.replace(beforeBytes, afterBytes)
print("SUCCESS | Patched {}!".format(key))
except Exception as ex:
print("ERROR | Failed to patch ", key, "! (", ex, ")")
with open(filename_out, 'wb') as outfile:
outfile.write(byteContent)
if __name__ == "__main__":
patch(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment