新增添加好友

This commit is contained in:
hugy 2023-02-17 08:44:51 +08:00
parent c8544a9286
commit db5051ae2f
4 changed files with 102 additions and 2 deletions

View File

@ -101,7 +101,9 @@ vcpkg
2023-02-09 新增3.9.0.28版本基础功能。
2023-02-13 新增查询联系人昵称功能。
2023-02-13 新增查询联系人昵称功能。
2023-02-17 新增通过wxid添加好友。
#### 功能预览:
0.检查是否登录
@ -113,7 +115,8 @@ vcpkg
10.取消hook消息
11.hook图片
12.取消hook图片
17.删除好友
17.删除好友
20.通过wxid添加好友
25.获取群成员
26.获取群成员昵称
27.删除群成员
@ -507,6 +510,43 @@ vcpkg
#### 20.通过wxid添加好友**
###### 接口功能
> 添加好友
###### 接口地址
> [/api/?type=20](/api/?type=20)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|wxid |true |string| 好友wxid |
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,1成功, -1失败|
|result|string|成功提示|
###### 接口示例
入参:
``` javascript
{
"wxid":"wxid_o1112222"
}
```
响应:
``` javascript
{"code":1,"result":"OK"}
```
#### 25.获取群成员**
###### 接口功能
> 获取群成员

View File

@ -324,6 +324,10 @@ void api_handle(mg_http_message *hm, struct mg_connection *c, string &ret) {
break;
}
case WECHAT_CONTACT_ADD_BY_WXID: {
wstring user_id = get_http_req_param(hm, j_param, "wxid", is_post);
int success = AddFriendByWxid(WS2LW(user_id));
json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump();
break;
}
case WECHAT_CONTACT_ADD_BY_V3: {

View File

@ -13,6 +13,7 @@ using namespace std;
#define WX_DO_DEL_CONTACT_OFFSET 0xca6480
#define WX_FREE_CONTACT_OFFSET 0xe23690
#define WX_GET_CONTACT_OFFSET 0xb93b20
#define WX_DO_VERIFY_USER_OFFSET 0xB91160
int GetAllContact(vector<Contact> &vec) {
DWORD base = GetWeChatWinBase();
@ -136,3 +137,56 @@ std::wstring GetContactOrChatRoomNickname(wchar_t *id) {
}
return name;
}
int AddFriendByWxid(wchar_t *wxid){
int success = -1;
DWORD base = GetWeChatWinBase();
DWORD contact_mgr_addr = base + WX_CONTACT_MGR_INSTANCE_OFFSET;
DWORD set_group_addr = base + 0x746E20;
DWORD fn2_addr = base + 0x285D968;
DWORD fn3_addr = base + 0x6F6050;
DWORD fn4_addr = base + 0xED3BE0;
DWORD do_verify_user_addr = base + WX_DO_VERIFY_USER_OFFSET;
DWORD instance =0;
WeChatString chat_room(NULL);
WeChatString user_id(wxid);
__asm{
PUSHAD
PUSHFD
CALL contact_mgr_addr
SUB ESP,0x18
MOV dword ptr [instance],EAX
MOV ECX,ESP
PUSH ECX
LEA ECX,chat_room
CALL set_group_addr
MOV EAX,fn2_addr
SUB ESP,0x18
MOV ECX,ESP
PUSH EAX
CALL fn3_addr
PUSH 0x0
PUSH 0XE
SUB ESP,0x14
MOV ESI,ESP
MOV dword ptr [ESI],0x0
MOV dword ptr [ESI+0x4],0x0
MOV dword ptr [ESI+0x8],0x0
MOV dword ptr [ESI+0xC],0x0
MOV dword ptr [ESI+0x10],0x0
PUSH 0x1
SUB ESP,0x14
MOV ECX,ESP
LEA EAX,user_id
PUSH EAX
CALL fn4_addr
MOV ECX,dword ptr [instance]
CALL do_verify_user_addr
MOV success,EAX
POPFD
POPAD
}
return success;
}

View File

@ -10,4 +10,6 @@ int GetAllContact(std::vector<Contact> &vec);
int DelContact(wchar_t* wxid);
std::wstring GetContactOrChatRoomNickname(wchar_t* id);
int AddFriendByWxid(wchar_t *wxid);
#endif