AppNinja 开发手记7:vr android注入工具inject hook EGL函数eglSwapBuffers,支持arm32,arm64(__aarch64__)
学习心得: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 detachn"); getchar(); PtraceDetach(pid); return so_handle; }
vr android注入工具inject hook EGL函数eglSwapBuffers 支持arm32,arm64
Injector,Hooker源代码下载地址:
https://download.csdn.net/download/a2831942318/49573640
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)