Created
March 15, 2022 06:28
-
-
Save dreness/3879922517d6403e7f0e6b76be1a4275 to your computer and use it in GitHub Desktop.
run tcpdump to capture chrome activity
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/zsh | |
# This script uses apple-specific features of tcpdump | |
INT=en0 | |
PIDS=($(pgrep Chrome | tr '\n' ' ')) | |
PID_FILTER=$(echo pid=${(j: or pid=:)PIDS}) | |
FILTER="-Q \"$(echo -n "if=${INT} and ("${PID_FILTER}))\"" | |
OUT=$(mktemp) | |
CMD="/usr/bin/sudo /usr/sbin/tcpdump -i pktap,${INT} -s0 -w ${OUT} -nk ${FILTER}" | |
echo "Capturing to ${OUT} with command:\n${CMD}" | |
eval ${CMD} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment