![tcpreplay 输出到 STDOUT?](https://linux22.com/image/47196/tcpreplay%20%E8%BE%93%E5%87%BA%E5%88%B0%20STDOUT%EF%BC%9F.png)
$ tcpreplay tcpdump-2015-01-02-18h-13m.pcap
ERROR: The intf1 option is required
tcpreplay (tcpreplay) - Replay network traffic stored in pcap files
USAGE: tcpreplay [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <pcap_file(s)>
-q, --quiet Quiet mode
-T, --timer=str Select packet timing mode: select, ioport, rdtsc, gtod, nano, abstime
--sleep-accel=num Reduce the amount of time to sleep by specified usec
--rdtsc-clicks=num Specify the RDTSC clicks/usec
-v, --verbose Print decoded packets via tcpdump to STDOUT
-A, --decode=str Arguments passed to tcpdump decoder
-K, --enable-file-cache Enable caching of packets to internal memory
--preload-pcap Preloads packets into RAM before sending
-c, --cachefile=str Split traffic via a tcpprep cache file
-i, --intf1=str Server/primary traffic output interface
-I, --intf2=str Client/secondary traffic output interface
--listnics List available network interfaces and exit$
$ pkg_info | grep tcpreplay
tcpreplay-3.4.4p1 resend network traffic saved by tcpdump
$ uname -a
OpenBSD notebook.lan 5.6 GENERIC.MP#333 amd64
$
由于wireshark太耗资源,我需要在tcpreplay中查看数据包,就像在wireshark中一样。问:我怎样才能做到这一点?
答案1
tcpreplay
是错误的工具。它的工作是生成数据包并将其发送到网络,而不是将其内容显示到标准输出。
如果 Wireshark(包括其命令行实用程序tshark
)被认为对您来说太耗资源,那么可能唯一的其他选择是tcpdump
.请注意,它的数据包解码功能不如 Wireshark 丰富,但是……这些额外的功能使 Wireshark 变得更重。