和IDA类似,记录一些内容
全局调试,root下
magisk resetprop ro.debuggable 1
stop
start
快速获取入口类
adb shell "dumpsys package com.starbucks.cn | grep -A 1 MAIN | grep filter | cut -d ' ' -f 10"
adb shell "dumpsys package com.starbucks.cn | grep -A 1 MAIN | grep filter | awk '{print $2}'"
com.starbucks.cn/.home.revamp.launch.RevampLaunchActivity
adb shell am start -D -n com.starbucks.cn/.home.revamp.launch.RevampLaunchActivity
获取进程号,向GPT交流后取得两种方案
ps -ef | grep "[c]om.starbucks.cn" | awk '{print $2}'
ps -ef | grep "[c]om.starbucks.cn" | tr -s ' ' | cut -d' ' -f2
编写bat如下
@echo off
set PKG=com.starbucks.cn
set PKG_REGEX=[%PKG:~0,1%]%PKG:~1%
for /f "tokens=* USEBACKQ" %%F IN (`adb shell "dumpsys package %PKG% | grep -A 1 MAIN | grep filter | awk '{print $2}'"`) DO (
set ACTIVITY=%%F
)
echo start %ACTIVITY%
adb shell am start -D -n %ACTIVITY%
timeout /t 1 /nobreak
for /f "tokens=* USEBACKQ" %%F IN (`adb shell "ps -ef | grep "%PKG_REGEX%" | awk '{print $2}'"`) DO (
set PID=%%F
)
echo "Please use debugger attach to %PID%, continue (Y/N)?"
<nul set /p=attach %PID% | clip
set /p INPUT=
if not defined INPUT (
set INPUT=Y
)
if /i "%INPUT%"=="Y" (
echo "Continuing..."
adb forward tcp:8700 jdwp:%PID%
jdb -connect com.sun.jdi.SocketAttach:hostname=127.0.0.1,port=8700
) else (
echo "Exiting..."
)
pause
code-server跑在手机上还是太吃力了