微信iOS消息拦截插件教程

编程入门 行业动态 更新时间:2024-10-24 16:30:14

微信iOS消息拦截<a href=https://www.elefans.com/category/jswz/34/1771202.html style=插件教程"/>

微信iOS消息拦截插件教程

-安装好theos框架之后,下面用一个简单的例子进行说明编译过程
-新建一个代码目录

-进入terminal,cd到刚才的目录中

1、进入目录
2、执行/opt/theos/bin/nic.pl
3、选择模板11
4、输入你的插件名字 wechat_hook
5、输入你公司的名字 com.tencent.xin,名字随意
6、输入作者的名字,author 随意
7、输入你的插件需要Hook的目标App Bundle ID ,微信的是 com.tencent.xin
8、输入安装时需要结束进程的App Bundle ID,这里直接Enter跳过
执行完毕之后你将看到目录:
-进入terminal,cd 到 wechat_hook中
1、执行make指令之后你很可能看到错误
'''
Makefile:1: /makefiles/common.mk: No such file or directory
Makefile:6: /tweak.mk: No such file or directory
make: *** No rule to make target `/tweak.mk'. Stop.
'''
这个是因为路径不对,需要在终端中添加默认环境变量
-解决编译错误,在终端中输入,export THEOS=/opt/theos
-将Tweak.xm修改为下面的代码
'''
%hook ClassName

// Hooking a class method

  • (id)sharedInstance {
    return %orig;
    }

// Hooking an instance method with an argument.

  • (void)messageName:(int)argument {
    %log; // Write a message about this call, including its class, name and arguments, to the system log.

    %orig; // Call through to the original function with its original arguments.
    %orig(nil); // Call through to the original function with a custom argument.

    // If you use %orig(), you MUST supply all arguments (except for self and _cmd, the automatically generated ones.)
    }

// Hooking an instance method with no arguments.

  • (id)noArguments {
    %log;
    id awesome = %orig;
    //[awesome doSomethingElse];
    [awesome performSelector:@selector(doSomethingElse)];

    return awesome;
    }

// Always make sure you clean up after yourself; Not doing so could have grave consequences!
%end
'''
-然后make

如果看到下面的结果表明编译成功了


如果你觉的有帮助,请赞赏一点点(1元,2元,5元),多了不要,买瓶水喝。

代码地址:

更多推荐

微信iOS消息拦截插件教程

本文发布于:2024-02-11 08:18:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1679996.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   消息   教程   iOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!