/ripcordpatcher.py Secret
Last active
December 7, 2019 15:26
-
-
Save Bluscream/d4fabc61e5769e7ff3dbfc00356854d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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": ("07488D0D91962600", "08488D0D91962600"), | |
"DELETED_MESSAGE_PATCH_3": ("00488D4C2448E940", "00488D4C2448EB03"), | |
"DELETED_MESSAGE_PATCH_4": ("5B64656C657465645D0000", "5B64656C657465645D2000"), | |
"RATE_LIMIT_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