TCPreplay 拆分报文回放脚本
#!/bin/bash
for arg in $*
do
if [ -f "$arg" ];
then
if [ ! -f "$arg.cache" ];
then
echo "--------step 0: generating cache file---------";
echo "source file: $arg ==> dest file: $arg.cache";
tcpprep -a client -i $arg -o $arg.cache
fi
echo "-------step 1: replay pcap -------";
echo "tcpreplay -i eth1 -p 10000 -I eth2 -c $arg.cache $arg"
tcpreplay -i eth1 -p 10000 -I eth2 -c $arg.cache $arg
else
echo "-------error---cannot find $arg!!"
fi
done