Created
January 25, 2018 13:20
-
-
Save Tony3-sec/806c6c74006cfb17b66000bdfdc82490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## This script will convert packet caputre file (in current directory) to tcpdump capture format. | |
echo "converting pcap to tcpdump file format...." | |
pcap_exts=$(ls | grep "\.pcap\|\.flow\|\.cap\|\.pcapng") #list of possible pcap files | |
header="converted_" | |
for pcapfile in $pcap_exts | |
do | |
file $pcapfile | grep -v "tcpdump" > /dev/null #check whether or not the file is in tcpdump capture format | |
if [ $? -eq 0 ]; then | |
newfile=$header$pcapfile #create new output filename | |
editcap -F libpcap $pcapfile $newfile #convert the file to tcpdump capture format | |
fi | |
done | |
echo "Complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment