#android #adb #devices #tokio #bridge #forensics

forensic-adb

Tokio based client library for the Android Debug Bridge (adb) based on mozdevice

4 releases

0.7.0 Mar 18, 2024
0.6.2 Apr 8, 2023
0.6.1 Mar 26, 2023
0.6.0 Mar 26, 2023

#229 in Debugging

Download history 18/week @ 2023-12-29 6/week @ 2024-01-05 41/week @ 2024-01-12 9/week @ 2024-01-19 18/week @ 2024-02-02 2/week @ 2024-02-09 4/week @ 2024-02-16 11/week @ 2024-02-23 9/week @ 2024-03-01 9/week @ 2024-03-08 115/week @ 2024-03-15 23/week @ 2024-03-22 28/week @ 2024-03-29 12/week @ 2024-04-05

67 downloads per month
Used in spytrap-adb

MPL-2.0 license

71KB
1.5K SLoC

forensic-adb

Tokio based client library for the Android Debug Bridge (adb) based on mozdevice for Rust.

Documentation

This code has been extracted from mozilla-central/testing/mozbase/rust/mozdevice and ported to async Rust. It also removes root detection so no commands are executed on the remote device by default.

use forensic_adb::{AndroidStorageInput, DeviceError, Host};

#[tokio::main]
async fn main() -> Result<(), DeviceError> {
    let host = Host::default();

    let devices = host.devices::<Vec<_>>().await?;
    println!("Found devices: {:?}", devices);

    let device = host
        .device_or_default(Option::<&String>::None, AndroidStorageInput::default())
        .await?;
    println!("Selected device: {:?}", device);

    let output = device.execute_host_shell_command("id").await?;
    println!("Received response: {:?}", output);

    Ok(())
}

License

Mozilla Public License (MPL-2.0)

Dependencies

~8–20MB
~271K SLoC