抓包:

1、tcpdump

 

2、tshark是wireshark的命令行版。

tshark使用示例:

1,实时打印当前http请求的url

# tshark -s 512 -i eth0 -n -f 'tcp dst port 80' -R 'http.host and http.request.uri' -T fields -e http.host -e http.request.uri -l | tr -d '\t'

参数含义:

    -s 512 :只抓取前512个字节数据
    -i eth0 :捕获eth0网卡
    -n :禁止网络对象名称解析
    -f 'tcp dst port 80' :只捕捉协议为tcp,目的端口为80的数据包
    -R 'http.host and http.request.uri' :过滤出http.host和http.request.uri
    -T fields -e http.host -e http.request.uri :打印http.host和http.request.uri
    -l :输出到标准输出

2、实时打印当前mysql查询语句

# tshark -s 512 -i eth0 -n -f 'tcp dst port 3306' -R 'mysql.query' -T fields -e mysql.query

参数含义:

    -s 512 :只抓取前512个字节数据
    -i eth0 :捕获eth0网卡
    -n :禁止网络对象名称解析
    -f 'tcp dst port 3306' :只捕捉协议为tcp,目的端口为3306的数据包
    -R 'mysql.query' :过滤出mysql.query
    -T fields -e mysql.query :打印mysql查询语句
tshark -f 'tcp dst port 6443'

 

 

3、查看网络流量 iftop

iftop,查看哪个进程占用带宽

相关文章:

  • 2021-11-06
  • 2022-01-05
  • 2022-12-23
  • 2021-12-27
  • 2021-07-08
  • 2021-11-30
  • 2021-04-23
猜你喜欢
  • 2021-10-23
  • 2022-12-23
  • 2021-07-29
  • 2021-12-24
  • 2021-05-22
  • 2021-11-20
相关资源
相似解决方案