modified: Cargo.lock
Some checks failed
gitea/Frida/pipeline/head There was a failure building this commit
Some checks failed
gitea/Frida/pipeline/head There was a failure building this commit
modified: frida_client/src/client.rs modified: frida_core/src/device.rs modified: frida_core/src/linux_tun.rs modified: frida_core/src/tun.rs modified: frida_core/src/win_tun.rs
This commit is contained in:
parent
be7c5a7461
commit
c3b886c21f
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -1644,7 +1644,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "frida-client"
|
name = "frida_cli"
|
||||||
|
version = "0.2.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "frida_client"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
@ -1657,10 +1661,6 @@ dependencies = [
|
|||||||
"x25519-dalek",
|
"x25519-dalek",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "frida_cli"
|
|
||||||
version = "0.2.0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "frida_core"
|
name = "frida_core"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -192,6 +192,8 @@ pub mod android {
|
|||||||
pub mod desktop {
|
pub mod desktop {
|
||||||
use crate::client::general::{CoreVpnClient, DevReader, DevWriter, VpnClient};
|
use crate::client::general::{CoreVpnClient, DevReader, DevWriter, VpnClient};
|
||||||
use crate::config::ClientConfiguration;
|
use crate::config::ClientConfiguration;
|
||||||
|
use frida_core::create;
|
||||||
|
use frida_core::device::AbstractDevice;
|
||||||
use futures::{SinkExt, StreamExt};
|
use futures::{SinkExt, StreamExt};
|
||||||
use log::info;
|
use log::info;
|
||||||
use tokio::net::UdpSocket;
|
use tokio::net::UdpSocket;
|
||||||
@ -267,7 +269,7 @@ pub mod desktop {
|
|||||||
async fn start(&self) {
|
async fn start(&self) {
|
||||||
info!("s_interface: {:?}", &self.s_interface);
|
info!("s_interface: {:?}", &self.s_interface);
|
||||||
info!("client_address: {:?}", &self.client_config.client.address);
|
info!("client_address: {:?}", &self.client_config.client.address);
|
||||||
let mut config = Configuration::default();
|
let mut config = AbstractDevice::default();
|
||||||
config.address(&self.client_config.client.address)
|
config.address(&self.client_config.client.address)
|
||||||
.netmask("255.255.255.255")
|
.netmask("255.255.255.255")
|
||||||
.destination("10.66.66.1")
|
.destination("10.66.66.1")
|
||||||
@ -279,7 +281,7 @@ pub mod desktop {
|
|||||||
let sock = UdpSocket::bind(("0.0.0.0", 0)).await.unwrap();
|
let sock = UdpSocket::bind(("0.0.0.0", 0)).await.unwrap();
|
||||||
sock.connect(&self.client_config.server.endpoint).await.unwrap();
|
sock.connect(&self.client_config.server.endpoint).await.unwrap();
|
||||||
|
|
||||||
let dev = create_as_async(&config).unwrap();
|
let dev = create(&config).unwrap();
|
||||||
let (mut dev_writer , mut dev_reader) = dev.into_framed().split();
|
let (mut dev_writer , mut dev_reader) = dev.into_framed().split();
|
||||||
|
|
||||||
let mut client = CoreVpnClient{ client_config: self.client_config.clone(), dev_reader: DevReader{ dr: dev_reader }, dev_writer: DevWriter{dr: dev_writer }, close_token: tokio_util::sync::CancellationToken::new()};
|
let mut client = CoreVpnClient{ client_config: self.client_config.clone(), dev_reader: DevReader{ dr: dev_reader }, dev_writer: DevWriter{dr: dev_writer }, close_token: tokio_util::sync::CancellationToken::new()};
|
||||||
|
@ -1,31 +1,38 @@
|
|||||||
|
|
||||||
|
use std::net::IpAddr;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct AbstractDevice {
|
pub struct AbstractDevice {
|
||||||
address: String,
|
address: Option<IpAddr>,
|
||||||
netmask: String,
|
netmask: Option<IpAddr>,
|
||||||
destination: String,
|
destination: Option<IpAddr>,
|
||||||
mtu: u16,
|
mtu: Option<u16>,
|
||||||
tun_name: String
|
tun_name: Option<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AbstractDevice {
|
impl AbstractDevice {
|
||||||
fn address(&mut self, address: String) {
|
pub fn address(&mut self, address: IpAddr) -> &mut Self {
|
||||||
self.address = address;
|
self.address = Some(address);
|
||||||
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn netmask(&mut self, netmask: String) {
|
pub fn netmask(&mut self, netmask: IpAddr) -> &mut Self {
|
||||||
self.netmask = netmask;
|
self.netmask = Some(netmask);
|
||||||
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destination(&mut self, destination: String) {
|
pub fn destination(&mut self, destination: IpAddr) -> &mut Self {
|
||||||
self.destination = destination;
|
self.destination = Some(destination);
|
||||||
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mtu(&mut self, mtu: u16) {
|
pub fn mtu(&mut self, mtu: u16) -> &mut Self {
|
||||||
self.mtu = mtu;
|
self.mtu = Some(mtu);
|
||||||
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tun_name(&mut self, tun_name: String) {
|
pub fn tun_name<S: AsRef<str>>(&mut self, tun_name: S) -> &mut Self {
|
||||||
self.tun_name = tun_name;
|
self.tun_name = Some(tun_name.as_ref().into());
|
||||||
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ use tokio_tun::Tun;
|
|||||||
use std::net::Ipv4Addr;
|
use std::net::Ipv4Addr;
|
||||||
use std::os::unix::io::AsRawFd;
|
use std::os::unix::io::AsRawFd;
|
||||||
|
|
||||||
pub fn create() -> (DeviceReader, DeviceWriter) {
|
pub fn create(cfg: AbstractDevice) -> (DeviceReader, DeviceWriter) {
|
||||||
let tun = Arc::new(
|
let tun = Arc::new(
|
||||||
Tun::builder()
|
Tun::builder()
|
||||||
.name("") // if name is empty, then it is set by kernel.
|
.name("") // if name is empty, then it is set by kernel.
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
use crate::device::AbstractDevice;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
use crate::win_tun::{DeviceReader, DeviceWriter, create};
|
use crate::win_tun::{DeviceReader, DeviceWriter, create};
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use crate::linux_tun::{DeviceReader, DeviceWriter, create};
|
use crate::linux_tun::{DeviceReader, DeviceWriter, create};
|
||||||
|
|
||||||
pub fn create_tun() -> (DeviceReader, DeviceWriter) {
|
pub fn create_tun(cfg: AbstractDevice) -> (DeviceReader, DeviceWriter) {
|
||||||
create()
|
create(cfg)
|
||||||
}
|
}
|
@ -3,7 +3,9 @@ use wintun::Session;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
pub fn create() -> (DeviceReader, DeviceWriter) {
|
use crate::device::AbstractDevice;
|
||||||
|
|
||||||
|
pub fn create(cfg: AbstractDevice) -> (DeviceReader, DeviceWriter) {
|
||||||
//Unsafe because we are loading an arbitrary dll file
|
//Unsafe because we are loading an arbitrary dll file
|
||||||
let wintun = unsafe { wintun::load_from_path("wintun.dll") }
|
let wintun = unsafe { wintun::load_from_path("wintun.dll") }
|
||||||
.expect("Failed to load wintun dll");
|
.expect("Failed to load wintun dll");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user