2

A while ago I was decompiling an application with apktool in order to understand some snippets. the curious thing was that the application was obfuscated, in fact , the app presented just one class called "Protection.class" full of method like "class.forName" or "class.getMethod"..

Searching on google this is of course the reflection structure, but, seeing some tutorials I ve understood that the classes called by reflection have to be in the application package. And in my case there are no classes except the "protection" one.

In conclusion my questions are: Is it possible to completly take off classes from package and nevertheless use their methods in someway? Where they are stored in the apk folder (if they are)? Is there a way to interact with the apk building process in order to obfuscate code or (like in this case) hide classes from package?

NOTE: Proguard can't do it, I have already tested it in the past

Cœur
  • 37,241
  • 25
  • 195
  • 267
Alessio Trecani
  • 713
  • 2
  • 10
  • 25
  • 1
    It sounds like all the necessary classes must have been moved to be inner classes inside the Protection class. If you can remember which app it was then that would be most useful information – zmarties Jan 19 '16 at 11:50
  • Thank you for the answer.. The apk is A Mod of perkTv (or something like that). I think it is exactly what you ve said.. And how can I include all classes in a single class and call them with reflection. Note: I have a screenshot of jd-gui with some code inside.(if you want to see it I can post it) – Alessio Trecani Jan 19 '16 at 11:53

4 Answers4

2

you can use progaurd to protect apk file from decompiler. also you can use DexGaurd for better security https://www.guardsquare.com/dexguard

  • The problem is that proguard simply obfuscate the code(but smali files can be read without problem).. What I m searching for is understand How apk building process works in order to understand how can I hide classes and where they are stored. – Alessio Trecani Jan 19 '16 at 11:30
  • to understand the process please read the official documentation link http://developer.android.com/sdk/installing/studio-build.html – Nauman Ali Shah Jan 19 '16 at 11:35
  • yes I read it but, my question is the same, " Is there a way to interact with the apk building process in order to obfuscate code or (like in this case) hide classes from package?" – Alessio Trecani Jan 19 '16 at 11:39
  • this link might be helpful for you http://stackoverflow.com/questions/13854425/how-to-avoid-reverse-engineering-of-an-apk-file @AlessioTrecani – Nauman Ali Shah Jan 19 '16 at 11:45
  • Thanks again for your answer... In any case I ve already read it and there is not the answer to my question. They talk about proguard (and that doesn't work), and also they talk about code obfuscation. My question is another one. – Alessio Trecani Jan 19 '16 at 11:50
2

Your screenshot shows that this is an app that is protected by DexGuard (the commercial development of ProGuard that goes a lot further).

See also this answer: What methods are being used to protect this Android APK: Reflection? Encryption? How do I reverse engineer it and analyze it?

Community
  • 1
  • 1
zmarties
  • 4,809
  • 22
  • 39
  • From that post "original classes can (and I think they will) be divided to multiple smaller classes" in my case they are completly hidden.. But In anycase thanks so much for the thread link.. it helped me a lot. – Alessio Trecani Jan 19 '16 at 12:25
0

You can use progaurd by php library for it and write a progaurd for your project then attach to your app project in gradle file (in android studio) of progaurd file (in eclipse). for this php has a fine library named php_progaurd

BinMan1
  • 95
  • 1
  • 10
0

You can use DexGuard for this purpose. DexGuard has, amongst a lot of other features, the ability to encrypt your classes and decrypt them on runtime. These classes will only be present in memory during runtime, so no sourcecode can be reversed from a static APK. DexGuard is a commercial product developed by the creator of ProGuard. I would you suggest you contact them at helloworld@guardsquare.com.

Cheers,

h4