modified: Cargo.toml new file: Jenkinsfile modified: src/client_socks.rs modified: src/main.rs
This commit is contained in:
parent
714c17b39b
commit
35594dea3c
24
Cargo.lock
generated
24
Cargo.lock
generated
@ -554,7 +554,6 @@ dependencies = [
|
|||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
"socket2 0.4.10",
|
"socket2 0.4.10",
|
||||||
"socks5-server",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"tun2",
|
"tun2",
|
||||||
"x25519-dalek",
|
"x25519-dalek",
|
||||||
@ -1501,29 +1500,6 @@ dependencies = [
|
|||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "socks5-proto"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3d91431c4672e25e372ef46bc554be8f315068c03608f99267a71ad32a12e8c4"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"thiserror",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "socks5-server"
|
|
||||||
version = "0.10.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5223c26981806584cc38c74fddf58808dbdcf4724890471ced69e7a2e8d86345"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"bytes",
|
|
||||||
"socks5-proto",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
|
@ -33,5 +33,4 @@ x25519-dalek = { version = "2.0.1", features = ["getrandom", "static_secrets"] }
|
|||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
chrono = "0.4.38"
|
chrono = "0.4.38"
|
||||||
console-subscriber = "0.4.0"
|
console-subscriber = "0.4.0"
|
||||||
network-interface = "2.0.0"
|
network-interface = "2.0.0"
|
||||||
socks5-server = "0.10.1"
|
|
10
Jenkinsfile
vendored
Normal file
10
Jenkinsfile
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
stages {
|
||||||
|
stage('Build Project') {
|
||||||
|
steps {
|
||||||
|
build "Frida"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,56 +1,63 @@
|
|||||||
use crossbeam_channel::unbounded;
|
use crossbeam_channel::unbounded;
|
||||||
use socket2::SockAddr;
|
use socket2::SockAddr;
|
||||||
use tokio::{net::UdpSocket, sync::Mutex};
|
use tokio::{net::UdpSocket, sync::Mutex};
|
||||||
use std::{io::{Read, Write}, net::SocketAddr};
|
use std::{io::{Read, Write}, net::{SocketAddr, Ipv4Addr, IpAddr}};
|
||||||
use base64::prelude::*;
|
use base64::prelude::*;
|
||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::net::Ipv4Addr;
|
|
||||||
use x25519_dalek::{PublicKey, StaticSecret};
|
use x25519_dalek::{PublicKey, StaticSecret};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use std::collections::HashMap;
|
||||||
use aes_gcm::{
|
use aes_gcm::{
|
||||||
aead::{Aead, AeadCore, KeyInit, OsRng},
|
aead::{Aead, AeadCore, KeyInit, OsRng},
|
||||||
Aes256Gcm, Nonce};
|
Aes256Gcm, Nonce};
|
||||||
|
|
||||||
use crate::config::ClientConfiguration;
|
use crate::config::ClientConfiguration;
|
||||||
use crate::udp::{UDPVpnPacket, UDPVpnHandshake, UDPSerializable};
|
use crate::udp::{UDPVpnPacket, UDPVpnHandshake, UDPSerializable};
|
||||||
|
use network_interface::NetworkInterface;
|
||||||
|
use network_interface::NetworkInterfaceConfig;
|
||||||
|
|
||||||
pub async fn client_mode(client_config: ClientConfiguration) {
|
pub async fn client_mode(client_config: ClientConfiguration, s_interface: Option<&str>) {
|
||||||
info!("Starting client...");
|
info!("Starting client...");
|
||||||
|
info!("s_interface: {:?}", s_interface);
|
||||||
|
|
||||||
|
let proxy_sock = UdpSocket::bind("127.0.0.1:9997").await.unwrap();
|
||||||
|
let proxy_sock_rec = Arc::new(proxy_sock);
|
||||||
|
let proxy_sock_snd = proxy_sock_rec.clone();
|
||||||
|
|
||||||
let sock = UdpSocket::bind("0.0.0.0:25565").await.unwrap();
|
let sock = UdpSocket::bind("0.0.0.0:25565").await.unwrap();
|
||||||
sock.connect(&client_config.server.endpoint).await.unwrap();
|
sock.connect(&client_config.server.endpoint).await.unwrap();
|
||||||
|
|
||||||
// socks5
|
|
||||||
|
|
||||||
let (mut dev_reader, mut dev_writer) = dev.split();
|
|
||||||
|
|
||||||
let sock_rec = Arc::new(sock);
|
let sock_rec = Arc::new(sock);
|
||||||
let sock_snd = sock_rec.clone();
|
let sock_snd = sock_rec.clone();
|
||||||
|
|
||||||
let (tx, rx) = unbounded::<Vec<u8>>();
|
let (tx, rx) = unbounded::<Vec<u8>>();
|
||||||
let (dx, mx) = unbounded::<Vec<u8>>();
|
let (dx, mx) = unbounded::<Vec<u8>>();
|
||||||
|
|
||||||
|
let addresses = Arc::new(Mutex::new(SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080)));
|
||||||
|
|
||||||
let cipher_shared = Arc::new(Mutex::new(None));
|
let cipher_shared = Arc::new(Mutex::new(None));
|
||||||
|
|
||||||
|
let addresses_snd = addresses.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
while let Ok(bytes) = rx.recv() {
|
while let Ok(bytes) = rx.recv() {
|
||||||
//info!("Write to tun {:?}", hex::encode(&bytes));
|
//info!("Write to tun {:?}", hex::encode(&bytes));
|
||||||
dev_writer.write_all(&bytes).unwrap();
|
let al = addresses_snd.lock().await;
|
||||||
|
proxy_sock_snd.send_to(&bytes, al.clone()).await;
|
||||||
|
drop(al);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let addresses_rec = addresses.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut buf = vec![0; 8192];
|
let mut buf = vec![0; 8192];
|
||||||
while let Ok(n) = dev_reader.read(&mut buf) {
|
while let Ok((len, addr)) = proxy_sock_rec.recv_from(&mut buf).await {
|
||||||
dx.send(buf[..n].to_vec()).unwrap();
|
let mut al = addresses_rec.lock().await;
|
||||||
|
*al = addr;
|
||||||
|
dx.send(buf[..len].to_vec()).unwrap();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let s_a: SocketAddr = client_config.server.endpoint.parse().unwrap();
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
configure_routes(&s_a.ip().to_string(), s_interface);
|
|
||||||
|
|
||||||
let priv_key = BASE64_STANDARD.decode(client_config.client.private_key).unwrap();
|
let priv_key = BASE64_STANDARD.decode(client_config.client.private_key).unwrap();
|
||||||
|
|
||||||
let cipher_shared_clone = cipher_shared.clone();
|
let cipher_shared_clone = cipher_shared.clone();
|
||||||
|
@ -10,7 +10,7 @@ mod server;
|
|||||||
mod client;
|
mod client;
|
||||||
mod udp;
|
mod udp;
|
||||||
mod config;
|
mod config;
|
||||||
//mod client_socks;
|
mod client_socks;
|
||||||
|
|
||||||
fn generate_server_config(matches: &ArgMatches, config_path: &str) {
|
fn generate_server_config(matches: &ArgMatches, config_path: &str) {
|
||||||
let bind_address = matches.value_of("bind-address").expect("No bind address specified");
|
let bind_address = matches.value_of("bind-address").expect("No bind address specified");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user