Created
June 30, 2021 18:54
-
-
Save mwicat/68b0aba5eb37068ce0c949a39b83049c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| set -o nounset | |
| set -o errexit | |
| iface=any | |
| function show_usage() { | |
| echo "Usage: `basename $0` HOST EXPR" | |
| echo "Example: `basename $0` myarg" | |
| } | |
| while getopts "i:h" opt; do | |
| case "$opt" in | |
| i) iface="$OPTARG" ;; | |
| h) show_usage >&2; exit ;; | |
| esac | |
| done | |
| shift $((OPTIND-1)) | |
| if [ "$#" -ne 2 ]; then | |
| show_usage >&2; exit | |
| fi | |
| host="$1" | |
| expr="$2" | |
| wireshark -k -i <(ssh -l root $host "tcpdump -i $iface -s 0 -U -n -w - \"$expr\"") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment