From ee552a68ad0e9e3ed26e8e2a632d9763c19f0e3a Mon Sep 17 00:00:00 2001 From: ko1N Date: Sat, 24 Apr 2021 23:19:09 +0200 Subject: [PATCH] Improved examples --- memflow-pcileech/examples/ps_inventory.rs | 2 +- memflow-pcileech/examples/ps_win32.rs | 2 +- memflow-pcileech/examples/read_phys.rs | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/memflow-pcileech/examples/ps_inventory.rs b/memflow-pcileech/examples/ps_inventory.rs index b1caab4..1ccfd9f 100644 --- a/memflow-pcileech/examples/ps_inventory.rs +++ b/memflow-pcileech/examples/ps_inventory.rs @@ -30,7 +30,7 @@ fn main() { let connector_args = if let Some(arg) = args().nth(1) { Args::parse(arg.as_ref()).expect("unable to parse command line arguments") } else { - Args::default() + Args::new().insert("device", "FPGA") }; let inventory = Inventory::scan(); diff --git a/memflow-pcileech/examples/ps_win32.rs b/memflow-pcileech/examples/ps_win32.rs index 96f78e7..923030e 100644 --- a/memflow-pcileech/examples/ps_win32.rs +++ b/memflow-pcileech/examples/ps_win32.rs @@ -29,7 +29,7 @@ fn main() { let connector_args = if let Some(arg) = args().nth(1) { Args::parse(arg.as_ref()).expect("unable to parse command line arguments") } else { - Args::default() + Args::new().insert("device", "FPGA") }; let connector = memflow_pcileech::create_connector(&connector_args, Level::Debug) diff --git a/memflow-pcileech/examples/read_phys.rs b/memflow-pcileech/examples/read_phys.rs index 1881051..62f6ca7 100644 --- a/memflow-pcileech/examples/read_phys.rs +++ b/memflow-pcileech/examples/read_phys.rs @@ -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 and prints them to stdout. */ +use std::env::args; use std::time::Instant; use log::{info, Level}; @@ -15,7 +16,13 @@ fn main() { .init() .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"); let metadata = connector.metadata();