Warning: In April 2016, Supercell has started banning accounts for the use of third party software. We are unsure what, if any, checks are in place that might reveal the use of this tool, so continue at your own risk. See here for more info.
This tool patches the Clash Royale APK. Once applied, your game will connect with the official servers through cr-proxy instead of directly. This allows you to see every message that is sent to and from the server, decrypted and decoded.
Read the installation section before
First, you need an .apk of the game. You can download an official one for example here. Put it to this folder (the one where patcher.py is). The name should match the following format:
<package>-<version>.apk
If you use the official APK, the package is com.supercell.clashroyale, with a file name of com.supercell.clashroyale-1.8.1.apk
Run the script with:
python3.5 patcher.py [--json] version-number
For example:
python3.5 patcher.py 1.8.1
By default, cr-patcher will retrieve the keys, MD5s, and key/URL offsets from the cr-proxy wiki. To provide these values for a new or unknown APK version, enter them in config.json and use the --json flag.
If you need to, enter them with this layout (click to expand)
"versions": {
"8.212.9": {
"key": "469b704e7f6009ba8fc72e9b5c864c8e9285a755c5190f03f5c74852f6d9f419",
"arm": {
"md5": "769e2e9e1258b75d15cb7e04b2e49de3",
"key-offset": "4280344",
"url-offset": "3534513"
},
"x86": {
"md5": "29ca23e48a5e419e83f2a7988c842d3e",
"key-offset": "6189080",
"url-offset": "4768816"
}
}
}
debug(true/false) - when set to true, you can use external tools to debug the app while it's running. If you only want to run the proxy, you probably won't need this, but most likely you also won't have any reason to disable this.package- if you somehow changed the package in game files before, change it here also (remember to change the name of .apk). The main reason for changing it is to make it possible to install both the original Clash Royale and your modified version at the same time. This tool doesn't change the package automatically.key- you shouldn't have any reason to change this. The default key guarantees that after patching the game will be able to connect tocr-proxy. If for some reasons you change the key, make sure the proxy is also setup with the same key.url- the address of server which the game will connect to. The default one,game.clashroyaleapp.com, is 23 characters long. Yours also needs to be 23 characters. If you have a domain, you can add a subdomain and redirect it to the proxy. The official server of Clash Royale is running on port 9339, so is the proxy. The game will always look for a server at this port, that's why there is noportfield in this config. Also, don't try to add the port likethe.ip.here:1337.keystore- if the key used to sign the app changes, you won't be able to update it without uninstalling the previous version before. You can learn more about signing Android apps for example here. Also note, thekeypassanddnamefields are only required to create a new keystore. See here for how to fill out thednamefields (if you really want to, but that isn't important).paths- paths of executables of different dependencies.versions- if you need to change something here - experiment, ask around, or wait for someone else to do it for you, when a new version is out
- Download the dependencies and install if needed.
- Copy the
config.json.examplefile toconfig.json(so you can do it again when you break something) and fill it in. The changes that you have to make are:
- in
paths, setapktoolto the path of your Apktool wrapper script. If you followed the instructions on their website, the path isC:\\Windows\\apktool.baton Windows and/usr/local/bin/apktoolon Linux and Mac. - in
paths, setzipalignto the path of that program (look at dependencies) Note: On Windows, use either/to separate folders in path, or use double\->\\, because of how json works.
- You may want to change a few more things in the config
- Read the running section
-
Python 3.5 to run this script
-
Apktool - home page - download & install instructions
-
keytoolandjarsignerfrom the Java JDK, on Windows most likely can be found inC:\Program Files\Java\<version>\bin\ -
zipalignfrom the Android SDKIf you haven't already, install Android Studio. Open it and download SDK for any version of Android (the one that will be chosen by default, lastest stable, should be fine). Then, you can find
zipalignin<sdk-folder>/build-tools/<version>/zipalign(.exe on Windows).For example, on Linux, I found it in
~/Android/Sdk/build-tools/25.0.2/zipalign, and on Windows inC:\Program Files (x86)\Android\android-sdk\build-tools\22.0.1\zipalign.exe(remember to double the\or use/instead)If you don't want to download the entire Android Studio, you can scroll the download page down to Get just the command line tools. Download the version for your OS, unzip it, run
sdkmanager(.exe)(this program has a gui), download one version of SDK, just like you would do in Android Studio. Rest works like above ^ -
dd- is built in Linux/MAC. For Windows, you can download it here -
Note:
requestsandrequests-cachecan be installed with:python3.5 -m pip install requests requests-cacheTo install it this way, you need
pip. Check if you have it withpip --version, if you don't, on Ubuntu you can get it withapt-get -y install python-pip