diff --git a/README.md b/README.md
index a2bbd9e..d2fee42 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ wechat hook 。PC端微信逆向学习。
本仓库发布的内容,仅用于学习研究,请勿用于非法用途和商业用途!如因此产生任何法律纠纷,均与作者无关!
#### 项目说明:
-本项目是逆向练习项目,可能会造成封号等后果。请自行承担风险。仅用于学习研究,请勿于非法用途。
+本项目是逆向学习项目,可能会造成封号等后果。请自行承担风险。仅用于学习研究,请勿于非法用途。
#### 实现原理:
逆向分析PC端微信客户端,定位相关功能关键Call,编写dll调用关键Call。然后将该dll文件注入到微信进程。
@@ -38,7 +38,7 @@ curl --location --request POST '127.0.0.1:19088/api/userInfo'
#### 参与项目
-个人精力和水平有限,项目还有许多不足,欢迎提出 issues 或 pr。期待你的贡献。
+个人精力和水平有限,项目还有许多不足,欢迎提出 issues 或 pr。
@@ -46,7 +46,7 @@ curl --location --request POST '127.0.0.1:19088/api/userInfo'
个人常用的方法,请参考https://github.com/ttttupup/wxhelper/wiki
使用上的问题,可查询https://github.com/ttttupup/wxhelper/discussions
数据库解密,请参考https://github.com/ttttupup/wxhelper/wiki
-个人精力有限,只维护最新版本,旧版本的bug会在新版本中修复,不维护旧版本。
+个人精力有限,该项目随缘更新。
#### 编译环境
@@ -59,18 +59,34 @@ cmake
vcpkg
#### 编译构建
-
```
+cd wxhelper/app/3rdparty
+git clone https://github.com/microsoft/Detours.git
+git clone https://github.com/gabime/spdlog.git
+git clone https://github.com/nlohmann/json.git
+或者使用vcpkg 安装相应库
+vcpkg install detours:x64-windows
+vcpkg install nlohmann-json:x64-windows
+vcpkg install spdlog:x64-windows
+
+cd wxhelper/cmake
+copy detours.cmake wxhelper/app/3rdparty/Detours/CMakeLists.txt
+
cd wxhelper
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=cl.exe \
-DCMAKE_CXX_COMPILER=cl.exe \
+-DCMAKE_ASM_MASM_COMPILER=ml64.exe \
-DCMAKE_BUILD_TYPE=Debug \
--DCMAKE_TOOLCHAIN_FILE:FILEPATH=${vcpkg install dir}/scripts/buildsystems/vcpkg.cmake \
--SC:/wxhelper \
--BC:/wxhelper/build/x64-debug\
--G Ninja
+-DCMAKE_INSTALL_PREFIX=${SOURCE_DIR}/wxhelper/install/x64-debug \
+-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_INSTALL_DIR}/scripts/buildsystems/vcpkg.cmake \
+-SC:${SOURCE_DIR}/wxhelper \
+-BC:${SOURCE_DIR}/wxhelper/build/x64-debug\
+-G Ninja
+cmake --build ..
+```
+如果有错误按错误提示修正即可。
#### 讨论组
diff --git a/app/wxhelper/src/chat_controller.cc b/app/wxhelper/src/chat_controller.cc
index 8250cfb..242ee74 100644
--- a/app/wxhelper/src/chat_controller.cc
+++ b/app/wxhelper/src/chat_controller.cc
@@ -1,4 +1,4 @@
-#include "chat_controller.h"
+#include "chat_controller.h"
#include "json_utils.h"
#include "nlohmann/json.hpp"
@@ -18,7 +18,7 @@ namespace wxhelper {
std::string ChatController::SendTextMsg(std::string params) {
int64_t base_addr = wxutils::GetWeChatWinBase();
nlohmann::json jp = nlohmann::json::parse(params);
- SPDLOG_INFO("sendTextMsg wxid={},msg={}",jp["wxid"],jp["msg"]);
+ SPDLOG_INFO("sendTextMsg wxid={},msg={}", jp["wxid"], jp["msg"]);
std::wstring wxid = jsonutils::GetWStringParam(jp, "wxid");
std::wstring msg = jsonutils::GetWStringParam(jp, "msg");
prototype::WeChatString to_user(wxid);
@@ -41,22 +41,70 @@ std::string ChatController::SendTextMsg(std::string params) {
reinterpret_cast(&temp), 1, 1, 0, 0);
free(reinterpret_cast(&chat_msg));
- nlohmann::json ret_data = {{"code", success}, {"data", {}}, {"msg", "success"}};
+ nlohmann::json ret_data = {
+ {"code", success}, {"data", {}}, {"msg", "success"}};
return ret_data.dump();
}
+
std::string ChatController::SendImageMsg(std::string params) {
- return std::string();
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
}
+
std::string ChatController::SendFileMsg(std::string params) {
- return std::string();
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
}
+
std::string ChatController::SendAtText(std::string params) {
- return std::string();
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
}
+
std::string ChatController::SendMultiAtText(std::string params) {
- return std::string();
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
}
+
+std::string ChatController::SendCustomEmotion(std::string params) {
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
+}
+
+std::string ChatController::SendApplet(std::string params) {
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
+}
+
+std::string ChatController::SendPatMsg(std::string params) {
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
+}
+
std::string ChatController::ForwardMsg(std::string params) {
- return std::string();
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
}
+
+std::string ChatController::ForwardPublicMsgByMsgId(std::string params) {
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
+}
+
+std::string ChatController::ForwardPublicMsg(std::string params) {
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
+}
+
+
} // namespace wxhelper
\ No newline at end of file
diff --git a/app/wxhelper/src/chat_controller.h b/app/wxhelper/src/chat_controller.h
index 37b2b53..50e359c 100644
--- a/app/wxhelper/src/chat_controller.h
+++ b/app/wxhelper/src/chat_controller.h
@@ -1,4 +1,4 @@
-#ifndef WXHELPER_CHAT_CONTROLLER_H_
+#ifndef WXHELPER_CHAT_CONTROLLER_H_
#define WXHELPER_CHAT_CONTROLLER_H_
#include "http_controller.h"
@@ -10,18 +10,67 @@ class ChatController : public http::HttpController {
ADD_PATH("/api/sendTextMsg", SendTextMsg);
ADD_PATH("/api/sendImagesMsg", SendImageMsg);
ADD_PATH("/api/sendFileMsg", SendFileMsg);
+
ADD_PATH("/api/sendAtText", SendAtText);
ADD_PATH("/api/sendMultiAtText", SendMultiAtText);
+ ADD_PATH("/api/sendCustomEmotion", SendCustomEmotion);
+ ADD_PATH("/api/sendApplet", SendApplet);
+ ADD_PATH("/api/sendPatMsg", SendPatMsg);
+
ADD_PATH("/api/forwardMsg", ForwardMsg);
+ ADD_PATH("/api/forwardPublicMsgByMsgId", ForwardPublicMsgByMsgId);
+ ADD_PATH("/api/forwardPublicMsg", ForwardPublicMsg);
+
PATHS_END
public:
+ /// @brief 发送文本
+ /// @param params json
+ /// @return json
static std::string SendTextMsg(std::string params);
+ /// @brief 发送图片
+ /// @param params json
+ /// @return json
static std::string SendImageMsg(std::string params);
+ /// @brief 发送文件
+ /// @param params json
+ /// @return json
static std::string SendFileMsg(std::string params);
+
+ /// @brief 发送@文本
+ /// @param params json
+ /// @return json
static std::string SendAtText(std::string params);
+ /// @brief 发送多个@文本
+ /// @param params json
+ /// @return json
static std::string SendMultiAtText(std::string params);
+ /// @brief 发送自定义表情
+ /// @param params json
+ /// @return json
+ static std::string SendCustomEmotion(std::string params);
+ /// @brief 发送小程序
+ /// @param params json
+ /// @return json
+ static std::string SendApplet(std::string params);
+ /// @brief 拍一拍
+ /// @param params json
+ /// @return json
+ static std::string SendPatMsg(std::string params);
+
+
+ /// @brief 转发消息
+ /// @param params json
+ /// @return json
static std::string ForwardMsg(std::string params);
+ /// @brief 转发公众号消息
+ /// @param params json
+ /// @return json
+ static std::string ForwardPublicMsgByMsgId(std::string params);
+ /// @brief 发送公众号消息
+ /// @param params json
+ /// @return json
+ static std::string ForwardPublicMsg(std::string params);
};
} // namespace wxhelper
diff --git a/app/wxhelper/src/client_socket.cc b/app/wxhelper/src/client_socket.cc
index ab0268c..00b9f18 100644
--- a/app/wxhelper/src/client_socket.cc
+++ b/app/wxhelper/src/client_socket.cc
@@ -1,4 +1,4 @@
-#include "client_socket.h"
+#include "client_socket.h"
#include
#include
diff --git a/app/wxhelper/src/client_socket.h b/app/wxhelper/src/client_socket.h
index 026f7ce..d78589d 100644
--- a/app/wxhelper/src/client_socket.h
+++ b/app/wxhelper/src/client_socket.h
@@ -1,4 +1,4 @@
-#ifndef WXHELPER_CLIENT_SOCKET_H_
+#ifndef WXHELPER_CLIENT_SOCKET_H_
#define WXHELPER_CLIENT_SOCKET_H_
#include
diff --git a/app/wxhelper/src/config.cc b/app/wxhelper/src/config.cc
index 085a114..7e0806e 100644
--- a/app/wxhelper/src/config.cc
+++ b/app/wxhelper/src/config.cc
@@ -1,4 +1,4 @@
-#include "config.h"
+#include "config.h"
#include
@@ -20,7 +20,7 @@ void Config::init() {
spdlog::set_pattern("%Y-%m-%d %H:%M:%S [%l] [%t] - <%s>|<%#>|<%!>,%v");
http_server_port_ =
GetPrivateProfileInt("config", "HttpServerPort", 19088, "./config.ini");
- hidden_dll_ = GetPrivateProfileInt("config", "HiddenDll", 1, "./config.ini");
+ hidden_dll_ = GetPrivateProfileInt("config", "HiddenDll", 0, "./config.ini");
TCHAR host[MAX_PATH];
GetPrivateProfileStringA("config", "HttpServerHost", "http://0.0.0.0", host,
sizeof(host), "./config.ini");
diff --git a/app/wxhelper/src/config.h b/app/wxhelper/src/config.h
index f7ea25a..778557e 100644
--- a/app/wxhelper/src/config.h
+++ b/app/wxhelper/src/config.h
@@ -1,4 +1,4 @@
-#ifndef WXHELPER_CONFIG_H_
+#ifndef WXHELPER_CONFIG_H_
#define WXHELPER_CONFIG_H_
#include
diff --git a/app/wxhelper/src/dllMain.cc b/app/wxhelper/src/dllMain.cc
index bc58ba8..910c818 100644
--- a/app/wxhelper/src/dllMain.cc
+++ b/app/wxhelper/src/dllMain.cc
@@ -1,4 +1,4 @@
-
+
#include "wxhelper.h"
BOOL APIENTRY DllMain(HMODULE module, DWORD ul_reason_for_call,
diff --git a/app/wxhelper/src/hook.cc b/app/wxhelper/src/hook.cc
index 800d61a..eac3c1c 100644
--- a/app/wxhelper/src/hook.cc
+++ b/app/wxhelper/src/hook.cc
@@ -1,4 +1,4 @@
-#include
+#include
#include "hook.h"
diff --git a/app/wxhelper/src/hook.h b/app/wxhelper/src/hook.h
index 68c20fe..182350e 100644
--- a/app/wxhelper/src/hook.h
+++ b/app/wxhelper/src/hook.h
@@ -1,4 +1,4 @@
-#ifndef WXHELPER_HOOK_H_
+#ifndef WXHELPER_HOOK_H_
#define WXHELPER_HOOK_H_
#include
#include
diff --git a/app/wxhelper/src/hook_controller.cc b/app/wxhelper/src/hook_controller.cc
index bdff1ce..1a62dff 100644
--- a/app/wxhelper/src/hook_controller.cc
+++ b/app/wxhelper/src/hook_controller.cc
@@ -1,4 +1,4 @@
-#include "hook_controller.h"
+#include "hook_controller.h"
#include "json_utils.h"
#include "nlohmann/json.hpp"
@@ -7,10 +7,25 @@
namespace jsonutils = wxhelper::jsonutils;
namespace wxhelper {
std::string HookController::HookSyncMsg(std::string params) {
- SyncMsgHook::GetInstance().Init();
int success = SyncMsgHook::GetInstance().Hook();
nlohmann::json ret_data = {
{"code", success}, {"data", {}}, {"msg", "success"}};
return ret_data.dump();
}
+std::string HookController::UnHookSyncMsg(std::string params) {
+ int success = SyncMsgHook::GetInstance().Unhook();
+ nlohmann::json ret_data = {
+ {"code", success}, {"data", {}}, {"msg", "success"}};
+ return ret_data.dump();
+}
+std::string HookController::HookLog(std::string params) {
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
+}
+std::string HookController::UnHookLog(std::string params) {
+ nlohmann::json ret = {
+ {"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
+ return ret.dump();
+}
} // namespace wxhelper
\ No newline at end of file
diff --git a/app/wxhelper/src/hook_controller.h b/app/wxhelper/src/hook_controller.h
index 771625a..a524fcc 100644
--- a/app/wxhelper/src/hook_controller.h
+++ b/app/wxhelper/src/hook_controller.h
@@ -1,4 +1,4 @@
-#ifndef WXHELPER_HOOK_CONTROLLER_H_
+#ifndef WXHELPER_HOOK_CONTROLLER_H_
#define WXHELPER_HOOK_CONTROLLER_H_
#include "http_controller.h"
@@ -8,10 +8,28 @@ class HookController : public http::HttpController {
public:
PATHS_BEGIN
ADD_PATH("/api/hookSyncMsg", HookSyncMsg);
+ ADD_PATH("/api/unhookSyncMsg", UnHookSyncMsg);
+ ADD_PATH("/api/hookLog", HookLog);
+ ADD_PATH("/api/unhookLog", UnHookLog);
PATHS_END
public:
+ /// @brief hook消息
+ /// @param params json
+ /// @return json
static std::string HookSyncMsg(std::string params);
+ /// @brief 取消hook消息
+ /// @param params json
+ /// @return json
+ static std::string UnHookSyncMsg(std::string params);
+ /// @brief hook日志消息
+ /// @param params json
+ /// @return json
+ static std::string HookLog(std::string params);
+ /// @brief 取消hook日志消息
+ /// @param params json
+ /// @return json
+ static std::string UnHookLog(std::string params);
};
} // namespace wxhelper
diff --git a/app/wxhelper/src/http_client.cc b/app/wxhelper/src/http_client.cc
index 176106c..9194cf4 100644
--- a/app/wxhelper/src/http_client.cc
+++ b/app/wxhelper/src/http_client.cc
@@ -1,4 +1,4 @@
-#include "http_client.h"
+#include "http_client.h"
namespace http {
diff --git a/app/wxhelper/src/http_client.h b/app/wxhelper/src/http_client.h
index 1ec422a..900bde7 100644
--- a/app/wxhelper/src/http_client.h
+++ b/app/wxhelper/src/http_client.h
@@ -1,4 +1,4 @@
-#ifndef WXHELPER_HTTP_CLIENT_H_
+#ifndef WXHELPER_HTTP_CLIENT_H_
#define WXHELPER_HTTP_CLIENT_H_
#include
diff --git a/app/wxhelper/src/http_controller.h b/app/wxhelper/src/http_controller.h
index 24d4396..4f8bc13 100644
--- a/app/wxhelper/src/http_controller.h
+++ b/app/wxhelper/src/http_controller.h
@@ -1,4 +1,4 @@
-
+
#ifndef WXHELPER_HTTP_CONTROLLER_H_
#define WXHELPER_HTTP_CONTROLLER_H_
diff --git a/app/wxhelper/src/http_router.cc b/app/wxhelper/src/http_router.cc
index b70a168..525197e 100644
--- a/app/wxhelper/src/http_router.cc
+++ b/app/wxhelper/src/http_router.cc
@@ -1,4 +1,4 @@
-#include "http_router.h"
+#include "http_router.h"
#include
diff --git a/app/wxhelper/src/http_router.h b/app/wxhelper/src/http_router.h
index 8ab4645..2cca129 100644
--- a/app/wxhelper/src/http_router.h
+++ b/app/wxhelper/src/http_router.h
@@ -1,4 +1,4 @@
-#ifndef WXHELPER_HTTP_ROUTER_H_
+#ifndef WXHELPER_HTTP_ROUTER_H_
#define WXHELPER_HTTP_ROUTER_H_
#include
#include