【发布时间】:2016-10-07 03:35:19
【问题描述】:
我有以下场景
机器 A:(发电机)
我正在机器 A 上使用 tcpreplay 生成流量。
所以生成器脚本会调用如下
tcpreplay --loop=100000 --intf1=eth0 64.pcap
# then I do the above for other pcaps, 128.pcap, 256.pcap etc
机器 B:(监控和处理)
将捕获数据并处理它们,
以下是要包含在接收脚本中的项目。
#calls my capture daemon, should run even before the generator starts
./capture_start # takes some time to process
# Here I need to stop the process (ctrl+c), then it will output file1.dat files
# process the file1.dat
./capture_processing -i file1.dat -o file2.dat # generates file2.dat
# analyze the file2.dat and generate the final result
./capture_analysing file2.dat >> 64.log #similarly for other logs
我可以分别为机器 A 和 B 自动执行上述操作。
但是我如何同步机器 A 和机器 B(即机器 B 启动捕获守护程序,然后机器 A 开始生成,一旦所有数据包到达机器 B 停止并开始处理)。这会持续几个数据包大小的循环。
如何自动执行上述操作以运行多次迭代并返回日志。 欢迎任何建议/cmets。
【问题讨论】:
-
机器A和B是python脚本吗?
-
很抱歉给您带来了困惑。机器 A 和 B 是服务器,它们分别运行用于生成和捕获流量的脚本。我已经编辑了我的问题以明确。谢谢
-
*nix 服务器还是 Windows?
-
*nix 服务器(运行 Ubuntu)
标签: python shell networking scripting automation