linux服務器tcpdump抓http包

tcpdump安裝略過。

1.監聽eth0網卡HTTP 80端口的request和response
tcpdump -i eth0 -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'


2.監聽eth0網卡HTTP 80端口的request(不包括response),指定來源域名"example.com",也可以指定IP"192.168.1.107"
tcpdump -i eth0 -A -s 0 'src example.com and tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'


3.監聽本機發送至本機的HTTP 80端口的request和response
tcpdump -i lo -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'


4.監聽eth0網卡HTTP 80端口的request和response,結果另存爲cap文件
tcpdump -i eth0 -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -w ./dump.cap

注1:如果報錯"tcpdump: Bluetooth link-layer type filtering not implemented",是因爲默認網卡不是ech0,需要用-i參數指定

注2:通過ifconfig命令查看網卡

End;

原文出自:http://blog.csdn.net/daiyudong2020/article/details/71375256

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章