当前位置:网站首页>超好用的抓包工具tcpdump
超好用的抓包工具tcpdump
2022-07-23 05:46:00 【hgswnsa】
tcpdump的简单使用
tcpdump是什么?
tcpdump是Linux里的字符界面的数据包抓包分析软件
怎么使用?
首先需要安装
yum install tcpdump -y
我们先来看看它有哪些参数,这些参数通常是用来过滤的
1、option 可选参数
2、proto 类过滤器:根据协议进行过滤
3、direction 类过滤器:根据数据流向进行过滤
4、type 类过滤器:这些词后边需要再接参数
抓取的数据包结构分析
22:29:32.698761 IP 192.168.2.143.53629 > localhost.localdomain.ssh: Flags [P.], seq 37:73, ack 292188, win 4106, length 36
第一列:时间(时分秒毫秒),22:29:32.698761
第二列:网络协议,IP
第三列:发送方的地址,其中 192.168.2.143 是 ip,而 53629 是端口号
第四列:箭头 >, 表示数据流向
第五列:接收方的地址,localhost.localdomain.ssh
第六列:冒号
第七列:数据包内容,包括Flags 标识符,seq 号,ack 号,win 窗口,数据长度 length,其中 [P.] 表示 PUSH 标志位为 1
简单使用
抓取ens33的数据包
tcpdump -i ens33

显示更加详细的信息
tcpdump -i ens33 -vv

显示mac地址
tcpdump -i ens33 -e

根据源mac地址来抓包
tcpdump -i ens33 ether src 00:0c:29:ae:fd:42

根据源ip抓包
需要两台虚拟机配合,虚拟机A去ping,虚拟机B去抓包
虚拟机A的ip为192.168.2.170,虚拟机B的ip为192.168.2.127
虚拟机A: ping 192.168.2.127
虚拟机B: tcpdump -i ens33 icmp and src 192.168.2.170
将数据存入文件并读取
# 将抓包数据存入文件中
tcpdump -i ens33 -w test.pcap icmp and src 192.168.2.170
# 查看文件类型
[[email protected] ~]# file test.pcap
test.pcap: tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 262144)
# 读取文件
tcpdump -r test.pcap

边栏推荐
- 第一类错误离我们有多远
- 大白话说说synchronized关键词的三种用法
- 学习日记——(路由与交换技术)OSPF协议
- Hcip --- BGP --- border gateway protocol
- WebSocket 协议讲解
- HCIP---BGP相关配置(联邦篇)
- Briefly describe the similarities and differences between raft and Paxos in design
- HCIP---条件匹配和OSPF协议
- Common sort -- merge sort (recursive and non recursive) + count sort
- Analyze redis cluster
猜你喜欢
随机推荐
关于如何排查vpn服务器无法转发的问题
以go语言为例类比侦探推理来讲解【性能分析】
【无标题】
比较临时的修改node_modules内包的源码并编译引用 修改依赖包
【读书笔记《凤凰架构》- 构架可靠的大型分布式系统.周志明】(一)
[fee of AUTOSAR (difference between nonvolatile memory flash and EEPROM)]
In depth analysis of replication in redis
C#(CSharp) 微信公众号开发一 基本配置
C #: TOPK: take the largest 100 before 10000 numbers, and sort the heap
How to write a web page with a common text editor
HCIP --- HDLC和PPP协议
第五周作业
Design experience of log file IO system
C (CSharp) wechat official account development - basic configuration
SQL server performance analysis, view slow queries
整数乘以整数溢出了
OSPF的路由策略和流量抓取
unity3d:UGUI源码EventSystem输入系统常见问题
学习日记——(路由与交换技术)OSPF协议
MySQL performance optimization, index optimization









