Files
workphone-sdk/sdk/agent/hook/setup_redmi11.sh

37 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 红米11 Root 设备 Hook 环境初始化脚本
# 用法: bash setup_redmi11.sh <device_id>
set -euo pipefail
DEVICE_ID="${1:-}"
if [[ -z "$DEVICE_ID" ]]; then
echo "用法: bash setup_redmi11.sh <device_id>"
exit 1
fi
echo "== 1) 基础连通检查 =="
adb -s "$DEVICE_ID" get-state
adb -s "$DEVICE_ID" shell getprop ro.product.model
adb -s "$DEVICE_ID" shell getprop ro.build.version.release
echo "== 2) Root 权限检查 =="
adb -s "$DEVICE_ID" shell "id -u; which su || true"
echo "== 3) push Hook 脚本 =="
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
adb -s "$DEVICE_ID" push "$SCRIPT_DIR/wechat_hook_v1.js" /data/local/tmp/wechat_hook_v1.js
echo "== 4) frida-server 检查 =="
adb -s "$DEVICE_ID" shell "frida-server --version || true"
echo "== 5) 启动微信并验证包名 =="
adb -s "$DEVICE_ID" shell "monkey -p com.tencent.mm -c android.intent.category.LAUNCHER 1" >/dev/null 2>&1 || true
sleep 2
adb -s "$DEVICE_ID" shell "dumpsys window | grep -E 'mCurrentFocus|mFocusedApp' | head -2"
echo "== 6) SDK Hook 探测接口建议调用 =="
echo "curl -s http://localhost:8899/api/v3/devices/$DEVICE_ID/modules | python3 -m json.tool"
echo "完成红米11 Hook 基础环境就绪(脚本已推送)"