by psophis · 7y ago · 0 comments
ssh root@sniff_server_ip -p port tcpdump -U -s0 'not port 22' -i eth0 -w - | wireshark -k -i -
Source: https://serverfault.com/questions/362529/how-can-i-sniff-the...It works very well on low volume captures.
wirelive.sh:
#!/bin/bash
if [[ -z "$1" ]]; then
echo -e "Usage: $(basename $0) <host[:port]> <interface> [filters]"
exit
fi
ssh_host=$(echo $1 | cut -d: -f1)
ssh_port=$(echo $1 | cut -s -d: -f2)
[[ -z "$ssh_port" ]] && ssh_port=22
[[ -z "$2" ]] && tcpdump_interface="any" || tcpdump_interface="$2"
[[ ! -z "$3" ]] && tcpdump_filters="and \($3\)"
ssh root@${ssh_host} -p ${ssh_port} \
tcpdump -U -s0 "not port ${ssh_port} ${tcpdump_filters}" -i ${tcpdump_interface} -w - \
| wireshark -k -i -BTW, for anyone new to tcpdump, you can also specify selectors/filtering on the command line, to reduce the traffic. The filtering in Wireshark is on top of that.
It's one of best guarded secrets in gaming industry.
ssh root@remotehost "tcpdump -i eth1 -s0 -l -w - 'udp'" | /mnt/c/Program\ Files/Wireshark/Wireshark.exe -k -i -- On Linux, flush buffer at wrong places, breaking last (few) packet(s);
- On Windows, flush buffer after every byte (which gives acceptable result, but is very inefficient).
With "-w", always use "-U" instead.
[0] https://openwrt.org/docs/guide-user/firewall/misc/tcpdump_wi...