Linux下抓包

安装工具

  • 以 centos 为例,安装 tcpdump 工具
yum install -y tcpdump
  • 执行命令 ip addr show 查看网卡名
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:6a:5f:93 brd ff:ff:ff:ff:ff:ff
    inet 192.168.119.160/24 brd 192.168.119.255 scope global noprefixroute dynamic ens33
       valid_lft 1358sec preferred_lft 1358sec
    inet6 fe80::1646:1c58:ee87:bc13/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
  • 然后可以执行以下命令进行抓包
tcpdump tcp -i ens33 -w ./package.cap
  • 接着我们可以将输出的数据导入到 wireshar 进行查看
posted @ 2020-11-13 13:48  会飞的小黑鱼  阅读(237)  评论(0编辑  收藏  举报