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;
|
mod mobile;
|
||||||
|
|
||||||
static TUN_QUIT: std::sync::Mutex<Option<tokio_util::sync::CancellationToken>> = std::sync::Mutex::new(None);
|
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) {
|
pub fn log2java(text: String) {
|
||||||
if let Ok(mut l) = LOG_ENV.lock() {
|
if let Some(mut file) = LOG_FILE {
|
||||||
if l.is_some() {
|
file.write_all(text.as_bytes());
|
||||||
jni::FridaLib::traceFromNative(l.unwrap(), text);
|
//jni::FridaLib::traceFromNative(l.unwrap(), text);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ mod jni {
|
|||||||
use robusta_jni::jni::objects::AutoLocal;
|
use robusta_jni::jni::objects::AutoLocal;
|
||||||
use robusta_jni::jni::JNIEnv;
|
use robusta_jni::jni::JNIEnv;
|
||||||
use crate::mobile;
|
use crate::mobile;
|
||||||
use crate::{TUN_QUIT, LOG_ENV};
|
use crate::{TUN_QUIT, LOG_FILE};
|
||||||
|
|
||||||
#[derive(Signature, TryIntoJavaValue, IntoJavaValue, TryFromJavaValue)]
|
#[derive(Signature, TryIntoJavaValue, IntoJavaValue, TryFromJavaValue)]
|
||||||
#[package(com.alterdekim.frida)]
|
#[package(com.alterdekim.frida)]
|
||||||
@ -58,7 +57,8 @@ mod jni {
|
|||||||
impl<'env: 'borrow, 'borrow> FridaLib<'env, 'borrow> {
|
impl<'env: 'borrow, 'borrow> FridaLib<'env, 'borrow> {
|
||||||
pub extern "jni" fn start(self, env: &JNIEnv, config_b32: String,
|
pub extern "jni" fn start(self, env: &JNIEnv, config_b32: String,
|
||||||
tun_fd: i32,
|
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();
|
let close_token = tokio_util::sync::CancellationToken::new();
|
||||||
if let Ok(mut l) = TUN_QUIT.lock() {
|
if let Ok(mut l) = TUN_QUIT.lock() {
|
||||||
@ -70,11 +70,10 @@ mod jni {
|
|||||||
return Ok(-2);
|
return Ok(-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(mut l) = LOG_ENV.lock() {
|
LOG_FILE = Some(File::options()
|
||||||
if !l.is_some() {
|
.read(false)
|
||||||
*l = Some(&env.clone());
|
.write(true)
|
||||||
}
|
.open(&temp_file).unwrap());
|
||||||
}
|
|
||||||
|
|
||||||
let main_loop = async move {
|
let main_loop = async move {
|
||||||
/*if let Err(err) = {
|
/*if let Err(err) = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user