ADB cheatsheet

Get Foreground Activity
inside a .bat file: 

 

 @adb shell "dumpsys activity activities | grep ResumedActivity" @adb shell "dumpsys activity | grep mCurrentFocus" @adb shell "dumpsys activity top | grep 'ACTIVITY' | tail -n 1"

Run tcpdump and forward to wireshark
From a linux (WSL) host 

 adb shell su -c "tcpdump -U -w - " | "C:\Program Files\Wireshark\Wireshark.exe" -k -i - 

   

 From a windows machine, SSH to a WSL host, which is connected to the Android Phone 

   

 plink -ssh -l <USER> -pw "<PASSWORD>" -batch <HOST> "adb shell su -c 'tcpdump -U -w - '" | "C:\Program Files\Wireshark\Wireshark.exe" -k -i -