re-enable frida_handler test

Signed-off-by: Dimitris Zervas <dzervas@dzervas.gr>
This commit is contained in:
Dimitris Zervas 2024-04-14 01:12:48 +03:00
parent a5a0153d31
commit 20cb136c57
No known key found for this signature in database
3 changed files with 28 additions and 22 deletions

5
Cargo.lock generated
View File

@ -227,6 +227,7 @@ dependencies = [
"frida", "frida",
"goblin", "goblin",
"lazy_static", "lazy_static",
"mylib",
"pretty_assertions", "pretty_assertions",
"serde", "serde",
"serde_json", "serde_json",
@ -568,6 +569,10 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "mylib"
version = "0.1.0"
[[package]] [[package]]
name = "nom" name = "nom"
version = "7.1.3" version = "7.1.3"

View File

@ -33,3 +33,4 @@ build-target = "0.4"
[dev-dependencies] [dev-dependencies]
pretty_assertions = "1.4.0" pretty_assertions = "1.4.0"
mylib = { path = "tests/mylib" }

View File

@ -88,29 +88,29 @@ impl ScriptHandler for Handler {
} }
} }
// #[cfg(test)] #[cfg(test)]
// mod tests { mod tests {
// use super::*; use super::*;
// use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
// #[link(name = "mylib", kind = "dylib")] #[link(name = "mylib", kind = "dylib")]
// extern { extern {
// fn mylib_foo() -> u8; fn mylib_foo() -> u8;
// } }
// #[test] #[test]
// fn test_attach_pid() { fn test_attach_pid() {
// assert_eq!(10, unsafe { mylib_foo() }); assert_eq!(10, unsafe { mylib_foo() });
// let frida_script = r#" let frida_script = r#"
// const foo = Module.getExportByName(null, "mylib_foo"); const foo = Module.getExportByName(null, "mylib_foo");
// Interceptor.replace(foo, new NativeCallback(function () { Interceptor.replace(foo, new NativeCallback(function () {
// console.log("replaced foo() called"); console.log("replaced foo() called");
// return 20; return 20;
// }, "uint8", [])); }, "uint8", []));
// "#; "#;
// attach_pid(frida_script, 0); attach_pid(frida_script, 0);
// assert_eq!(20, unsafe { mylib_foo() }); assert_eq!(20, unsafe { mylib_foo() });
// } }
// } }