Skip to content

Instantly share code, notes, and snippets.

@korc
Created February 16, 2017 13:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korc/30760df61d501ebe67be60a1274293be to your computer and use it in GitHub Desktop.
Save korc/30760df61d501ebe67be60a1274293be to your computer and use it in GitHub Desktop.
Convert $SSH_CONNECTION to pcap filter
#!/bin/sh
test -n "$SSH_CONNECTION" || {
echo "No SSH_CONNECTION defined." >&2
echo "Example usage: ssh host dumpcap -P -i eth0 -f '\"not \$(${0##*/})\"' -w - | wireshark -k -i -" >&2
exit 1
}
read h1 p1 h2 p2 <<EOF
$SSH_CONNECTION
EOF
echo "((host $h1 and port $p1) and (host $h2 and port $p2))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment