From c10945f2e0cb0eaf2a9250e05ab9f6f26ea4e3cd Mon Sep 17 00:00:00 2001 From: Dimitris Zervas Date: Sat, 27 May 2023 22:12:51 +0300 Subject: [PATCH] Add DLL proxying to readme --- README.md | 22 ++++++++++++++++++++++ src/injector.rs | 3 --- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3693d16..f10f98f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ the script. All desktop platforms are supported (Windows, Linux, macOS). +**NOTE**: To cross-compile for Windows you can use [cargo-xwin](https://github.com/rust-cross/cargo-xwin) +with target `x86_64-pc-windows-msvc`. + ## Usage You're gonna have to compile the tool yourself as the frida script gets embedded @@ -49,3 +52,22 @@ void inject_self(); // Run the frida script in the process that called the funct ``` By default, on load the library will call `inject_self()`. + +### DLL Proxying + +There's also the option of generating a DLL ready for DLL Proxying use. +That means that you give the DLL `myawesome.dll` to cargo +(using the `DLL_PROXY` environment variable) and it will generate a DLL +`myawesome.dll` that can replace the original DLL. It will tell the linker +that any functions found during compilation (e.g. functions `foo` and `bar` +exported by the original `myawesome.dll`) should be redirected to `myawesome-orig.dll` + +That allows you to make your script completely permanent without having to +run any extra commands. + +**NOTE**: This only works on Windows (for now?). + +```bash +git clone https://github.com/dzervas/frida-deepfreeze-rs +DLL_PROXY='../myawesome.dll' FRIDA_CODE='console.log("Hello world from frida-deepfreeze-rs!")' cargo xwin build --lib --target x86_64-pc-windows-msvc +``` diff --git a/src/injector.rs b/src/injector.rs index bc4eb5b..497502f 100644 --- a/src/injector.rs +++ b/src/injector.rs @@ -44,9 +44,6 @@ pub fn attach(pid: u32) { #[no_mangle] pub fn attach_self() { println!("[*] Attaching to self"); - // #[cfg(windows)] - // attach(std::process::id()); - // #[cfg(unix)] attach(0); }