Add symbols for non-windows dll proxying
Signed-off-by: Dimitris Zervas <dzervas@dzervas.gr>
This commit is contained in:
parent
ed6f77e71c
commit
a4bf277c47
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ __handlers__
|
|||||||
/examples/cs/bin
|
/examples/cs/bin
|
||||||
/examples/cs/obj
|
/examples/cs/obj
|
||||||
/dotnet
|
/dotnet
|
||||||
|
src/symbols.rs
|
||||||
|
23
build.rs
23
build.rs
@ -1,4 +1,7 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::path::Path;
|
||||||
#[cfg(feature = "dotnet")]
|
#[cfg(feature = "dotnet")]
|
||||||
use csbindgen;
|
use csbindgen;
|
||||||
|
|
||||||
@ -6,9 +9,12 @@ fn main() {
|
|||||||
println!("cargo:rerun-if-env-changed=FRIDA_CODE");
|
println!("cargo:rerun-if-env-changed=FRIDA_CODE");
|
||||||
println!("cargo:rerun-if-env-changed=DLL_PROXY");
|
println!("cargo:rerun-if-env-changed=DLL_PROXY");
|
||||||
|
|
||||||
if let Ok(lib_path) = env::var("DLL_PROXY") {
|
let Ok(lib_path) = env::var("DLL_PROXY") else {
|
||||||
println!("cargo:rerun-if-changed={}", &lib_path);
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
use goblin::Object;
|
use goblin::Object;
|
||||||
|
println!("cargo:rerun-if-changed={}", &lib_path);
|
||||||
|
|
||||||
let path = std::path::Path::new(&lib_path);
|
let path = std::path::Path::new(&lib_path);
|
||||||
let lib_filename = path.file_name().unwrap().to_str().unwrap();
|
let lib_filename = path.file_name().unwrap().to_str().unwrap();
|
||||||
@ -56,13 +62,24 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
{
|
||||||
|
let symbols_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("src").join("symbols.rs");
|
||||||
|
let mut symbols = File::create(&symbols_path).unwrap();
|
||||||
|
println!("cargo:rerun-if-changed={:?}", symbols_path);
|
||||||
|
|
||||||
|
writeln!(symbols, "#[allow(dead_code)]").unwrap();
|
||||||
|
writeln!(symbols, "#[link(name = \"{}\")]", lib_name.replace("lib", "")).unwrap();
|
||||||
|
writeln!(symbols, "extern {{").unwrap();
|
||||||
for e in exports.iter() {
|
for e in exports.iter() {
|
||||||
println!("cargo:warning=Exported function: {}", e);
|
println!("cargo:warning=Exported function: {}", e);
|
||||||
|
// writeln!(symbols, "\t#[no_mangle]").unwrap();
|
||||||
|
writeln!(symbols, "\tpub fn {}();", e).unwrap();
|
||||||
|
}
|
||||||
|
writeln!(symbols, "}}").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("cargo:warning=Expected library name: {}-orig.dll", lib_name);
|
println!("cargo:warning=Expected library name: {}-orig.dll", lib_name);
|
||||||
println!("cargo:rustc-env=LIB_NAME={}-orig.dll", lib_name);
|
println!("cargo:rustc-env=LIB_NAME={}-orig.dll", lib_name);
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "dotnet")]
|
#[cfg(feature = "dotnet")]
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,8 @@ pub mod injector;
|
|||||||
pub mod frida_handler;
|
pub mod frida_handler;
|
||||||
// #[cfg(feature = "dotnet")]
|
// #[cfg(feature = "dotnet")]
|
||||||
// pub mod cs;
|
// pub mod cs;
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
pub mod symbols;
|
||||||
|
|
||||||
pub use injector::attach_self;
|
pub use injector::attach_self;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user