Skip to content

Instantly share code, notes, and snippets.

@yurenchen000
Created November 29, 2019 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurenchen000/eaa7b3f3ee466a35d6a55952875b757f to your computer and use it in GitHub Desktop.
Save yurenchen000/eaa7b3f3ee466a35d6a55952875b757f to your computer and use it in GitHub Desktop.
wireshark capture on remote host ( through ssh tcpdump )
#!/bin/bash
# ssh root@yurenchen.com "tcpdump -w - -U 'host g.cn'" | sudo wireshark -k -i -
# tcpdump Capture on remote host (by ssh) & Show packets on local wireshark
# $remote Need Capture permission
# $filter is tcpdump capture filter
# example:
# $ wireshark_remote root@10.1.1.2 'host yurenchen.com'
wireshark_remote(){
local remote="$1"
local filter="$2"
ssh $remote "tcpdump -w - -U '$filter'" | wireshark -k -i -
}
[ -n "$1" ] && wireshark_remote $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment