Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57ab98351a | ||
|
|
88e89c4836 | ||
|
|
158da3fb64 | ||
|
|
5e04ddfcd2 | ||
|
|
6d254c5f82 |
+51
-2
@@ -50,6 +50,7 @@
|
||||
64.发送小程序
|
||||
65.退款
|
||||
66.下载头像
|
||||
67.修改好友备注
|
||||
### 接口文档:
|
||||
|
||||
|
||||
@@ -302,7 +303,10 @@
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|port |true |string| 本地服务端端口,用来接收消息内容 |
|
||||
|ip |true |string| 服务端ip地址,用来接收消息内容,可以是任意ip,即tcp客户端连接的服务端的ip (3.8.1.26版本)|
|
||||
|ip |true |string| 服务端ip地址,用来接收消息内容,可以是任意ip,即tcp客户端连接的服务端的ip |
|
||||
|url |true |string| http的请求地址,enableHttp=1时,不能为空 |
|
||||
|timeout |true |string| 超时时间,单位ms|
|
||||
|enableHttp |true |number| 0/1 :1.启用http 0.不启用http|
|
||||
|
||||
###### 返回字段
|
||||
|返回字段|字段类型|说明 |
|
||||
@@ -316,7 +320,10 @@
|
||||
``` javascript
|
||||
{
|
||||
"port": "19099"
|
||||
"ip":"127.0.0.1"
|
||||
"ip":"127.0.0.1",
|
||||
"url":"http://test.com",
|
||||
"timeout":"3000",
|
||||
"enableHttp":1
|
||||
}
|
||||
```
|
||||
响应:
|
||||
@@ -2007,6 +2014,48 @@
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 67.修改好友备注**
|
||||
###### 接口功能
|
||||
> 修改好友备注
|
||||
|
||||
###### 接口地址
|
||||
> [/api/?type=67](/api/?type=67)
|
||||
|
||||
###### HTTP请求方式
|
||||
> POST JSON
|
||||
|
||||
###### 请求参数
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|wxid|string|微信id|
|
||||
|remark|string|备注内容|
|
||||
|
||||
|
||||
###### 返回字段
|
||||
|返回字段|字段类型|说明 |
|
||||
|---|---|---|
|
||||
|code|int|返回状态,1成功|
|
||||
|result|string|成功提示|
|
||||
|
||||
|
||||
|
||||
|
||||
###### 接口示例
|
||||
入参:
|
||||
``` javascript
|
||||
{
|
||||
"wxid":"wxid_agz5q76f11112",
|
||||
"remark":"123"
|
||||
}
|
||||
```
|
||||
响应:
|
||||
``` javascript
|
||||
{"code":1,"result":"OK"}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 感谢
|
||||
https://github.com/ljc545w/ComWeChatRobot
|
||||
|
||||
|
||||
+5
-2
@@ -299,7 +299,7 @@ enableHttp=0时,使用ip,port的tcp服务回传消息。
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|port |true |string| 本地服务端端口,用来接收消息内容 |
|
||||
|ip |true |string| 服务端ip地址,用来接收消息内容,可以是任意ip,即tcp客户端连接的服务端的ip (3.8.1.26版本)|
|
||||
|ip |true |string| 服务端ip地址,用来接收消息内容,可以是任意ip,即tcp客户端连接的服务端的ip |
|
||||
|url |true |string| http的请求地址,enableHttp=1时,不能为空 |
|
||||
|timeout |true |string| 超时时间,单位ms|
|
||||
|enableHttp |true |number| 0/1 :1.启用http 0.不启用http|
|
||||
@@ -316,7 +316,10 @@ enableHttp=0时,使用ip,port的tcp服务回传消息。
|
||||
``` javascript
|
||||
{
|
||||
"port": "19099"
|
||||
"ip":"127.0.0.1"
|
||||
"ip":"127.0.0.1",
|
||||
"url":"http://test.com",
|
||||
"timeout":"3000",
|
||||
"enableHttp":1,
|
||||
}
|
||||
```
|
||||
响应:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "account_mgr.h"
|
||||
#include "wechat_function.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
using namespace std;
|
||||
namespace wxhelper {
|
||||
@@ -215,6 +216,35 @@ int AccountMgr::Logout() {
|
||||
return success;
|
||||
}
|
||||
|
||||
int AccountMgr::EnterWeChat() {
|
||||
int success = -1;
|
||||
DWORD enter_wechat_callback_addr = base_addr_ + WX_ENTER_WECHAT_CALLBACK_OFFSET;
|
||||
std::vector<DWORD> vec;
|
||||
bool found = Utils::ScanAndMatchValue(base_addr_ + 0x2A66A18, vec);
|
||||
if (found) {
|
||||
HANDLE handle = GetCurrentProcess();
|
||||
for (int i = 0; i < vec.size(); i++) {
|
||||
DWORD ptr = vec.at(i);
|
||||
DWORD value;
|
||||
if (ReadProcessMemory(handle, (LPVOID)ptr, &value, sizeof(value), NULL)) {
|
||||
if (value == base_addr_ + 0x2A66A18) {
|
||||
DWORD login_wnd = ptr;
|
||||
__asm {
|
||||
PUSHAD
|
||||
MOV ECX, login_wnd
|
||||
CALL enter_wechat_callback_addr
|
||||
POPAD
|
||||
}
|
||||
success = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/// @brief 根据 502647092 提供的偏移 获取二维码url
|
||||
/// @return
|
||||
std::string AccountMgr::GetQRCodeUrl() {
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace wxhelper{
|
||||
int Logout();
|
||||
|
||||
std::string GetQRCodeUrl();
|
||||
|
||||
int EnterWeChat();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -80,6 +80,8 @@ typedef enum HTTP_API_ROUTE {
|
||||
WECHAT_SEND_APP_MSG,
|
||||
WECHAT_REFUSE,
|
||||
WECHAT_GET_HEAD_IMG,
|
||||
WECHAT_MOD_CONTACT_REMARK,
|
||||
WECHAT_ENTER_WECHAT,
|
||||
} WECHAT_HTTP_APIS,
|
||||
*PWECHAT_HTTP_APIS;
|
||||
|
||||
|
||||
@@ -285,4 +285,24 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
|
||||
success = 1;
|
||||
return success;
|
||||
}
|
||||
|
||||
int ContactMgr::ModifyContactRemark(wchar_t* wxid,wchar_t* remark){
|
||||
int success = -1;
|
||||
WeChatString contact(wxid);
|
||||
WeChatString content(remark);
|
||||
DWORD mod__addr = base_addr_ + WX_MOD_REMARK_OFFSET;
|
||||
__asm{
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
LEA EAX,content
|
||||
PUSH EAX
|
||||
LEA EAX,contact
|
||||
PUSH EAX
|
||||
CALL mod__addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
success = 1;
|
||||
return success;
|
||||
}
|
||||
} // namespace wxhelper
|
||||
@@ -17,6 +17,7 @@ class ContactMgr : public BaseMgr {
|
||||
int VerifyApply(wchar_t *v3, wchar_t *v4,int permission);
|
||||
int GetContactByWxid(wchar_t* wxid,ContactProfile& profile);
|
||||
int GetHeadImage(wchar_t* wxid,wchar_t* url);
|
||||
int ModifyContactRemark(wchar_t* wxid,wchar_t* remark);
|
||||
};
|
||||
} // namespace wxhelper
|
||||
|
||||
|
||||
@@ -677,6 +677,20 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
case WECHAT_MOD_CONTACT_REMARK:{
|
||||
wstring wxid = GetWStringParam(j_param, "wxid");
|
||||
wstring remark = GetWStringParam(j_param, "remark");
|
||||
int success =g_context.contact_mgr->ModifyContactRemark(WS2LPWS(wxid), WS2LPWS(remark));
|
||||
json ret_data = {{"code", success}, {"result", "OK"}};
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
case WECHAT_ENTER_WECHAT: {
|
||||
int success = g_context.account_mgr->EnterWeChat();
|
||||
json ret_data = { {"code", success}, {"result", "OK"} };
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
json ret_data = {{"result", "ERROR"}, {"msg", "not support api"}};
|
||||
ret = ret_data.dump();
|
||||
|
||||
@@ -211,4 +211,36 @@ bool Utils::IsTextUtf8(const char *str,int length) {
|
||||
}
|
||||
return (bytes_num == 0);
|
||||
}
|
||||
|
||||
bool Utils::ScanAndMatchValue(DWORD value, std::vector<DWORD>& result) {
|
||||
SYSTEM_INFO sys_info;
|
||||
GetSystemInfo(&sys_info);
|
||||
|
||||
LPVOID current_addr = sys_info.lpMinimumApplicationAddress;
|
||||
DWORD pageSize = sys_info.dwPageSize;
|
||||
|
||||
MEMORY_BASIC_INFORMATION mem_info = {};
|
||||
HANDLE handle = GetCurrentProcess();
|
||||
while (current_addr < sys_info.lpMaximumApplicationAddress) {
|
||||
if (VirtualQueryEx(handle, current_addr, &mem_info, sizeof(MEMORY_BASIC_INFORMATION))) {
|
||||
if (mem_info.State == MEM_COMMIT && (mem_info.Protect & (PAGE_READONLY | PAGE_READWRITE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE))) {
|
||||
// 读取内存并搜索值
|
||||
LPVOID pBuffer = new BYTE[mem_info.RegionSize];
|
||||
if (ReadProcessMemory(handle, mem_info.BaseAddress, pBuffer, mem_info.RegionSize, NULL)) {
|
||||
for (DWORD i = 0; i < mem_info.RegionSize; i += sizeof(DWORD)) {
|
||||
if (*(PDWORD)((LPBYTE)pBuffer + i) == value) {
|
||||
result.push_back((DWORD)mem_info.BaseAddress + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
delete[] pBuffer;
|
||||
}
|
||||
current_addr = (LPBYTE)mem_info.BaseAddress + mem_info.RegionSize;
|
||||
}
|
||||
else {
|
||||
current_addr = (LPBYTE)current_addr + pageSize;
|
||||
}
|
||||
};
|
||||
return !result.empty();
|
||||
}
|
||||
} // namespace wxhelper
|
||||
@@ -49,6 +49,8 @@ class Utils {
|
||||
|
||||
static bool IsTextUtf8(const char * str,int length) ;
|
||||
|
||||
static bool ScanAndMatchValue(DWORD value, std::vector<DWORD>& result);
|
||||
|
||||
template <typename T1, typename T2>
|
||||
static std::vector<T1> split(T1 str, T2 letter) {
|
||||
std::vector<T1> arr;
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
#define WX_VERIFY_OK_OFFSET 0xa18bd0
|
||||
#define WX_NEW_ADD_FRIEND_HELPER_OFFSET 0xa17d50
|
||||
#define WX_FREE_ADD_FRIEND_HELPER_OFFSET 0xa17e70
|
||||
#define WX_MOD_REMARK_OFFSET 0xbfd5e0
|
||||
|
||||
// pushAttachTask
|
||||
|
||||
@@ -126,6 +127,7 @@
|
||||
#define WX_GET_CURRENT_DATA_PATH_OFFSET 0xc872c0
|
||||
#define WX_QR_CODE_LOGIN_MGR_OFFSET 0xae9db0
|
||||
#define WX_GET_QR_CODE_IMAGE_OFFSET 0xcda6f0
|
||||
#define WX_ENTER_WECHAT_CALLBACK_OFFSET 0xaf5050
|
||||
|
||||
//forward
|
||||
#define WX_FORWARD_MSG_OFFSET 0xce6730
|
||||
|
||||
Reference in New Issue
Block a user