Tcpdump -w 将乱码写入文件
Tcpdump with -w writing gibberish to file
尝试将 tcpdump 输出捕获到文件时,我得到以下信息:
▒ò▒▒▒▒3▒X▒▒<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒X▒▒<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒X▒▒<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒X▒<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒徐<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒X▒<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒X▒D<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒X▒D<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒X5▒<<▒▒▒▒▒▒▒4▒4▒b
7
7▒▒3▒X▒<<▒▒▒▒▒▒▒4▒4▒b
如果我 运行 tcpdump 没有 -w 输出在 shell.
中显示正常
这是输入:
tcpdump -i eth0 -Z root -w `date '+%m-%d-%y.%T.pcap'`
tcpdump -w
写的是原始文件,不是直接读的。您可以按照手册页中的建议使用 tcpdump -r
选项读取文件:
-r Read packets from file (which was created with the -w option). Standard input is used if file is ‘‘-’’.
-w Write the raw packets to file rather than parsing and printing them out. They can later be printed with the -r option. Standard output is used if file is ‘‘-’’. See pcap-savefile(5) for a description of the file format.
另一种选择是在不使用 -w 选项的情况下重定向输出:
tcpdump -i eth0 -Z root > `date '+%m-%d-%y.%T.pcap'`
但是,如果我没记错的话,您不会确切地知道使用 -w
选项会写什么。
尝试将 tcpdump 输出捕获到文件时,我得到以下信息:
▒ò▒▒▒▒3▒X▒▒<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒X▒▒<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒X▒▒<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒X▒<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒徐<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒X▒<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒X▒D<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒X▒D<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒X5▒<<▒▒▒▒▒▒▒4▒4▒b 7 7▒▒3▒X▒<<▒▒▒▒▒▒▒4▒4▒b
如果我 运行 tcpdump 没有 -w 输出在 shell.
中显示正常这是输入:
tcpdump -i eth0 -Z root -w `date '+%m-%d-%y.%T.pcap'`
tcpdump -w
写的是原始文件,不是直接读的。您可以按照手册页中的建议使用 tcpdump -r
选项读取文件:
-r Read packets from file (which was created with the -w option). Standard input is used if file is ‘‘-’’.
-w Write the raw packets to file rather than parsing and printing them out. They can later be printed with the -r option. Standard output is used if file is ‘‘-’’. See pcap-savefile(5) for a description of the file format.
另一种选择是在不使用 -w 选项的情况下重定向输出:
tcpdump -i eth0 -Z root > `date '+%m-%d-%y.%T.pcap'`
但是,如果我没记错的话,您不会确切地知道使用 -w
选项会写什么。