From bd714e1f1675d1694c4dd231875c0199bb07d8cf Mon Sep 17 00:00:00 2001 From: ko1N Date: Wed, 25 Nov 2020 19:32:00 +0100 Subject: [PATCH] Updated readme --- README.md | 48 +++++++++++++++++++------- memflow-pcileech/examples/read_phys.rs | 1 - 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8df5d12..1598563 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,33 @@ On Linux you need to check-out and compile the `leechcore_ft601_driver_linux` pr More information about these requirements can be found in the [LeechCore-Plugins](https://github.com/ufrisk/LeechCore-plugins) repository. -### Using the install script +### Running the example + +To run the example simply execute: + +```cargo run --example read_phys --release -- FPGA``` + +On Linux the example binary will be ran with `sudo -E` to elevate privileges. + +Since the invoked binary is placed in the `target/release/examples` or `/target/debug/examples` folder the `leechcore_ft601_driver_linux.so` has to be placed in the corresponding folder. +On Windows the `FTD3XX.dll` has to be placed in the corresponding examples folder as well. + +### Installing the library The `./install.sh` script will just compile and install the plugin. The connector will be installed to `~/.local/lib/memflow` by default. -Additionally the `--system` flag can be specified which will install the connector in /usr/lib/memflow as well. +Additionally the `--system` flag can be specified which will install the connector in `/usr/lib/memflow` as well. + +Remarks: The `install.sh` script does currently not place the `leechcore_ft601_driver_linux.so` / `FTD3XX.dll` in the corresponding folders. Please make sure to provide it manually. + +### Building the stand-alone connector for dynamic loading + +The stand-alone connector of this library is feature-gated behind the `inventory` feature. +To compile a dynamic library for use with the connector inventory use the following command: + +```cargo build --release --all-features``` + +As mentioned above the `leechcore_ft601_driver_linux.so` or `FTD3XX.dll` have to be placed in the same folder the connector library is placed in. ### Using the library in a rust project @@ -41,21 +63,23 @@ To use the plugin in a rust project just include it in your Cargo.toml memflow-pcileech = { git = "https://github.com/memflow/memflow-pcileech", branch = "master" } ``` -Make sure to not enable the `plugin` feature when importing multiple +Make sure to _NOT_ enable the `plugin` feature when importing multiple connectors in a rust project without using the memflow plugin inventory. This might cause duplicated exports being generated in your project. -### Building the stand-alone connector for dynamic loading +After adding the dependency to your Cargo.toml you can easily create a new Connector instance and pass it some args: -The stand-alone connector of this library is feature-gated behind the `inventory` feature. -To compile a dynamic library for use with the connector inventory use the following command: +```rust +let args: Vec = env::args().collect(); +let conn_args = if args.len() > 1 { + ConnectorArgs::parse(&args[1]).expect("unable to parse arguments") +} else { + ConnectorArgs::new() +}; -```cargo build --release --all-features``` - -### Installing the library - -Alternatively to manually placing the library in the `PATH` the connector can be installed with the `install.sh` script. -It will place it inside `~/.local/lib/memflow` directory. Add `~/.local/lib` directory to `PATH` to use the connector in other memflow projects. +let mut conn = memflow_pcileech::create_connector(&conn_args) + .expect("unable to initialize memflow_pcileech"); +``` ## Arguments diff --git a/memflow-pcileech/examples/read_phys.rs b/memflow-pcileech/examples/read_phys.rs index 78a3e03..8c4caf1 100644 --- a/memflow-pcileech/examples/read_phys.rs +++ b/memflow-pcileech/examples/read_phys.rs @@ -12,7 +12,6 @@ fn main() { .unwrap(); let args: Vec = env::args().collect(); - println!("{:?}", args); let conn_args = if args.len() > 1 { ConnectorArgs::parse(&args[1]).expect("unable to parse arguments") } else {