mirror of
https://github.com/ttttupup/wxhelper.git
synced 2025-04-29 08:19:48 +08:00
Compare commits
15 Commits
3.9.8.25-v
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
fa90a0ea87 | ||
|
335a4771fe | ||
|
24bb7212fa | ||
|
1528b66b94 | ||
|
62a641d7f7 | ||
|
49188b7ef0 | ||
|
e4656e5139 | ||
|
0bd8b47da0 | ||
|
7a5a8a90df | ||
|
b5cc83be77 | ||
|
3b5f191bf2 | ||
|
dff024745c | ||
|
8b6e2d7160 | ||
|
5d7c1d1d48 | ||
|
d574af863a |
640
doc/postman.json
Normal file
640
doc/postman.json
Normal file
@ -0,0 +1,640 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "Wechat Hook 395",
|
||||||
|
"_postman_id": "d2b6a4f2-6d7d-4a21-9bbf-65b5a5a3a5a",
|
||||||
|
"description": "A collection of Wechat Hook 395 API requests.",
|
||||||
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||||
|
},
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "checkLogin",
|
||||||
|
"request": {
|
||||||
|
"url": {
|
||||||
|
"raw": "http://127.0.0.1:19088/api/checkLogin",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": [
|
||||||
|
"127.0.0.1"
|
||||||
|
],
|
||||||
|
"port": "19088",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"checkLogin"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": ""
|
||||||
|
},
|
||||||
|
"description": "API to check login status."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "userInfo",
|
||||||
|
"request": {
|
||||||
|
"url": {
|
||||||
|
"raw": "http://127.0.0.1:19088/api/userInfo",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": [
|
||||||
|
"127.0.0.1"
|
||||||
|
],
|
||||||
|
"port": "19088",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"userInfo"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": ""
|
||||||
|
},
|
||||||
|
"description": "API to get user information."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sendTextMsg",
|
||||||
|
"request": {
|
||||||
|
"url": {
|
||||||
|
"raw": "http://127.0.0.1:19088/api/sendTextMsg",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": [
|
||||||
|
"127.0.0.1"
|
||||||
|
],
|
||||||
|
"port": "19088",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"sendTextMsg"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"wxid\": \"filehelper\",\"msg\": \"12www\"}"
|
||||||
|
},
|
||||||
|
"description": "API to send text messages."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sendImagesMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/sendImagesMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"wxid\": \"filehelper\",\"imagePath\": \"C:\\pic.png\"}"
|
||||||
|
},
|
||||||
|
"description": "API to send image messages."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sendFileMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/sendFileMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"wxid\": \"filehelper\",\"filePath\": \"C:\\test.zip\"}"
|
||||||
|
},
|
||||||
|
"description": "API to send file messages."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "hookSyncMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/hookSyncMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"port\": \"19099\",\"ip\": \"127.0.0.1\",\"url\": \"http://localhost:8080\",\"timeout\": \"3000\",\"enableHttp\": \"0\"}"
|
||||||
|
},
|
||||||
|
"description": "API to hook sync messages."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "unhookSyncMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/unhookSyncMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": ""
|
||||||
|
},
|
||||||
|
"description": "API to unhook sync messages."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getContactList",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/getContactList",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": ""
|
||||||
|
},
|
||||||
|
"description": "API to get the contact list."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getDBInfo",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/getDBInfo",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": ""
|
||||||
|
},
|
||||||
|
"description": "API to get database information."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "execSql",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/execSql",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"dbHandle\": 1713425147584,\"sql\": \"select * from MSG where localId =100;\"}"
|
||||||
|
},
|
||||||
|
"description": "API to execute SQL queries."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getChatRoomDetailInfo",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/getChatRoomDetailInfo",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"chatRoomId\": \"123333@chatroom\"}"
|
||||||
|
},
|
||||||
|
"description": "API to get chat room detail information."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "addMemberToChatRoom",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/addMemberToChatRoom",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"chatRoomId\": \"123@chatroom\",\"memberIds\": \"wxid_123\"}"
|
||||||
|
},
|
||||||
|
"description": "API to add member to chat room."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "delMemberFromChatRoom",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/delMemberFromChatRoom",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"chatRoomId\": \"21363231004@chatroom\",\"memberIds\": \"wxid_123\"}"
|
||||||
|
},
|
||||||
|
"description": "API to delete member from chat room."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "modifyNickname",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/modifyNickname",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"chatRoomId\": \"123@chatroom\",\"wxid\": \"wxid_123\",\"nickName\": \"test\"}"
|
||||||
|
},
|
||||||
|
"description": "API to modify a nickname in a chat room."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getMemberFromChatRoom",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/getMemberFromChatRoom",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"chatRoomId\": \"123@chatroom\"}"
|
||||||
|
},
|
||||||
|
"description": "API to get members from a chat room."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "topMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/topMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"msgId\": 1222222}"
|
||||||
|
},
|
||||||
|
"description": "API to top a message."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "removeTopMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/removeTopMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"chatRoomId\": \"123@chatroom\",\"msgId\": 123}"
|
||||||
|
},
|
||||||
|
"description": "API to remove a topped message."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "InviteMemberToChatRoom",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/InviteMemberToChatRoom",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"chatRoomId\": \"123@chatroom\",\"memberIds\": \"wxid_123\"}"
|
||||||
|
},
|
||||||
|
"description": "API to invite members to a chat room."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "hookLog",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/hookLog",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": ""
|
||||||
|
},
|
||||||
|
"description": "API to hook logs."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "unhookLog",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/unhookLog",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": ""
|
||||||
|
},
|
||||||
|
"description": "API to unhook logs."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "createChatRoom",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/createChatRoom",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"memberIds\": \"wxid_8yn4k908tdqp22,wxid_oyb662qhop4422\"}"
|
||||||
|
},
|
||||||
|
"description": "API to create a chat room."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "quitChatRoom",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/quitChatRoom",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"chatRoomId\": \"123@chatroom\"}"
|
||||||
|
},
|
||||||
|
"description": "API to quit a chat room."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "forwardMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/forwardMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"wxid\": \"filehelper\",\"msgId\": \"12331\"}"
|
||||||
|
},
|
||||||
|
"description": "API to forward a message."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getSNSFirstPage",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/getSNSFirstPage",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": ""
|
||||||
|
},
|
||||||
|
"description": "API to get the first page of SNS data."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getSNSNextPage",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/getSNSNextPage",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"snsId\": \"\"}"
|
||||||
|
},
|
||||||
|
"description": "API to get the next page of SNS data."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "addFavFromMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/addFavFromMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"msgId\": \"1222222\"}"
|
||||||
|
},
|
||||||
|
"description": "API to add a favorite from a message."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "addFavFromImage",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/addFavFromImage",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"wxid\": \"\",\"imagePath\": \"\"}"
|
||||||
|
},
|
||||||
|
"description": "API to add a favorite from an image."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getContactProfile",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/getContactProfile",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"wxid\": \"\"}"
|
||||||
|
},
|
||||||
|
"description": "API to get contact profile."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sendAtText",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/sendAtText",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"wxids\": \"notify@all\",\"chatRoomId\": \"123@chatroom\",\"msg\": \"你好啊\"}"
|
||||||
|
},
|
||||||
|
"description": "API to send an at-text message."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "forwardPublicMsg",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/forwardPublicMsg",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"appName\": \"\",\"userName\": \"\",\"title\": \"\",\"url\": \"\",\"thumbUrl\": \"\",\"digest\": \"\",\"wxid\": \"filehelper\"}"
|
||||||
|
},
|
||||||
|
"description": "API to forward a public message."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "forwardPublicMsgByMsgId",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/forwardPublicMsgByMsgId",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"msgId\": 123,\"wxid\": \"filehelper\"}"
|
||||||
|
},
|
||||||
|
"description": "API to forward a public message by message ID."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "downloadAttach",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/downloadAttach",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"msgId\": 123}"
|
||||||
|
},
|
||||||
|
"description": "API to download an attachment."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "decodeImage",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/decodeImage",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"filePath\": \"C:\\66664816980131.dat\",\"storeDir\": \"C:\\test\"}"
|
||||||
|
},
|
||||||
|
"description": "API to decode an image."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getVoiceByMsgId",
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:19088/api/getVoiceByMsgId",
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"description": "Specify that the request body is in JSON format."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"msgId\": 7880439644200,\"storeDir\": \"c:\\test\"}"
|
||||||
|
},
|
||||||
|
"description": "API to get voice by message ID."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.2</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.example</groupId>
|
<groupId>com.example</groupId>
|
||||||
@ -14,7 +14,8 @@
|
|||||||
<name>wxhk</name>
|
<name>wxhk</name>
|
||||||
<description>wxhk</description>
|
<description>wxhk</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>21</java.version>
|
||||||
|
<vertx-web-client.version>4.5.3</vertx-web-client.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -39,7 +40,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-all</artifactId>
|
<artifactId>netty-all</artifactId>
|
||||||
<version>4.1.92.Final</version>
|
<version>4.1.105.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
@ -50,22 +51,22 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.vertx</groupId>
|
<groupId>io.vertx</groupId>
|
||||||
<artifactId>vertx-core</artifactId>
|
<artifactId>vertx-core</artifactId>
|
||||||
<version>4.4.2</version>
|
<version>${vertx-web-client.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.vertx</groupId>
|
<groupId>io.vertx</groupId>
|
||||||
<artifactId>vertx-web</artifactId>
|
<artifactId>vertx-web</artifactId>
|
||||||
<version>4.4.2</version>
|
<version>${vertx-web-client.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.vertx</groupId>
|
<groupId>io.vertx</groupId>
|
||||||
<artifactId>vertx-web-client</artifactId>
|
<artifactId>vertx-web-client</artifactId>
|
||||||
<version>4.4.2</version>
|
<version>${vertx-web-client.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.vertx</groupId>
|
<groupId>io.vertx</groupId>
|
||||||
<artifactId>vertx-mysql-client</artifactId>
|
<artifactId>vertx-mysql-client</artifactId>
|
||||||
<version>4.4.2</version>
|
<version>${vertx-web-client.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -42,6 +42,11 @@ public class PrivateChatMsg implements Serializable {
|
|||||||
private String signature;
|
private String signature;
|
||||||
private String time;
|
private String time;
|
||||||
private Integer timestamp;
|
private Integer timestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对用户,如果是文件助手是filehelper
|
||||||
|
*/
|
||||||
|
private String toUser;
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
*/
|
*/
|
||||||
|
@ -15,4 +15,17 @@ import lombok.experimental.Accessors;
|
|||||||
public class OpenHook implements SendMsg<OpenHook> {
|
public class OpenHook implements SendMsg<OpenHook> {
|
||||||
String port;
|
String port;
|
||||||
String ip;
|
String ip;
|
||||||
|
/**
|
||||||
|
* 0/1 :1.启用http 0.不启用http
|
||||||
|
*/
|
||||||
|
boolean enableHttp;
|
||||||
|
/**
|
||||||
|
* 超时时间,单位ms
|
||||||
|
*/
|
||||||
|
String timeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http的请求地址,enableHttp=1时,不能为空
|
||||||
|
*/
|
||||||
|
String url;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import org.w3c.dom.NodeList;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
@ -50,7 +51,12 @@ public class WxMsgHandle {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
add(chatMsg -> {
|
add(chatMsg -> {
|
||||||
wxSmgServer.私聊(chatMsg);
|
if(Objects.equals(chatMsg.getToUser(), FILEHELPER)){
|
||||||
|
wxSmgServer.文件助手(chatMsg);
|
||||||
|
}else{
|
||||||
|
wxSmgServer.私聊(chatMsg);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, WxMsgType.私聊信息);
|
}, WxMsgType.私聊信息);
|
||||||
add(chatMsg -> {
|
add(chatMsg -> {
|
||||||
@ -174,8 +180,8 @@ public class WxMsgHandle {
|
|||||||
if (monery.startsWith("¥")) {
|
if (monery.startsWith("¥")) {
|
||||||
String substring = monery.substring(1);
|
String substring = monery.substring(1);
|
||||||
BigDecimal decimal = new BigDecimal(substring);
|
BigDecimal decimal = new BigDecimal(substring);
|
||||||
log.info("收款:{},付款人:{},付款备注:{}", decimal.stripTrailingZeros().toPlainString(), chatMsg.getFromUser(), remark);
|
log.info("收款:{},付款人:{},付款备注:{}", decimal.stripTrailingZeros().toPlainString(), receiver_username, remark);
|
||||||
wxSmgServer.收款之后(new PayoutInformation(chatMsg.getFromUser(), decimal, remark));
|
wxSmgServer.收款之后(new PayoutInformation(receiver_username, decimal, remark));
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,12 +32,14 @@ public class WxSmgServerImpl implements com.example.wxhk.server.WxSmgServer {
|
|||||||
public void 私聊(PrivateChatMsg chatMsg) {
|
public void 私聊(PrivateChatMsg chatMsg) {
|
||||||
if (Objects.equals(chatMsg.getIsSendMsg(), 1) && Objects.equals(chatMsg.getIsSendByPhone(), 1)) {
|
if (Objects.equals(chatMsg.getIsSendMsg(), 1) && Objects.equals(chatMsg.getIsSendByPhone(), 1)) {
|
||||||
log.info("手机端对:{}发出:{}", chatMsg.getFromUser(), chatMsg.getContent());
|
log.info("手机端对:{}发出:{}", chatMsg.getFromUser(), chatMsg.getContent());
|
||||||
|
}else{
|
||||||
|
log.info("收到私聊{}",chatMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void 文件助手(PrivateChatMsg chatMsg) {
|
public void 文件助手(PrivateChatMsg chatMsg) {
|
||||||
|
log.info("文件助手:{}",chatMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,8 @@ package com.example.wxhk.tcp.vertx;
|
|||||||
|
|
||||||
import com.example.wxhk.WxhkApplication;
|
import com.example.wxhk.WxhkApplication;
|
||||||
import com.example.wxhk.constant.WxMsgType;
|
import com.example.wxhk.constant.WxMsgType;
|
||||||
import com.example.wxhk.util.HttpAsyncUtil;
|
import com.example.wxhk.model.request.OpenHook;
|
||||||
|
import com.example.wxhk.util.HttpSendUtil;
|
||||||
import io.vertx.core.AbstractVerticle;
|
import io.vertx.core.AbstractVerticle;
|
||||||
import io.vertx.core.DeploymentOptions;
|
import io.vertx.core.DeploymentOptions;
|
||||||
import io.vertx.core.Future;
|
import io.vertx.core.Future;
|
||||||
@ -75,7 +76,10 @@ public class VertxTcp extends AbstractVerticle implements CommandLineRunner {
|
|||||||
listen.onComplete(event -> {
|
listen.onComplete(event -> {
|
||||||
boolean succeeded = event.succeeded();
|
boolean succeeded = event.succeeded();
|
||||||
if (succeeded) {
|
if (succeeded) {
|
||||||
HttpAsyncUtil.exec(HttpAsyncUtil.Type.开启hook, new JsonObject().put("port", InitWeChat.getVertxPort().toString()).put("ip", "127.0.0.1"));
|
HttpSendUtil.开启hook(new OpenHook().setPort(InitWeChat.getVertxPort().toString()).setIp("127.0.0.1")
|
||||||
|
.setEnableHttp(false)
|
||||||
|
.setTimeout("5000"));
|
||||||
|
// HttpAsyncUtil.exec(HttpAsyncUtil.Type.开启hook, new JsonObject().put("port", InitWeChat.getVertxPort().toString()).put("ip", "127.0.0.1"));
|
||||||
startPromise.complete();
|
startPromise.complete();
|
||||||
} else {
|
} else {
|
||||||
startPromise.fail(event.cause());
|
startPromise.fail(event.cause());
|
||||||
|
@ -24,7 +24,7 @@ public class HttpAsyncUtil {
|
|||||||
protected static final Log log = Log.get();
|
protected static final Log log = Log.get();
|
||||||
|
|
||||||
public static Future<HttpResponse<Buffer>> exec(Type type, JsonObject object) {
|
public static Future<HttpResponse<Buffer>> exec(Type type, JsonObject object) {
|
||||||
return client.post(InitWeChat.wxPort, "localhost", "/api/?type=" + type.getType())
|
return client.post(InitWeChat.wxPort, "localhost", "/api/" + type.getType())
|
||||||
.sendJsonObject(object)
|
.sendJsonObject(object)
|
||||||
.onSuccess(event ->
|
.onSuccess(event ->
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ public class HttpAsyncUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Future<HttpResponse<Buffer>> exec(Type type, JsonObject object, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
|
public static Future<HttpResponse<Buffer>> exec(Type type, JsonObject object, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
|
||||||
return client.post(InitWeChat.wxPort, "localhost", "/api/?type=" + type.getType())
|
return client.post(InitWeChat.wxPort, "localhost", "/api/" + type.getType())
|
||||||
.sendJsonObject(object)
|
.sendJsonObject(object)
|
||||||
.onComplete(handler)
|
.onComplete(handler)
|
||||||
;
|
;
|
||||||
@ -45,22 +45,31 @@ public class HttpAsyncUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
检查微信登陆("0"),
|
检查微信登陆("checkLogin"),
|
||||||
获取登录信息("1"),
|
获取登录信息("userInfo"),
|
||||||
发送文本("2"),
|
发送文本("sendTextMsg"),
|
||||||
发送at文本("3"),
|
转发消息("forwardMsg"),
|
||||||
|
发送at文本("sendAtText"),
|
||||||
发送图片("5"),
|
发送图片("5"),
|
||||||
发送文件("6"),
|
发送文件("sendFileMsg"),
|
||||||
开启hook("9"),
|
开启hook("hookSyncMsg"),
|
||||||
关闭hook("10"),
|
关闭hook("unhookSyncMsg"),
|
||||||
添加好友("20"),
|
添加好友("20"),
|
||||||
通过好友申请("23"),
|
通过好友申请("23"),
|
||||||
获取群成员("25"),
|
获取群成员("getMemberFromChatRoom"),
|
||||||
获取群成员昵称("26"),
|
获取群成员基础信息("getContactProfile"),
|
||||||
删除群成员("27"),
|
获取群详情("getChatRoomDetailInfo"),
|
||||||
|
添加群成员("addMemberToChatRoom"),
|
||||||
|
修改群昵称("modifyNickname"),
|
||||||
|
删除群成员("delMemberFromChatRoom"),
|
||||||
|
置顶群消息("topMsg"),
|
||||||
|
取消置顶群消息("removeTopMsg"),
|
||||||
|
邀请入群("InviteMemberToChatRoom"),
|
||||||
确认收款("45"),
|
确认收款("45"),
|
||||||
联系人列表("46"),
|
联系人列表("getContactList"),
|
||||||
查询微信信息("55"),
|
查询微信信息("55"),
|
||||||
|
下载附件("downloadAttach"),
|
||||||
|
解码("decodeImage"),
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -27,7 +27,7 @@ public class HttpSyncUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JsonObject exec(HttpAsyncUtil.Type type, JsonObject obj) {
|
public static JsonObject exec(HttpAsyncUtil.Type type, JsonObject obj) {
|
||||||
String post = engine.send(Request.of("http://localhost:" + InitWeChat.wxPort + "/api/?type=" + type.getType()).method(Method.POST).body(obj.encode())).bodyStr();
|
String post = engine.send(Request.of("http://localhost:" + InitWeChat.wxPort + "/api/" + type.getType()).method(Method.POST).body(obj.encode())).bodyStr();
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("type:{},{}", type.getType(), post);
|
log.debug("type:{},{}", type.getType(), post);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
wx.path=D:\\Program Files (x86)\\Tencent\\WeChat\\[3.9.2.23]\\WeChat.exe
|
wx.path=D:\\Program Files (x86)\\Tencent\\WeChat\\WeChat.exe
|
||||||
wx.port=19088
|
wx.port=19088
|
||||||
spring.profiles.active=local
|
spring.profiles.active=local
|
||||||
vertx.port=8080
|
vertx.port=8080
|
Binary file not shown.
Binary file not shown.
@ -7,6 +7,8 @@ import org.dromara.hutool.core.lang.Console;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ -41,5 +43,7 @@ class HttpSendUtilTest {
|
|||||||
void 获取群成员() {
|
void 获取群成员() {
|
||||||
GroupMembers 获取群成员 = HttpSendUtil.获取群成员(new GetGroupMembers().setChatRoomId("24964676359@chatroom"));
|
GroupMembers 获取群成员 = HttpSendUtil.获取群成员(new GetGroupMembers().setChatRoomId("24964676359@chatroom"));
|
||||||
Console.log(获取群成员);
|
Console.log(获取群成员);
|
||||||
|
|
||||||
|
Duration between = Duration.between(LocalDateTime.now(), LocalDateTime.now());
|
||||||
}
|
}
|
||||||
}
|
}
|
26
nodejs_client/tcp_server.js
Normal file
26
nodejs_client/tcp_server.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
const net = require('net')
|
||||||
|
|
||||||
|
const server = net.createServer(socket => {
|
||||||
|
console.log('New client connected')
|
||||||
|
|
||||||
|
let data = Buffer.from('')
|
||||||
|
|
||||||
|
socket.on('data', data => {
|
||||||
|
data = Buffer.concat([data, chunk])
|
||||||
|
console.log(`Received data: ${data}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
socket.on('end', () => {
|
||||||
|
const decodedData = data.toString('utf8')
|
||||||
|
console.log(`Received data: ${decodedData}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
socket.on('close', () => {
|
||||||
|
console.log('Client disconnected')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const port = 19099
|
||||||
|
server.listen(port, () => {
|
||||||
|
console.log(`Server listening on port ${port}`)
|
||||||
|
})
|
@ -526,7 +526,7 @@ DWORD GetPIDForProcess(wchar_t* process)
|
|||||||
if (!hSnapshot) {
|
if (!hSnapshot) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pe32.dwSize = sizeof(PROCESSENTRY32);
|
pe32.dwSize = sizeof(PROCESSENTRY32W);
|
||||||
for (working = Process32FirstW(hSnapshot, &pe32); working; working = Process32NextW(hSnapshot, &pe32))
|
for (working = Process32FirstW(hSnapshot, &pe32); working; working = Process32NextW(hSnapshot, &pe32))
|
||||||
{
|
{
|
||||||
if (!wcscmp(pe32.szExeFile, process))
|
if (!wcscmp(pe32.szExeFile, process))
|
||||||
@ -933,7 +933,7 @@ int InjectDll(wchar_t* szPName, wchar_t* szDllPath)
|
|||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD dErrorCode = GetLastError();
|
DWORD dErrorCode = GetLastError();
|
||||||
printf("dll inject fail");
|
printf("dll inject fail");
|
||||||
printf("error code : %d ", dErrorCode);
|
printf("error code : %d ", dErrorCode);
|
||||||
|
@ -1165,8 +1165,9 @@ INT64 Manager::SendApplet(const std::wstring &recv_wxid,
|
|||||||
common::VectorInner *list = (common::VectorInner *)temp;
|
common::VectorInner *list = (common::VectorInner *)temp;
|
||||||
|
|
||||||
prototype::WeChatString *member = BuildWechatString(recv_wxid);
|
prototype::WeChatString *member = BuildWechatString(recv_wxid);
|
||||||
|
#ifdef _DEBUG
|
||||||
list->head = reinterpret_cast<UINT64>(member);
|
list->head = reinterpret_cast<UINT64>(member);
|
||||||
|
#endif
|
||||||
list->start = reinterpret_cast<UINT64>(member);
|
list->start = reinterpret_cast<UINT64>(member);
|
||||||
list->finsh = reinterpret_cast<UINT64>(member) + 0x20;
|
list->finsh = reinterpret_cast<UINT64>(member) + 0x20;
|
||||||
list->end = reinterpret_cast<UINT64>(member) + 0x20;
|
list->end = reinterpret_cast<UINT64>(member) + 0x20;
|
||||||
@ -1245,8 +1246,8 @@ INT64 Manager::DoOCRTask(const std::wstring &img_path, std::string &result) {
|
|||||||
reinterpret_cast<UINT64>(buff),reinterpret_cast<UINT64>(&unkonwn));
|
reinterpret_cast<UINT64>(buff),reinterpret_cast<UINT64>(&unkonwn));
|
||||||
INT64 number = *(INT64 *)(buff + 0x8);
|
INT64 number = *(INT64 *)(buff + 0x8);
|
||||||
if (number > 0) {
|
if (number > 0) {
|
||||||
INT64 header = list->start;
|
INT64 header = *(INT64 *)(buff);
|
||||||
for (unsigned int i = 0; i < number - 1; i++) {
|
for (unsigned int i = 0; i < number; i++) {
|
||||||
INT64 content = *(INT64 *)header;
|
INT64 content = *(INT64 *)header;
|
||||||
result += Utils::ReadWstringThenConvert(content + 0x28);
|
result += Utils::ReadWstringThenConvert(content + 0x28);
|
||||||
result += "\r\n";
|
result += "\r\n";
|
||||||
|
@ -3000,21 +3000,20 @@ static int encode_variable_length(uint8_t *buf, size_t value) {
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t decode_variable_length(const char *buf,
|
static size_t decode_varint(const uint8_t *buf, size_t len, size_t *value) {
|
||||||
uint32_t *bytes_consumed) {
|
uint32_t multiplier = 1;
|
||||||
uint32_t value = 0, multiplier = 1, offset;
|
size_t offset;
|
||||||
|
*value = 0;
|
||||||
|
|
||||||
for (offset = 0; offset < 4; offset++) {
|
for (offset = 0; offset < 4 && offset < len; offset++) {
|
||||||
uint8_t encoded_byte = ((uint8_t *) buf)[offset];
|
uint8_t encoded_byte = buf[offset];
|
||||||
value += (encoded_byte & 0x7F) * multiplier;
|
*value += (encoded_byte & 0x7F) * multiplier;
|
||||||
multiplier *= 128;
|
multiplier *= 128;
|
||||||
|
|
||||||
if (!(encoded_byte & 0x80)) break;
|
if (!(encoded_byte & 0x80)) return offset + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes_consumed != NULL) *bytes_consumed = offset + 1;
|
return 0;
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mqtt_prop_type_by_id(uint8_t prop_id) {
|
static int mqtt_prop_type_by_id(uint8_t prop_id) {
|
||||||
@ -3107,8 +3106,8 @@ static void mg_send_mqtt_properties(struct mg_connection *c,
|
|||||||
size_t mg_mqtt_next_prop(struct mg_mqtt_message *msg, struct mg_mqtt_prop *prop,
|
size_t mg_mqtt_next_prop(struct mg_mqtt_message *msg, struct mg_mqtt_prop *prop,
|
||||||
size_t ofs) {
|
size_t ofs) {
|
||||||
uint8_t *i = (uint8_t *) msg->dgram.ptr + msg->props_start + ofs;
|
uint8_t *i = (uint8_t *) msg->dgram.ptr + msg->props_start + ofs;
|
||||||
size_t new_pos = ofs;
|
uint8_t *end = (uint8_t *) msg->dgram.ptr + msg->dgram.len;
|
||||||
uint32_t bytes_consumed;
|
size_t new_pos = ofs, len;
|
||||||
prop->id = i[0];
|
prop->id = i[0];
|
||||||
|
|
||||||
if (ofs >= msg->dgram.len || ofs >= msg->props_start + msg->props_size)
|
if (ofs >= msg->dgram.len || ofs >= msg->props_start + msg->props_size)
|
||||||
@ -3148,8 +3147,8 @@ size_t mg_mqtt_next_prop(struct mg_mqtt_message *msg, struct mg_mqtt_prop *prop,
|
|||||||
new_pos += 2 + prop->val.len;
|
new_pos += 2 + prop->val.len;
|
||||||
break;
|
break;
|
||||||
case MQTT_PROP_TYPE_VARIABLE_INT:
|
case MQTT_PROP_TYPE_VARIABLE_INT:
|
||||||
prop->iv = decode_variable_length((char *) i, &bytes_consumed);
|
len = decode_varint(i, (size_t) (end - i), (size_t *) &prop->iv);
|
||||||
new_pos += bytes_consumed;
|
new_pos = (!len) ? 0 : new_pos + len;
|
||||||
break;
|
break;
|
||||||
default: new_pos = 0;
|
default: new_pos = 0;
|
||||||
}
|
}
|
||||||
@ -3314,7 +3313,8 @@ int mg_mqtt_parse(const uint8_t *buf, size_t len, uint8_t version,
|
|||||||
}
|
}
|
||||||
if (p > end) return MQTT_MALFORMED;
|
if (p > end) return MQTT_MALFORMED;
|
||||||
if (version == 5 && p + 2 < end) {
|
if (version == 5 && p + 2 < end) {
|
||||||
m->props_size = decode_variable_length((char *) p, &len_len);
|
len_len = (uint32_t) decode_varint(p, (size_t) (end - p), &m->props_size);
|
||||||
|
if (!len_len) return MQTT_MALFORMED;
|
||||||
m->props_start = (size_t) (p + len_len - buf);
|
m->props_start = (size_t) (p + len_len - buf);
|
||||||
p += len_len + m->props_size;
|
p += len_len + m->props_size;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user