buginux / WeChatRedEnvelop

iOS版微信抢红包Tweak
2.27k stars 576 forks source link

将动态链接库注入二进制文件中 这一步报错 #112

Closed gank0326 closed 7 years ago

gank0326 commented 7 years ago

因为 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

clang: error: no such file or directory: '/Users/ganshunwei/optool/optool/FSArgumentParser/CoreParse/CoreParse/Parsers/CPShiftReduceParsers/CPShiftReduceAction.m' clang: error: no input files

BUILD FAILED

The following build commands failed: CompileC build/ArgumentParser.build/Release/ArgumentParser-Static.build/Objects-normal/x86_64/CPItem.o CoreParse/CoreParse/Parsers/CPShiftReduceParsers/CPItem.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler CompileC build/ArgumentParser.build/Release/ArgumentParser-Static.build/Objects-normal/x86_64/CPLR1Parser.o CoreParse/CoreParse/Parsers/CPShiftReduceParsers/CPLR1Parser.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler CompileC build/ArgumentParser.build/Release/ArgumentParser-Static.build/Objects-normal/x86_64/CPShiftAction.o CoreParse/CoreParse/Parsers/CPShiftReduceParsers/CPShiftAction.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler CompileC build/ArgumentParser.build/Release/ArgumentParser-Static.build/Objects-normal/x86_64/CPShiftReduceAction.o CoreParse/CoreParse/Parsers/CPShiftReduceParsers/CPShiftReduceAction.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (4 failures)

gank0326 commented 7 years ago

非越狱的手机也要执行这一步吗? $ scp root@:/usr/lib/libsubstrate.dylib ~/Desktop $ install_name_tool -change /usr/lib/libsubstrate.dylib @loader_path/libsubstrate.dylib WeChatRedEnvelop.dylib $ otool -L WeChatRedEnvelop.dylib

buginux commented 7 years ago

这就是非越狱手机要执行的啊,越狱就不用这么麻烦了。

gank0326 commented 7 years ago

@buginux 报错,找不到文件夹
gank:~ ganshunwei$ scp root@<172.31.56.74>:/usr/lib/libsubstrate.dylib ~/Desktop -bash: 172.31.56.74: No such file or directory gank:~ ganshunwei$

buginux commented 7 years ago

。。不要加尖括号,这个是 bash 的知识

gank0326 commented 7 years ago

小白😂 gank:~ ganshunwei$ scp root@172.31.56.74:/usr/lib/libsubstrate.dylib ~/Desktop ssh: connect to host 172.31.56.74 port 22: Connection refused

gank0326 commented 7 years ago

是不是要改这个ssh_config 文件里的配置?mac自带ssh?我看我机器里有

buginux commented 7 years ago

你的手机安装 openssh 了吗

gank0326 commented 7 years ago

@buginux 跟手机有关?这只是注入二进制文件需要手机也安装?

buginux commented 7 years ago

这个是环境问题,手机也要装东西啊。

你再认真看下文章吧:http://www.swiftyper.com/2016/01/25/ios-tweak-install-guide/

gank0326 commented 7 years ago

我是看的免越狱的,不想越狱手机 http://www.swiftyper.com/2016/12/26/wechat-redenvelop-tweak-for-non-jailbroken-iphone/

gank0326 commented 7 years ago

@buginux
1、在你那边的是 /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate 这个库,具体的可以参考 http://bbs.iosre.com/t/ios/6119/26 这个帖子,里面有一个跟你情况一样的,我给了解释。

我的也是这样,下载了你百度云里的libsubstrate.dylib 下一步该怎么做?install_name_tool -change /Users/ganshunwei/Desktop/qiuqiu/libsubstrate.dylib @loader_path/libsubstrate.dylib WeChatRedEnvelop.dylib 这样改路径不成功,按照文章上的那么改也不行,求助

buginux commented 7 years ago

这是你没安装 optool 啊,你工具得装全来啊

gank0326 commented 7 years ago

@buginux 全部弄好了,最后一步错误 执行最后一步,报错找不到路径,是因为这个executable_path 需要配置吗?

gank:Desktop ganshunwei$ /path/to/optool install -c load -p "@executable_path/WeChatRedEnvelop.dylib" -t wechat/Payload/WeChat.app/WeChat -bash: /path/to/optool: No such file or directory

buginux commented 7 years ago

先把 optool 装好,这个文章上面有讲。建议你先仔细照着文章上面的步骤走一遍,有问题再提出来。

gank0326 commented 7 years ago

装好了啊!GenerateDSYMFile build/Release/optool.dSYM build/Release/optool cd /Users/ganshunwei/Documents/code/WeChatRedEnvelop/optool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/ganshunwei/Documents/code/WeChatRedEnvelop/optool/build/Release/optool -o /Users/ganshunwei/Documents/code/WeChatRedEnvelop/optool/build/Release/optool.dSYM

BUILD SUCCEEDED

gank0326 commented 7 years ago

是不是/path/to/ 这个需要配置环境变量?我也把optool拷贝到usr/local/bin 下了!网上已经搜不到了,哎

gank0326 commented 7 years ago

可以加我QQ 373949629 吗?跟着文章弄了十几个小时了,这个错网上都搜不到了😭

buginux commented 7 years ago

这个 /path/to 是指你安装 optool 的路径,不是照抄的,你要写你自己的路径。

gank0326 commented 7 years ago

还是不可以😢,这个命令是要在wechat文件中执行吗? gank:Desktop ganshunwei$ /path/to/usr/local/bin/optool install -c load -p "@executable_path/WeChatRedEnvelop.dylib" -t wechat/Payload/WeChat.app/WeChat -bash: /path/to/usr/local/bin/optool: No such file or directory gank:Desktop ganshunwei$

buginux commented 7 years ago

把 /path/to 去掉,直接调用 /usr/local/bin/optool install -c load -p "@executable_path/WeChatRedEnvelop.dylib" -t wechat/Payload/WeChat.app/WeChat

建议你去好好补下命令行的知识啊,你这样搞,事倍功半啊。我也没那么多时间一直在这里回复你,这些都是很基础的知识,你最好自己先去补上。

gank0326 commented 7 years ago

嗯嗯,谢谢!不好意思耽误你这么久!最后执行是不报错了,但是安装后打开就闪退!先不弄了,学下基础知识先!