如何使用StreamDivert将网络流量重定向到其他目的地址
关于StreamDivert
StreamDivert是一款中间人工具和网络流量转发工具,该工具可以针对目标系统中的进出网络流量执行分析和重定向操作,并且能够将TCP、UDP和ICMP流量转发至其他的目标地址。比如说,StreamDivert可以将所有传入的SMB连接转发到另一台服务器的445端口上,或者仅将指定传入的SMB连接从给定的源IP地址集转发至其他服务器。
StreamDivert功能介绍
将所有到特定端口的传入连接中继到另一个目标;
将从特定源IP到端口的传入连接中继到另一个目标;
将传入连接中继到SOCKS(4/5)服务器;
将所有到特定端口的传出连接中继到另一个目标;
将传出连接中继到特定IP和端口的另一个目标上;
通过IPv4和IPv6处理TCP、UDP和ICMP流量;
强制通过特定网络接口重定向数据包;
工具下载&安装
广大研究人员可以访问该项目的Releases页面下载并获取StreamDivert的最新版本预编译源码。
或者,也可以使用下列命令将该项目源码克隆至本地:
git clone https://github.com/jellever/StreamDivert.git
工具使用
我们可以直接以管理员权限并运行下列命令来执行StreamDivert
streamdivert.exe config_file [-f] [-v]
StreamDivert所提供的配置文件中包含了我们需要处理和分流的条目信息,下面给出的是config配置文件的参考样例
//Divert all inbound TCP connections to port 445 (SMB) coming from 10.0.1.50 to 10.0.1.49 port 445
tcp < 445 10.0.1.50 -> 10.0.1.49 445
//Divert all inbound TCP connections to port 445 (SMB) coming from 10.0.1.51 to a local SOCKS server
tcp < 445 10.0.1.51 -> socks
//Divert all inbound TCP connections to port 445 (SMB) coming from fe80::f477:846a:775d:d37 to fe80::20c:29ff:fe6f:88ff port 445
tcp < 445 fe80::f477:846a:775d:d37 -> fe80::20c:29ff:fe6f:88ff 445
//Divert all inbound TCP connections to port 445 (SMB) to 10.0.1.48 port 445
tcp < 445 0.0.0.0 -> 10.0.1.48 445
//Divert all inbound UDP connections to to port 53 (DNS) to 10.0.1.49 port 53
udp < 53 0.0.0.0 -> 10.0.1.49 53
//Divert all inbound ICMP packets coming from 10.0.1.50 to 10.0.1.49
icmp < 10.0.1.50 -> 10.0.1.49
//Divert all outbound TCP connections to 10.0.1.50, port 80 to 10.0.1.49 port 8080
tcp > 10.0.1.50 80 -> 10.0.1.49 8080
//Send all packets going to 10.0.1.50 port 80 and prefer interface 9 to send them. If the interface does not exist or is not up, the packets are send from the default interface.
tcp > 10.0.1.50 80 -> 10.0.1.50 80 interface 9
//Force all packets going to 10.0.1.50 port 80 over interface 9, or drop the packets if the interface does not exist or is not up.
tcp > 10.0.1.50 80 -> 10.0.1.50 80 force interface 9
//Divert all outbound UDP connection to port 53 (DNS) to 10.0.1.49 port 53
udp > 0.0.0.0 53 -> 10.0.1.49 53
其中的[f]参数将会修改Windows防火墙,并将某个应用程序设置为例外,以正确地将传入流量重定向到另一个端口。[-v]参数可以控制日志记录的详细程度。如果提供,StreamDivert将记录有关重定向数据包和数据流的详细信息。
StreamDivert使用场景
将出站C&C流量转移到本地Socket以进行动态恶意软件分析;
将受感染主机的所有入站SMB连接转发至Responder/ ntlmrelayx(在渗透测试中很有用);
通过保留端口路由流量,当网络防火墙介于两者之间时有用。比如说,通过端口445路由Meterpreter Shell流量,或通过端口3389运行一台SOCKS服务器等等;
项目地址
https://github.com/jellever/StreamDivert
参考资料
https://github.com/jellever/StreamDivert/releases
相关文章
- 在 Go 里用 CGO?这 7 个问题你要关注!
- 9款优秀的去中心化通讯软件 Matrix 的客户端
- 求职数据分析,项目经验该怎么写
- 在OKR中,我看到了数据驱动业务的未来
- 火山引擎云原生大数据在金融行业的实践
- OpenHarmony富设备移植指南(二)—从postmarketOS获取移植资源
- 《数据成熟度指数》报告:64%的企业领袖认为大多数员工“不懂数据”
- OpenHarmony 小型系统兼容性测试指南
- 肯睿中国(Cloudera):2023年企业数字战略三大趋势预测
- 适用于 Linux 的十大命令行游戏
- GNOME 截图工具的新旧截图方式
- System76 即将推出的 COSMIC 桌面正在酝酿大变化
- 2GB 内存 8GB 存储即可流畅运行,Windows 11 极致精简版系统 Tiny11 发布
- 迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
- loongarch架构介绍(三)—地址翻译
- Go 语言怎么解决编译器错误“err is shadowed during return”?
- 敏捷:可能被开发人员遗忘的部分
- Denodo预测2023年数据管理和分析的未来
- 利用数据推动可持续发展
- 在 Vue3 中实现 React 原生 Hooks(useState、useEffect),深入理解 React Hooks 的