Tutorial How to find decryption key for cocos2djs

AndnixSH

PMT Elite Modder
Original poster
Staff member
Modding-Team
Jun 27, 2017
4,684
297,060
1,213
Modding World
Rarely seen games based on cocos2djs, the game is compiled and encrypted to .jsc files. I think Cocos2d would come out encrypted by default with it's hardcoded key. Finding decryption key is pretty easy

This is not for all cocos2djs games. Some games may hide the decryption key, making it hard to find, so you would need to reverse deeper and debug it

Let's get started!

In this tutorial, I use this game Download LifeSimulator - Chinese Life APK for Android (Free)

Extract jsc files from assets folder of APK file

Now we gonna look after the key

Method 1: Hex editor
Use any hex eidtor that support string search. I use 010 editor

Search for jsb-adapter, jsb-builtin.js or main.js

The key should be located between Game. and .jsb-adapter . In my case the key is e07a4d47-b82e-4f

1626710532908.png


If it's blank like this, or you can't find the key, it must have been encoded or encrypted. Use IDA Pro instead

1626710651495.png


Method 2: IDA Pro
It is highly recommended to use IDA Pro 7.5 and later which can display string correctly. Older version may not be able to display string correctly

I WILL NOT SHARE LINK TO IDA PRO. HOWEVER IT IS EASIER TO FIND IF YOU USE BRAVE OR DUCKDUCKGO SEARCH


Load the libcoco2djs.so to IDA Pro

Search for AppDelegate::applicationDidFinishLaunching

Press F5 to view pseduocode, and tada!, here is the decryption key

Image 1625848935.png


Tools to decrypt and encrypt
You can use any xxtea tools to decrypt and encrypt, like Mika's Tool Encryption & Decryption JSC Files to Modded Games Based Cocos2djs - Platinmods.com - Android & iOS MODs, Mobile Games & Apps

I successfully decrypted .jsc to .js

Image 1625848815.png
 
Last edited:

DDeveloper

1/3 Games Approved
Aug 12, 2020
25
13
3
sbenny.com
Why waste so much time in loading the Lib in IDA ? Follow this instead:
1. open the libcoco2djs.so in HxD
2. search for "jsb-adapter" (ignore quotes)

the key is located between two dots and the second dot is just before "jsb-adapter"
Here's a screenshot:

Screenshot_2021-06-08_101045.jpg


In my case the key is "e7-a4d47-b82e-4f".
I hope it saves time :)
 
  • Like
Reactions: Yaskashije

AndnixSH

PMT Elite Modder
Original poster
Staff member
Modding-Team
Jun 27, 2017
4,684
297,060
1,213
Modding World
Why waste so much time in loading the Lib in IDA ? Follow this instead:
1. open the libcoco2djs.so in HxD
2. search for "jsb-adapter" (ignore quotes)

the key is located between two dots and the second dot is just before "jsb-adapter"
Here's a screenshot:


In my case the key is "e7-a4d47-b82e-4f".
I hope it saves time :)
I know this method, but i forgot to update the tutorial
However, you can't do this on some games due to string being encrypted or encoded but IDA Pro can decrypt it
 
  • Like
Reactions: DDeveloper

DDeveloper

1/3 Games Approved
Aug 12, 2020
25
13
3
sbenny.com
I know this method, but i forgot to update the tutorial
However, you can't do this on some games due to string being encrypted or encoded but IDA Pro can decrypt it
Yes, but people can try this first :) and if they cannot find it then they can proceed with IDA.
 

Yaskashije

PMT Elite Modder
Staff member
Modding-Team
Sep 9, 2018
4,553
834,748
1,213
Minkowski Space
Thank you verry much for help, but with a decryption tool for pc games, can u help me?
Every game has their own encryption system.
The one in this tutorial is for most games which use cocos2d engine and rely on jsc files (which is just a possibility of many)
You will have to reverse which encryption the game you are working has and find a way to decrypt it.
 
  • Like
Reactions: DDeveloper

mozapi

Platinian
Mar 7, 2021
9
3
3
33
none
That's right lol. You can't analyze without a file XD
Even if i analyze the file the options still remain the same as i have shown on screenshot, just that they are not greyed out anymore. Pressing f5 or shift f5 does not show me the pseudocode.
 

AndnixSH

PMT Elite Modder
Original poster
Staff member
Modding-Team
Jun 27, 2017
4,684
297,060
1,213
Modding World
Even if i analyze the file the options still remain the same as i have shown on screenshot, just that they are not greyed out anymore. Pressing f5 or shift f5 does not show me the pseudocode.
You nust open a function in order to use it.
It seems you are totally new to IDA, please refer to online tutorial howto use it