Merge pull request #274 from ttttupup/dev-3.9.5.81

Dev 3.9.5.81
This commit is contained in:
ttttupup 2023-08-31 09:33:55 +08:00 committed by GitHub
commit 632d4222fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 159 additions and 2 deletions

View File

@ -1688,7 +1688,7 @@ enableHttp=0时使用ipport的tcp服务回传消息。
> 发送小程序(待完善,不稳定),相关参数可以参考示例的滴滴小程序的内容自行组装。
###### 接口地址
> [/api/sendCustomEmotion](/api/sendApplet)
> [/api/sendApplet](/api/sendApplet)
###### HTTP请求方式
> POST JSON
@ -1737,4 +1737,93 @@ enableHttp=0时使用ipport的tcp服务回传消息。
"data": {},
"msg": "success"
}
```
#### 35.拍一拍**
###### 接口功能
> 拍一拍
###### 接口地址
> [/api/sendPatMsg](/api/sendPatMsg)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|wxid|string|被拍人id|
|receiver|string|接收人id可以是自己wxid私聊好友wxid群id|
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,大于0成功, -1失败|
|msg|string|成功提示|
|data|object|null|
###### 接口示例
入参:
``` javascript
{
"wxid":"wxid_1234",
"receiver":"wxid_1234",
}
```
响应:
``` javascript
{
"code": 1,
"data": {},
"msg": "success"
}
```
#### 36.OCR**
###### 接口功能
> OCR识别文字非0时再调用一次一般需要调用2次
###### 接口地址
> [/api/ocr](/api/ocr)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|imagePath|string|图片全路径|
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,0成功, 非0时再调用一次|
|msg|string|成功提示|
|data|object|识别得结果|
###### 接口示例
入参:
``` javascript
{
"imagePath":"C:\\var\\123.jpg"
}
```
响应:
``` javascript
{
"code": 0,
"data": "17 硬卧下铺别人能不能坐?12306回应\r\n18 中南财大被解聘女讲师已失联4个多月\r\n19 新一轮存款利率下调即将落地\r\n",
"msg": "success"
}
```

View File

@ -579,6 +579,23 @@ std::string HttpDispatch(struct mg_connection *c, struct mg_http_message *hm) {
{"code", success}, {"msg", "success"}, {"data", {}}};
ret = ret_data.dump();
return ret;
} else if (mg_http_match_uri(hm, "/api/sendPatMsg")) {
std::wstring room_id = GetWStringParam(j_param, "receiver");
std::wstring wxid = GetWStringParam(j_param, "wxid");
INT64 success =
wxhelper::GlobalContext::GetInstance().mgr->SendPatMsg(room_id, wxid);
nlohmann::json ret_data = {
{"code", success}, {"msg", "success"}, {"data", {}}};
ret = ret_data.dump();
return ret;
} else if (mg_http_match_uri(hm, "/api/ocr")) {
std::wstring image_path = GetWStringParam(j_param, "imagePath");
std::string text("");
INT64 success = wxhelper::GlobalContext::GetInstance().mgr->DoOCRTask(image_path,text);
nlohmann::json ret_data = {
{"code", success}, {"msg", "success"}, {"data", text}};
ret = ret_data.dump();
return ret;
} else if (mg_http_match_uri(hm, "/api/test")) {
INT64 success = wxhelper::GlobalContext::GetInstance().mgr->Test();
nlohmann::json ret_data = {

View File

@ -1213,6 +1213,49 @@ INT64 Manager::SendApplet(const std::wstring &recv_wxid,
return success;
}
INT64 Manager::SendPatMsg(const std::wstring &room_id,
const std::wstring &wxid) {
INT64 success = -1;
UINT64 send_pat_msg_addr = base_addr_ + offset::kSendPatMsg;
func::__SendPatMsg send_pat_msg =(func::__SendPatMsg)send_pat_msg_addr;
prototype::WeChatString chat_room(room_id);
prototype::WeChatString target(wxid);
success = send_pat_msg(reinterpret_cast<UINT64>(&chat_room),reinterpret_cast<UINT64>(&target));
return success;
}
INT64 Manager::DoOCRTask(const std::wstring &img_path, std::string &result) {
INT64 success = -1;
UINT64 ocr_manager_addr = base_addr_ + offset::kGetOCRManager;
func::__GetOCRManager ocr_manager = (func::__GetOCRManager)ocr_manager_addr;
UINT64 do_ocr_task_addr = base_addr_ + offset::kDoOCRTask;
func::__DoOCRTask do_ocr_task = (func::__DoOCRTask)do_ocr_task_addr;
prototype::WeChatString img(img_path);
std::vector<INT64> *temp = Utils::WxHeapAlloc<std::vector<INT64>>(0x20);
INT64 unkonwn = 0;
common::VectorInner *list = (common::VectorInner *)temp;
list->start = reinterpret_cast<INT64>(&list->start);
list->finsh = list->start;
char buff[0x28] = {0};
memcpy(buff, &list->start, sizeof(INT64));
UINT64 mgr = ocr_manager();
success = do_ocr_task(mgr, reinterpret_cast<UINT64>(&img),1,
reinterpret_cast<UINT64>(buff),reinterpret_cast<UINT64>(&unkonwn));
INT64 number = *(INT64 *)(buff + 0x8);
if (number > 0) {
INT64 header = list->start;
for (unsigned int i = 0; i < number - 1; i++) {
INT64 content = *(INT64 *)header;
result += Utils::ReadWstringThenConvert(content + 0x28);
result += "\r\n";
header = content;
}
}
return success;
}
INT64 Manager::Test() {
auto vec = Utils::QWordScan(base_addr_ + 0x32D1318, 0x1, L"WeChatWin.dll");
for (int i = 0; i < vec.size(); i++) {

View File

@ -56,12 +56,14 @@ class Manager {
INT64 GetVoiceByDB(ULONG64 msg_id, const std::wstring& dir);
INT64 SendCustomEmotion(const std::wstring& file_path,
const std::wstring& wxid);
INT64 Manager::SendApplet(
INT64 SendApplet(
const std::wstring& recv_wxid, const std::wstring& waid_suff,
const std::wstring& waid_w, const std::string& waid_s,
const std::string& wa_wxid, const std::string& json_param,
const std::string& head_image, const std::string& big_image,
const std::string& index_page);
INT64 SendPatMsg(const std::wstring& room_id, const std::wstring& wxid);
INT64 DoOCRTask(const std::wstring& img_path, std::string &result);
INT64 Test();
private:
UINT64 base_addr_;

View File

@ -282,6 +282,9 @@ typedef UINT64 (*__GetAppInfoByWaid)(UINT64,UINT64);
typedef UINT64 (*__CopyShareAppMessageRequest)(UINT64,UINT64);
typedef UINT64 (*__NewWAUpdatableMsgInfo)(UINT64);
typedef UINT64 (*__FreeWAUpdatableMsgInfo)(UINT64);
typedef UINT64 (*__SendPatMsg)(UINT64,UINT64);
typedef UINT64 (*__GetOCRManager)();
typedef UINT64 (*__DoOCRTask)(UINT64,UINT64,UINT64,UINT64,UINT64);
} // namespace function
@ -440,6 +443,9 @@ const UINT64 kGetAppInfoByWaid = 0x13c5790;
const UINT64 kCopyShareAppMessageRequest = 0x13c0670;
const UINT64 kNewWAUpdatableMsgInfo = 0x919ca0;
const UINT64 kFreeWAUpdatableMsgInfo = 0x8fc230;
const UINT64 kSendPatMsg = 0x195f340;
const UINT64 kGetOCRManager = 0x999780;
const UINT64 kDoOCRTask = 0x190b2a0;
} // namespace offset
} // namespace V3_9_5_81