Closed kobe1941 closed 5 years ago
用下面的生成 Xcode 工程
cmake .. -G Xcode \
-DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake \
-DIOS_PLATFORM=OS \
-DIOS_ARCH=arm64 \
-DENABLE_ARC=FALSE \
-DENABLE_BITCODE=OFF \
-DDEBUG=ON \
-DSHARED=ON \
-DPLATFORM=iOS \
-DARCH=armv8 \
-DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release
我没看到这个是啥操作,直接复制到命令行会提示不能识别cmake这个命令 😳 另外就是,我已经有一个Xcode工程了,如何直接引入你的框架呢?我用monkeyDev去生成这个工程的,如果直接再来一个工程,不知道能不能兼容。。
打错,没看懂这是要怎么操作?
用过 cmake 么?
@jmpews 安装好cmake了,也编译通过了,怎么集成到我的已有的工程呢?
hmm 两个 Xcode 不会集成嘛? :(
我用第一种方式的,编译完了生成了一些文件,不知道怎么用到Xcode工程里
emmmmmm... 建议你先看下 cmake 怎么用.
生成了Xcode工程,尝试做最后一步:make -j4 终端里报错了:
/Users/hufeng/Documents/backup/HookZz/./srcxx/AssemblyClosureTrampoline.h/Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/platform/platform.h::44::1010:: fatal errorfatal error: :
'iostream' 'cstdarg'file filenot notfound found
#include <iostream>#include <cstdarg>
^~~~~~~~~~ ^~~~~~~~~
1 warning generated.
In file included from /Users/hufeng/Documents/backup/HookZz/srcxx/vm_core/arch/cpu.cc:2:
In file included from /Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/arch/cpu.h:4:
In file included from /Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/globals.h:4:
In file included from /Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/macros.h:7:
In file included from /Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/logging.h:4:
/Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/platform/platform.h:4:10: fatal error:
'cstdarg' file not found
#include <cstdarg>
^~~~~~~~~
[ 20%] Building CXX object CMakeFiles/hookzz.dir/srcxx/vm_core/objects/code.cc.o
1 warning and 1 error generated.
make[2]: *** [CMakeFiles/hookzz.dir/srcxx/vm_core/logging.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the
command line to use the libc++ standard library instead
[-Wstdlibcxx-not-found]
1 warning and 1 error generated.
1 warning and 1 error generated.
make[2]: *** [CMakeFiles/hookzz.dir/srcxx/vm_core/arch/cpu.cc.o] Error 1
make[2]: *** [CMakeFiles/hookzz.dir/srcxx/intercept_routing_handler.cc.o] Error 1
In file included from /Users/hufeng/Documents/backup/HookZz/srcxx/vm_core/objects/code.cc:1:
In file included from /Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/objects/code.h:4:
In file included from /Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/globals.h:4:
In file included from /Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/macros.h:7:
In file included from /Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/logging.h:4:
/Users/hufeng/Documents/backup/HookZz/./srcxx/vm_core/platform/platform.h:4:10: fatal error:
'cstdarg' file not found
#include <cstdarg>
^~~~~~~~~
1 warning and 1 error generated.
make[2]: *** [CMakeFiles/hookzz.dir/srcxx/vm_core/objects/code.cc.o] Error 1
make[1]: *** [CMakeFiles/hookzz.dir/all] Error 2
make: *** [all] Error 2
大神指教一下?
cstdarg这个文件,在Xcode的工程里,是可以找到的。。
我用这个仓库提供的静态库直接拖到工程里可以运行了 https://github.com/yuzhouheike/HookZz-Learn 虽然自己编译失败了,还是感谢作者~
@kobe1941 @jmpews hookobjc_msgSend
方法的时候,一些系统调用的方法并不会获取到,比如viewDidLoad
是故意屏蔽了吗
@chenzhengxu 你是怎么hook的,截图放一下? 我用旧版本可以hook到所有的函数,不过太耗性能了就去掉了
+ (void)load {
[self hook_objc_msgSend];
}
+ (void)hook_objc_msgSend {
ZzHookGOT(NULL,"objc_msgSend", NULL, NULL, objc_msgSend_pre_call, objc_msgSend_post_call);
}
void objc_msgSend_pre_call(RegState *rs, ThreadStackPublic *ts, CallStackPublic *cs, const HookEntryInfo *info) {
char *selector = (char *)rs->ZREG(1);
id tmpObject = (id)rs->ZREG(0);
Class tmpClass = object_getClass(tmpObject);
if (!tmpClass)
return;
const char *className = class_getName(tmpClass);
long log_time = log_timeInterval();
stack.push({className, selector, log_time, 0});
}
void objc_msgSend_post_call(RegState *rs, ThreadStackPublic *ts, CallStackPublic *cs, const HookEntryInfo *info) {
long log_time = log_timeInterval();
MethodItem *item = &stack.top();
item->post_time = log_time;
printf("end:[thread:|%ld] [%s %s] startTime:[%ld] endTime:[%ld]\n", ts->thread_id, item->className, item->selector, item->pre_time, item->post_time);
stack.pop();
}
与https://github.com/yuzhouheike/HookZz-Learn
的方式一样 @kobe1941
我可以hook到所有的函数的,你看看是不是被过滤掉了
我这边没有过滤操作,https://github.com/everettjf/AppleTrace
这个库也用了hookzz,也不会打印所有函数,你有哪个工程可以hook所有函数的吗,有没有地址给看下
我用旧版本的可以hook,不过用了新版本后就不行了,hook失败,作者也没告诉我怎么用o(╯□╰)o
hook 这个 objc_msgSend 会有坑, 出触发 libMainChecker.dylib 的校验, 需要另外一段时间修复, 目前在关注 dev branch 以及一些插件.
kobe1941 notifications@github.com 于2019年4月8日周一 下午6:26写道:
我用旧版本的可以hook,不过用了新版本后就不行了,hook失败,作者也没告诉我怎么用o(╯□╰)o
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jmpews/HookZz/issues/44#issuecomment-480775339, or mute the thread https://github.com/notifications/unsubscribe-auth/AEcgNb2tql-5_rj-ySS-AN4hQP65DLkiks5vexlUgaJpZM4X95CF .
@jmpews 请问下,hookobjc_msg_send
的时候是如何屏蔽一大堆系统方法的
通过 x0(this), x1(selector) 的地址.
更好的方法是不要 inlinehook objc_msgSend, 通过 fishhook 限定在 binary image 的 objc_msgSend.
Johnny notifications@github.com 于2019年4月10日周三 下午4:57写道:
@jmpews https://github.com/jmpews 请问下,hookobjc_msg_send的时候是如何屏蔽一大堆系统方法的
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jmpews/HookZz/issues/44#issuecomment-481603922, or mute the thread https://github.com/notifications/unsubscribe-auth/AEcgNQ1pKFjcWKuwzyj4sCGw85yxv1lHks5vfad9gaJpZM4X95CF .
如题,readme看不懂里边的步骤,我现在有一个Xcode工程,想用hookzz来打印函数的调用,如何集成呢?