Skip to content

Commit

Permalink
Exclude multicast and broadcast on WinDivert's filter (#146)
Browse files Browse the repository at this point in the history
* Filter out multicast and broadcast on WinDivert

* Exclude loopback in WinDivert filter

* Exclude multicast on WinDivert

* Restore socket operations filter, and update network filter to exclude ipv6 multicast

---------

Co-authored-by: Osher Jacob <[email protected]>
Co-authored-by: Nicolai Moore <[email protected]>
  • Loading branch information
3 people authored Nov 6, 2024
1 parent f6b796f commit 05d1b28
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mitmproxy-windows/redirector/src/main2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ async fn main() -> Result<()> {
1041,
WinDivertFlags::new().set_recv_only().set_sniff(),
)?;
let network_handle = WinDivert::network("tcp || udp", 1040, WinDivertFlags::new())?;
// WinDivert's syntax supports IP ranges (https://github.com/basil00/Divert/issues/250#issuecomment-723515347)
let wd_net_filter = "!loopback && ((ip && remoteAddr < 224.0.0.0) || (ip6 && remoteAddr < ff00::)) && (tcp || udp)";
let network_handle = WinDivert::network(wd_net_filter, 1040, WinDivertFlags::new())?;
let inject_handle = WinDivert::network("false", 1039, WinDivertFlags::new().set_send_only())?;

let tx_clone = event_tx.clone();
Expand Down

0 comments on commit 05d1b28

Please sign in to comment.