c - 我可以在 Android 本机二进制文件中使用 printf 吗?

假设手机已获得 root 权限并且可以安装 arm 二进制文件。我可以使用 Android Studio 和 printf 输出制作控制台二进制文件吗?

是否有使用带有 Android Studio 的传统 C 程序 int main() 或创建 Android.mk 文件编写和编译此类二进制文件的分步指南

GitHub 上有一些项目是这样做的:

https://github.com/strazzere/android-unpacker/tree/master/native-unpacker

https://github.com/Shabbypenguin/DexPwn

回答1

#include <stdio.h>

int main() {
  printf("Hello, world\n");
  return 0;
}

然后:

  1. ~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=aarch64-linux-android21 helloworld.c -o helloworld
  2. adb push helloworld /data/local/tmp/helloworld
  3. adb shell /data/local/tmp/helloworld

相似文章

随机推荐

最新文章