Created
October 29, 2014 17:21
-
-
Save Inndy/6cf4a490526ac3171860 to your computer and use it in GitHub Desktop.
Read CHEATENGINE dump file head
This file contains hidden or 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
| import sys, struct | |
| CE_MAGIC = b'CHEATENGINE' | |
| def usage(argv): | |
| print('Usage: python {script} cheatengine-memory-dump-file' | |
| .format(script = argv[0])) | |
| return 0 | |
| def check_magic(data, magic): | |
| return data[:len(magic)] == magic | |
| def main(argv): | |
| if len(argv) < 2: | |
| return usage(argv) | |
| filename = argv[1] | |
| fo = open(filename, 'rb') | |
| buff = fo.read(23) | |
| if not check_magic(buff, CE_MAGIC): | |
| print('[-] This is not a CHEATENGINE dump file') | |
| return 1 | |
| buff = buff[len(CE_MAGIC):] | |
| tag, adr_lo, adr_hi = struct.unpack('<III', buff) | |
| address = ( | |
| "0x%.8x" % adr_lo | |
| if not adr_hi else | |
| "0x%.8x %.8x" % (adr_hi, adr_lo) | |
| ) | |
| print("Tag = %.8x\nAddress = %s" % (tag, address)) | |
| if __name__ == '__main__': | |
| main(sys.argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment