Android NDK反编译本机代码的可能性

Android NDK possibility of decompiling native code

是否可以通过 ndk 解码编译并喜欢 android 的本机代码?

是否可以从 apk 重建项目并将其导入 eclipse(或任何其他 IDE)?

如果 java 本地函数声明正确完成,是否可以再次使用 apk 文件中的 .so 文件来重建项目或与另一个项目一起使用?

将本机反编译为源代码是可能的(可能,我没有尝试过),有一些像这样的工具https://www.hex-rays.com/products/decompiler/

可以从 apk 重建项目,但代码会被混淆(奇怪的 class 和方法名称)。您可以根据 apk2gold 检查您的应用程序 (https://github.com/lxdvs/apk2gold)

至于你的最后一个问题,有点努力 - 是的。

Is is possible to decode native code compiled

没有。

is it possible from the apk to reconstruct the project

是的,很多。提取 .class 个文件很容易,反编译也很容易。构建过程中的混淆步骤会使这变得更加困难。

然而,常量值和初始化器很容易从编译的 class 中获得。不要尝试 private static String SECRET = "sesame123"; 之类的东西。这一点也不难逆向工程。 - 顺便说一句,同样适用于 .so 个文件。

is it possible to use the .so files in the apk file again to reconstruct the project

没有

这取决于你对 "project" 的理解。在任何情况下,您的本机库的功能和签名可能很容易从相应的(编译的)Java class 中恢复。在编译为本机代码后,(源)代码基本上是 "lost"。如果有人知道如何使用您的共享库(很容易理解,见上文),他就可以在他喜欢的任何应用程序中使用它。

总结一下:

a) 无法从已编译的本机代码重构源代码。

b) Java 源代码更容易从已编译的 .class 文件中重建;代码的混淆会使它变得更难。

c) 您的应用程序可能具有的任何功能,无论是否是本机的,都可以很容易地被攻击者可能编写的另一个应用程序提取和利用。

另请参阅:http://en.wikipedia.org/wiki/Security_through_obscurity

is it possible from the apk to reconstruct the project and import it to eclipse (or any other IDE)?

这可以通过 dex 反编译器和 apk 资源提取器来完成。

Is is possible to decode native code compiled and liked to android through ndk ?

is it possible to use the .so files in the apk file again to reconstruct the project or with another project if the java native function declaration is done appropriately?

获得共享对象后,您可以将其包含在您自己的项目中。您可以转储库的全局符号并通过反编译的 Java 代码了解其用法。但是,如果共享对象是针对特定体系结构构建的,则您可能无法跨其他平台重建它。

Is is possible to decode native code compiled and liked to android through ndk ?

一个可以disassemble;有 C/C++ 反编译器,但对于真正复杂的代码,它们几乎没用。

and is it possible from the apk to reconstruct the project and import it to eclipse (or any other IDE)?

可以 baksmali (disassemble) 一个 .apk,修复其中的某些内容,然后再次 smali (assemble)。可以用其他函数调用替换一些函数调用,也可以添加新的 类.

反编译成Java也是可以的,但是代码很可能编译不了,所以与其说是修改,不如说是分析。

混淆后的代码仍然是可读的,前提是他们在分析上付出了一些努力。

您可以混淆代码,但他们会看到图标,他们会找到资源 ID,他们会找到 onClick() 按钮处理程序。

is it possible to use the .so files in the apk file again to reconstruct the project or with another project if the java native function declaration is done appropriately?

他们在另一个项目中使用 .so 不会有任何问题(除非有人要求他们修复 .so 中的错误)。同样,他们可以从您的 .apk 制作一个 .jar 并将该 .jar 用作另一个项目的库。

一般来说,.so 比 .jar 更难修改。