Windows packet forwarding

We are currently running windows on all of our machines due to software limitations.

In this case, we need to forward certain packets that enter the IP and port to another port (the same IP). We have proxy listening software.

This can be done using IPTables on Linux by doing something similar to:

iptables -t nat -I PREROUTING -p udp -d <DSTIP> --dport <DSTPORT> -m u32 --u32 '0>>22& 0x3C@8 =0xFFFFFFFF && 0>>22& 0x3C@12 =0x54536F75 && 0>>22& 0x3C@16 =0x72636520 && 0>>22& 0x3C@20 =0x456E6769 && 0>>22& 0x3C@24 =0x6E652051 && 0>>22& 0x3C@28 =0x75657279' -j REDIRECT --to-port <REDIRECT PORT> 

This works fine on linux and redirects certain packages to our proxy software, however, is it possible to do something like this on windows without having to use a specialized machine in front of our Windows machines?

I was thinking of writing something with pcap.net, but I guess that would have to direct reading from the NIC, not from the windows?

+5
source share
1 answer

From MSDN :

Netsh is a command line scripting utility that allows you, either locally or remotely, to display or modify the network configuration of the computer that is currently running.

You can redirect connections going to any port to another local (or remote) port using the command:

 netsh interface portproxy add v4tov4 listenaddress=localaddress listenport=localport connectaddress=destaddress connectport=destport 

Also, as pointed out in this SO post , netsh is a good replacement for iptabes on Windows.

+3
source

Source: https://habr.com/ru/post/1246083/


All Articles