Data handling completely rebuilt. Now correctly handles all TCP/IP traffic.

This commit is contained in:
PinkP4nther 2021-09-02 21:06:27 -07:00
commit f19c7d8f2a
12 changed files with 493 additions and 604 deletions

View file

@ -0,0 +1,9 @@
[package]
name = "modifydata"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
sslrelay = {path = "../../"}

View file

@ -0,0 +1,6 @@
bind_host = "0.0.0.0"
bind_port = "443"
ssl_private_key_path = "./remote.com.key"
ssl_cert_path = "./remote.com.crt"
remote_host = "remote.com"
remote_port = "443"

View file

@ -0,0 +1,46 @@
use sslrelay::{self, ConfigType, RelayConfig, HandlerCallbacks};
// Handler object
#[derive(Clone)] // Must have Clone trait implemented.
struct Handler;
/*
Callback traits that can be used to read or inject/modify data
into upstream or downstream data.
*/
impl HandlerCallbacks for Handler {
// DownStream non blocking callback
fn ds_nb_callback(&self, _in_data: Vec<u8>) {
println!("[+] Data before complete rewrite:\n{:#04X?}", _in_data);
}
// DownStream blocking callback
fn ds_b_callback(&self, _in_data: &mut Vec<u8>) {
_in_data.reverse();
println!("[+] Data rewritten to:\n{:#04X?}", _in_data);
}
// UpStream non blocking callback
fn us_nb_callback(&self, _in_data: Vec<u8>) {
println!("[+] Data before complete rewrite:\n{:#04X?}", _in_data);
}
// UpStream blocking callback
fn us_b_callback(&self, _in_data: &mut Vec<u8>) {
_in_data.reverse();
println!("[+] Data rewritten to:\n{:#04X?}", _in_data);
}
}
fn main() {
// Create new SSLRelay object
let mut relay = sslrelay::SSLRelay::new(Handler);
// Load Configuration
relay.load_config(ConfigType::Default);
// Start listening
relay.start();
}