Giter Site home page Giter Site logo

Comments (20)

jmpews avatar jmpews commented on July 23, 2024

用下面的生成 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

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

我没看到这个是啥操作,直接复制到命令行会提示不能识别cmake这个命令 😳
另外就是,我已经有一个Xcode工程了,如何直接引入你的框架呢?我用monkeyDev去生成这个工程的,如果直接再来一个工程,不知道能不能兼容。。

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

打错,没看懂这是要怎么操作?

from dobby.

jmpews avatar jmpews commented on July 23, 2024

用过 cmake 么?

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

@jmpews 安装好cmake了,也编译通过了,怎么集成到我的已有的工程呢?

from dobby.

jmpews avatar jmpews commented on July 23, 2024

hmm 两个 Xcode 不会集成嘛? :(

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

我用第一种方式的,编译完了生成了一些文件,不知道怎么用到Xcode工程里
image

from dobby.

jmpews avatar jmpews commented on July 23, 2024

emmmmmm... 建议你先看下 cmake 怎么用.

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

生成了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

大神指教一下?

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

cstdarg这个文件,在Xcode的工程里,是可以找到的。。

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

我用这个仓库提供的静态库直接拖到工程里可以运行了 https://github.com/yuzhouheike/HookZz-Learn
虽然自己编译失败了,还是感谢作者~

from dobby.

chenzhengxu avatar chenzhengxu commented on July 23, 2024

@kobe1941 @jmpews hookobjc_msgSend方法的时候,一些系统调用的方法并不会获取到,比如viewDidLoad是故意屏蔽了吗

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

@chenzhengxu 你是怎么hook的,截图放一下?
我用旧版本可以hook到所有的函数,不过太耗性能了就去掉了

from dobby.

chenzhengxu avatar chenzhengxu commented on July 23, 2024
+ (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

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

我可以hook到所有的函数的,你看看是不是被过滤掉了

from dobby.

chenzhengxu avatar chenzhengxu commented on July 23, 2024

我这边没有过滤操作,https://github.com/everettjf/AppleTrace这个库也用了hookzz,也不会打印所有函数,你有哪个工程可以hook所有函数的吗,有没有地址给看下

from dobby.

kobe1941 avatar kobe1941 commented on July 23, 2024

我用旧版本的可以hook,不过用了新版本后就不行了,hook失败,作者也没告诉我怎么用o(╯□╰)o

from dobby.

jmpews avatar jmpews commented on July 23, 2024

from dobby.

chenzhengxu avatar chenzhengxu commented on July 23, 2024

@jmpews 请问下,hookobjc_msg_send的时候是如何屏蔽一大堆系统方法的

from dobby.

jmpews avatar jmpews commented on July 23, 2024

from dobby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.