Merge branch 'master' into next

pull/7/head
ko1N 4 years ago
commit 9edb44d03b

@ -7,88 +7,58 @@ env:
jobs: jobs:
build: build_ubuntu_x86-64:
runs-on: ${{ matrix.os }} name: Build for ubuntu-latest (x86-64)
strategy: runs-on: ubuntu-latest
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
- name: Install libusb-1.0 submodules: 'true'
- name: install libusb-1.0
run: sudo apt-get install libusb-1.0-0-dev run: sudo apt-get install libusb-1.0-0-dev
if: runner.os != 'Windows' - name: build
run: cargo build --workspace --all-features --verbose
- name: Build - name: run tests
run: cargo build --workspace --verbose run: cargo test --workspace --verbose
- name: build examples
- name: Build examples run: cargo build --workspace --all-features --examples --verbose
run: cargo build --workspace --examples --verbose
build-arm: build_windows_x86-64:
runs-on: ubuntu-latest name: Build for windows-latest (x86-64)
runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with: with:
toolchain: stable submodules: 'true'
target: aarch64-unknown-linux-gnu - name: install llvm and clang
override: true uses: KyleMayes/install-llvm-action@v1
- run: sudo apt-get install libusb-1.0-0-dev
- uses: actions-rs/cargo@v1
with: with:
use-cross: true version: "10.0"
command: build directory: ${{ runner.temp }}/llvm
args: --target aarch64-unknown-linux-gnu --workspace --verbose - name: set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
test: - name: build
runs-on: ${{ matrix.os }} shell: bash
strategy: run: cargo build --workspace --all-features --verbose
matrix: - name: run tests
os: [macos-latest, ubuntu-latest, windows-latest] shell: bash
steps:
- uses: actions/checkout@v2
- name: Install libusb-1.0
run: sudo apt-get install libusb-1.0-0-dev
if: runner.os != 'Windows'
- name: Run all tests
run: cargo test --workspace --verbose run: cargo test --workspace --verbose
if: runner.os == 'Linux' - name: build examples
shell: bash
- name: Run all tests run: cargo build --workspace --all-features --examples --verbose
run: cargo test --workspace --exclude memflow-derive --verbose
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
submodules: 'true'
- name: install libusb-1.0
run: sudo apt-get install libusb-1.0-0-dev
- run: rustup component add clippy - run: rustup component add clippy
- name: Check formatting - name: check formatting
run: cargo fmt -- --check run: cargo fmt -- --check
- uses: actions-rs/clippy-check@v1 - uses: actions-rs/clippy-check@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets args: --all-targets
build-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Rust nightly
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- run: cargo install grcov
- name: Run tests with coverage
run: |
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
export RUSTDOCFLAGS="-Cpanic=abort"
cargo build --workspace --exclude memflow-derive
cargo test --workspace --exclude memflow-derive
grcov ./target/debug/ -s . -t lcov --llvm --branch --ignore-not-existing -o ./target/debug/coverage
bash <(curl -s https://codecov.io/bash) -f ./target/debug/coverage -t ${{ secrets.CODECOV_TOKEN }};

@ -0,0 +1,77 @@
name: Release binaries
on:
release:
types: [created]
env:
CARGO_TERM_COLOR: always
jobs:
build_ubuntu_x86-64:
name: Build artifacts for ubuntu-latest (x86-64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: install libusb-1.0
run: sudo apt-get install libusb-1.0-0-dev
- name: build
run: cargo build --release --workspace --all-features --verbose
- uses: actions/upload-artifact@v2
with:
name: library-ubuntu
path: target/release/*.so
build_windows_x86-64:
name: Build artifacts for windows-latest (x86-64)
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: install llvm and clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "10.0"
directory: ${{ runner.temp }}/llvm
- name: set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
- name: build
shell: bash
run: cargo build --release --workspace --all-features --verbose
- uses: actions/upload-artifact@v2
with:
name: library-windows
path: target/release/*.dll
publish_artifacts:
name: Publish artifacts for x86-64/windows-latest
runs-on: ubuntu-latest
needs: [build_ubuntu_x86-64, build_windows_x86-64]
steps:
- uses: actions/download-artifact@v2
with:
name: library-ubuntu
- name: Create archive for linux x86-64
run: zip memflow_pcileech_linux_x86-64.zip *.so
- name: Upload artifacts for linux x86-64
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'memflow_pcileech_linux_x86-64.zip'
- uses: actions/download-artifact@v2
with:
name: library-windows
- name: Create archive for windows x86-64
run: zip memflow_pcileech_windows_x86-64.zip *.dll
- name: Upload artifacts for windows x86-64
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'memflow_pcileech_windows_x86-64.zip'

@ -1,5 +1,3 @@
# This repository is currently work-in-progress and might not fully work.
# memflow-pcileech # memflow-pcileech
This connector implements a rust-native implementation of the pcileech interface. This connector implements a rust-native implementation of the pcileech interface.
@ -19,6 +17,8 @@ Install the following build tools:
- clang - clang
- libusb-1.0 (only required on linux) - libusb-1.0 (only required on linux)
Make sure that libclang can be found by either adding it to your `PATH` or via the `LIBCLANG_PATH` environment variable.
On Windows you additionally need to supply the proprietary `FTD3XX.dll`. It can be downloaded from the [FTDI Website](https://www.ftdichip.com/Drivers/D3XX.htm) in the `Application Library (DLL)` column. On Windows you additionally need to supply the proprietary `FTD3XX.dll`. It can be downloaded from the [FTDI Website](https://www.ftdichip.com/Drivers/D3XX.htm) in the `Application Library (DLL)` column.
On Linux you need to check-out and compile the `leechcore_ft601_driver_linux` project from the [LeechCore-Plugins](https://github.com/ufrisk/LeechCore-plugins) repository. On Linux you need to check-out and compile the `leechcore_ft601_driver_linux` project from the [LeechCore-Plugins](https://github.com/ufrisk/LeechCore-plugins) repository.
@ -105,6 +105,11 @@ real_base=0x3000
The `real_base` parameter is optional. If it is not set there will be no re-mapping. The `real_base` parameter is optional. If it is not set there will be no re-mapping.
On Windows systems the memory map can be obtained from the Registry under the following Key:
```
HKEY_LOCAL_MACHINE\\HARDWARE\\RESOURCEMAP\\System Resources\\Physical Memory\\.Translated
```
## Troubleshooting ## Troubleshooting
Q: The plugin is not detected/found by memflow Q: The plugin is not detected/found by memflow

@ -1,6 +1,6 @@
[package] [package]
name = "leechcore-sys" name = "leechcore-sys"
version = "0.1.0" version = "0.1.5"
authors = ["ko1N <ko1N1337@gmail.com>"] authors = ["ko1N <ko1N1337@gmail.com>"]
edition = "2018" edition = "2018"
readme = "../README.md" readme = "../README.md"
@ -12,6 +12,6 @@ links = "leechcore"
ctor = "0.1" ctor = "0.1"
[build-dependencies] [build-dependencies]
cc = "1.0.62" cc = "1.0"
bindgen = "0.55" bindgen = "0.56"
pkg-config = "0.3" pkg-config = "0.3"

@ -16,6 +16,11 @@ fn os_define() -> &'static str {
"LINUX" "LINUX"
} }
#[cfg(target_os = "macos")]
fn os_define() -> &'static str {
"LINUX"
}
fn build_leechcore(target: &str) { fn build_leechcore(target: &str) {
let mut files = vec![ let mut files = vec![
"oscompatibility.c", "oscompatibility.c",
@ -64,7 +69,7 @@ fn build_leechcore(target: &str) {
for flag in String::from_utf8_lossy(&libusb_flags.stdout) for flag in String::from_utf8_lossy(&libusb_flags.stdout)
.trim() .trim()
.split(" ") .split(' ')
{ {
cfg.flag(flag); cfg.flag(flag);
} }
@ -91,7 +96,7 @@ fn build_leechcore(target: &str) {
println!("cargo:rustc-link-lib=static=leechcore"); println!("cargo:rustc-link-lib=static=leechcore");
} }
fn main() -> () { fn main() {
let target = env::var("TARGET").unwrap(); let target = env::var("TARGET").unwrap();
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());

@ -1 +1 @@
Subproject commit 9b859f127784961882ab8ea8803043b37fd1ab61 Subproject commit e31a5084e264b4ab3c21238a95f703e994ec3384

@ -1,6 +1,6 @@
[package] [package]
name = "memflow-pcileech" name = "memflow-pcileech"
version = "0.1.0" version = "0.1.5"
authors = ["ko1N <ko1N1337@gmail.com>"] authors = ["ko1N <ko1N1337@gmail.com>"]
edition = "2018" edition = "2018"
description = "qemu procfs connector for leechcore/pcileech" description = "qemu procfs connector for leechcore/pcileech"

@ -46,6 +46,7 @@ const fn calc_num_pages(start: u64, size: u64) -> u64 {
((start & (PAGE_SIZE as u64 - 1)) + size + (PAGE_SIZE as u64 - 1)) >> 12 ((start & (PAGE_SIZE as u64 - 1)) + size + (PAGE_SIZE as u64 - 1)) >> 12
} }
#[allow(clippy::mutex_atomic)]
#[derive(Debug)] #[derive(Debug)]
pub struct PciLeech { pub struct PciLeech {
handle: Arc<Mutex<HANDLE>>, handle: Arc<Mutex<HANDLE>>,
@ -82,6 +83,7 @@ impl PciLeech {
Self::with_mapping(device, memmap) Self::with_mapping(device, memmap)
} }
#[allow(clippy::mutex_atomic)]
fn with_mapping(device: &str, mem_map: MemoryMap<(Address, usize)>) -> Result<Self> { fn with_mapping(device: &str, mem_map: MemoryMap<(Address, usize)>) -> Result<Self> {
// open device // open device
let mut conf = build_lc_config(device); let mut conf = build_lc_config(device);

Loading…
Cancel
Save