list_exports func added and initial RPC code.#147
Conversation
|
Thanks for this. In the future please try to do one PR per feature. It makes it easier to review. |
|
Please fix CI. |
|
Here is a compact example using local and without the loop+thread-sleep (wasn't sure what it was showcasing). use frida::{Frida, Message};
use lazy_static::lazy_static;
lazy_static! {
static ref FRIDA: Frida = unsafe { Frida::obtain() };
}
fn main() {
let device_manager = frida::DeviceManager::obtain(&FRIDA);
let local_device = device_manager.get_local_device().unwrap();
let session = local_device.attach(0).unwrap();
let script_source = r#"
rpc.exports = {
a: function() {},
b: function() {}
};
"#;
let mut script_option = frida::ScriptOption::default();
let mut script = session.create_script(script_source, &mut script_option).unwrap();
script.handle_message(Handler).unwrap();
script.load().unwrap();
println!("{:?}", script.list_exports().unwrap());
script.unload().unwrap();
session.detach().unwrap();
}
struct Handler;
impl frida::ScriptHandler for Handler {
fn on_message(&mut self, message: &Message) {
println!("- {:?}", message);
}
}Also. To me it seems like |
Thank you @hsorbo I used some of your code. I put it in a loop to show that the communication is working as expected.
I'm not 100% either. I saw in an example and a comment in the code, that that's how we have to do it , so I follow that.. If that is not intended then it have to be fix in a different PR.
You are right. I updated the code. Thanks. |
s1341
left a comment
There was a problem hiding this comment.
Please fix the few nitpicks, then it is ready to merge i think.
| where | ||
| 'b: 'a, | ||
| { | ||
| pub fn obtain<'b: 'a>(_gum: &'b Gum) -> Interceptor<'b> { |
There was a problem hiding this comment.
'b: 'a ensures that the lifetime of the input is at least as long as 'a. I had to put that because 117003b broke the no_std test
There was a problem hiding this comment.
Oh I didn't realize 'a was on the Interceptor.
|
Ready to merge? |
|
Yes, thank you @s1341! |
list_exports. Included an example demonstrating how to use it.console_logto align with the recent changes made to theon_messagefunction.device.rsandvariant.rs: After adding serde to cargo, I encountered compilation issues withfrida_sys::FALSE. I set the types to resolve these issues.Please let me know if you have any notes. Once we get this approved I can move to finalize the RPC calls #105