-
Type:
Suggestion
-
Resolution: Won't Fix
-
Component/s: None
sudo tcpdump -i `netstat -nr |grep -E '(^[dD]efault|^0\.0\.0\.0)'|sed 's/.* //g'` -nn src net 104.192.143.0/24 and tcp[13]=18
tcpdump: syntax error
Apparently because, in my case, netstat returns multiple interfaces (adding head -1 or tail -1 fixes it). But it seems it could be replaced with the word 'any' in linux 2.2+
man tcpdump # excerpt :
On Linux systems with 2.2 or later kernels, an interface argument of ``any'' can be used to capture
packets from all interfaces. Note that captures on the ``any'' device will not be done in promiscuous
mode.
tcpdump --version
tcpdump version 4.7.4
libpcap version 1.7.4
OpenSSL 1.0.2g 1 Mar 2016
netstat --version
net-tools 1.60
netstat 1.42 (2001-04-15)
Fred Baumgarten, Alan Cox, Bernd Eckenfels, Phil Blundell, Tuan Hoang and others
+NEW_ADDRT +RTF_IRTT +RTF_REJECT +FW_MASQUERADE +I18N
AF: (inet) +UNIX +INET +INET6 +IPX +AX25 +NETROM +X25 +ATALK +ECONET +ROSE
HW: +ETHER +ARC +SLIP +PPP +TUNNEL -TR +AX25 +NETROM +X25 +FR +ROSE +ASH +SIT +FDDI +HIPPI +HDLC/LAPB +EUI64
uname -s -r -v -o
Linux 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
I suggest this alteration to the document :
sudo tcpdump -i $( [ $( uname -r ) \> '2.2' ] && echo 'any' || netstat -nr | grep -E '(^[dD]efault|^0\.0\.0\.0)' | sed 's/.* //g' ) -nn src net 104.192.143.0/24 and tcp[13]=18 # determine the MSS value received from BitBucket