1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use std::path::PathBuf;
use argh::FromArgs;
#[allow(clippy::struct_excessive_bools, reason = "CLI")]
#[derive(FromArgs)]
/// Feature-rich Android OTA payload dumper written in Rust
pub struct Args {
/// path or URL to your payload
#[argh(positional)]
pub payload_path: PathBuf,
/// output directory for extracted partitions
#[argh(option, short = 'o', default = "\"output\".into()")]
pub out: PathBuf,
/// enable differential OTA mode (requires --old)
#[argh(switch)]
pub diff: bool,
/// path to the directory containing old partition images (required for --diff)
#[argh(option, default = "\"old\".into()")]
pub old: PathBuf,
/// list of partition names to extract
#[argh(option, short = 'p')]
pub partitions: Vec<String>,
/// number of threads to use for parallel processing
#[argh(option)]
pub threads: Option<usize>,
/// list available partitions in the payload
// TODO: Conflict with ["diff", "old", "partitions", "threads"]
#[argh(switch, short = 'l')]
pub list: bool,
/// save complete metadata as JSON (use --out - to write to stdout)
// TODO: Conflict with ["diff", "old", "partitions"]
#[argh(switch)]
pub metadata: bool,
/// disable parallel extraction
#[argh(switch)]
pub no_parallel: bool,
/// skip hash verification
#[argh(switch)]
pub no_verify: bool,
/// the User-Agent to use if extracting from URL (Defaults to a representative browser UA)
#[argh(
option,
short = 'u',
default = "\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36\".into()"
)]
pub user_agent: String,
}