Created
July 31, 2011 16:37
-
-
Save tehmaze/1116940 to your computer and use it in GitHub Desktop.
tcpdump for VMWare Fusion
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 | |
if echo ${1} | grep -q '^vmnet[0-9]$'; then | |
ERRCOUNT='0' | |
PIDSNIFF='0' | |
PIDTDUMP='0' | |
CAPINTF="${1}" | |
CAPFILE="$(mktemp -t capture)" | |
trap "rm -rf \"${CAPFILE}\"" EXIT TERM INT | |
shift | |
if rm -f "${CAPFILE}"; then | |
if mkfifo "${CAPFILE}"; then | |
/Library/Application\ Support/VMware\ Fusion/vmnet-sniffer \ | |
-w "${CAPFILE}" "${CAPINTF}" >/dev/null || let ERRCOUNT++ & | |
tcpdump -r "${CAPFILE}" ${*} || let ERRCOUNT++ & | |
wait | |
else | |
let ERRCOUNT++ | |
fi | |
else | |
let ERRCOUNT++ | |
fi | |
else | |
let ERRCOUNT++ | |
echo "usage: $(basename ${0}) <vmnet interface> [tcpdump options]" | |
fi | |
exit "${ERRCOUNT}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment