/fa

FA(fast adb) helps you win at ADB(Android Debug Bridge).

Primary LanguageGoMIT LicenseMIT

fa = fast adb

Build Status GoDoc

fa is a command line tool that wraps adb in order to extend it with extra features and commands that make working with Android easier.

This project is still in developing, please be careful when use in production.

Features

  • show device selection when multi device connected
  • screenshot
  • install support http url
  • support launch after install apk
  • support fa devices --json
  • support fa shell
  • colorful logcat and filter with package name
  • install apk and auto click confirm
  • check device health status
  • show current app
  • unlock device
  • reset device state, clean up installed packages
  • show wlan (ip,mac,signal), enable and disable it
  • share device to public web
  • fa share-server
  • install ipa support
  • fahub service

Install

For mac

brew install codeskyblue/tap/fa

For windows and linux

download binary from releases

Usage

Show version

$ fa version
fa version v0.0.5 # just example
adb server version 28

Show devices

  • Remove header List of devices attached to make it easy parse
$ fa devices
3578298f        device

$ fa devices --json
[
   {"serial": "3578298f", "status": "device"}
]

Run adb command with device select

if multi device connected, fa will give you list of devices to choose.

$ fa adb shell
@ select device
  > 3aff8912  Smartion
    vv12afvv  Google Nexus 5
{selected 3aff8912}
shell $

-s option and $ANDROID_SERIAL is also supported, but if you known serial, maybe use adb directly is better.

$ fa -s 3578298f adb shell pwd
/
$ ANDROID_SERIAL=3578298 fa adb shell pwd
/

Screenshot

only png format now.

fa screenshot -o screenshot.png

Install APK

fa install ApiDemos-debug.apk # from local file
fa install http://example.org/demo.apk # from URL
fa install -l ApiDemos-debug.apk # launch after install
fa install -f ApiDemos-debug.apk # uninstall before install

Show debug info when install

$ fa -d install --force --launch https://github.com/appium/java-client/raw/master/src/test/java/io/appium/java_client/ApiDemos-debug.apk
Downloading ApiDemos-debug.apk...
 2.94 MiB / 2.94 MiB [================================] 100.00% 282.47 KiB/s 10s
Download saved to ApiDemos-debug.apk
+ adb -s 0123456789ABCDEF uninstall io.appium.android.apis
+ adb -s 0123456789ABCDEF install ApiDemos-debug.apk
ApiDemos-debug.apk: 1 file pushed. 4.8 MB/s (3084877 bytes in 0.609s)
        pkg: /data/local/tmp/ApiDemos-debug.apk
Success
Launch io.appium.android.apis ...
+ adb -s 0123456789ABCDEF shell am start -n io.appium.android.apis/.ApiDemos

App

$ fa app list # show all app package names
$ fa app list -3 # only show third party packages

Shell

Like adb shell, run fa shell will open a terminal

The difference is fa shell will add /data/local/tmp into $PATH So if you have binary busybox in /data/local/tmp, You can just run

$ fa shell busybox ls
# using adb shell you have to
$ adb shell /data/local/tmp/busybox ls

Watch

Trace device came online and went offline

$ fa watch
3578298f offline
3578298f device

Hook script when device online

# on windows
$ fa watch --online-hook-cmd="echo %SERIAL%" 

# on linux
$ fa watch --online-hook-cmd="echo \$SERIAL" 

This subcommand seems not very stable, raise issue when you find something wrong.

Share

Share local device

# share in localnet
$ fa share
Connect with: adb connect 10.0.0.1:6174

# share to public ip
$ fa share --tunnel
______                   __
/_  __/_ _____  ___  ___ / /
 / / / // / _ \/ _ \/ -_) /
/_/  \_,_/_//_/_//_/\__/_/ v0.2.11

Expose local servers to internet securely
https://labstack.com/docs/tunnel
________________________________O/_______
                                O\
⇨ routing traffic from tcp://leo.labstack.me:10081

When use tunnel, you should use adb connect leo.labstack.me:10081

Then you can use adb to do anything just like device plugged in your computer.

Pidcat (logcat)

Current implementation is wrapper of pidcat.py So use this feature, you need python installed.

$ fa help pidcat
USAGE:
   fa pidcat [package-name ...]

OPTIONS:
   --current                     filter logcat by current running app
   --clear                       clear the entire log before running
   --min-level value, -l value   Minimum level to be displayed {V,D,I,W,E,F}
   --tag value, -t value         filter output by specified tag(s)
   --ignore-tag value, -i value  filter output by ignoring specified tag(s)

The pidcat is very beautiful.

pidcat

Thanks for these Articles and Codes

Libs might be useful

LICENSE

MIT