modified: src/main.rs
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit

modified:   src/simple_log.rs
This commit is contained in:
Michael Wain 2024-10-06 02:46:20 +03:00
parent be7193a2f2
commit da9741e215
2 changed files with 7 additions and 12 deletions

View File

@ -38,7 +38,7 @@ pub unsafe extern "C" fn Java_com_alterdekim_frida_FridaLib_fetchLogs(
mut env: JNIEnv,
_clazz: JClass
) -> jstring {
String::from_utf8_lossy(simple_log::fetch_logs()[..])
String::from_utf8_lossy(&simple_log::fetch_logs()[..])
}
#[no_mangle]

View File

@ -1,27 +1,22 @@
use crossbeam_channel::unbounded;
use crossbeam_channel::{ Sender, Receiver };
struct ll {
pub tx: Sender<Vec<u8>>,
pub rx: Receiver<Vec<u8>>
}
static mut l2: ll;
static tx: Sender<Vec<u8>>;
static rx: Receiver<Vec<u8>>;
pub fn init_logger() {
let (tx, rx) = unbounded::<Vec<u8>>();
l2 = ll{tx, rx};
(tx, rx) = unbounded::<Vec<u8>>();
}
pub fn fetch_logs() -> Vec<u8> {
if let Ok(bytes) = l2.rx.recv() {
if let Ok(bytes) = rx.recv() {
return bytes;
}
Vec::new()
}
pub fn push_log(data: Vec<u8>) {
l2.tx.send(data);
tx.send(data);
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
@ -54,6 +49,6 @@ impl SimpleLogger {
record.module_path().unwrap_or(""),
record.args()
);
push_log(msg.to_vec());
push_log(msg.as_bytes());
}
}