Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decompiling .apk file created in Appcelerator and getting to .js files

Is there any way to get to .js files with code created with Appcelerator from compiled .apk? I lost a source coude of one of projects and now have only .apk files and would like not to rewrite the whole code. Thank in advance

like image 414
kreatywny Avatar asked Nov 21 '22 17:11

kreatywny


1 Answers

If you would like to do this manually:

In release version of the app, Titanium puts all of the assets into Java class called AssetCryptImpl, you would have to decompile apk and look for that class file in the sources.

AssetCryptImpl file will contain private method called initAssetsBytes, which returns one large chunk of data as CharBuffer, which contains encrypted data for all of the asset files. The other method called initAssets, will contain all of the original asset filenames and also ranges for each of the asset files.

Asset data is encrypted using AES in ECB mode, and last 16 bytes from asset data are the decryption key. Asset decryption method implementation is inside JNI library but its not hard to rewrite. filterDataInRange will call native code to decrypt the resource.

You can easily rewrite filterDataInRange method, with your implementation, which will get the key and decrypt the resource data and write it to file. And write a method which will call readAsset for each filename from HashMap, from initAssets method.

If you want one click solution:

You can use the tool called ti_recover.

Install it with node package manager:

npm install ti_recover

Than use it from terminal/command line:

ti_recover apkfile.apk outputdir
like image 179
Mirko Avatar answered Nov 23 '22 07:11

Mirko