1.如今pp助手下載越獄微信app,並改名爲wechatc++
2.準備 dylib 動態連接庫git
2.1首先安裝越獄開發工具包theosgithub
export THEOS=/opt/theos # 若是以前已經安裝過 theos,請先刪除,而後下載最新版 rm -rf $THEOS sudo git clone --recursive https://github.com/theos/theos.git $THEOS
2.2配置ldid,xcode
從 http://joedj.net/ldid下載微信
cd <下載ldid的目錄> sudo mv ldid /opt/theos/bin sudo chmod 777 /opt/theos/bin/ldid
2.3下載紅包連接庫app
git clone https://github.com/buginux/WeChatRedEnvelop.git $ cd WeChatRedEnvelop $ make # > Making all for tweak WeChatRedEnvelop… # ==> Preprocessing Tweak.xm… # ==> Compiling Tweak.xm (armv7)… # ==> Compiling XGPayingViewController.m (armv7)… # ... # ==> Signing WeChatRedEnvelop… $ cp .theos/obj/debug/WeChatRedEnvelop.dylib ~/Desktop # 注意是 .theos 目錄,這是個隱藏目錄
3.檢查依賴項工具
cd ~/Desktop ➜ Desktop otool -L WeChatRedEnvelop.dylib WeChatRedEnvelop.dylib (architecture armv7): /Library/MobileSubstrate/DynamicLibraries/WeChatRedEnvelop.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1450.14.0) /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1450.14.0) /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 3698.33.6) /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.1) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0) WeChatRedEnvelop.dylib (architecture arm64): /Library/MobileSubstrate/DynamicLibraries/WeChatRedEnvelop.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1450.14.0) /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1450.14.0) /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 3698.33.6) /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.1) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
4.使用install_name_tool 命令修改動態庫依賴庫的路徑,指向 app 二進制文件的同級目錄。開發工具
➜ Desktop install_name_tool -change /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate @loader_path/libsubstrate.dylib WeChatRedEnvelop.dylib ➜ Desktop otool -L WeChatRedEnvelop.dylib WeChatRedEnvelop.dylib (architecture armv7): /Library/MobileSubstrate/DynamicLibraries/WeChatRedEnvelop.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1450.14.0) /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1450.14.0) /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 3698.33.6) @loader_path/libsubstrate.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.1) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0) WeChatRedEnvelop.dylib (architecture arm64): /Library/MobileSubstrate/DynamicLibraries/WeChatRedEnvelop.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1450.14.0) /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1450.14.0) /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 3698.33.6) @loader_path/libsubstrate.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.1) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0) ➜ Desktop ll
5.將動態連接庫注入到二進制文件ui
# 由於 optool 添加了 submodule,由於須要使用 --recuresive 選項,將子模塊所有 clone 下來 $ git clone --recursive https://github.com/alexzielenski/optool.git $ cd optool $ xcodebuild -project optool.xcodeproj -configuration Release ARCHS="x86_64" build
6..net
➜ Release git:(master) /Users/guanguan/study/wx/optool/build/Release/optool install -c load -p "@executable_path/WeChatRedEnvelop.dylib" -t ~/Desktop/WeChat
7.打包和重命名
8.安裝到手機上