Fix frida_code_file, initial config support

Signed-off-by: Dimitris Zervas <dzervas@dzervas.gr>
This commit is contained in:
Dimitris Zervas
2024-04-14 15:16:40 +03:00
parent 7f9a223c61
commit b6a48d5155
11 changed files with 166 additions and 143 deletions

View File

@ -9,11 +9,11 @@ use crate::frida_handler::attach_pid as frida_attach_pid;
pub extern "C" fn attach(pid: u32) {
#[cfg(feature = "frida")]
{
let frida_code = env!("FRIDA_CODE");
let frida_code = env!("FRIDA_CODE").replace("\\n", "\n");
#[cfg(windows)]
std::thread::spawn(move || frida_attach_pid(frida_code, pid));
std::thread::spawn(move || frida_attach_pid(&frida_code, pid));
#[cfg(not(windows))]
frida_attach_pid(frida_code, pid);
frida_attach_pid(&frida_code, pid);
}
}

View File

@ -39,11 +39,11 @@ mod tests {
.arg("--target-dir")
.arg("target/test_frida_on_load")
.env("FRIDA_CODE", r#"
const foo = Module.getExportByName(null, "mylib_foo");
Interceptor.replace(foo, new NativeCallback(function () {
console.log("replaced foo() called");
return 40;
}, "uint8", []));
const foo = Module.getExportByName(null, "mylib_foo");
Interceptor.replace(foo, new NativeCallback(function () {
console.log("replaced foo() called");
return 40;
}, "uint8", []));
"#)
.status()
.unwrap();