模糊处理资源字符串,可能会放弃对编程逻辑太多的信息太多、可能会、字符串、逻辑

2023-09-06 01:15:55 作者:南岸青栀

我目前用单板层积材和Proguard的组合作为防御海盗的第一道防线。

I currently use a combination of LVL and Proguard as a first line of defence against piracy.

不过,关于资源字符串?例如,如果有喜欢的资源串许可证检查失败,那么没有盗版只需要跟踪的资源ID回到它是在code使用?事实上,这也是真实的,如果该字符串是通用的东西,如请联系开发。

However, what about the resource strings? For example, if there is a resource string like "License check failed" then doesn't the pirate simply need to trace that resource id back to where it was used in the code? In fact, this is also true if the string is something generic like "Please contact dev".

什么是最好的方法呢?

推荐答案

如果你定义一个资源字符串,你可能会定义或使用它:

If you define a resource string, you will probably define or use it in:

字符串资源文件中的 RES /价值/ strings.xml中的 在布局文件的 RES /布局/ *。xml的的 生成的资源文件中的 R.java 的 您的Java code的的src / **。java的的 the string resource file res/values/strings.xml, layout files res/layout/*.xml, the generated resource file R.java, your java code src/**.java.

编译后,资源字符串,它的名字,它的整数code结束在:

After compilation, the resource string, its name, and its integer code end up in:

在资源文件中的 resources.arsc 的(字符串,名称和code) 在资源类的 R $为String.class 的(名字,code) 您编译code的 **级的(内联code)。 the resource file resources.arsc (string, name, and code), the resource class R$string.class (name, code), your compiled code **.class (inlined code).

ProGuard的将删除的 R $为String.class 的全部,但Android的反编译可以从重建的 resources.arsc 的所有信息。它仍然需要一些工作,但该字符串可能在的code而言的确暗示(以及某些API调用)。

ProGuard will remove R$string.class entirely, but Android decompilers can reconstruct all information from resources.arsc. It still takes a bit of work, but the strings may indeed hint at the purpose of the code (along with certain API calls).

您可以通过加密/混淆在code中的字符串,通过使用反射来访问某些API,如谷歌的presentation的规避海盗和停止吸血鬼

You can improve on this by encrypting/obfuscating the strings in your code and by using reflection to access certain APIs, as suggested in Google's presentation Evading Pirates and Stopping Vampires.

ProGuard的封闭源码的兄弟为Android DexGuard 可以为你(以及API调用和整个班级)加密的字符串,可能更有力的你可以手工实现的,不负担源$ C ​​$ C。

ProGuard's closed-source sibling for Android DexGuard can encrypt strings for you (along with API calls and entire classes), probably more effectively than you could achieve manually, and without burdening the source code.

(我ProGuard,并将DexGuard的开发者)

(I am the developer of ProGuard and DexGuard)