200415-tcpdump抓取http包

tcpdump抓取https包

安装

tcpdump安装略过。

使用

  1. 监听eth0网卡HTTP 9099端口的request和response

    1
    tcpdump -i eth0 -A -s 0 'tcp port 9099 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
  2. 监听eth0网卡HTTP 9099端口的request(不包括response),指定来源域名”example.com“,也可以指定IP”192.168.1.107”

    1
    tcpdump -i eth0 -A -s 0 'src example.com and tcp port 9099 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
  3. 监听本机发送至本机的HTTP 9099端口的request和response

    1
    tcpdump -i lo -A -s 0 'tcp port 9099 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
  4. 监听eth0网卡HTTP 80端口的request和response,结果另存为cap文件

    1
    tcpdump -i eth0 -A -s 0 'tcp port 9099 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命令查看网卡

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×