You need to enable JavaScript to run this app.
导航

网络抓包(tcpdump)

最近更新时间2024.04.17 16:11:39

首次发布时间2024.04.17 16:11:39

您可以通过 tcpdump 命令捕获和分析网络流量。

注意事项

  • 该命令仅供内部使用,安装包下载地址请参见:
    • Linux
    • Windows
    • macOS
  • 执行该命令前您需要安装 libpcap.so.0.8 依赖包,否则会导致命令无法正常使用。

命令语法

  • 获取所有网卡
./tosutil tcpdump [-sdt=xxx]
  • 抓取制定网卡的包
./tosutil tcpdump device [-o=xxx] [-bpf=xxx] [-t=1]

参数说明

参数名

参数类型

描述

device

String

目标网卡名。

-sdt

String

根据指定的设备 IP 地址类型显示设备列表。取值如下:

  • all
  • ip
  • ipv4
  • ipv6

默认为 all

-o

String

执行 tcpdump 命令时存储执行结果的本地文件路径。

-bpf

String

执行 tcpdump 命令时指定的 BPF 过滤表达式。

-t

String

tcpdump 命令的最大执行时间,单位:秒。

使用示例

  • 命令
./tosutil tcpdump
  • 返回
interface 1: eth0
 - ip: 192.168.2.158, mask: ffffff00, broad addr: 192.168.2.255
 - ip: fe80::216:3eff:fe14:78b9

interface 2: nflog

interface 3: nfqueue

interface 4: usbmon1

interface 5: usbmon2

interface 6: usbmon3

interface 7: usbmon4

interface 8: any

interface 9: lo
 - ip: 127.0.0.1
 - ip: ::1