Changes to be committed:
All checks were successful
gitea/Frida-android-native/pipeline/head This commit looks good

modified:   src/client.rs
	modified:   src/main.rs
	modified:   src/mobile.rs
This commit is contained in:
Michael Wain 2024-10-12 16:39:52 +03:00
parent e2559ce7a6
commit 2818a34862
3 changed files with 8 additions and 10 deletions

View File

@ -24,7 +24,7 @@ use network_interface::NetworkInterfaceConfig;
use robusta_jni::jni::JNIEnv; use robusta_jni::jni::JNIEnv;
use crate::jni::FridaLib; use crate::jni::FridaLib;
pub async fn client_mode(client_config: ClientConfiguration, fd: i32, /*env: &JNIEnv<'_>,*/ close_token: CancellationToken) { pub async fn client_mode(client_config: ClientConfiguration, fd: i32, env: &JNIEnv<'_>, close_token: CancellationToken) {
let (ltx, lrx) = unbounded::<Vec<u8>>(); let (ltx, lrx) = unbounded::<Vec<u8>>();
ltx.send("Starting client...".as_bytes().to_vec()); ltx.send("Starting client...".as_bytes().to_vec());
@ -120,10 +120,8 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, /*env: &JN
let s_cipher = cipher_shared.clone(); let s_cipher = cipher_shared.clone();
loop { loop {
if close_token.is_cancelled() { if close_token.is_cancelled() {
//sock_read_task.abort(); sock_read_task.abort();
//dev_read_task.abort(); dev_read_task.abort();
//return;
ltx.send("Closed token called".as_bytes().to_vec());
return; return;
} }
if let Ok(bytes) = rx.try_recv() { if let Ok(bytes) = rx.try_recv() {
@ -136,7 +134,7 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, /*env: &JN
} }
} }
if let Ok(bytes) = lrx.try_recv() { if let Ok(bytes) = lrx.try_recv() {
//FridaLib::traceFromNative(&env, String::from_utf8_lossy(&bytes).to_string()); FridaLib::traceFromNative(&env, String::from_utf8_lossy(&bytes).to_string());
} }
if let Ok(bytes) = mx.try_recv() { if let Ok(bytes) = mx.try_recv() {
let s_c = s_cipher.lock().await; let s_c = s_cipher.lock().await;

View File

@ -65,12 +65,12 @@ mod jni {
FridaLib::traceFromNative(env, format!("main loop error: {}", err)); FridaLib::traceFromNative(env, format!("main loop error: {}", err));
return Err(err); return Err(err);
}*/ }*/
mobile::mobile_run(config_b32, close_fd_on_drop, tun_fd, /*env, */close_token).await; mobile::mobile_run(config_b32, close_fd_on_drop, tun_fd, env, close_token).await;
}; };
let exit_code = match tokio::runtime::Builder::new_multi_thread().enable_all().build() { let exit_code = match tokio::runtime::Builder::new_multi_thread().enable_all().build() {
Err(_e) => -3, Err(_e) => -3,
Ok(rt) => { rt.spawn(main_loop); -4 } // block_on Ok(rt) => { rt.block_on(main_loop); -4 }
}; };
Ok(exit_code) Ok(exit_code)

View File

@ -5,7 +5,7 @@ use jni::sys::jint;
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
use robusta_jni::jni::JNIEnv; use robusta_jni::jni::JNIEnv;
pub async fn mobile_run(cfg_raw: String, close_fd_on_drop: bool, tun_fd: i32, /*env: &JNIEnv<'_>,*/ close_token: tokio_util::sync::CancellationToken) { pub async fn mobile_run(cfg_raw: String, close_fd_on_drop: bool, tun_fd: i32, env: &JNIEnv<'_>, close_token: tokio_util::sync::CancellationToken) {
let config: ClientConfiguration = serde_yaml::from_slice(hex::decode(cfg_raw).unwrap().as_slice()).expect("Bad client config file structure"); let config: ClientConfiguration = serde_yaml::from_slice(hex::decode(cfg_raw).unwrap().as_slice()).expect("Bad client config file structure");
client::client_mode(config, tun_fd, /*env, */close_token).await; client::client_mode(config, tun_fd, env, close_token).await;
} }