From 52a03b904523a54af50106f394eae8ff961e54fc Mon Sep 17 00:00:00 2001 From: PinkP4nther <0x0090@protonmail.com> Date: Tue, 21 Sep 2021 09:31:43 -0700 Subject: [PATCH 1/2] Now handles IPv6 connections correctly --- Cargo.toml | 2 +- src/data.rs | 17 ++++++++++------- src/lib.rs | 9 ++++++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3db9d97..5f76870 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sslrelay" -version = "0.3.0" +version = "0.3.1" authors = ["PinkP4nther "] edition = "2018" diff --git a/src/data.rs b/src/data.rs index 505f97f..a24bc9c 100644 --- a/src/data.rs +++ b/src/data.rs @@ -327,7 +327,9 @@ where { ds_tcp_stream: Arc>>, us_tcp_stream: Option>>>, - remote_endpoint: String, + //remote_endpoint: String, + remote_host: String, + remote_port: String, ds_inner_m: Arc>, us_inner_m: Arc>, inner_handlers: InnerHandlers, @@ -335,14 +337,15 @@ where impl FullDuplexTcp { - pub fn new(ds_tcp_stream: SslStream, remote_endpoint: String, handlers: InnerHandlers) -> Self { + pub fn new(ds_tcp_stream: SslStream, remote_host: String, remote_port: String, handlers: InnerHandlers) -> Self { let _ = ds_tcp_stream.get_ref().set_read_timeout(Some(Duration::from_millis(50))); FullDuplexTcp { ds_tcp_stream: Arc::new(Mutex::new(ds_tcp_stream)), us_tcp_stream: None, - remote_endpoint, + remote_host, + remote_port, ds_inner_m: Arc::new(Mutex::new(DownStreamInner{ds_stream: None, internal_data_buffer: Vec::::new()})), us_inner_m: Arc::new(Mutex::new(UpStreamInner{us_stream: None, internal_data_buffer: Vec::::new()})), inner_handlers: handlers, @@ -519,17 +522,17 @@ impl s, Err(e) => { - self.handle_error(format!("Can't connect to remote host: {}\nErr: {}", self.remote_endpoint, e).as_str()); + self.handle_error(format!("Can't connect to remote host: {}\nErr: {}", format!("{}:{}", self.remote_host, self.remote_port), e).as_str()); return -1; } }; - let r_host: Vec<&str> = self.remote_endpoint.as_str().split(":").collect(); + //let r_host: Vec<&str> = self.remote_endpoint.as_str().split(":").collect(); - let s = match connector.connect(r_host[0], s) { + let s = match connector.connect(self.remote_host.as_str(), s) { Ok(s) => s, Err(e) => { self.handle_error(format!("Failed to accept TLS/SSL handshake: {}", e).as_str()); diff --git a/src/lib.rs b/src/lib.rs index 1d559ef..5e73852 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -80,7 +80,7 @@ impl { // FULL DUPLEX OBJECT CREATION HERE - FullDuplexTcp::new(stream, r_endpoint, handler_clone).handle(); + FullDuplexTcp::new(stream, r_host, r_port, handler_clone).handle(); }, Err(e) => { From 00006f0d8f0a287338c53a7cdaae1665c86e9c3b Mon Sep 17 00:00:00 2001 From: PinkP4nther <0x0090@protonmail.com> Date: Tue, 21 Sep 2021 09:33:23 -0700 Subject: [PATCH 2/2] V0.3.1 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9d72d42..f1e1b35 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,6 @@ Then use this library to continuously rewrite or display decrypted network traff 09/16/2021 | Version 0.3 +09/21/2021 | v0.3.1 | Fully supports IPv6. + More updates/ideas to come.. I think.. \ No newline at end of file