为 tcpdump 编写一个 linux 脚本以停止并再次 运行 但将信息保存在另一个文件中
Writing a linux script for tcpdump for stopping and running again but save the info in another file
我是编写脚本的新手,不确定我为 tcpdump 编写这样的脚本来收集 pcap 信息是否正确。
tcpdump -s 0 port ftp or ssh or http or https -i eth0 -w mycap.pcap
#run the tcpdump and store all the info in mycap.pcap
sudo kill -2 #for exit purpose
这使我能够 运行 tcpdump 这很好,但是,我想停止这个(由于 space for mycap.pcap 满足每个文件 3GB 的最大容量)自动通过相同的脚本和再次 运行 但这次,我将把它存储在另一个文件中(例如 mycap1.pcap)
然后循环再次进行,直到我按 crtl+c
停止该过程
这可以做到吗?
您不需要为此编写脚本。
tcpdump -C <filesize> -s 0 port ftp or ssh or http or https -i eth0 -w mycap.pcap
查看 tcpdump 的手册页。
我是编写脚本的新手,不确定我为 tcpdump 编写这样的脚本来收集 pcap 信息是否正确。
tcpdump -s 0 port ftp or ssh or http or https -i eth0 -w mycap.pcap
#run the tcpdump and store all the info in mycap.pcap
sudo kill -2 #for exit purpose
这使我能够 运行 tcpdump 这很好,但是,我想停止这个(由于 space for mycap.pcap 满足每个文件 3GB 的最大容量)自动通过相同的脚本和再次 运行 但这次,我将把它存储在另一个文件中(例如 mycap1.pcap)
然后循环再次进行,直到我按 crtl+c
停止该过程这可以做到吗?
您不需要为此编写脚本。
tcpdump -C <filesize> -s 0 port ftp or ssh or http or https -i eth0 -w mycap.pcap
查看 tcpdump 的手册页。