#adb #debugging #command #shell #manager #adb-manager #adb-list

adb-utils

Rust implementation of commonly used ADB commands

6 releases (breaking)

0.6.0 Dec 8, 2023
0.5.0 Aug 28, 2023
0.4.0 Aug 27, 2023
0.3.0 Aug 22, 2023
0.1.0 Aug 16, 2023

#597 in Hardware support

MIT license

34KB
895 lines

ADB Utils

Rust implementation of commonly used ADB commands

Usage

Get all the photos taken on a certain day

use adb_utils::{manager::ADBManager, shell::ADBList};

fn main() {
    let mut manager = ADBManager::new();
    manager.cwd("/storage/emulated/0/DCIM/Camera");
    if let Err(err) = manager.connect("192.168.1.133", 36415) {
        println!("Could not connect: {err}");
        return;
    }
    let mut list = ADBList::default();
    let files = manager.execute_path_based(&mut list).unwrap().to_vec();
    files
        .iter()
        .filter(|file| file.starts_with("20230827"))
        .for_each(|file| println!("{file}"));
    // 20230827_132733.jpg
    // 20230827_141248.jpg
}

More usage examples here.

Supported commands

The list of commands is from running adb help

General

  • devices
  • help
  • version

Networking

  • connect
  • disconnect
  • pair
  • forward
  • ppp TTY
  • reverse
  • mdns check
  • mdns services

File transfer

  • push
  • pull
  • sync

Shell

  • shell
  • emu command

App installation

  • install
  • install-multiple
  • uninstall

Debugging

  • bugreport
  • jdwp
  • logcat

Security

  • disable-verify
  • enable-verify
  • keygen

Scripting

  • wait-for
  • get-state
  • get-serialno
  • get-devpath
  • remount
  • reboot
  • sideload
  • root
  • unroot
  • usb
  • tcpip

Internal debugging

  • start-server
  • kill-server
  • reconnect
  • reconnect device
  • reconnect offline

USB

  • attach
  • detach

Environment variables

  • adb trace
  • adb vendor keys
  • android serial
  • android log tags
  • adb local transport max port
  • adb mdns auto connect

No runtime deps