首页   注册   登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
华为云
V2EX  ›  Android

菜鸟关于 Cydia Substrate 的问题

  •  
  •   chenqh · 3 天前 · 398 次点击

    现象

    日志提示: can not find libnative-lib.
    

    C++代码

    #include <jni.h>
    #include "substrate.h"
    #include <android/log.h>
    #include <unistd.h>
    #include <stdio.h>
    #include <fcntl.h>
    #include <sys/types.h>
    #include <string.h>
    #include <sys/stat.h>
    
    #define TAG "HOOKTEST"
    #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
    #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
    
    //MSConfig(MSFilterLibrary, "libnative-lib.so");
    MSConfig(MSFilterExecutable, "/system/bin/app_process");
    
    bool (*_dvmLoadNativeCode)(char* pathName, void* classLoader, char** detail);
    
    bool fake_dvmLoadNativeCode(char* soPath, void* classLoader, char** detail)
    {
    	LOGD("fake_dvmLoadNativeCode soPath:%s", soPath);
    	return _dvmLoadNativeCode(soPath,classLoader,detail);
    }
    char* (*getFromNativeString) (void);
    
    char* newhello(void)
    {	static char str[] = "hello better tomorrow";
    //    return "hello better tomorrow from cqh";
    	return str;
    }
    
    //Substrate entry point
    MSInitialize{
        LOGD("Substrate initialized.");
    //    LOGD();
        MSImageRef image;
        image = MSGetImageByName("/data/app-lib/zcgames.com.cynativeexample-1/libnative-lib.so"); // ¾ø¶Ô·¾¶
        if (image != NULL)
        {
        	LOGD("dvm image: 0x%08X", (void*)image);
    
            void * dvmload = MSFindSymbol(image, "createHello");
            LOGD("Search createHello");
            if(dvmload == NULL)
            {
                LOGD("error find createHello.");
            }
            else
            {	MSHookFunction(dvmload, (void*)&fake_dvmLoadNativeCode, (void **)&_dvmLoadNativeCode);
            //	MSHookFunction(dvmload,(void*)&newhello,(void **)&getFromNativeString);
    			LOGD("hook createHello sucess.");
            }
        }
        else{
            LOGD("can not find libnative-lib.");
        }
    }
    
    

    app so 的路径为data/data/zcgames.com.cynativeexample/libnative-lib.so, 而在内存中的名字为

    root@hammerhead:/ # cat /proc/1855/maps | grep "libnative"
    402af000-402b3000 r-xp 00000000 b3:19 970        /system/lib/libnativehelper.so
    402b3000-402b4000 r--p 00003000 b3:19 970        /system/lib/libnativehelper.so
    402b4000-402b5000 rw-p 00004000 b3:19 970        /system/lib/libnativehelper.so
    75615000-75618000 r-xp 00000000 b3:1c 1638427    /data/app-lib/zcgames.com.cynativeexample-1/libnative-lib.so
    75618000-75619000 r--p 00002000 b3:1c 1638427    /data/app-lib/zcgames.com.cynativeexample-1/libnative-lib.so
    75619000-7561a000 rw-p 00003000 b3:1c 1638427    /data/app-lib/zcgames.com.cynativeexample-1/libnative-lib.so
    root@hammerhead:/ #
    

    现在问题为什么问题提示找不到 library 呢 ?有大佬指点下吗?

    目前尚无回复
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   2221 人在线   最高记录 3762   ·  
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.1 · 22ms · UTC 13:19 · PVG 21:19 · LAX 06:19 · JFK 09:19
    ♥ Do have faith in what you're doing.
    沪ICP备16043287号-1