Improved examples

pull/7/head
ko1N 4 years ago
parent 058f229d3c
commit ee552a68ad

@ -30,7 +30,7 @@ fn main() {
let connector_args = if let Some(arg) = args().nth(1) { let connector_args = if let Some(arg) = args().nth(1) {
Args::parse(arg.as_ref()).expect("unable to parse command line arguments") Args::parse(arg.as_ref()).expect("unable to parse command line arguments")
} else { } else {
Args::default() Args::new().insert("device", "FPGA")
}; };
let inventory = Inventory::scan(); let inventory = Inventory::scan();

@ -29,7 +29,7 @@ fn main() {
let connector_args = if let Some(arg) = args().nth(1) { let connector_args = if let Some(arg) = args().nth(1) {
Args::parse(arg.as_ref()).expect("unable to parse command line arguments") Args::parse(arg.as_ref()).expect("unable to parse command line arguments")
} else { } else {
Args::default() Args::new().insert("device", "FPGA")
}; };
let connector = memflow_pcileech::create_connector(&connector_args, Level::Debug) let connector = memflow_pcileech::create_connector(&connector_args, Level::Debug)

@ -3,6 +3,7 @@ This example shows how to use the pcileech connector to read physical_memory
from a target machine. It also evaluates the number of read cycles per second from a target machine. It also evaluates the number of read cycles per second
and prints them to stdout. and prints them to stdout.
*/ */
use std::env::args;
use std::time::Instant; use std::time::Instant;
use log::{info, Level}; use log::{info, Level};
@ -15,7 +16,13 @@ fn main() {
.init() .init()
.unwrap(); .unwrap();
let mut connector = memflow_pcileech::create_connector(&Args::default(), Level::Debug) let connector_args = if let Some(arg) = args().nth(1) {
Args::parse(arg.as_ref()).expect("unable to parse command line arguments")
} else {
Args::new().insert("device", "FPGA")
};
let mut connector = memflow_pcileech::create_connector(&connector_args, Level::Debug)
.expect("unable to create pcileech connector"); .expect("unable to create pcileech connector");
let metadata = connector.metadata(); let metadata = connector.metadata();

Loading…
Cancel
Save