windows windows下TCP包截取与重定向

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3508004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:03:33  来源:igfitidea点击:

TCP packet interception and redirection under windows

windowsredirecttcpwindows-firewall

提问by FCPK

I have been trying to find some way of redirecting outbound TCP packets under windows, but so far have not been successful. Does anyone know of any software/code bit that would do something like that? I am not even sure it is possible with the windows stack.

我一直在尝试寻找一些在windows下重定向出站TCP数据包的方法,但到目前为止还没有成功。有谁知道任何软件/代码位可以做这样的事情?我什至不确定 Windows 堆栈是否可行。

I am looking at doing something similar to what "-j REDIRECT" is to iptables.

我正在考虑对 iptables 执行类似于“-j REDIRECT”的操作。

EDIT: to be more precise, what needs to be done here, is to transparently(ie without the original application having to do anything) redirect outgoing tcp packet with a certain destination port to a specific ip.(alternatively redirecting them to a local port would be fine too since I can then just use something like rinetd or any port forwarder)

编辑:更准确地说,这里需要做的是透明地(即原始应用程序无需执行任何操作)将具有特定目标端口的传出 tcp 数据包重定向到特定 ip。(或者将它们重定向到本地端口也可以,因为我可以使用诸如 rinetd 或任何端口转发器之类的东西)

回答by Mohammad Nikravan

see BarbaTunnel here and use its port redirecting

在此处查看 BarbaTunnel 并使用其端口重定向

BarbaTunnel project

巴巴隧道项目

回答by mindiga

Netsh is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running. netsh interface portproxy add v4tov4 listenaddress=localaddress listenport=localport connectaddress=destaddress connectport=destport

Netsh 是一个命令行脚本实用程序,允许您在本地或远程显示或修改当前正在运行的计算机的网络配置。netsh interface portproxy add v4tov4 listenaddress=localaddress listenport=localport connectaddress=destaddress connectport=destport