capture network traffic on two different ports simultaneously

穿精又带淫゛_ 提交于 2019-12-06 00:24:05
taho

Hi, you just need to compose two ports like this:

tcpdump -n -i $INTERFACE port 21 or port 22

where -n will get numerical address without reverse resolving (faster)
and $INTERFACE is real interface where you sniff trafic

I am no tcpdump expert but found this in the tcpdump manpage:

tcpdump 'gateway snup and (port ftp or ftp-data)'

So try this

tcpdump '(port ftp or ftp-data)'

Problem solved it was actually very simple I should have tried it before ..

but thanks I got my idea just by looking at your answers.

I think it is the beauty of stackoverflow if we could find an exact answer , we can invent it through the discussion. ..

 $ tcpdump -X -s0 protochain 50 or 51

Like other contributors said, you can use the and logical operator, but be aware than you can also use it in conjunction with other operators. To ensure that tcpdump sees them, and that the operator precedence is the one you want, use brackets, but only within single quotes, like in this example below: sudo tcpdump -i eth0 '(port 465 or port 587)' and src 1.2.3.4, because if you omit the single quotes, your shell may interpret them before tcpdump does, and b), you will not be certain of what the operator precedence is to one another. Strong of this, you may now do any combination, just like in arithmetic.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!