modified: src/main.rs
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit
This commit is contained in:
parent
0f5a1bb72a
commit
fa5753ed3e
23
src/main.rs
23
src/main.rs
@ -25,13 +25,12 @@ mod udp;
|
||||
mod mobile;
|
||||
|
||||
static TUN_QUIT: std::sync::Mutex<Option<tokio_util::sync::CancellationToken>> = std::sync::Mutex::new(None);
|
||||
static LOG_ENV: std::sync::Mutex<Option<&JNIEnv>> = std::sync::Mutex::new(None);
|
||||
static LOG_FILE: Option<File> = None;
|
||||
|
||||
pub fn log2java(text: String) {
|
||||
if let Ok(mut l) = LOG_ENV.lock() {
|
||||
if l.is_some() {
|
||||
jni::FridaLib::traceFromNative(l.unwrap(), text);
|
||||
}
|
||||
if let Some(mut file) = LOG_FILE {
|
||||
file.write_all(text.as_bytes());
|
||||
//jni::FridaLib::traceFromNative(l.unwrap(), text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +45,7 @@ mod jni {
|
||||
use robusta_jni::jni::objects::AutoLocal;
|
||||
use robusta_jni::jni::JNIEnv;
|
||||
use crate::mobile;
|
||||
use crate::{TUN_QUIT, LOG_ENV};
|
||||
use crate::{TUN_QUIT, LOG_FILE};
|
||||
|
||||
#[derive(Signature, TryIntoJavaValue, IntoJavaValue, TryFromJavaValue)]
|
||||
#[package(com.alterdekim.frida)]
|
||||
@ -58,7 +57,8 @@ mod jni {
|
||||
impl<'env: 'borrow, 'borrow> FridaLib<'env, 'borrow> {
|
||||
pub extern "jni" fn start(self, env: &JNIEnv, config_b32: String,
|
||||
tun_fd: i32,
|
||||
close_fd_on_drop: bool) -> JniResult<i32> {
|
||||
close_fd_on_drop: bool,
|
||||
temp_file: String) -> JniResult<i32> {
|
||||
|
||||
let close_token = tokio_util::sync::CancellationToken::new();
|
||||
if let Ok(mut l) = TUN_QUIT.lock() {
|
||||
@ -70,11 +70,10 @@ mod jni {
|
||||
return Ok(-2);
|
||||
}
|
||||
|
||||
if let Ok(mut l) = LOG_ENV.lock() {
|
||||
if !l.is_some() {
|
||||
*l = Some(&env.clone());
|
||||
}
|
||||
}
|
||||
LOG_FILE = Some(File::options()
|
||||
.read(false)
|
||||
.write(true)
|
||||
.open(&temp_file).unwrap());
|
||||
|
||||
let main_loop = async move {
|
||||
/*if let Err(err) = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user