From d7d3531dc05875afb083e3c15dce3a0f195e43e1 Mon Sep 17 00:00:00 2001 From: alterdekim Date: Tue, 10 Dec 2024 03:32:59 +0300 Subject: [PATCH] modified: frida_cli/src/main.rs modified: frida_client/src/client.rs --- frida_cli/src/main.rs | 6 +++--- frida_client/src/client.rs | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frida_cli/src/main.rs b/frida_cli/src/main.rs index b3dd3a0..d73ef66 100644 --- a/frida_cli/src/main.rs +++ b/frida_cli/src/main.rs @@ -61,10 +61,10 @@ async fn init_server(cfg_raw: &str, s_interface: Option<&str>) { //server::server_mode(config, s_interface).await; } -async fn init_client(cfg_raw: &str, s_interface: Option) { +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, s_interface}; + let client = DesktopClient{client_config: config}; client.start().await; } @@ -157,7 +157,7 @@ async fn main() { match mode { "server" => init_server(cfg_raw, matches.value_of("interface")).await, - "client" => init_client(cfg_raw, matches.value_of("interface").map_or(None, |x| Some(String::from(x)))).await, + "client" => init_client(cfg_raw), "new_peer" => generate_peer_config(&matches, config_path, cfg_raw), _ => error!("There is config file already") } diff --git a/frida_client/src/client.rs b/frida_client/src/client.rs index 711d973..dd8ac09 100644 --- a/frida_client/src/client.rs +++ b/frida_client/src/client.rs @@ -205,15 +205,17 @@ pub mod desktop { #[cfg(target_os = "linux")] - fn configure_routes(endpoint_ip: &str, s_interface: Option) { + fn configure_routes(endpoint_ip: &str) { let interfaces = NetworkInterface::show().unwrap(); let net_inter = interfaces.iter() .filter(|i| !i.addr.iter().any(|b| b.ip().to_string() == "127.0.0.1" || b.ip().to_string() == "::1") ) .min_by(|x, y| x.index.cmp(&y.index)) .unwrap(); - - let inter_name = if s_interface.is_some() { s_interface.unwrap() } else { net_inter.name.clone() }; + + info!("Main interface: {:?}", net_inter); + + let inter_name = net_inter.name.clone(); info!("Main network interface: {:?}", inter_name); @@ -281,13 +283,11 @@ pub mod desktop { } pub struct DesktopClient { - pub client_config: ClientConfiguration, - pub s_interface: Option + pub client_config: ClientConfiguration } impl VpnClient for DesktopClient { async fn start(&self) { - info!("s_interface: {:?}", &self.s_interface); info!("client_address: {:?}", &self.client_config.client.address); let mut config = AbstractDevice::default(); let mtu: u16 = 1400; @@ -309,7 +309,7 @@ pub mod desktop { #[cfg(target_os = "linux")] { let s_a: std::net::SocketAddr = self.client_config.server.endpoint.parse().unwrap(); - configure_routes(&s_a.ip().to_string(), self.s_interface.clone()); + configure_routes(&s_a.ip().to_string()); } client.start(sock, dev_reader, dev_writer, mtu).await;