diff --git a/README.md b/README.md index 4b256db..375e288 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,38 @@ vcpkg ``` +#### 10.取消hook消息** +###### 接口功能 +> 取消hook消息 + +###### 接口地址 +> [/api/?type=10](/api/?type=10) + +###### HTTP请求方式 +> POST JSON + +###### 请求参数 +|参数|必选|类型|说明| +|---|---|---|---| + + + +###### 返回字段 +|返回字段|字段类型|说明 | +|---|---|---| +|code|int|返回状态,1成功, 0失败| +|result|string|成功提示| + + +###### 接口示例 +入参: +``` javascript + +``` +响应: +``` javascript +{"code":1,"result":"OK"} +``` #### 11.hook图片** ###### 接口功能 @@ -348,6 +380,38 @@ vcpkg ``` +#### 12.取消hook图片** +###### 接口功能 +> 取消hook图片 + +###### 接口地址 +> [/api/?type=12](/api/?type=12) + +###### HTTP请求方式 +> POST JSON + +###### 请求参数 +|参数|必选|类型|说明| +|---|---|---|---| + + + +###### 返回字段 +|返回字段|字段类型|说明 | +|---|---|---| +|code|int|返回状态,1成功, 0失败| +|result|string|成功提示| + + +###### 接口示例 +入参: +``` javascript + +``` +响应: +``` javascript +{"code":1,"result":"OK"} +``` #### 17.删除好友** ###### 接口功能 diff --git a/src/api.cc b/src/api.cc index 9a08828..61efb34 100644 --- a/src/api.cc +++ b/src/api.cc @@ -267,7 +267,11 @@ void api_handle(mg_http_message *hm, struct mg_connection *c, string &ret) { } case WECHAT_MSG_START_HOOK: { int port = get_http_req_param_int(hm, j_param, "port", is_post); - int success = HookRecvMsg(port); + wstring ip = get_http_req_param(hm, j_param, "ip", is_post); + string client_ip = Wstring2String(ip); + char ip_cstr[16]; + strcpy_s(ip_cstr,client_ip.c_str()); + int success = HookRecvMsg(ip_cstr,port); json ret_data = {{"code", success}, {"result", "OK"}}; ret = ret_data.dump(); break; diff --git a/src/hook_recv_msg.cc b/src/hook_recv_msg.cc index 5728370..71fe1a5 100644 --- a/src/hook_recv_msg.cc +++ b/src/hook_recv_msg.cc @@ -20,6 +20,7 @@ using namespace std; #define CLIENT_IP "127.0.0.1" static int kServerPort = 0; static int kMessageHooked = FALSE; +static char kServerIp[16]= "127.0.0.1"; static DWORD kWeChatWinBase = GetWeChatWinBase(); static char kOriginReceMsgAsmCode[5] = {0}; @@ -59,10 +60,12 @@ BOOL SendBySocket(const char *buffer, size_t len) { memset(&client_addr, 0, sizeof(client_addr)); client_addr.sin_family = AF_INET; client_addr.sin_port = htons((u_short)kServerPort); - InetPtonA(AF_INET, CLIENT_IP, &client_addr.sin_addr.s_addr); + InetPtonA(AF_INET, kServerIp, &client_addr.sin_addr.s_addr); if (connect(client_socket, reinterpret_cast(&client_addr), sizeof(sockaddr)) < 0) { #ifdef _DEBUG + cout << "kServerIp:" << kServerIp <