#!/bin/bash
function tcpdump_show(){
for file in `ls $1`
do
if [ -d $1"/"$file ]
then continue
else
if [ $file == "test.sh" ] #脚本名称为test.sh 与pcap放于同一目录
then continue
else
name=$file
txt=${name%.*}
tcpdump -r $name > $txt.txt
fi
fi
done
}
DIR="./"
tcpdump_show $DIR

本文介绍了一段bash脚本,用于自动化处理目录下的所有pcap文件,将其转换为txt格式,便于进一步的数据分析和处理。脚本通过遍历指定目录,跳过子目录和特定脚本文件,然后使用tcpdump工具读取每个pcap文件并导出为txt格式。
2536

被折叠的 条评论
为什么被折叠?



