新增通过好友申请

This commit is contained in:
hugy 2023-04-08 13:18:27 +08:00
parent bfe5b0ee12
commit 7220b23cb3
5 changed files with 105 additions and 35 deletions

View File

@ -10,11 +10,12 @@
10.取消hook消息 10.取消hook消息
11.hook图片 11.hook图片
12.取消hook图片 12.取消hook图片
13.hook语音 13.hook语音(不推荐)
14.取消hook语音 14.取消hook语音
<!-- 17.删除好友 --> <!-- 17.删除好友 -->
19.通过手机或qq查找微信 19.通过手机或qq查找微信
<!-- 20.通过wxid添加好友 --> 20.通过wxid添加好友
23.通过好友申请
25.获取群成员 25.获取群成员
26.获取群成员昵称 26.获取群成员昵称
27.删除群成员 27.删除群成员
@ -597,7 +598,42 @@
|参数|必选|类型|说明| |参数|必选|类型|说明|
|---|---|---|---| |---|---|---|---|
|wxid |true |string| 好友wxid | |wxid |true |string| 好友wxid |
|msg |true |string| 验证消息 |
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,1成功, -1失败|
|result|string|成功提示|
###### 接口示例
入参:
``` javascript
{
"wxid":"wxid_o1112222"
}
```
响应:
``` javascript
{"code":1,"result":"OK"}
```
#### 23.通过好友申请**
###### 接口功能
> 通过好友的申请
###### 接口地址
> [/api/?type=23](/api/?type=23)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|v3 |true |string| 添加好友消息内容里的encryptusername|
|v4 |true |string| 添加好友消息内容里的ticket|
###### 返回字段 ###### 返回字段
|返回字段|字段类型|说明 | |返回字段|字段类型|说明 |

View File

@ -129,17 +129,22 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
DWORD fn1_addr = base_addr_ + 0x758720; DWORD fn1_addr = base_addr_ + 0x758720;
WeChatString user_id(wxid); WeChatString user_id(wxid);
WeChatString w_msg(msg); WeChatString w_msg(msg);
DWORD null_ptr = 0;
DWORD instance =0; DWORD instance =0;
Unkown null_obj={}; Unkown null_obj={0,0,0,0,0,0xF};
null_obj.field6 = 0xF;
__asm{ __asm{
PUSHAD PUSHAD
PUSHFD PUSHFD
CALL contact_mgr_addr CALL contact_mgr_addr
MOV dword ptr [instance],EAX MOV dword ptr [instance],EAX
MOV EDI,0x6
MOV ESI,0
MOV EAX,0x2
SUB ESP,0x18 SUB ESP,0x18
MOV EAX,ESP MOV EAX,ESP
MOV dword ptr ds:[EAX],0
MOV dword ptr ds:[EAX+0x14],0xF
MOV dword ptr ds:[EAX+0x10],0
MOV byte ptr ds:[EAX],0
SUB ESP,0x18 SUB ESP,0x18
LEA EAX,null_obj LEA EAX,null_obj
MOV ECX,ESP MOV ECX,ESP
@ -148,6 +153,7 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
PUSH 0x0 PUSH 0x0
PUSH 0x6 PUSH 0x6
MOV EAX,w_msg MOV EAX,w_msg
SUB ESP,0x14 SUB ESP,0x14
MOV ECX,ESP MOV ECX,ESP
PUSH -0x1 PUSH -0x1
@ -155,6 +161,7 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
CALL verify_msg_addr CALL verify_msg_addr
PUSH 0x2 PUSH 0x2
LEA EAX,user_id LEA EAX,user_id
SUB ESP,0x14 SUB ESP,0x14
MOV ECX,ESP MOV ECX,ESP
PUSH EAX PUSH EAX
@ -165,29 +172,48 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
POPFD POPFD
POPAD POPAD
} }
// __asm {
// PUSHAD
// PUSHFD
// SUB ESP,0x14
// MOV ECX,ESP
// PUSH -0x1
// PUSH w_msg
// CALL verify_msg_addr
// PUSH 0x2
// LEA EAX,user_id
// SUB ESP,0x14
// MOV ECX,ESP
// PUSH EAX
// CALL set_value_addr
// CALL contact_mgr_addr
// MOV ECX,EAX
// CALL do_verify_user_addr
// MOV success,EAX
// POPFD
// POPAD
// }
return success; return success;
} }
int ContactMgr::VerifyApply(wchar_t *v3, wchar_t *v4){
int success = -1;
DWORD set_value_addr = base_addr_ + WX_INIT_CHAT_MSG_OFFSET;
DWORD verify_addr = base_addr_ + WX_VERIFY_OK_OFFSET;
DWORD new_helper_addr = base_addr_ + WX_NEW_ADD_FRIEND_HELPER_OFFSET;
DWORD free_helper_addr = base_addr_ + WX_FREE_ADD_FRIEND_HELPER_OFFSET;
WeChatString v4_str(v4);
WeChatString v3_str(v3);
char helper_obj[0x40] = {0};
char nullbuffer[0x3CC] = {0};
__asm {
PUSHAD
PUSHFD
LEA ECX,helper_obj
CALL new_helper_addr
MOV ESI,0x0
MOV EDI,0x6
PUSH ESI
PUSH EDI
SUB ESP,0x14
MOV ECX,ESP
LEA EAX,v4_str
PUSH EAX
CALL set_value_addr
SUB ESP,0x8
PUSH 0x0
LEA EAX, nullbuffer
PUSH EAX
LEA EAX,v3_str
PUSH EAX
LEA ECX,helper_obj
CALL verify_addr
MOV success,EAX
LEA ECX,helper_obj
CALL free_helper_addr
POPFD
POPAD
}
return success;
}
} // namespace wxhelper } // namespace wxhelper

View File

@ -14,6 +14,7 @@ class ContactMgr : public BaseMgr {
int DelContact(wchar_t* wxid); int DelContact(wchar_t* wxid);
std::wstring GetContactOrChatRoomNickname(wchar_t* id); std::wstring GetContactOrChatRoomNickname(wchar_t* id);
int AddFriendByWxid(wchar_t* wxid,wchar_t* msg); int AddFriendByWxid(wchar_t* wxid,wchar_t* msg);
int VerifyApply(wchar_t *v3, wchar_t *v4);
}; };
} // namespace wxhelper } // namespace wxhelper

View File

@ -237,11 +237,11 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
break; break;
} }
case WECHAT_CONTACT_ADD_BY_WXID: { case WECHAT_CONTACT_ADD_BY_WXID: {
// wstring user_id = GetWStringParam(j_param, "wxid"); wstring user_id = GetWStringParam(j_param, "wxid");
// wstring msg = GetWStringParam(j_param, "msg"); wstring msg = GetWStringParam(j_param, "msg");
// int success = g_context.contact_mgr->AddFriendByWxid(WS2LPWS(user_id),WS2LPWS(msg)); int success = g_context.contact_mgr->AddFriendByWxid(WS2LPWS(user_id),WS2LPWS(msg));
// json ret_data = {{"code", success}, {"result", "OK"}}; json ret_data = {{"code", success}, {"result", "OK"}};
// ret = ret_data.dump(); ret = ret_data.dump();
break; break;
} }
case WECHAT_CONTACT_ADD_BY_V3: { case WECHAT_CONTACT_ADD_BY_V3: {
@ -251,6 +251,11 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
break; break;
} }
case WECHAT_CONTACT_VERIFY_APPLY: { case WECHAT_CONTACT_VERIFY_APPLY: {
wstring v3 = GetWStringParam(j_param, "v3");
wstring v4 = GetWStringParam(j_param, "v4");
int success = g_context.contact_mgr->VerifyApply(WS2LPWS(v3),WS2LPWS(v4));
json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump();
break; break;
} }
case WECHAT_CONTACT_EDIT_REMARK: { case WECHAT_CONTACT_EDIT_REMARK: {

View File

@ -79,7 +79,9 @@
#define WX_GET_CONTACT_OFFSET 0xc04e00 #define WX_GET_CONTACT_OFFSET 0xc04e00
#define WX_DO_VERIFY_USER_OFFSET 0xc02100 #define WX_DO_VERIFY_USER_OFFSET 0xc02100
#define WX_VERIFY_MSG_OFFSET 0xf59d40 #define WX_VERIFY_MSG_OFFSET 0xf59d40
#define WX_VERIFY_OK_OFFSET 0xa18bd0
#define WX_NEW_ADD_FRIEND_HELPER_OFFSET 0xa17d50
#define WX_FREE_ADD_FRIEND_HELPER_OFFSET 0xa17e70
// pushAttachTask // pushAttachTask