modified: frida_cli/src/main.rs
modified: frida_client/src/client.rs modified: frida_core/src/android_tun.rs
This commit is contained in:
parent
9a009b337e
commit
bce62bc5f4
@ -6,8 +6,6 @@ use log::{error, LevelFilter};
|
||||
use frida_core::config::{ ServerConfiguration, ClientConfiguration, ObfsProtocol, ServerPeer };
|
||||
use frida_client::client::{desktop::DesktopClient, general::VpnClient};
|
||||
|
||||
//mod server;
|
||||
|
||||
fn generate_server_config(matches: &ArgMatches, config_path: &str) {
|
||||
let bind_address = matches.value_of("bind-address").expect("No bind address specified");
|
||||
let internal_address = matches.value_of("internal-address").expect("No internal address specified");
|
||||
@ -63,7 +61,6 @@ async fn init_server(cfg_raw: &str, s_interface: Option<&str>) {
|
||||
|
||||
async fn init_client(cfg_raw: &str) {
|
||||
let config: ClientConfiguration = serde_yaml::from_str(cfg_raw).expect("Bad client config file structure");
|
||||
//client::client_mode(config, s_interface).await;
|
||||
let client = DesktopClient{client_config: config};
|
||||
client.start().await;
|
||||
}
|
||||
|
@ -58,14 +58,14 @@ pub mod general {
|
||||
let mut buf1 = vec![0; 4096]; // should be changed to less bytes
|
||||
|
||||
tokio::spawn(async move {
|
||||
let mut buf = vec![0; mtu.into()]; // mtu
|
||||
let mut buf = vec![0; mtu.into()];
|
||||
loop {
|
||||
match dev_reader.read(&mut buf).await {
|
||||
Ok(n) => {
|
||||
info!("Read from tun."); // hex::encode(&buf[..n])
|
||||
//info!("Read from tun.");
|
||||
dx.send(buf[..n].to_vec()).unwrap();
|
||||
},
|
||||
Err(e) => { error!("Read failed {}", e); }
|
||||
Err(_e) => { /*error!("Read failed {}", e);*/ }
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -80,19 +80,16 @@ pub mod general {
|
||||
}
|
||||
rr = rx.recv() => {
|
||||
if let Some(bytes) = rr {
|
||||
info!("Write to tun. len={:?}", bytes.len());
|
||||
//info!("Write to tun. len={:?}", bytes.len());
|
||||
|
||||
if let Err(e) = dev_writer.write(&bytes).await {
|
||||
error!("Writing error: {:?}", e);
|
||||
//error!("Writing error: {:?}", e);
|
||||
}
|
||||
/* if let Err(e) = self.dev_writer.flush().await {
|
||||
error!("Flushing error: {:?}", e);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
rr2 = mx.recv() => {
|
||||
if let Some(bytes) = rr2 {
|
||||
info!("Got info for sending");
|
||||
//info!("Got info for sending");
|
||||
let s_c = s_cipher.lock().await;
|
||||
|
||||
if s_c.is_some() {
|
||||
@ -115,7 +112,7 @@ pub mod general {
|
||||
}
|
||||
rr = sock_rec.recv(&mut buf1) => {
|
||||
if let Ok(l) = rr {
|
||||
info!("Read from socket");
|
||||
//info!("Read from socket");
|
||||
let mut s_cipher = cipher_shared_clone.lock().await;
|
||||
match buf1.first() {
|
||||
Some(h) => {
|
||||
|
@ -10,14 +10,6 @@ use libc::fdopen;
|
||||
use std::ffi::CString;
|
||||
|
||||
pub fn create(cfg: i32) -> (DeviceReader, DeviceWriter) {
|
||||
// check this if android build won't work
|
||||
/*let mode_read = CString::new("r").unwrap();
|
||||
let mode_write = CString::new("w").unwrap();
|
||||
let fd1 = cfg.clone();
|
||||
let fd2 = fd1.clone();
|
||||
let reader = unsafe { fdopen(fd1, mode_read.as_ptr()) };
|
||||
let writer = unsafe { fdopen(fd2, mode_write.as_ptr()) };*/
|
||||
|
||||
let fd1 = cfg.clone();
|
||||
let fd2 = fd1.clone();
|
||||
let mut reader = unsafe { File::from_raw_fd(fd1) };
|
||||
|
Loading…
x
Reference in New Issue
Block a user