Skip to content

Instantly share code, notes, and snippets.

@bsmt
bsmt / XORRegions.java
Created February 15, 2020 05:17
Ghidra script to XOR two arbitrary size regions of memory together and write the resulting buffer somewhere. *dest = *src_1 ^ *src_2
// XOR two memory regions together and write result at a third location.
//@author bsmt
//@category Memory
//@keybinding
//@menupath
//@toolbar
import ghidra.app.script.GhidraScript;
import ghidra.program.model.util.*;
import ghidra.program.model.reloc.*;
@bsmt
bsmt / sly4_save.ksy
Last active October 16, 2024 15:09
meta:
id: sly4_save
title: Sly Cooper - Thieves In Time save file
file-extension: bin
endian: be
doc: |
Incomplete definition for Sly 4 save files.
Most of the basic cheating things are defined.
# Half-done definition for XGPro's ULI/UDC files.
# These let users add support for new flash chips, provided there is an
# existing "reference" chip that is similar enough.
# The XGPro software does not allow users to change the size of the chip, however.
# So, XGPro will not let you add chip that is bigger than everything else it supports.
# This is currently incomplete and cannot be used to create a definition from scratch.
meta:
id: xgpro_uli
file-extension: uli, udc
endian: le
'''Fix the checksum in ULI files.'''
import argparse
import binascii
import struct
BULLSHIT = [0, 2519730039, 744558318, 3125873049, 432303367, 2415159920, 900031465, 2744476830, 847829774, 2763578489, 518641120, 2295976599, 726447625, 3179065726, 120436967, 2434645904, 1678817053, 4062228586, 1215412723, 3728850564, 2111101466, 3957644653, 1370871028, 3347436419, 1452829715, 3232263012, 2063164157, 3972621706, 1331429652, 3647735395, 1664946170, 4111272077, 3357568571, 1578133836, 3829489877, 1920034722, 3521381180, 1205077067, 4253355474, 1807026853, 4205360437, 1821946434, 3603545051, 1090108588, 3815561266, 1969020741, 3473790684, 1497223595, 2888882470, 973135441, 2152847304, 375509183, 3052712993, 600093526, 2576726735, 262520248, 2662859304, 143131999, 3000569030, 619252657, 2273079087, 290220120, 2870829505, 1026385590, 2420235382, 108124929, 3156267672, 705746415, 2307240305, 532002310, 2783231903, 869578984, 2731083640, 888733711, 2393377174, 412618465, 3138218623, 759000328, 2540463249, 22832102