能力值:
( LV1,RANK:0 )
|
-
-
51 楼
666
|
能力值:
( LV1,RANK:0 )
|
-
-
52 楼
万里星河
经测试 指令级Hook用不了 native层并没有注册相关函数 不过so里有注册的相关代码 强制手动注册后不会崩溃了&n ...
不知道你的测试代码是什么呢,机型是什么,给的demo是默认需要点load初始化才注册的,在android7-16系统上我测试都是没问题的。
|
能力值:
( LV2,RANK:10 )
|
-
-
53 楼
try { System.loadLibrary("api"); registerAlbatrossLib(Albatross.class); Albatross.init(0); } catch (Throwable ignore) { Albatross.loadLibrary("albatross_base"); } 请问demo里的初始化代码是指上上面这个吗?但似乎没有libapi.so这个文件。 于是: 我第一版初始化代码是这样的: Albatross.loadLibrary("albatross_base"); Method onCreate = Activity.class.getDeclaredMethod("onCreate", Bundle.class); Albatross.hookInstruction(onCreate, 0, 100, new InstructionCallback() { @Override public void onEnter(Member member, Object self, int dexPc, InvocationContext invocationContext) { Log.d("Albatross","dex_Pc:" + dexPc); } }); 报错:No implementation found for int qing.albatross.core.Albatross.getRuntimeISA() (tried Java_qing_albatross_core_Albatross_getRuntimeISA and Java_qing_albatross_core_Albatross_getRuntimeISA__) - is the library loaded, e.g. System.loadLibrary?
于是我改成了这样: System.loadLibrary("albatross_base"); Method onCreate = Activity.class.getDeclaredMethod("onCreate", Bundle.class); Albatross.hookInstruction(onCreate, 0, 100, new InstructionCallback() { @Override public void onEnter(Member member, Object self, int dexPc, InvocationContext invocationContext) { Log.d("Albatross","dex_Pc:" + dexPc); } }); 报错: java.lang.UnsatisfiedLinkError: No implementation found for long qing.albatross.core.InstructionListener.hookInstructionNative(java.lang.reflect.Member, int, int, java.lang.Object) (tried Java_qing_albatross_core_InstructionListener_hookInstructionNative and Java_qing_albatross_core_InstructionListener_hookInstructionNative__Ljava_lang_reflect_Member_2IILjava_lang_Object_2) - is the library loaded, e.g. System.loadLibrary? at qing.albatross.core.InstructionListener.hookInstructionNative(Native Method) at qing.albatross.core.Albatross.hookInstruction(Albatross.java:447) at qing.albatross.core.Albatross.hookInstruction(Albatross.java:436) 于是用ida看了下 看到了注册的代码 手动注册 但这个函数似乎需要一个jmethod作为参数 于是随便传了个InstructionListener的onEnter进去: typedef void(*Func)(JNIEnv*,jobject); void* handle = dlopen("albatross_base",RTLD_LAZY); Func entry = (Func)dlsym(handle,"_ZN9albatross23InstrumentationListener23registerInstrumentationEP7_JNIEnvP8_jobject"); entry(env,obj); 不报错了 注册成功 但没有效果 测试机型: 小米6 lineageos 安卓15 小米8 官方系统 安卓10
|
能力值:
( LV2,RANK:10 )
|
-
-
54 楼
WanQing
不知道你的测试代码是什么呢,机型是什么,给的demo是默认需要点load初始化才注册的,在android7-16系统上我测试都是没问题的。
最终初始化代码如下: System.loadLibrary("albatross_base"); Method onEnter = InstructionListener.class.getDeclaredMethod("onEnter", Object.class, int.class, long.class); registerAlbatrossLib(onEnter); // Albatross.init(0); 执行会报错 Method onClick = b.class.getDeclaredMethod("onClick", DialogInterface.class, int.class); Albatross.hookInstruction(onClick, 0, 10, new InstructionCallback() { @Override public void onEnter(Member member, Object self, int dexPc, InvocationContext invocationContext) { Log.d("Albatross","dex_Pc:" + dexPc); } });
|
能力值:
( LV1,RANK:0 )
|
-
-
55 楼
万里星河
最终初始化代码如下:
System.loadLibrary("albatross_base");
Meth ...
谢谢你的反馈,已经修复了,v1.0.5的版本有问题,你可以试试最新提交的版本,在android10和android15的手机测试都是可以的
|
能力值:
( LV1,RANK:0 )
|
-
-
56 楼
代码开源不?指令Hook是怎么实现的呢?
|
能力值:
( LV2,RANK:10 )
|
-
-
57 楼
WanQing
谢谢你的反馈,已经修复了,v1.0.5的版本有问题,你可以试试最新提交的版本,在android10和android15的手机测试都是可以的
好的 我试试
|
能力值:
( LV2,RANK:10 )
|
-
-
58 楼
|
能力值:
( LV2,RANK:10 )
|
-
-
59 楼
ddd
|
能力值:
( LV2,RANK:10 )
|
-
-
60 楼
WanQing
谢谢你的反馈,已经修复了,v1.0.5的版本有问题,你可以试试最新提交的版本,在android10和android15的手机测试都是可以的
测试了以下 没有任何区别 System.loadLibrary后native函数还是没有注册 通过解析符号进行手动注册还是没效果 建议先修复注册问题
|
能力值:
( LV2,RANK:10 )
|
-
-
61 楼
6666
|
能力值:
( LV1,RANK:0 )
|
-
-
62 楼
来了
|
能力值:
( LV2,RANK:10 )
|
-
-
63 楼
666
|
能力值:
( LV1,RANK:0 )
|
-
-
64 楼
万里星河
测试了以下 没有任何区别 System.loadLibrary后native函数还是没有注册 通过解析符号进行手动注册还是没效果 建议先修复注册问题
System.loadLibrary加载是不行的,为了支持混淆,需要将类传递到AlbatrossAndroidInit注册,然后再初始化。最好先跑通demo。
|
能力值:
( LV2,RANK:10 )
|
-
-
65 楼
WanQing
System.loadLibrary加载是不行的,为了支持混淆,需要将类传递到AlbatrossAndroidInit注册,然后再初始化。最好先跑通demo。
可我就是这样做的呀: // 初始化 但hookInstruction还是未注册
AlbatrossAndroidInit(env, cls);
// 尝试手动注册
typedef void(*Func)(JNIEnv*,jobject);
void* handle = dlopen("albatross_base",RTLD_LAZY);
Func entry = (Func)dlsym(handle,"_ZN9albatross23InstrumentationListener23registerInstrumentationEP7_JNIEnvP8_jobject");
entry(env,obj);
return JNI_TRUE;
|
能力值:
( LV2,RANK:10 )
|
-
-
66 楼
6666666666
|
能力值:
( LV2,RANK:10 )
|
-
-
67 楼
System.loadLibrary("albatross_base");
System.loadLibrary("api");
registerAlbatrossLib(Albatross.class);
Albatross.init(0);extern "C"
JNIEXPORT jboolean JNICALL
Java_com_example_aliucord_MainActivity_registerAlbatrossLib(JNIEnv *env, jclass clazz,jclass albatross) {
int err_code = AlbatrossAndroidInit(env, clazz);
if (err_code)
return JNI_FALSE;
return JNI_TRUE;
}cmake_minimum_required(VERSION 3.18.1)
project("api")
add_library(
api
SHARED
native-lib.cpp)
set(JNI_LIBS_DIR ${CMAKE_SOURCE_DIR}/../jniLibs)
target_link_libraries(
api
android
${JNI_LIBS_DIR}/${ANDROID_ABI}/libalbatross_base.so
log)调用 Albatross.init(0) 会报错:
2025-08-15 03:19:10.772 22173-22173/com.example.aliucord A/libc: Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7c760cf9e7 in tid 22173 (xample.aliucord), pid 22173 (xample.aliucord)
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: Build fingerprint: 'Xiaomi/dipper/dipper:10/QKQ1.190828.002/20.9.4:user/release-keys'
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: Revision: '0'
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: ABI: 'arm64'
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: Timestamp: 2025-08-15 03:19:10+0800
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: pid: 22173, tid: 22173, name: xample.aliucord >>> com.example.aliucord <<<
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: uid: 10227
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7c760cf9e7
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: Cause: execute-only (no-read) memory access error; likely due to data in .text.
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: x0 0000007c5e0aa800 x1 0000000000000000 x2 ffffffffffffffe8 x3 0000007c5e0aa9c0
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: x4 0000007c5e0aaa28 x5 0000000000000004 x6 0000007cfc43f660 x7 0000000000000000
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: x8 0000000000000000 x9 00000000ffffffff x10 0000000000000008 x11 00000000ffffffff
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: x12 0000007c09e8cc78 x13 ffffffffffffffed x14 0000007c09f3568d x15 0000000000000000
2025-08-15 03:19:10.909 22220-22220/? A/DEBUG: x16 0000007c09f31d90 x17 0000007cfa256220 x18 0000007cfcdb2000 x19 0000007fcee16b84
2025-08-15 03:19:10.910 22220-22220/? A/DEBUG: x20 0000007fcee16b88 x21 0000007c760cf9e4 x22 0000007c5e632a40 x23 0000000000000001
2025-08-15 03:19:10.910 22220-22220/? A/DEBUG: x24 0000007c760cf9e4 x25 0000007c09a9db1d x26 0000007c760cf9e4 x27 0000000000000001
2025-08-15 03:19:10.910 22220-22220/? A/DEBUG: x28 0000000000000002 x29 0000007fcee168e0
2025-08-15 03:19:10.910 22220-22220/? A/DEBUG: sp 0000007fcee168d0 lr 0000007c09e857fc pc 0000007c09e85864
2025-08-15 03:19:11.013 22220-22220/? A/DEBUG: backtrace:
2025-08-15 03:19:11.013 22220-22220/? A/DEBUG: #00 pc 000000000001b864 /data/app/com.example.aliucord-S9BCUcPIRKMSw8Y8vC42jA==/base.apk
|
能力值:
( LV1,RANK:0 )
|
-
-
68 楼
万里星河
System.loadLibrary("albatross_base");
System.loadLibrary("api") ...
谢谢你的反馈,我这边写错了,我混淆后才发现传错参数了,是把类albatross传进去 extern "C" JNIEXPORT JNICALL jboolean Java_qing_albatross_demo_AlbatrossDemoMainActivity_registerAlbatrossLib(JNIEnv *env, jclass clazz, jclass albatross) { int err_code = AlbatrossAndroidInit(env, albatross); if (err_code) return JNI_FALSE; return JNI_TRUE; }
|
能力值:
( LV1,RANK:0 )
|
-
-
69 楼
万里星河
System.loadLibrary("albatross_base");
System.loadLibrary("api") ...
看问题可能是修改aot或jit代码是读写属性没有修改成功。可以加个vx方便交流么。
最后于 2025-8-15 10:25
被WanQing编辑
,原因:
|
能力值:
( LV2,RANK:10 )
|
-
-
70 楼
WanQing
谢谢你的反馈,我这边写错了,我混淆后才发现传错参数了,是把类albatross传进去
extern "C"
JNIEXPORT JNICALL jboolean
Java_ ...
我也在这儿疑惑了好久
|
能力值:
( LV7,RANK:103 )
|
-
-
71 楼
mark
|
能力值:
( LV2,RANK:10 )
|
-
-
72 楼
测试机型:一加五 安卓9
init不报memory access error了 但没有任何效果 代码:
System.loadLibrary("api");
registerAlbatrossLib(Albatross.class);
Albatross.init(0);
Method onCreate = Activity.class.getDeclaredMethod("onCreate", Bundle.class);
Albatross.hookInstruction(onCreate, 0, 30, new InstructionCallback()
{
@Override
public void onEnter(Member member, Object self, int dexPc, InvocationContext invocationContext)
{
Log.d("Albatross","dex_Pc:" + dexPc);
}
});
Log.d("Albatross","hook ok");日志:
2025-08-15 14:10:35.077 I/Albatross: Cannot find target constructor for static void qing.albatross.core.ClassLoaderHook.init(java.lang.ClassLoader,java.lang.Void,java.lang.String,java.lang.ClassLoader)
2025-08-15 14:10:35.078 I/Albatross: Cannot find target constructor for static void qing.albatross.core.ClassLoaderHook.initM(java.lang.ClassLoader,java.lang.ClassLoader,boolean)
2025-08-15 14:10:35.078 I/Albatross: Hooked protected java.lang.ClassLoader(java.lang.ClassLoader): hookBackup=private static void qing.albatross.core.ClassLoaderHook.init(java.lang.ClassLoader,java.lang.ClassLoader)
2025-08-15 14:10:35.078 I/Albatross: Hooked private java.lang.ClassLoader(java.lang.Void,java.lang.ClassLoader): hookBackup=static void qing.albatross.core.ClassLoaderHook.init(java.lang.ClassLoader,java.lang.Void,java.lang.ClassLoader)
2025-08-15 14:10:35.263 I/nzack.langeniu: Compiler allocated 7MB to compile int qing.albatross.core.Albatross.hookClassInternal(java.lang.Class, java.lang.ClassLoader, java.lang.Class, java.lang.Object)
2025-08-15 14:10:35.280 D/Albatross: hook ok
最后于 2025-8-15 14:21
被万里星河编辑
,原因:
|
能力值:
( LV1,RANK:0 )
|
-
-
73 楼
万里星河
测试机型:一加五 安卓9
init不报memory access error了 但没有任何效果代码:
S ...
适配好了,稍后更新,其实最早的版本都是可以的,v1.0.5优化后面尽可能提升运行速度,做了优化,导致会遗漏掉。
最后于 2025-8-15 20:03
被WanQing编辑
,原因:
|
能力值:
( LV2,RANK:10 )
|
-
-
74 楼
先生大才啊,特来学习,感谢分享技术
|
能力值:
( LV2,RANK:10 )
|
-
-
75 楼
WanQing
万里星河
测试机型:一加五&nbsp;安卓9&nbsp;
init不报memory&nb ...
嗯嗯 坐等
最后于 2025-8-15 22:38
被万里星河编辑
,原因:
|
|
|