Skip to content

Instantly share code, notes, and snippets.

@pedrovanzella
Created September 4, 2012 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedrovanzella/3615507 to your computer and use it in GitHub Desktop.
Save pedrovanzella/3615507 to your computer and use it in GitHub Desktop.
strip-capture.sh
#!/bin/bash
print_usage() {
echo "Usage: $0 <essid> </path/to/capture.cap>"
}
hash tshark &> /dev/null
if [ $? -eq 1 ]; then
echo "This script requires 'tshark', but it does not appear to be installed."
echo "Please install 'tshark', (sudo apt-get install tshark) and try again."
exit
fi
if [ -z "$1" ]; then
echo "You must specify an ESSID!"
print_usage
exit
fi
if [ -z "$2" ]; then
echo "You must specify a capture file!"
print_usage
exit
fi
if ! [ -f "$2" ]; then
echo "$2 does not exist!"
print_usage
exit
fi
echo "Stripping file..."
tshark -r "$2" -R "eapol || wlan_mgt.tag.interpretation eq $1 || (wlan.fc.type_subtype==0x08 && wlan_mgt.ssid eq $1)" -w stripped.cap
echo "Done! Wrote stripped file to ./stripped.cap"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment