ttttupup / wxhelper

Hook WeChat / 微信逆向
MIT License
2.26k stars 607 forks source link

能搞一个详细一点的编译文档吗 #316

Closed liupeng176 closed 9 months ago

liupeng176 commented 11 months ago

新手小白也能跟着编译的那种。vs不熟悉,有点难编译呀。

ttttupup commented 11 months ago

vcpkg+cmake 已经足够简单了。没什么好写的了。

liupeng176 commented 11 months ago

昨晚编译成功,写一下详细教程: 环境:win10_64位+VisualStudio2022+科学上网(只要可以正常访问github从github下载仓库)

1.下载vs2022(2023应该也可以)并安装成功,注意安装时候要选中支持cmake编译
2.下载vcpkg(https://github.com/microsoft/vcpkg.git ) , 保存在c盘,解压后目录C:\vcpkg,然后执行C:\vcpkg目录中的bootstrap-vcpkg.bat 会自动生成 vcpkg.exe
3.设置系统环境变量,右键我的电脑,属性,高级系统设置,环境变量,下面的框,找变量Path 添加一个 C:\vcpkg, 然后验证,在任意目录执行cmd命令: vcpkg --version 查看版本号,判断是否设置成功。 4.打开vs,选中右边的克隆存储库,填 https://github.com/ttttupup/wxhelper.git 点击右下角的克隆 5.克隆成功后,点击右边栏目的文件夹视图,并查看spdlog文件夹里面的第三方库是否下载成功,如果没有手动从github下载一下(一般都会下载成功,不行就多下载几次) 6.在c:\vcpkg目录下执行cmd命令: .\vcpkg.exe install nlohmann-json .\vcpkg.exe install mongoose .\vcpkg.exe install detours 注意安装失败会爆红,检查是否科学上网,install 成功后查看对应的目录看是否真的成功, 成功后C:\vcpkg目录会多出installed目录 里面有vcpkg和x64-windows两个目录

C:\vcpkg\installed\x64-windows\debug\lib目录下会有detours.lib和mongoose.lib文件 C:\vcpkg\installed\x64-windows\include目录下会有detours目录,nlohmann目录,和mongoose.h文件 其他目录也有对应文件,检查上面两个存在基本就没问题。

然后开始编译dll: 在vs右边栏目,选中CMakeLists.txt,然后在vs顶部中间 绿色运行小箭头旁边下拉,选 当前文档 ,点击运行,底部log框会出现 xxx.obj 就是开始编译,等弹出缺少可执行文件 没有配置可执行文件无法启动就是编译成功,

这个时候在第4步中 克隆的wxhelper的项目位置目录里面会多出一个out目录在out\build\x64-Debug\lib目录下就会出现刚才编译好的wxhelper.dll文件 就是最后的编译成果。

ee9304889208653687d98ea8bd5254b 854a4e5615263872c3d226dd1430445 2f7be45fbdf59bde56e1c090ce66f6c

588589b34a79ea744786fdd781645fd

2863caf97a37aa4cf1fe318e65ed112

liupeng176 commented 11 months ago

另外ocr识别(通过图片识别出文本)那里有个bug 会漏掉第一行内容,哪位大佬解决了还请@我一下

che246 commented 11 months ago

编译好的wxhelper.dll文件 2736kb 正常吗?

che246 commented 11 months ago

3.9.5.81-v10 wxhelper.dll 下载的是578kb 是不是用压缩了

liupeng176 commented 11 months ago

编译好的wxhelper.dll文件 2736kb 正常吗?

正常的,这是debug版本 这玩意我也不熟悉,需要你自己摸索了

yuanshangyujingshierlou commented 11 months ago

nlohmann-json 大佬,为什么我执行就会报这个错呀


PS C:\vcpkg> vcpkg search nlohmann-json
json-schema-validator    2.2.0            C++ library for validating JSON documents based on a JSON Schema. This val...
nlohmann-json            3.11.2           JSON for Modern C++
nlohmann-json[diagnostics]                Build json_diagnostics
The result may be outdated. Run `git pull` to get the latest results.
If your port is not listed, please open an issue at and/or consider making a pull request.  -  https://github.com/Microsoft/vcpkg/issues
PS C:\vcpkg> vcpkg install nlohmann-json
warning: In the September 2023 release, the default triplet for vcpkg libraries changed from x86-windows to the detected host triplet (x64-windows). For the old behavior, add --triplet x86-windows . To suppress this message, add --triplet x64-windows .
Computing installation plan...
A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip->C:\vcpkg\downloads\cmake-3.27.1-windows-i386.zip
Downloading https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip
Extracting cmake...
The following packages will be built and installed:
nlohmann-json:x64-windows -> 3.11.2
* vcpkg-cmake:x64-windows -> 2023-05-04
* vcpkg-cmake-config:x64-windows -> 2022-02-06#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
A suitable version of powershell-core was not found (required v7.2.11) Downloading portable powershell-core 7.2.11...
Downloading powershell-core...
https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/PowerShell-7.2.11-win-x86.zip->C:\vcpkg\downloads\PowerShell-7.2.11-win-x86.zip
Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/PowerShell-7.2.11-win-x86.zip
Extracting powershell-core...
A suitable version of 7zip was not found (required v23.1.0) Downloading portable 7zip 23.1.0...
Downloading 7zip...
https://www.7-zip.org/a/7z2301-extra.7z->C:\vcpkg\downloads\7z2301-extra.7z
Downloading https://www.7-zip.org/a/7z2301-extra.7z
Extracting 7zip...
Restored 2 package(s) from C:\Users\25025\AppData\Local\vcpkg\archives in 27.4 ms. Use --debug to see more details.
Installing 1/3 vcpkg-cmake:x64-windows...
Elapsed time to handle vcpkg-cmake:x64-windows: 5.16 ms
Installing 2/3 vcpkg-cmake-config:x64-windows...
Elapsed time to handle vcpkg-cmake-config:x64-windows: 3.91 ms
Installing 3/3 nlohmann-json:x64-windows...
Building nlohmann-json:x64-windows...
-- Downloading https://github.com/nlohmann/json/archive/v3.11.2.tar.gz -> nlohmann-json-v3.11.2.tar.gz...
-- Extracting source C:/vcpkg/downloads/nlohmann-json-v3.11.2.tar.gz
-- Using source at C:/vcpkg/buildtrees/nlohmann-json/src/v3.11.2-efdad4750e.clean
-- Configuring x64-windows
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
Command failed: C:/vcpkg/downloads/tools/ninja/1.10.2-windows/ninja.exe -v
Working Directory: C:/vcpkg/buildtrees/nlohmann-json/x64-windows-rel/vcpkg-parallel-configure
Error code: 1
See logs for more information:
C:\vcpkg\buildtrees\nlohmann-json\config-x64-windows-dbg-CMakeCache.txt.log
C:\vcpkg\buildtrees\nlohmann-json\config-x64-windows-rel-CMakeCache.txt.log
C:\vcpkg\buildtrees\nlohmann-json\config-x64-windows-out.log

Call Stack (most recent call first): installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:252 (vcpkg_execute_required_process) ports/nlohmann-json/portfile.cmake:18 (vcpkg_cmake_configure) scripts/ports.cmake:168 (include)

error: building nlohmann-json:x64-windows failed with: BUILD_FAILED Elapsed time to handle nlohmann-json:x64-windows: 11 s Please ensure you're using the latest port files with git pull and vcpkg update. Then check for known issues at: https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+nlohmann-json You can submit a new issue at: https://github.com/microsoft/vcpkg/issues/new?title=[nlohmann-json]+Build+error&body=Copy+issue+body+from+C%3A%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

liupeng176 commented 11 months ago

@yuanshangyujingshierlou 检查你的代理,这应该是你的网络问题。安装这个库需要 安装PowerShell 7z这些依赖,我安装时候还安装过vcpkg install nlohmann_json 你可以试试不知道有没关系,我不熟悉这一块。不是做c/c#开发的。

yuanshangyujingshierlou commented 11 months ago

@yuanshangyujingshierlou 检查你的代理,这应该是你的网络问题。安装这个库需要 安装PowerShell 7z这些依赖,我安装时候还安装过vcpkg install nlohmann_json 你可以试试不知道有没关系,我不熟悉这一块。不是做c/c#开发的。

不清楚是不是网络问题,我把vs卸载了重装了一遍,然后用git bash执行安装倒是成功了

liupeng176 commented 11 months ago

可以就好,一般安装失败都跟网络有关。

yuanshangyujingshierlou commented 11 months ago

可以就好,一般安装失败都跟网络有关。

谢谢了 已经可以打开http了,但是好像请求登陆一直说没登陆

liupeng176 commented 11 months ago

重装一下这个版本的某信,有可能会自动更新了

liupeng176 commented 11 months ago

我用两台win10 64位和win11 64位的都可以用的。

yuanshangyujingshierlou commented 11 months ago

我用两台win10 64位和win11 64位的都可以用的。

知道了哈哈,因为我没用3.9.5.81的那个接口,不能用老接口来着,谢谢大佬解答

yuanshangyujingshierlou commented 11 months ago

我用两台win10 64位和win11 64位的都可以用的。

大佬,你知道哪有详细点的接口文档吗

liupeng176 commented 11 months ago

没有噢兄弟,我只用了一个ocr识别的接口,就是看的doc里面的 .md文档

yuanshangyujingshierlou commented 11 months ago

没有噢兄弟,我只用了一个ocr识别的接口,就是看的doc里面的 .md文档

好滴 感谢

kanadeblisst00 commented 11 months ago

没有噢兄弟,我只用了一个ocr识别的接口,就是看的doc里面的 .md文档

只用OCR的话,我写了个纯Python端的,不需要启动微信。https://github.com/kanadeblisst00/wechat_ocr

liupeng176 commented 11 months ago

牛 @kanadeblisst00

kanadeblisst00 commented 10 months ago

牛 @kanadeblisst00

好用的话帮忙star一下

qianqian1530 commented 10 months ago

为啥 我编译没任何错误.. 但DLL 没有呢.. vcpkg 都正常配置的没出任何所悟呀... 大佬 01 02

qianqian1530 commented 10 months ago

为啥 我编译没任何错误.. 但DLL 没有呢.. vcpkg 都正常配置的没出任何所悟呀... 大佬 01 02

解决办法
C:\vcpkg\installed\x64-windows\debug\lib C:\vcpkg\installed\x64-windows\include

需要在环境里 添加这俩目录......

Xieweikang123 commented 8 months ago

求助,前6步都成功了,编译环节报错了,报错输出如下


发现和使用 vcpkg 工具链文件(C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/vcpkg/scripts/buildsystems/vcpkg.cmake)。
1> 命令行: "C:\Windows\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "c:\program files\microsoft visual studio\2022\professional\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\57031\Desktop\wxhelper\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe"   -DCMAKE_MAKE_PROGRAM="c:\program files\microsoft visual studio\2022\professional\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/vcpkg/scripts/buildsystems/vcpkg.cmake" "C:\Users\57031\Desktop\wxhelper" 2>&1"
1> 工作目录: C:\Users\57031\Desktop\wxhelper\out\build\x64-Debug
1> [CMake] CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
1> [CMake]   Compatibility with CMake < 3.5 will be removed from a future version of
1> [CMake]   CMake.
1> [CMake] 
1> [CMake]   Update the VERSION argument <min> value or use a ...<max> suffix to tell
1> [CMake]   CMake that the project does not need compatibility with older versions.
1> [CMake] 
1> [CMake] 
1> [CMake] -- The C compiler identification is MSVC 19.38.33134.0
1> [CMake] -- The CXX compiler identification is MSVC 19.38.33134.0
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - failed
1> [CMake] -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe
1> [CMake] -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - broken
1> [CMake] CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake:67 (message):
1> [CMake]   The C compiler
1> [CMake] 
1> [CMake]     "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe"
1> [CMake] 
1> [CMake]   is not able to compile a simple test program.
1> [CMake] 
1> [CMake]   It fails with the following output:
1> [CMake] 
1> [CMake]     Change Dir: 'C:/Users/57031/Desktop/wxhelper/out/build/x64-Debug/CMakeFiles/CMakeScratch/TryCompile-atclcx'
1> [CMake]     
1> [CMake]     Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" -v cmTC_69dea
1> [CMake]     [1/2] C:\PROGRA~1\MICROS~1\2022\PROFES~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\cl.exe  /nologo   /DWIN32 /D_WINDOWS  /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_69dea.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_69dea.dir\ /FS -c C:\Users\57031\Desktop\wxhelper\out\build\x64-Debug\CMakeFiles\CMakeScratch\TryCompile-atclcx\testCCompiler.c
1> [CMake]     [2/2] cmd.exe /C "cd . && "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_69dea.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\PROFES~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_69dea.dir\testCCompiler.c.obj  /out:cmTC_69dea.exe /implib:cmTC_69dea.lib /pdb:cmTC_69dea.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\Users\57031\Desktop\wxhelper\out\build\x64-Debug\CMakeFiles\CMakeScratch\TryCompile-atclcx && C:\Users\57031\.dotnet\tools\pwsh.exe -noprofile -executionpolicy Bypass -file "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/vcpkg/scripts/buildsystems/msbuild/applocal.ps1" -targetBinary C:/Users/57031/Desktop/wxhelper/out/build/x64-Debug/CMakeFiles/CMakeScratch/TryCompile-atclcx/cmTC_69dea.exe -installedDir "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/vcpkg/installed/x64-windows/debug/bin" -OutVariable out""
1> [CMake]     FAILED: cmTC_69dea.exe 
1> [CMake]     cmd.exe /C "cd . && "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_69dea.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\PROFES~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_69dea.dir\testCCompiler.c.obj  /out:cmTC_69dea.exe /implib:cmTC_69dea.lib /pdb:cmTC_69dea.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\Users\57031\Desktop\wxhelper\out\build\x64-Debug\CMakeFiles\CMakeScratch\TryCompile-atclcx && C:\Users\57031\.dotnet\tools\pwsh.exe -noprofile -executionpolicy Bypass -file "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/vcpkg/scripts/buildsystems/msbuild/applocal.ps1" -targetBinary C:/Users/57031/Desktop/wxhelper/out/build/x64-Debug/CMakeFiles/CMakeScratch/TryCompile-atclcx/cmTC_69dea.exe -installedDir "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/vcpkg/installed/x64-windows/debug/bin" -OutVariable out""
1> [CMake]     The argument 'C:/Program' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

image

sadboy-cn commented 7 months ago

感谢 大佬,按照以上教程编译失败,在 CMakeLists.txt 增加如下代码后成功,from #211 ,跟楼记录一下

set(DETOURS_INCLUDE_DIRS "C:/vcpkg/installed/x64-windows/include") set(DETOURS_LIBRARY "C:/vcpkg/installed/x64-windows/debug/lib/detours.lib") set(CMAKE_PREFIX_PATH "C:/vcpkg/installed/x64-windows/share/nlohmann_json")

WIGIW1314 commented 5 months ago

这个错误到底是因为什么啊?头大 image

willnzy commented 2 weeks ago

image 我编译出现这个错误,谁知道要怎么解决么