test_send.sh
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# Test Route A send hook via adb
# Usage: bash test_send.sh <wxid> "<text>"
# Example: bash test_send.sh wxid_abc123 "Hello from hook"
#
# NOTE: This is a TEST SCRIPT — read-only / dry-run by default.
# Set DRY_RUN=0 to actually trigger the broadcast.
set -euo pipefail
TALKER="${1:-}"
TEXT="${2:-}"
DRY_RUN="${DRY_RUN:-1}" # Default: print only, don't fire
if [ -z "$TALKER" ] || [ -z "$TEXT" ]; then
echo "Usage: DRY_RUN=0 bash test_send.sh <talker> '<text>'"
echo " talker examples:"
echo " wxid_abc123 (1-on-1)"
echo " 12345678901@chatroom (group)"
exit 1
fi
CMD="adb shell am broadcast \
-a com.hermes.wechat.SEND_MSG_INTERNAL \
--es to \"$TALKER\" \
--es text \"$TEXT\""
echo "Command to run:"
echo " $CMD"
echo ""
if [ "$DRY_RUN" = "1" ]; then
echo "[DRY RUN] Not executing. Set DRY_RUN=0 to actually send."
else
echo "[SENDING] Executing broadcast..."
eval "$CMD"
echo ""
echo "Check logcat for: [WeChatSendHook]"
echo " adb logcat -s Xposed:D | grep WeChatSendHook"
fi