From 52773488a14ce204438f9b531fcac69f202345ed Mon Sep 17 00:00:00 2001 From: ko1N Date: Mon, 22 Nov 2021 20:37:29 +0100 Subject: [PATCH] Fixed leechcore-sys compilation; Fixed examples --- README.md | 2 +- leechcore-sys/build.rs | 1 + memflow-pcileech/examples/read_phys.rs | 6 ++++-- memflow-pcileech/src/lib.rs | 12 +----------- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 5dfa18e..e918c2f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # memflow-pcileech -This connector implements a rust-native implementation of the pcileech interface. +This connector implements the [LeechCore](https://github.com/ufrisk/LeechCore) interface of pcileech for memflow. More information about pcileech can be found under https://github.com/ufrisk/pcileech. diff --git a/leechcore-sys/build.rs b/leechcore-sys/build.rs index 375063c..dbc6240 100644 --- a/leechcore-sys/build.rs +++ b/leechcore-sys/build.rs @@ -32,6 +32,7 @@ fn build_leechcore(target: &str) { "device_pmem.c", "device_tmd.c", "device_usb3380.c", + "device_vmware.c", "leechrpcclient.c", ]; if target.contains("windows") { diff --git a/memflow-pcileech/examples/read_phys.rs b/memflow-pcileech/examples/read_phys.rs index 62f6ca7..1a09b00 100644 --- a/memflow-pcileech/examples/read_phys.rs +++ b/memflow-pcileech/examples/read_phys.rs @@ -30,7 +30,8 @@ fn main() { let mut mem = vec![0; 8]; connector - .phys_read_raw_into(Address::from(0x1000).into(), &mut mem) + .phys_view() + .read_raw_into(Address::from(0x1000).into(), &mut mem) .expect("unable to read physical memory"); info!("Received memory: {:?}", mem); @@ -39,7 +40,8 @@ fn main() { loop { let mut buf = vec![0; 0x1000]; connector - .phys_read_raw_into(Address::from(0x1000).into(), &mut buf) + .phys_view() + .read_raw_into(Address::from(0x1000).into(), &mut buf) .expect("unable to read physical memory"); counter += 1; diff --git a/memflow-pcileech/src/lib.rs b/memflow-pcileech/src/lib.rs index 9ba1928..05bf84d 100644 --- a/memflow-pcileech/src/lib.rs +++ b/memflow-pcileech/src/lib.rs @@ -48,7 +48,7 @@ const fn calc_num_pages(start: u64, size: u64) -> u64 { } #[allow(clippy::mutex_atomic)] -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct PciLeech { handle: Arc>, metadata: PhysicalMemoryMetadata, @@ -57,16 +57,6 @@ pub struct PciLeech { unsafe impl Send for PciLeech {} -impl Clone for PciLeech { - fn clone(&self) -> Self { - Self { - handle: self.handle.clone(), - metadata: self.metadata, - mem_map: self.mem_map.clone(), - } - } -} - // TODO: proper drop + free impl -> LcMemFree(pLcErrorInfo); #[allow(clippy::mutex_atomic)] impl PciLeech {