AppNinja 开发手记7:vr android注入工具inject hook EGL函数eglSwapBuffers源代码,支持arm32,arm64,注入apk和surfaceflinger

AppNinja 开发手记7:vr android注入工具inject hook EGL函数eglSwapBuffers,支持arm32,arm64(__aarch64__),注入apk和surfaceflinger 

学习心得:VR使用的是安卓系统,hook eglSwapBuffers,支持arm32,arm64(__aarch64__)

学习方向:VR、元宇宙、OpenGL、Hook、Inject、arm64

http://blog.csdn.net/a2831942318

Written by AppNinja 开发手记

注入VR 安卓服务或APK neweglSwapBuffers

用法:

injector com.target.apk /data/local/tmp/libmy.so

injector /system/bin/surfaceflinger /data/local/tmp/libmy64bit.so


static EGLBoolean neweglSwapBuffers(EGLDisplay dpy, EGLSurface surf) {

    LOGE("hookSuccess");

    if (NULL == original) {

        LOGE("failed to get original eglSwapBuffers");

        return EGL_FALSE;

    }

  glClearColor ( 1. , 0. , 0. , 1);  // background color

  return original(dpy, surf);

}

void __attribute__ ((constructor)) hookermain() {



#if defined(__arm__)

  LOGD("enter vr hooker_main() arm32...");

#elif defined(__aarch64__)

 LOGD("enter vr hooker_main() __aarch64__...");

#else

 LOGD("enter vr hooker_main() unknown architecture!!!");

#endif  



    LOGD("vr hooker_main() hook eglSwapBuffers...");

}
static const struct Elf_Program_Type_Map {
    const char* name;
    ElfW(Word) value;
} ELF_PROGRAM_TYPE_MAP[] = {
    {"PT_NULL", PT_NULL},
    {"PT_LOAD", PT_LOAD},
    {"PT_DYNAMIC", PT_DYNAMIC},
    {"PT_INTERP", PT_INTERP},
    {"PT_NOTE", PT_NOTE},
    {"PT_SHLIB", PT_SHLIB},
    {"PT_PHDR", PT_PHDR},
    {"PT_TLS", PT_TLS},
    {"PT_LOOS", PT_LOOS},
    {"PT_HIOS", PT_HIOS},
    {"PT_LOPROC", PT_LOPROC},
    {"PT_HIPROC", PT_HIPROC},
    {"PT_GNU_EH_FRAME", PT_GNU_EH_FRAME},
    {"PT_GNU_STACK", PT_GNU_STACK},
    {"PT_GNU_RELRO", PT_GNU_RELRO},
    {"PT_ARM_EXIDX", PT_ARM_EXIDX}
};

long InjectLibrary(pid_t pid, const char* library_path) {
  if (DEBUG) {
    printf("Injection started...\n");
  }
  PtraceAttach(pid);
  long so_handle = CallDlopen(pid, library_path);
  if (DEBUG) {
    if (!so_handle) {
      printf("Injection failed...\n");
    } else {
      printf("Injection ended succesfully...\n");
    }
  }

  printf("Press enter to dlclose and detach\n");    
  getchar();   

  PtraceDetach(pid);
  return so_handle;
}

vr android注入工具inject hook EGL函数eglSwapBuffers 支持arm32,arm64,支持注入apk和/system/bin/surfaceflinger


Injector,Hooker源代码下载地址:

vrandroid注入工具injecthookEGL函数eglSwapBuffers支持arm32,arm64源代码_androideglswapbuffers-Android文档类资源-CSDN下载

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AppNinja

你的鼓励是我创作最大的动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值