Skip to content

Instantly share code, notes, and snippets.

@jatrost
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save jatrost/f2ba855578b3ae5772d5 to your computer and use it in GitHub Desktop.

Select an option

Save jatrost/f2ba855578b3ae5772d5 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$2" ] ; then
echo "Usage: $0 <input> <output> [start-offset]"
exit 1
fi
START=$3
if [ -z "$3" ] ; then
START="yesterday"
fi
TIMESTAMP=`tcpdump -tttt -nnNN -r "$1" -c1 2> /dev/null | awk '{print $1, $2}'`
DIFF=$[ $(date -d "$START" +%s) - $(date -d "$TIMESTAMP" +%s)]
editcap -t $DIFF $1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment