Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,33 @@ jobs:
toolchain: '1.76.0'
default: true
profile: minimal
components: rustfmt, clippy
- name: Setup Rust (Loader)
uses: actions-rs/toolchain@v1
if: matrix.os == 'windows-latest'
with:
toolchain: 'nightly-2024-02-11'
default: false
profile: minimal
components: rust-src
- name: rust-cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "./implants/ -> ../target"
- if: matrix.os == 'windows-latest'
shell: powershell
name: Build reflective loader
run: |
cd ./bin/reflective_loader/
rustup component add rust-src --toolchain nightly-2024-02-11-x86_64-pc-windows-msvc
cargo build --release -Z build-std=core,compiler_builtins -Z build-std-features=compiler-builtins-mem
- name: rust-cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "./implants/ -> ../target"
cargo +nightly-2024-02-11 build --release -Z build-std=core,compiler_builtins -Z build-std-features=compiler-builtins-mem
- name: Install latest nextest & cargo-llvm-cov release
uses: taiki-e/install-action@v2.17.7
with:
tool: nextest,cargo-llvm-cov
- name: 🔎 Run tests
run: cd ./implants/ && cargo llvm-cov nextest --lcov --output-path lcov.info
run: |
cd ./implants/ &&
cargo fmt --check &&
cargo llvm-cov nextest --lcov --output-path lcov.info
- name: 📶 Upload Coverage Results
uses: codecov/codecov-action@v3
18 changes: 13 additions & 5 deletions bin/reflective_loader/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#
# ============= DO NOT MANUALLY COMPILE =======================
# The reflective loader gets automatically compiled
# By the eldritch `build.rs` file. There's some differences
# in how to build the loader with `gnu` and `msvc`. If you're
# curious chekc out `realm/implants/lib/eldritch/build.rs`
#

[package]
name = "reflective_loader"
version = "0.1.0"
Expand All @@ -9,14 +17,14 @@ edition = "2021"
crate-type = ["cdylib"]

[profile.dev]
opt-level = "z" # This reduces the numebr of symbols not found.
opt-level = "z" # This reduces the numebr of symbols not found.
lto = true
codegen-units = 1
panic = "abort"

[profile.release]
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
lto = true
codegen-units = 1
panic = "abort"
Expand All @@ -41,5 +49,5 @@ features = [
"Win32_System_Diagnostics_Debug",
"Win32_System_SystemInformation",
"Win32_System_SystemServices",
"Win32_System_WindowsProgramming"
]
"Win32_System_WindowsProgramming",
]
15 changes: 8 additions & 7 deletions bin/reflective_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use core::ffi::c_void;
use windows_sys::Win32::Foundation::HINSTANCE;

mod loader;
mod loader;

type DWORD = i32;
type LPVOID = *mut c_void;
Expand All @@ -17,18 +17,19 @@ pub static _fltused: i32 = 0;

#[cfg(not(test))]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! { loop {} }
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}

#[no_mangle]
#[allow(non_snake_case, unused_variables)]
pub unsafe extern "system" fn _DllMainCRTStartup(
dll_module: HINSTANCE,
call_reason: DWORD,
reserved: LPVOID)
-> BOOL
{
reserved: LPVOID,
) -> BOOL {
match call_reason {
_ => ()
_ => (),
}
TRUE
}
}
Loading