basic reverse engineering steps about .apk file
DESCRIPTION
Basic reverse engineering steps about .apk fileTRANSCRIPT
![Page 1: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/1.jpg)
The Basic Reverse Engineering Steps
About APK Carl Adler
IDSL - Dep. IM - NTUST
![Page 2: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/2.jpg)
What’s in the .apk file?
![Page 3: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/3.jpg)
What’s in the META-INF?
![Page 4: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/4.jpg)
What’s in the res?
![Page 5: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/5.jpg)
Before We Start…First, download all the yellow files shown in figure below.
![Page 6: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/6.jpg)
Put the tools togetherExtract all the files you downloaded, and choose aapt.exe, apktool.bat and apktool.jar, just copy them
and move those files into the same file(it’s optional, but I think it can make your work more convenient).
![Page 7: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/7.jpg)
Does it work?Moving to the folder where the files you post them, then, open the cmd window, type command
“apktool -version” to ensure the tool really works.
![Page 8: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/8.jpg)
Install frameworkEnsure that you’ve already prepared an app.apk file, then type in the command
“apktool if BMICalculator.apk” and you may see something like below.
![Page 9: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/9.jpg)
Decompile your .apk fileType in command “apktool d xxx.apk path_you_want_to_put_the_output_file”.
![Page 10: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/10.jpg)
Decompile your .apk fileLet’s check the result…
![Page 11: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/11.jpg)
Decompile your .apk fileIn this way, you’ll get smali file and AndroidManifest.xml.
![Page 12: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/12.jpg)
Recompile your .apk fileAfter you modify the code, use the following command to recompile.
“apktool b path_your_decompiled_source path_you_want_to_put_the_recompile_apk”
![Page 13: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/13.jpg)
Recompile your .apk fileAnd you’ll see a folder named “build” in the decompiled path.
![Page 14: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/14.jpg)
Recompile your .apk fileAnd the new .apk file is also located at the path you specify.
![Page 15: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/15.jpg)
Wait, not yet.You MUST follow this step. Or else the app won’t work and when you try to push it into system,
the rom will be stuck in bootloop XD(Please use the signapk you downloaded before to execute
the following command).
java –jar signapk.jar certificate.pem key.pk8 your_repackaged_apk your_final_apk_after_sign
![Page 16: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/16.jpg)
It’s done, but…You might not want to edit the smali code, maybe you want to edit some higher-level code,
extract the following two yellow file you downloaded before and put to the location you want.
![Page 17: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/17.jpg)
Using dex2jarType in the following command:
jar xvf your_apk xxx.dex
![Page 18: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/18.jpg)
Using dex2jarType in the following command:
d2j-dex2jar xxx.dex
And you’ll see a xxx-dex2jar.jar file.
![Page 19: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/19.jpg)
Using dex2jarType in the following command:
jar xvf xxx-dex2jar.jar
![Page 20: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/20.jpg)
Using dex2jarAnd you may see two folder was generated, one is named with the top-level package name,
and the other one is android.
![Page 21: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/21.jpg)
Using JDOpen Java Decompiler, choose File -> Open File…
![Page 22: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/22.jpg)
Using JDChoose the .class file we extracted with dex2jar tool.
![Page 23: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/23.jpg)
Using JDIt’s the original java code.
![Page 24: Basic reverse engineering steps about .apk file](https://reader031.vdocument.in/reader031/viewer/2022012318/5550c2beb4c90504628b552c/html5/thumbnails/24.jpg)
END