0

有人知道 Win32 上的 CPAN 模块可以捕获网络数据包并即时编辑它们吗?据我所知,Win32 上唯一能即时处理数据包的 Perl 模块是Net::Pcap,但它只支持被动监控,不影响 TCP/IP 堆栈。

是否有这样的模块有人可以提供示例 /reference /documentation 吗?

4

3 回答 3

2

据我所知,libpcap 允许您读取传入和传出数据包的副本,并且某些实现允许您注入原始数据包,但不能重写数据包。您基本上必须丢弃原始数据包(libpcap 无法做到),然后在其位置注入一个新数据包。

允许您过滤传入和传出数据包的防火墙应用程序可能能够执行此类操作。但是,由于您谈论的是 Perl 和 Win32,因此您的选择可能有限。

于 2009-12-07T18:52:25.290 回答
0

I think right answer is "implement proxy for this".

If it works in your scenario, try to implement proxy server. Listen on same port as your target service does and read all incoming traffic. If you need modification of packet, do it and pass all traffic to target service. Of course you have to implement both directions.

You can search for basic TCP deamon snippet in perl or maybe you can implement just module for existing proxy server for your service. Is it HTTP or what kind of traffic you need to handle?

于 2009-12-21T13:39:56.647 回答
0

我建议使用 Net::Pcap 捕获流量,然后使用 TCPReplay 的 Cygwin 端口修改和重放流量。显然,Linux 设置会更可靠,因为 TCPreplay 可以开箱即用,无需 cygwin。

于 2010-01-19T15:31:33.653 回答