• 【tshark tcpdump】linux网络排查


    抓包:

    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 '	'
    
    参数含义:
    
        -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,查看哪个进程占用带宽

  • 相关阅读:
    二分查找法
    AES算法工具类
    SHA加密算法工具类
    使用SQL创建唯一索引
    springboot 启动类CommandLineRunner(转载)
    MD5加密算法工具类
    Android 通过Socket 和服务器通讯
    android 网络连接判断
    android 文件上传,中文utf-8编码
    github打不开问题
  • 原文地址:https://www.cnblogs.com/zealousness/p/11168278.html
Copyright © 2020-2023  润新知