modified: src/client.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
modified: src/main.rs modified: src/mobile.rs
This commit is contained in:
parent
b8e5a96e60
commit
96ec04cd41
@ -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, mut lrx) = mpsc::unbounded_channel::<Vec<u8>>();
|
let (ltx, mut lrx) = mpsc::unbounded_channel::<Vec<u8>>();
|
||||||
ltx.send("Starting client...".as_bytes().to_vec());
|
ltx.send("Starting client...".as_bytes().to_vec());
|
||||||
|
|
||||||
@ -138,7 +138,8 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, env: &JNIE
|
|||||||
}
|
}
|
||||||
rr1 = lrx.recv() => {
|
rr1 = lrx.recv() => {
|
||||||
if let Some(bytes) = rr1 {
|
if let Some(bytes) = rr1 {
|
||||||
FridaLib::traceFromNative(&env, String::from_utf8_lossy(&bytes).to_string());
|
crate::log2java(String::from_utf8_lossy(&bytes).to_string());
|
||||||
|
//FridaLib::traceFromNative(&env, );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rr2 = mx.recv() => {
|
rr2 = mx.recv() => {
|
||||||
|
13
src/main.rs
13
src/main.rs
@ -24,6 +24,13 @@ 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: Option<&JNIEnv> = None;
|
||||||
|
|
||||||
|
pub fn log2java(text: String) {
|
||||||
|
if Some(env) = LOG_ENV {
|
||||||
|
jni::FridaLib::traceFromNative(env, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[bridge]
|
#[bridge]
|
||||||
mod jni {
|
mod jni {
|
||||||
@ -60,17 +67,19 @@ mod jni {
|
|||||||
return Ok(-2);
|
return Ok(-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_ENV = Some(env);
|
||||||
|
|
||||||
let main_loop = async move {
|
let main_loop = async move {
|
||||||
/*if let Err(err) = {
|
/*if let Err(err) = {
|
||||||
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.block_on(main_loop); -4 }
|
Ok(rt) => { rt.spawn(main_loop); -4 } //block_on
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(exit_code)
|
Ok(exit_code)
|
||||||
|
@ -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;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user