adb pull /data/app/greatapp.apk
pm
utility in the shell, and when the file name is already known, it can be pulled down via adb pull /data/app/app.filename.apk
.classes.dex
out the classes.dex
file of classes.dex
with the compiled code that interests us.java -jar baksmali-1.3.2.jar classes.dex
*.smali
files. Each of them corresponds to a .class
file. Naturally, I don’t want everything obfuscated for the most, this directory looks like this:AdView
" (View, displaying ads from the AdMob SDK) for all files. AdView.smali
itself was AdView.smali
, R$id.smali
and some d.smali
. AdView.smali
not very interesting to look at, I somehow ignored R.$id
at first, and went straight to the mysterious d.smali
.a()
method in the d.smali
file with the first mentioning of AdView
(I decided it’s better to take a screenshot, otherwise it’s very sad to read without formatting):return-void
closer to the beginning. When I assembled and launched everything, the application happily crashed. Log from adb logcat
:E/AndroidRuntime(14262): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.greatapp/com.greatapp.GreatApp}: android.view.InflateException: Binary XML file line #22: Error inflating class com.google.ads.AdView
AdView
not created as a result of the manipulations. Forget about d.smali
.R$id
. Here is the line with AdView
:# static fields
.field public static final adView:I = 0x7f080006
0x7f080006
. We get only two results: the same R$id
and GreatApp.smali
. In GreatApp.smali, the text is much more interesting (my comments):View
(line 588) and literally immediately AdView is removed from the screen (line 595). Apparently deleted if the user paid for the lack of advertising? If you look a little higher, the look clings to line 558 with "keywords":invoke-static {v7, v8}, Lnet/robotmedia/billing/BillingController;->isPurchased(Landroid/content/Context;Ljava/lang/String;)Z
isPurchased()
method returns a string, which with the help of Boolean.valueOf()
converted into a Boolean object and, finally, into a regular boolean
via booleanValue()
.:cond_32
, if the result value == false
. Otherwise, the already viewed AdView
search and delete AdView
.java -jar ..\smali\smali-1.3.2.jar ..\smali\out -o classes.dex
apkbuilder C:\devel\greatapp\greatapp_cracked.apk -u -z C:\devel\greatapp\greatapp_noclasses.apk -f C:\devel\greatapp\classes.dex
jarsigner -verbose -keystore my-release-key.keystore -storepass testtest -keypass testtest greatapp_cracked.apk alias_name
adb install greatapp_cracked.apk
greatapp_noclasses.apk
is the original APK of the application from which classes.dex is removed, certificates are created using the Android SDK).classes.dex
CRC file and keep it encryptedSource: https://habr.com/ru/post/141522/
All Articles