mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-05 18:09:24 +08:00
新增查询昵称
This commit is contained in:
parent
75d470935d
commit
3d8ed813be
93
README.md
93
README.md
@ -7,11 +7,11 @@ wechat hook 。PC端微信逆向学习。支持3.8.0.41,3.8.1.26,3.9.0.28版
|
||||
本项目是个人学习学习逆向的项目,主要参考 https://github.com/ljc545w/ComWeChatRobot ,在此基础上实现了微信的的其它版本的部分内容。
|
||||
|
||||
#### 使用说明:
|
||||
支持的版本3.8.0.41,3.8.1.26,3.9.0.28。
|
||||
src:主要的dll代码
|
||||
tool:简单的注入工具,一个是控制台,一个是图形界面。
|
||||
python: 简单的服务器,用以接收消息内容。
|
||||
release:编译好的dll。
|
||||
支持的版本3.8.0.41,3.8.1.26, 3.9.0.28。
|
||||
src:主要的dll代码
|
||||
tool:简单的注入工具,一个是控制台,一个是图形界面。
|
||||
python: 简单的服务器,用以接收hook的消息内容。
|
||||
|
||||
|
||||
0.首先安装对应的微信版本,主分支是3.8.0.41版本,分支对应相应的微信版本号.
|
||||
1.通过cmake构建成功后,将wxhelper.dll注入到微信,本地启动tcp server,监听19088端口。
|
||||
@ -99,7 +99,9 @@ vcpkg
|
||||
|
||||
2023-02-08 : 新增朋友圈消息。
|
||||
|
||||
2023-02-09 : 新增3.9.0.28版本基础功能。
|
||||
2023-02-09 : 新增3.9.0.28版本基础功能。
|
||||
|
||||
2023-02-13 : 新增查询昵称功能。
|
||||
|
||||
#### 功能预览:
|
||||
0.检查是否登录
|
||||
@ -543,6 +545,43 @@ vcpkg
|
||||
```
|
||||
|
||||
|
||||
#### 26.获取群成员昵称**
|
||||
###### 接口功能
|
||||
> 获取群成员群内昵称
|
||||
|
||||
###### 接口地址
|
||||
> [/api/?type=26](/api/?type=26)
|
||||
|
||||
###### HTTP请求方式
|
||||
> POST JSON
|
||||
|
||||
###### 请求参数
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|chatRoomId |true |string| 群id |
|
||||
|memberId |true |string| 群成员id |
|
||||
|
||||
###### 返回字段
|
||||
|返回字段|字段类型|说明 |
|
||||
|---|---|---|
|
||||
|code|int|返回状态,1成功, 0失败|
|
||||
|result|string|成功提示|
|
||||
|nickname|string|昵称|
|
||||
|
||||
|
||||
###### 接口示例
|
||||
入参:
|
||||
``` javascript
|
||||
{
|
||||
"chatRoomId":"123@chatroom",
|
||||
"memberId":"wxid_123"
|
||||
}
|
||||
```
|
||||
响应:
|
||||
``` javascript
|
||||
{"code":1,"nickname":"昵称","result":"OK"}
|
||||
```
|
||||
|
||||
|
||||
#### 27.删除群成员**
|
||||
###### 接口功能
|
||||
@ -1241,6 +1280,48 @@ vcpkg
|
||||
{"code":1,"result":"OK"}
|
||||
```
|
||||
|
||||
|
||||
#### 55.获取联系人或者群名称**
|
||||
###### 接口功能
|
||||
> 根据wxid,获取联系人微信名称,传入群id获取群名称,传入群内非好友获取的是微信名称不是群内昵称。
|
||||
|
||||
###### 接口地址
|
||||
> [/api/?type=55](/api/?type=55)
|
||||
|
||||
###### HTTP请求方式
|
||||
> POST JSON
|
||||
|
||||
###### 请求参数
|
||||
|参数|必选|类型|说明|
|
||||
|---|---|---|---|
|
||||
|id |true |string| wxid或者群id |
|
||||
|
||||
|
||||
|
||||
###### 返回字段
|
||||
|返回字段|字段类型|说明 |
|
||||
|---|---|---|
|
||||
|code|int|返回状态,1成功, -1失败|
|
||||
|result|string|成功提示|
|
||||
|name|string|名称|
|
||||
|
||||
|
||||
###### 接口示例
|
||||
入参:
|
||||
``` javascript
|
||||
{
|
||||
"id":"wxid_123"
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
响应:
|
||||
``` javascript
|
||||
{"code":1,"name":"文件助手","result":"OK"}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 感谢
|
||||
https://github.com/ljc545w/ComWeChatRobot
|
||||
|
||||
|
15
src/api.cc
15
src/api.cc
@ -355,6 +355,12 @@ void api_handle(mg_http_message *hm, struct mg_connection *c, string &ret) {
|
||||
break;
|
||||
}
|
||||
case WECHAT_CHATROOM_GET_MEMBER_NICKNAME: {
|
||||
wstring room_id = get_http_req_param(hm, j_param, "chatRoomId", is_post);
|
||||
wstring member_id = get_http_req_param(hm, j_param, "memberId", is_post);
|
||||
|
||||
wstring nickname = GetChatRoomMemberNickname(WS2LW(room_id),WS2LW(member_id));
|
||||
json ret_data = {{"code", 1}, {"result", "OK"},{"nickname",unicode_to_utf8(WS2LW(nickname))}};
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
case WECHAT_CHATROOM_DEL_MEMBER: {
|
||||
@ -598,13 +604,20 @@ void api_handle(mg_http_message *hm, struct mg_connection *c, string &ret) {
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
case WECHAT_SNS_GET_NEXT_PAGE:{
|
||||
case WECHAT_SNS_GET_NEXT_PAGE: {
|
||||
ULONG64 snsid = get_http_param_ulong64(hm, j_param, "snsId", is_post);
|
||||
int success = GetNextPage(snsid);
|
||||
json ret_data = {{"code", success}, {"result", "OK"}};
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
case WECHAT_CONTACT_NAME:{
|
||||
wstring pri_id = get_http_req_param(hm, j_param, "id", is_post);
|
||||
wstring name =GetContactOrChatRoomNickname(WS2LW(pri_id));
|
||||
json ret_data = {{"code", 1}, {"result", "OK"},{"name",unicode_to_utf8(WS2LW(name))}};
|
||||
ret = ret_data.dump();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ typedef enum WECHAT_HTTP_APISTag
|
||||
WECHAT_REMOVE_TOP_MSG,
|
||||
WECHAT_SNS_GET_FIRST_PAGE,
|
||||
WECHAT_SNS_GET_NEXT_PAGE,
|
||||
WECHAT_CONTACT_NAME,
|
||||
} WECHAT_HTTP_APIS,
|
||||
*PWECHAT_HTTP_APIS;
|
||||
|
||||
|
@ -23,6 +23,10 @@ using namespace std;
|
||||
#define WX_TOP_MSG_OFFSET 0xb727e0
|
||||
#define WX_REMOVE_TOP_MSG_OFFSET 0xb725a0
|
||||
#define WX_FREE_CHAT_MSG_INSTANCE_COUNTER_OFFSET 0x6f5370
|
||||
#define WX_GET_MEMBER_NICKNAME_OFFSET 0xb703f0
|
||||
#define WX_CONTACT_MGR_INSTANCE_OFFSET 0x6f8990
|
||||
#define WX_GET_CONTACT_OFFSET 0xb93b20
|
||||
#define WX_FREE_CONTACT_OFFSET 0xe23690
|
||||
|
||||
int GetChatRoomDetailInfo(wchar_t* chat_room_id, ChatRoomInfoInner& room_info) {
|
||||
int success = 0;
|
||||
@ -352,4 +356,63 @@ int RemoveTopMsg(wchar_t* chat_room_id,ULONG64 msg_id){
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::wstring GetChatRoomMemberNickname(wchar_t* chat_room_id,wchar_t* wxid){
|
||||
WeChatString chat_room(chat_room_id);
|
||||
WeChatString member_id(wxid);
|
||||
WeChatString nickname(NULL);
|
||||
DWORD base = GetWeChatWinBase();
|
||||
DWORD get_chat_room_mgr_addr = base + WX_CHAT_ROOM_MGR_OFFSET;
|
||||
DWORD get_nickname_addr = base + WX_GET_MEMBER_NICKNAME_OFFSET;
|
||||
DWORD contact_mgr_addr = base + WX_CONTACT_MGR_INSTANCE_OFFSET;
|
||||
DWORD get_contact_addr = base + WX_GET_CONTACT_OFFSET;
|
||||
DWORD free_contact_addr = base + WX_FREE_CONTACT_OFFSET;
|
||||
__asm{
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
CALL get_chat_room_mgr_addr
|
||||
LEA ECX,nickname
|
||||
PUSH ECX
|
||||
LEA ECX,member_id
|
||||
PUSH ECX
|
||||
LEA ECX,chat_room
|
||||
PUSH ECX
|
||||
MOV ECX,EAX
|
||||
CALL get_nickname_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
wstring name = L"";
|
||||
if (nickname.ptr) {
|
||||
name += wstring(nickname.ptr);
|
||||
}else {
|
||||
char buff[0x440] = {0};
|
||||
__asm {
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
CALL contact_mgr_addr
|
||||
LEA ECX,buff
|
||||
PUSH ECX
|
||||
LEA ECX,member_id
|
||||
PUSH ECX
|
||||
MOV ECX,EAX
|
||||
CALL get_contact_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
name += READ_WSTRING(buff, 0x6C);
|
||||
|
||||
__asm{
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
LEA ECX,buff
|
||||
CALL free_contact_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
@ -11,4 +11,6 @@ int ModChatRoomMemberNickName(wchar_t* chat_room_id,wchar_t* wxid,wchar_t * nick
|
||||
|
||||
int SetTopMsg(wchar_t* wxid,ULONG64 msg_id);
|
||||
int RemoveTopMsg(wchar_t* chat_room_id,ULONG64 msg_id);
|
||||
|
||||
std::wstring GetChatRoomMemberNickname(wchar_t* chat_room_id,wchar_t* wxid);
|
||||
#endif
|
@ -11,6 +11,9 @@ using namespace std;
|
||||
#define WX_SYNC_MGR_OFFSET 0xa87fd0
|
||||
#define WX_SET_VALUE_OFFSET 0x1f80900
|
||||
#define WX_DO_DEL_CONTACT_OFFSET 0xca6480
|
||||
#define WX_FREE_CONTACT_OFFSET 0xe23690
|
||||
#define WX_GET_CONTACT_OFFSET 0xb93b20
|
||||
|
||||
int GetAllContact(vector<Contact> &vec) {
|
||||
DWORD base = GetWeChatWinBase();
|
||||
DWORD get_instance = base + WX_CONTACT_MGR_INSTANCE_OFFSET;
|
||||
@ -100,4 +103,36 @@ int DelContact(wchar_t *wxid) {
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
std::wstring GetContactOrChatRoomNickname(wchar_t *id) {
|
||||
int success = -1;
|
||||
char buff[0x440] = {0};
|
||||
WeChatString pri(id);
|
||||
DWORD base = GetWeChatWinBase();
|
||||
DWORD contact_mgr_addr = base + WX_CONTACT_MGR_INSTANCE_OFFSET;
|
||||
DWORD get_contact_addr = base + WX_GET_CONTACT_OFFSET;
|
||||
DWORD free_contact_addr = base + WX_FREE_CONTACT_OFFSET;
|
||||
wstring name = L"";
|
||||
__asm {
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
CALL contact_mgr_addr
|
||||
LEA ECX,buff
|
||||
PUSH ECX
|
||||
LEA ECX,pri
|
||||
PUSH ECX
|
||||
MOV ECX,EAX
|
||||
CALL get_contact_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
name += READ_WSTRING(buff, 0x6C);
|
||||
__asm {
|
||||
PUSHAD
|
||||
PUSHFD
|
||||
LEA ECX,buff
|
||||
CALL free_contact_addr
|
||||
POPFD
|
||||
POPAD
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
@ -8,4 +8,6 @@ int GetAllContact(std::vector<Contact> &vec);
|
||||
|
||||
|
||||
int DelContact(wchar_t* wxid);
|
||||
|
||||
std::wstring GetContactOrChatRoomNickname(wchar_t* id);
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user