blob: b5aaefe2c03f8d80fdff915541be90ecc902eb45 (
plain)
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
|
use goblin::error;
use std::path::Path;
use std::env;
use std::fs::File;
use std::io::Read;
fn run () -> error::Result<()> {
for (i, arg) in env::args().enumerate() {
if i == 1 {
let path = Path::new(arg.as_str());
let mut fd = File::open(path)?;
let buffer = { let mut v = Vec::new(); fd.read_to_end(&mut v).unwrap(); v};
let res = goblin::Object::parse(&buffer)?;
println!("{:#?}", res);
}
}
Ok(())
}
pub fn main () {
match run() {
Ok(()) => (),
Err(err) => println!("{:#}", err)
}
}
|