move dump cfg to androscalpel example
This commit is contained in:
parent
71d5afd3c8
commit
30ae4b064f
1 changed files with 0 additions and 31 deletions
|
|
@ -1,31 +0,0 @@
|
|||
use std::fs::File;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use androscalpel::{Apk, IdMethod, MethodCFG};
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None, arg_required_else_help = true)]
|
||||
struct Cli {
|
||||
#[arg(short, long)]
|
||||
apk: PathBuf,
|
||||
#[arg(short, long)]
|
||||
method: String,
|
||||
}
|
||||
|
||||
/// Usefull for debugging.
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
let cli = Cli::parse();
|
||||
let mut apk = Apk::load_apk(File::open(&cli.apk).unwrap(), |_, _, _| None, false).unwrap();
|
||||
let mid = IdMethod::from_smali(&cli.method).unwrap();
|
||||
let class = apk.get_class_mut(&mid.class_).unwrap();
|
||||
let method = if let Some(method) = class.virtual_methods.get(&mid) {
|
||||
method
|
||||
} else {
|
||||
class.direct_methods.get(&mid).unwrap()
|
||||
};
|
||||
let cfg = MethodCFG::new(method).unwrap();
|
||||
print!("{}", cfg.to_dot(true));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue