Skip to content

Commit

Permalink
Update main2.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
sbromt authored Dec 19, 2024
1 parent 5a16df5 commit 5505bf5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mitmproxy-windows/redirector/src/main2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,19 @@ async fn main() -> Result<()> {
}
}
Event::SocketInfo(address) => {
let proto = TransportProtocol::try_from(address.protocol())?;
let connection_id = ConnectionId {
proto,
src: SocketAddr::from((address.local_address(), address.local_port())),
dst: SocketAddr::from((address.remote_address(), address.remote_port())),
};

if address.process_id() == 4 {
// We get some weird operating system events here, which are not useful.
debug!("Skipping PID 4");

clear_connections(
packet.connection_id(),
connection_id,
&mut connections,
&inject_handle,
&mut ipc_tx,
Expand All @@ -248,7 +255,7 @@ async fn main() -> Result<()> {
warn!("Unknown transport protocol: {}", address.protocol());

clear_connections(
packet.connection_id(),
connection_id,
&mut connections,
&inject_handle,
&mut ipc_tx,
Expand All @@ -266,7 +273,7 @@ async fn main() -> Result<()> {
if connection_id.src.ip().is_multicast() || connection_id.dst.ip().is_multicast() {

clear_connections(
packet.connection_id(),
connection_id,
&mut connections,
&inject_handle,
&mut ipc_tx,
Expand Down

0 comments on commit 5505bf5

Please sign in to comment.