modified: frida_client/src/client.rs

modified:   frida_core/src/device.rs
	modified:   frida_core/src/linux_tun.rs
This commit is contained in:
Michael Wain 2024-12-09 19:08:49 +03:00
parent 0a772e5136
commit 80670aab59
3 changed files with 10 additions and 10 deletions

View File

@ -273,8 +273,8 @@ pub mod desktop {
info!("client_address: {:?}", &self.client_config.client.address); info!("client_address: {:?}", &self.client_config.client.address);
let mut config = AbstractDevice::default(); let mut config = AbstractDevice::default();
config.address(self.client_config.client.address.parse().unwrap()) config.address(self.client_config.client.address.parse().unwrap())
.netmask(std::net::IpAddr::V4(Ipv4Addr::new(255, 255, 255, 255))) .netmask(Ipv4Addr::new(255, 255, 255, 255))
.destination(std::net::IpAddr::V4(Ipv4Addr::new(10, 66, 66, 1))) .destination(Ipv4Addr::new(10, 66, 66, 1))
.mtu(1400) .mtu(1400)
.tun_name("tun0"); .tun_name("tun0");

View File

@ -1,27 +1,27 @@
use std::net::IpAddr; use std::net::Ipv4Addr;
#[derive(Default)] #[derive(Default)]
pub struct AbstractDevice { pub struct AbstractDevice {
pub(crate) address: Option<IpAddr>, pub(crate) address: Option<Ipv4Addr>,
pub(crate) netmask: Option<IpAddr>, pub(crate) netmask: Option<Ipv4Addr>,
pub(crate) destination: Option<IpAddr>, pub(crate) destination: Option<Ipv4Addr>,
pub(crate) mtu: Option<u16>, pub(crate) mtu: Option<u16>,
pub(crate) tun_name: Option<String> pub(crate) tun_name: Option<String>
} }
impl AbstractDevice { impl AbstractDevice {
pub fn address(&mut self, address: IpAddr) -> &mut Self { pub fn address(&mut self, address: Ipv4Addr) -> &mut Self {
self.address = Some(address); self.address = Some(address);
self self
} }
pub fn netmask(&mut self, netmask: IpAddr) -> &mut Self { pub fn netmask(&mut self, netmask: Ipv4Addr) -> &mut Self {
self.netmask = Some(netmask); self.netmask = Some(netmask);
self self
} }
pub fn destination(&mut self, destination: IpAddr) -> &mut Self { pub fn destination(&mut self, destination: Ipv4Addr) -> &mut Self {
self.destination = Some(destination); self.destination = Some(destination);
self self
} }

View File

@ -9,7 +9,7 @@ pub fn create(cfg: AbstractDevice) -> (DeviceReader, DeviceWriter) {
let tun = Arc::new( let tun = Arc::new(
Tun::builder() Tun::builder()
.name(&cfg.tun_name.unwrap()) // if name is empty, then it is set by kernel. .name(&cfg.tun_name.unwrap()) // if name is empty, then it is set by kernel.
.mtu(cfg.mtu.unwrap()) .mtu(cfg.mtu.unwrap().into())
.address(cfg.address.unwrap()) .address(cfg.address.unwrap())
.netmask(cfg.netmask.unwrap()) .netmask(cfg.netmask.unwrap())
.destination(cfg.destination.unwrap()) .destination(cfg.destination.unwrap())