modified: frida_core/src/mac_tun.rs
This commit is contained in:
parent
4a4d1c7e88
commit
118d48b4fe
@ -18,7 +18,7 @@ fn cmd(cmd: &str, args: &[&str]) {
|
|||||||
pub fn create(cfg: AbstractDevice) -> (DeviceReader, DeviceWriter) {
|
pub fn create(cfg: AbstractDevice) -> (DeviceReader, DeviceWriter) {
|
||||||
let iface = Iface::new("tun%d", Mode::Tun).unwrap();
|
let iface = Iface::new("tun%d", Mode::Tun).unwrap();
|
||||||
|
|
||||||
let address = cfg.address.unwrap().to_string();
|
let mut address = cfg.address.unwrap().to_string();
|
||||||
address.push_str("/24");
|
address.push_str("/24");
|
||||||
|
|
||||||
cmd("ip", &["addr", "add", "dev", iface.name(), &address]);
|
cmd("ip", &["addr", "add", "dev", iface.name(), &address]);
|
||||||
@ -41,12 +41,12 @@ pub struct DeviceReader {
|
|||||||
|
|
||||||
impl DeviceWriter {
|
impl DeviceWriter {
|
||||||
pub async fn write(&self, buf: &Vec<u8>) -> Result<usize, Box<dyn Error>> {
|
pub async fn write(&self, buf: &Vec<u8>) -> Result<usize, Box<dyn Error>> {
|
||||||
self.writer.send(buf)
|
Ok(self.writer.send(buf)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceReader {
|
impl DeviceReader {
|
||||||
pub async fn read(&self, buf: &mut Vec<u8>) -> Result<usize, Box<dyn Error>> {
|
pub async fn read(&self, buf: &mut Vec<u8>) -> Result<usize, Box<dyn Error>> {
|
||||||
self.reader.recv(buf)
|
Ok(self.reader.recv(buf)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user