Last active
August 29, 2015 14:05
-
-
Save wjlafrance/3fa59c6b5b55e0b44221 to your computer and use it in GitHub Desktop.
CSR Racing hack
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
/** | |
Using iExplorer, navigate to CSR Racing and extract the file from | |
/Library/Caches/pp. | |
$ mv user85500672{,.gz} | |
$ gunzip user85500672.gz | |
$ edit user85500672 | |
Remove the signature (first line). Edit "caea", "casp", "goea", and "gosp" | |
to modify your cash earned, cash spent, gold earned, and gold spent | |
respectively. Leave the NULL at the end of the file. | |
$ java Sign user85500672 | |
Add the new signature back to the beginning of the file. | |
$ gzip user85500672 | |
$ mv user85500672{.gz,} | |
Move the user file back onto your device. | |
Derived from the csrProfileFix tool originally posted here: | |
http://www.sinfuliphone.com/showthread.php?t=10024300 | |
*/ | |
import java.io.*; | |
import javax.crypto.*; | |
import javax.crypto.spec.*; | |
public class Sign { | |
public static void main(String args[]) throws Exception { | |
FileInputStream fis = new FileInputStream(args[0]); | |
byte[] data = new byte[fis.available()]; | |
fis.read(data); | |
int dataLength = data.length; | |
while (data[dataLength - 1] == 0) { // ignore tailing null characters | |
dataLength--; | |
} | |
byte[] secretKeyBytes = { 69, 89, 73, 118, 81, 73, 118, 107 }; | |
SecretKeySpec secretKey = new SecretKeySpec(secretKeyBytes, "HmacSHA1"); | |
Mac mac = Mac.getInstance("HmacSHA1"); | |
mac.init(secretKey); | |
mac.update(data, 0, dataLength); | |
byte[] digest = mac.doFinal(); | |
String finalData = String.format("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", new Object[] { | |
Integer.valueOf(digest[0] & 0xFF), Integer.valueOf(digest[1] & 0xFF), | |
Integer.valueOf(digest[2] & 0xFF), Integer.valueOf(digest[3] & 0xFF), | |
Integer.valueOf(digest[4] & 0xFF), Integer.valueOf(digest[5] & 0xFF), | |
Integer.valueOf(digest[6] & 0xFF), Integer.valueOf(digest[7] & 0xFF), | |
Integer.valueOf(digest[8] & 0xFF), Integer.valueOf(digest[9] & 0xFF), | |
Integer.valueOf(digest[10] & 0xFF), Integer.valueOf(digest[11] & 0xFF), | |
Integer.valueOf(digest[12] & 0xFF), Integer.valueOf(digest[13] & 0xFF), | |
Integer.valueOf(digest[14] & 0xFF), Integer.valueOf(digest[15] & 0xFF), | |
Integer.valueOf(digest[16] & 0xFF), Integer.valueOf(digest[17] & 0xFF), | |
Integer.valueOf(digest[18] & 0xFF), Integer.valueOf(digest[19] & 0xFF) | |
}); | |
System.out.println(finalData); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment