{"id":21373598,"url":"https://github.com/itenfay/wechat_tweak","last_synced_at":"2025-05-16T15:07:31.329Z","repository":{"id":37722687,"uuid":"186655336","full_name":"itenfay/WeChat_tweak","owner":"itenfay","description":"iOS版功能最全的微信插件，支持最新版微信，具备自动抢红包，屏蔽消息和群消息，过滤特定的群聊，防止撤回消息，伪定位 (朋友圈和附近的人)，修改微信运动步数和实时取景做聊天页的背景等功能。","archived":false,"fork":false,"pushed_at":"2024-06-02T16:19:02.000Z","size":62690,"stargazers_count":872,"open_issues_count":18,"forks_count":142,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-12T11:58:40.416Z","etag":null,"topics":["clutch","dynamic-library","fake-locations","hook","icon","ios","ios-tweak","iosopendev","objective-c","package","plist","red-envelope","resign","step","theos","tweak","wechat","wechat-tweak","xcode","xm"],"latest_commit_sha":null,"homepage":"https://itenfay.github.io/2017/04/20/ios-reverse-wechat-snatches-red-envelopes-automatically/","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itenfay.png","metadata":{"files":{"readme":"README-dev.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-14T15:57:58.000Z","updated_at":"2025-04-11T13:53:32.000Z","dependencies_parsed_at":"2024-06-12T10:39:43.039Z","dependency_job_id":null,"html_url":"https://github.com/itenfay/WeChat_tweak","commit_stats":null,"previous_names":["itenfay/wechat_tweak","chenxing640/wechat_tweak"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FWeChat_tweak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FWeChat_tweak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FWeChat_tweak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FWeChat_tweak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itenfay","download_url":"https://codeload.github.com/itenfay/WeChat_tweak/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clutch","dynamic-library","fake-locations","hook","icon","ios","ios-tweak","iosopendev","objective-c","package","plist","red-envelope","resign","step","theos","tweak","wechat","wechat-tweak","xcode","xm"],"created_at":"2024-11-22T08:29:24.824Z","updated_at":"2025-05-16T15:07:26.320Z","avatar_url":"https://github.com/itenfay.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 基本原理\n\n在 app 启动时，通过 dyld (the dynamic link editor) 加载我们注入的动态库，从而进行 hook ，而之所以能够执行注入的动态库，是因为使用了 mobilesubstrate 库，这个库能在程序运行的时候动态加载注入的动态库，而非越狱手机里面是没有的，所以我们需要直接将这个库打包进 ipa 中，使用它的 API 实现注入。mobilesubstrate 库在我的 [GitHub](Dynamic%20library/dylib) 中有提供，即是 libsubstrate.dylib 。\n\n\n## 打开终端\n\nTerminal 一般 Mac 电脑自带，打开 Terminal 执行后续操作。\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/WeChat_tweak/raw/master/images/terminal.png\" width=\"20%\" /\u003e\n\u003c/div\u003e\n\n\n## 安装 theos\n\ntheos 是一个越狱开发工具包，它可以生成 iOS app 以及 tweak 等程序的框架，并提供 makefile 来编译、打包和安装。\n\n- 从 Github 下载 theos ，进行如下操作：\n\n```\nexport THEOS=/opt/theos\nrm -rf $THEOS # 如果之前已经安装过 theos，请先删除，然后下载最新版\nsudo git clone --recursive https://github.com/theos/theos.git $THEOS\n```\n\n执行命令后，显示如下：\n\n```\nCloning into '/opt/theos'...\nremote: Enumerating objects: 18, done.\nremote: Counting objects: 100% (18/18), done.\nremote: Compressing objects: 100% (14/14), done.\nremote: Total 8802 (delta 4), reused 9 (delta 4), pack-reused 8784\nReceiving objects: 100% (8802/8802), 2.20 MiB | 9.00 KiB/s, done.\nResolving deltas: 100% (5467/5467), done.\nSubmodule 'vendor/dm.pl' (https://github.com/theos/dm.pl.git) registered for path 'vendor/dm.pl'\nSubmodule 'vendor/include' (https://github.com/theos/headers.git) registered for path 'vendor/include'\nSubmodule 'vendor/lib' (https://github.com/theos/lib.git) registered for path 'vendor/lib'\nSubmodule 'vendor/logos' (https://github.com/theos/logos.git) registered for path 'vendor/logos'\nSubmodule 'vendor/nic' (https://github.com/theos/nic.git) registered for path 'vendor/nic'\nCloning into '/opt/theos/vendor/dm.pl'...\nremote: Enumerating objects: 142, done.        \nremote: Total 142 (delta 0), reused 0 (delta 0), pack-reused 142        \nReceiving objects: 100% (142/142), 54.20 KiB | 9.00 KiB/s, done.\nResolving deltas: 100% (72/72), done.\n...\n...\n...\nSubmodule path 'vendor/include/rocketbootstrap/LightMessaging': checked out '496257b11c3e906333797639355db9a43015eb50'\nSubmodule path 'vendor/lib': checked out 'b1d502cc632ec349f8e2b3df9d7630bad64fd25e'\nSubmodule path 'vendor/logos': checked out 'a54760ea60acf45fa48267b9fb344c0317d9351c'\nSubmodule path 'vendor/nic': checked out '794d210f81198c6aef4f0ab8d04bd74ffe149f51'\n```\n\n- 配置 ldid\n\nldid 是用于对 iOS 可执行文件进行签名的工具，可以在越狱 iOS 中替换 Xcode 自带的签名工具。\n\n从 [http://joedj.net/ldid](http://joedj.net/ldid) 下载，将其移动到 /opt/theos/bin 目录下，然后设置可执行权限。\n\n```\n# cd \u003c下载ldid的目录\u003e\ncd ~/Downloads/\nsudo mv ldid /opt/theos/bin\nsudo chmod 777 /opt/theos/bin/ldid\n```\n\n- 配置环境变量\n\n使用命令 `vi ~/.bash_profile` 或者 `open -e ~/.bash_profile` ，在 .bash_profile 文件的最后加入 (否则每次重启 Terminal 都要重新 export)\n\n```\nexport PATH=/opt/theos/bin:$PATH\nexport THEOS=/opt/theos\n```\n\n保存并退出，使用命令 `source ~/.bash_profile` ，立即生效。\n\n*PS:  也可以使用 [iOSOpenDev](http://iosopendev.com)*\n\niOSOpenDev 集成在 Xcode 中，提供了一些模板，可直接使用 Xcode 进行开发。只是这个工具停止更新，对高版本的 Xcode 不能很好地支持。本人安装遇到了许多问题，通过查阅许多的资料，最后在 Xcode 中显示了该工具。若安装失败，则参考 [iOSOpenDev Wiki](https://github.com/kokoabim/iOSOpenDev/wiki) 或者其它资料。\n\n\n## Tweak\n\n### 何谓 tweak ?\n\ntweak 定义是：对复杂的系统—通常是电子设备—进行微调或修改来增强其功能。而在 iOS 当中，tweak 是指那些能够增强其它进程功能的 dylib 。可以将 tweak 理解为一个外挂，只不过这个外挂是以动态链接库的方式注入到目标应用当中。我们已经很了解外挂其实就是用来做一些原本的应用无法做到的事情。\n\n### 创建 tweak\n\n使用 nic.pl 创建 tweak ，若提示无此命令，请根据上述步骤配置环境变量，或者不嫌麻烦使用 /opt/theos/bin/nic.pl ，根据提示选择 iphone/tweak ，接着分别输入：\n\n- 项目名\n- 该 deb 包的名字（类似 bundle identifier，此 bundle identifier 与要 hook 的 app 的 bundle identifier 不是同一个）\n- 作者/维护者\n- tweak 作用对象的 bundle identifier（比如微信为com.tencent.xin）\n- tweak 安装完成后需要重启的应用名（比如微信为WeChat）\n\n如下图所示：\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/WeChat_tweak/raw/master/images/nic_create_tweak.png\" width=\"60%\" /\u003e\n\u003c/div\u003e\n\n完成后会看到四个文件( make 后将生成 .theos 、obj 文件夹)：**Makefile,\u0026nbsp; wcodtplugin.plist,\u0026nbsp; control,\u0026nbsp; Tweak.xm**。\n\n- Makefile\n\n工程用到的文件、框架、库等信息。该文件过于简单，还需要添加一些信息，如：\u003cbr /\u003e\n\n指定处理器架构 `ARCHS = armv7 arm64` \u003cbr /\u003e\n指定 SDK 版本 `TARGET = iphone:latest:8.0` \u003cbr /\u003e\n导入所需的 framework 等。\u003cbr /\u003e\n\n修改后的 Makefile 文件如下所示：\n\n```\nARCHS = armv7 arm64\nTARGET = iphone:latest:8.0\nTHEOS_MAKE_PATH = /opt/theos/makefiles\n\ninclude $(THEOS_MAKE_PATH)/common.mk\n\nTWEAK_NAME = wcodtplugin\n$(TWEAK_NAME)_FILES = $(wildcard src/*.m) src/Tweak.xm\n$(TWEAK_NAME)_FRAMEWORKS = UIKit AVFoundation CoreLocation\n\nsrc/xxa.m_CFLAGS = -fobjc-arc\n...\nsrc/xxz.m_CFLAGS = -fobjc-arc\n\ninclude $(THEOS_MAKE_PATH)/tweak.mk\n\nafter-install::\n    install.exec \"killall -9 WeChat\"\n```\n\n- wcodtplugin.plist\n\n该文件中的 Bundles : 指定 bundle 为 tweak 的作用对象，也可添加多个 bundle ，指定多个为 tweak 作用对象。\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/WeChat_tweak/raw/master/images/tweak_plist.png\" width=\"60%\" /\u003e\n\u003c/div\u003e\n\n- control\n\n该 tweak 所需的基本信息 (其实大部分都是创建 tweak 所填写的信息) \n\n```\nPackage: com.aple.wcodtplugin\nName: wcodtplugin\nDepends: mobilesubstrate\nVersion: 0.0.1 # 版本号\nArchitecture: iphoneos-arm\nDescription: An awesome MobileSubstrate tweak! # 填写项目描述\nMaintainer: dyf # 维护者\nAuthor: dyf # 作者\nSection: Tweaks\n```\n\n- Tweak.xm\n\n重点文件，用来编写 hook 代码，因为支持 Logos 和 C/C++ 语法，可以让我们不用去写一些 runtime 方法 (必要时候还是要写) ，从而进行 hook 。\n\nPS:  .x 文件支持 Logos 语法，.xm 文件支持 Logos 和 C/C++ 语法。\n\n### Logos 常用语法\n\n- %hook\n\n指定需要 hook 的类，以%end结尾。\n\n- %orig\n\n在 %hook 内部使用，执行 hook 住的方法原代码。\n\n- %new\n\n在 %hook 内部使用，给 class 添加新方法，与 class_addMethod 相同。\u003cbr /\u003e\n与 Category 中添加方法的区别：Category 为编译时添加，class_addMethod 为动态添加。\u003cbr /\u003e\nwarning ：添加的方法需要在 @interface 中进行声明。 \u003cbr /\u003e\n\n- %c\n\n获取一个类，等同于 objc_getClass 、NSClassFromString 。\n\n- MSHookIvar\u003cid\u003e(self, \"m_tableViewMgr\")\n\n在 %hook 内部使用，获取一个类的私有成员变量。\n\n\u003e %hook、%log、%orig 等都是 mobilesubstrate 的 MobileHooker 模块提供的宏，除此之外还有 %group  %init  %ctor 等，其实也就是把 method swizzling 相关的方法封装成了各种宏标记，若想深入了解，请左转 [Google](https://www.google.com) 或者 [Baidu](https://www.baidu.com) 。\n\n### 编写 Tweak.xm\n\n在熟悉各种语法之后，可以进行编写代码了，其中 MMUIViewController 为微信的基础的 ViewController 。我们通过 hook viewDidApper: 来进行 Hello World! 弹窗。 \n\n编写一个 hook 接口声明头文件 `HookInterfaceStatment.h`，代码如下：\n\n```\n@interface MMUIViewController : UIViewController\n\n- (void)startLoadingBlocked;\n- (void)startLoadingNonBlock;\n- (void)startLoadingWithText:(NSString *)text;\n- (void)stopLoading;\n- (void)stopLoadingWithFailText:(NSString *)text;\n- (void)stopLoadingWithOKText:(NSString *)text;\n\n// Added method.\n- (void)helloWorld;\n\n@end\n```\n\n编写 Tweak.xm ，代码如下：\n\n```\n#import \"HookInterfaceStatment.h\"\n\n%hook MMUIViewController\n\n- (void)viewWillAppear:(_Bool)arg1 {\n    %orig;\n    [self helloWorld];\n}\n\n%new\n- (void)helloWorld {\n    UIAlertController *alertController = ({\n        UIAlertController *_alertController = [UIAlertController alertControllerWithTitle:@\"Hello World!\" message:nil preferredStyle:UIAlertControllerStyleAlert];\n        [_alertController addAction:[UIAlertAction actionWithTitle:@\"确定\" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {}]];\n        [_alertController addAction:[UIAlertAction actionWithTitle:@\"取消\" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {}]];\n        _alertController;\n    });\n    [self presentViewController:alertController animated:YES completion:NULL];\n}\n\n%end\n```\n\n### 编译\n\n使用 `make` 进行编译，若想重新编译，则先 `make clean` 。make 编译完成后，在当前文件夹下面将生成两个文件夹: .theos 与 obj ，其中编译完成的动态库就在 .thoes/obj/debug 的下面，与工程名相同。\n\n#### 问题描述和解决方法\n\n- 问题1\n\n```\nMakefile:6: theos/makefiles/common.mk: Not a directory\nMakefile:25: /tweak.mk: No such file or directory\nmake: *** No rule to make target `/tweak.mk'.  Stop.\n```\n\n解决办法：首先确保安装并配置了 theos ，其次修改 Makefile 文件，在 `$(THEOS)/makefiles` 代码行上方定义 `THEOS_MAKE_PATH = /opt/theos/makefiles` ，将 `$(THEOS)/makefiles` 替换成 `$(THEOS_MAKE_PATH)` 。\n\n- 问题2\n\n```\nbash: ldid: command not found\nmake[2]: *** [/Users/xxx/Desktop/wcodtplugin/.theos/obj/debug/wcodtplugin.dylib] Error 6\nrm /Users/xxx/Desktop/wcodtplugin/.theos/obj/debug/wcodtplugin.dylib.47ba6b93.unsigned\nmake[1]: *** [internal-library-all_] Error 2\nmake: *** [wcodtplugin.all.tweak.variables] Error 2\n```\n\n解决办法：按照配置 ldid 步骤执行，重新编译。\n\n- 问题3\n\n```\nxcrun: error: SDK \"iphoneos\" cannot be located\nxcrun: error: SDK \"iphoneos\" cannot be located\n==\u003e Error: You do not have any SDKs in /Library/Developer/CommandLineTools/Platforms/iPhoneOS.platform/Developer/SDKs or /opt/theos/sdks.\nmake: *** [before-all] Error 1\n```\n\n解决办法：在终端执行命令 `sudo xcode-select --switch /Applications/Xcode.app` 即可。\n\n\n- 问题4 (代码报错)\n\n```\n\u003e Making all for tweak wcodtplugin…\n==\u003e Preprocessing Tweak.xm…\n==\u003e Compiling Tweak.xm (armv7)…\nTweak.xm:5:26: error: expected ';' after expression\n... UIAlertController *_alertController = [UIAlertController alertControllerWithTitle...\n                            ^\n                            ;\n1 error generated.\nmake[3]: *** [/Users/xxx/Desktop/wcodtplugin/.theos/obj/debug/armv7/Tweak.xm.8aee9f68.o] Error 1\nrm /Users/xxx/Desktop/wcodtplugin/.theos/obj/debug/armv7/Tweak.xm.mm\nmake[2]: *** [/Users/xxx/Desktop/wcodtplugin/.theos/obj/debug/armv7/wcodtplugin.dylib] Error 2\nmake[1]: *** [internal-library-all_] Error 2\nmake: *** [wcodtplugin.tweak.variables] Error 2\n```\n\n解决办法：根据错误提示，找到报错的代码进行修改，重新编译。\n\n- 问题5 (打包出错)\n\n```\n\u003e Making all for tweak wcodtplugin…\nmake[2]: Nothing to be done for `internal-library-compile'.\n\u003e Making stage for tweak wcodtplugin…\nCan't locate IO/Compress/Lzma.pm in @INC (you may need to install the IO::Compress::Lzma module) (@INC contains: /usr/local/Cellar/perl/5.26.2/lib/perl5/site_perl/5.26.2/darwin-thread-multi-2level /usr/local/Cellar/perl/5.26.2/lib/perl5/site_perl/5.26.2 /usr/local/Cellar/perl/5.26.2/lib/perl5/5.26.2/darwin-thread-multi-2level /usr/local/Cellar/perl/5.26.2/lib/perl5/5.26.2 /usr/local/lib/perl5/site_perl/5.26.2/darwin-thread-multi-2level /usr/local/lib/perl5/site_perl/5.26.2) at /opt/theos/bin/dm.pl line 12.\nBEGIN failed--compilation aborted at /opt/theos/bin/dm.pl line 12.\nmake: *** [internal-package] Error 2\n```\n\n解决办法：\n\n```\n1. /opt/theos/vendor/dm.pl/dm.pl\n# 注释掉第12、13行\n# use IO::Compress::Lzma;\n# use IO::Compress::Xz;\n\n2. /opt/theos/makefiles/package/deb.mk\n# 第6行 lzma 改为 gzip\n_THEOS_PLATFORM_DPKG_DEB_COMPRESSION ?= gzip\n```\n\n最后重新 make package ，成功了。\n\n\n## 获取砸壳版本的微信\n\n1. 百度网盘下载\n\n[https://pan.baidu.com/s/1eT3tgfQRjIHUu3PL77YY9Q - 提取码：o8sa](https://pan.baidu.com/s/1eT3tgfQRjIHUu3PL77YY9Q)\n\n2. SSH 服务\n\n实现在越狱手机上远程进行 ssh 服务，在 Cydia 中安装 OpenSSH 。\n\n- ssh : 远程登录\n\n```\n# 指令 ssh user@ip\nssh mobile@192.168.6.6\n```\n\n- scp : 远程拷贝\n\n本地文件拷贝到 iOS 上 (若从 iOS 上拷贝到本地，则相反) 。\n\n```\n# 指令 scp /path/to/localFile user@ip:/path/to/remoteFile\nscp ~/Desktop/icon.png root@192.168.6.6:/var/tmp/\n```\n\n\u003e 注意，OpenSSH 默认登录密码为 alpine ，iOS 上的用户只有 root 和 mobile，修改密码使用 passwd root (mobile) 。\n\n3. 使用 Clutch 对越狱手机上的应用进行砸壳\n\n- 将 Cluth 仓库 clone 到本地：\n\n```\ngit clone https://github.com/KJCracks/Clutch\ncd Clutch\n```\n\n- 使用 Xcode 进行构建，得到可执行文件：\n\n```\nxcodebuild -project Clutch.xcodeproj -configuration Release ARCHS=\"armv7 arm64\" build\n```\n\n- 将可执行文件 clutch 拷贝到手机上：\n\n```\nscp Clutch/clutch root@\u003cyour.device.ip\u003e:/usr/bin/\n```\n\n- 先 ssh 到越狱手机上，然后查看当前安装的应用：\n\n```\nssh root@\u003cyour.device.ip\u003e\n\n# 列出当前安装的应用\nclutch -i\n\n# Installed apps:\n# 1: WeChat \u003ccom.tencent.xin\u003e\n# ...\n```\n\n- 开始砸壳\n\n```\n# clutch -d \u003cbundle identifier\u003e\nclutch -d com.tencent.xin\n\n# Zipping WeChat.app\n# Swapping architectures..\n# ASLR slide: 0xb3000\n# ...\n# writing new checksum\n# DONE: /private/var/mobile/Documents/Dumped/com.tencent.xin-iOS9.2-(Clutch-2.0.4).ipa\n# Finished dumping com.tencent.xin in 76.9 seconds\n```\n\n- 将砸完壳的 ipa 包拷回 Mac 电脑上\n\n```\nmv /private/var/mobile/Documents/Dumped/com.tencent.xin-iOS9.2-\\(Clutch-2.0.4\\).ipa /private/var/mobile/Documents/Dumped/WeChat.ipa\n\nscp root@\u003cyour.device.ip\u003e:/private/var/mobile/Documents/Dumped/WeChat.ipa ~/Desktop/\n```\n\n\n## 解压 ipa \n\n```\n# cd \u003c微信ipa下载目录\u003e\ncd ~/Downloads/\n\n# 以 微信-7.0.5 版本为例，注意：下载的版本必须为破解版，如何查看？请阅读查看 app 是否被加密 (Check app)\nunzip -o 微信-7.0.5\\(越狱应用\\).ipa -d ./\n\n# 静默解压 (Unzip ipa)\n# unzip -q -o 微信-7.0.5\\(越狱应用\\).ipa -d ./\n\n# 将 Payload 移至桌面\nmv ./Payload/ ~/Desktop/\n```\n\n\n## 查看 app 是否被加密\n\notool 可以输出 app 的 load commands，然后通过查看 cryptid 这个标志位来判断 app 是否被加密，1：代表加密，0：代表被解密。\n\n```\n# 进入桌面\ncd ~/Desktop/\n\n# 查看 app 是否被加密\notool -l Payload/WeChat.app/WeChat | grep -B 2 crypt\n```\n\n结果显示如下：\n\n```\notool -l Payload/WeChat.app/WeChat | grep -B 2 crypt\n          cmd LC_ENCRYPTION_INFO_64\n      cmdsize 24\n     cryptoff 16384\n    cryptsize 100237312\n      cryptid 0\n```\n\n\n## 导出动态库\n\n### 克隆仓库\n\n```\n# 进入桌面\ncd ~/Desktop/\n\n# 克隆 (Clone Repository)\ngit clone https://github.com/itenfay/WeChat_tweak.git\n```\n\n### 编译 tweak 项目\n\n```\ncd WeChat_tweak/WeChatPluginDev/wapleodtcorexpc/\n# compile tweak project\nmake\n```\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/WeChat_tweak/raw/master/images/tweak_make.png\" width=\"60%\" /\u003e\n\u003c/div\u003e\n\n编译时出现的问题或错误，请查看上述 **Tweak** 小节中 **编译** 提及的 [问题描述和解决方法](#问题描述和解决方法)。\n\n### 导出\n\n将动态库拷贝至桌面：\n\n```\n# 将 wapleodtcorexpc.dylib 库拷贝至桌面\ncp .theos/obj/debug/wapleodtcorexpc.dylib ~/Desktop/\n\n# 直接打开目录，将 wapleodtcorexpc.dylib 库拷贝或拖拽至桌面\n# open .theos/obj/debug/\n```\n\n\n## 更改动态库的依赖\n\n将 libsubstrate.dylib 库拷贝至桌面：\n\n```\n# 进入桌面\ncd ~/Desktop/\n\n# 将 libsubstrate.dylib 库拷贝至桌面\ncp WeChat_tweak/Dynamic\\ library/dylib/libsubstrate.dylib ~/Desktop/\n```\n\n右键 wapleodtcorexpc.dylib ，选择显示简介，在名称与扩展名处将 wapleodtcorexpc.dylib 修改成 wapleodtcorexpc ，回车并移除。\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/WeChat_tweak/raw/master/images/rm_ext.png\" width=\"60%\" /\u003e\n\u003c/div\u003e\n\n同理，右键 libsubstrate.dylib ，选择显示简介，在名称与扩展名处将 libsubstrate.dylib 修改成 waplesubstrate ，回车并移除。\n\n执行更改动态库的依赖 (Change Dynamic Library Dependencies) 命令：\n\n```\ninstall_name_tool -change /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate @loader_path/waplesubstrate wapleodtcorexpc\n```\n\n查看依赖项，检查是否更改成功，使用以下命令：\n\n```\notool -L wapleodtcorexpc\n```\n\n显示如下：\n\n```\nwapleodtcorexpc (architecture armv7):\n    /Library/MobileSubstrate/DynamicLibraries/wapleodtcorexpc.dylib (compatibility version 0.0.0, current version 0.0.0)\n    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)\n    /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1570.15.0)\n    /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1570.15.0)\n    /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 61000.0.0)\n    /System/Library/Frameworks/AVFoundation.framework/AVFoundation (compatibility version 1.0.0, current version 2.0.0)\n    /System/Library/Frameworks/CoreLocation.framework/CoreLocation (compatibility version 1.0.0, current version 2245.12.30)\n    @loader_path/waplesubstrate (compatibility version 0.0.0, current version 0.0.0)\n    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)\n    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)\n    /System/Library/Frameworks/CoreVideo.framework/CoreVideo (compatibility version 1.2.0, current version 1.5.0)\nwapleodtcorexpc (architecture arm64):\n    /Library/MobileSubstrate/DynamicLibraries/wapleodtcorexpc.dylib (compatibility version 0.0.0, current version 0.0.0)\n    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)\n    /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1570.15.0)\n    /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1570.15.0)\n    /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 61000.0.0)\n    /System/Library/Frameworks/AVFoundation.framework/AVFoundation (compatibility version 1.0.0, current version 2.0.0)\n    /System/Library/Frameworks/CoreLocation.framework/CoreLocation (compatibility version 1.0.0, current version 2245.12.30)\n    @loader_path/waplesubstrate (compatibility version 0.0.0, current version 0.0.0)\n    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)\n    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)\n    /System/Library/Frameworks/CoreVideo.framework/CoreVideo (compatibility version 1.2.0, current version 1.5.0)\n```\n\nCydiaSubstrate 只有越狱的手机上才有，因此我们需要手动更改并导入。从上可见，`/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate` 更改成了 `@loader_path/waplesubstrate` ，这表明动态库的依赖更改成功。\n\n\n## 移除架构\n\n对于没有强迫证的同学来说，可略过这步 (Remove Architectures) 。目前 `WeChat` 可执行文件只有 `arm64` 架构，在以前版本中，若移除 `armv7` 架构，则可以大大减少包的大小，以节省手机空间。\n\n```\n# 进入桌面，确保当前在桌面上操作\ncd ~/Desktop/\n\nlipo -info waplesubstrate \n# Architectures in the fat file: waplesubstrate are: armv7 arm64 \n\nlipo waplesubstrate -remove armv7 -output ./waplesubstrate \n\nlipo -info waplesubstrate \n# Architectures in the fat file: waplesubstrate are: arm64 \n\nlipo -info wapleodtcorexpc \n# Architectures in the fat file: wapleodtcorexpc are: armv7 arm64\n\nlipo wapleodtcorexpc -remove armv7 -output ./wapleodtcorexpc\n\nlipo -info wapleodtcorexpc \n# Architectures in the fat file: wapleodtcorexpc are: arm64\n```\n\n\n## 建议\n\n如果您要将动态库 **wapleodtcorexpc** 和 **waplesubstrate** 修改成自定义的名字，那么只要将 **wapleodtcorexpc** 工程名和 **Makefile、control、xxx.plist** 文件内的部分信息一并修改，然后从步骤 **[编译 tweak 项目](#编译-tweak-项目)** 重新开始操作。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitenfay%2Fwechat_tweak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitenfay%2Fwechat_tweak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitenfay%2Fwechat_tweak/lists"}