【kali工具使用】Tcpdump 抓包查看三次握手过程

Tcpdump 抓包查看三次握手过程

tcpdump 常用参数:

-c

指定要抓取的数据包数量

-n 对 IP 地址以数字方式显式,否则显式为主机名

port 指定端口

-I

指定 tcpdump 需要监听的接口。默认会抓取第一个网络接口

tcp

1ClientSYN=1seq=x

2Server SYN=1 seq=y, ack=x+1,

3Client ack=y+1.

在 kali 上登录 x63,抓取 ssh 远程登录 x63 时,产生的 tcp 三次握手包:

┌──(root

x53)-\~

└─# tcpdump -n -c 3 port 22 -i eth0

打开另一个终端,开始建立 tcp 连接:

┌──(root

x53)-\~

└─# ssh 192.168.1.63

The authenticity of host '192.168.1.63 (192.168.1.63)' can't be established.

ED25519 key fingerprint is

SHA256:8kYEhyucVtzLJmSnDKOoYzaheaxjnTFxh36vkiFCGDs.

This key is not known by any other names

Are you sure you want to continue connecting (yes/no/fingerprint)? #到这里就不用执

行了,tcp 已经建立连接

查看数据包:

┌──(root

x)-\~

└─# tcpdump -n -c 3 port 22 -i eth0

tcpdump: verbose output suppressed, use -vv... for full protocol decode

listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes

13:47:56.525038 IP 192.168.1.53.42544 > 192.168.1.63.22: Flags S, seq 2919893900,

win 64240, options mss 1460,sackOK,TS val 2812743846 ecr 0,nop,wscale 7, length 0

13:47:56.525178 IP 192.168.1.63.22 > 192.168.1.53.42544: Flags S., seq 3068407345,

ack 2919893901, win 28960, options [mss 1460,sackOK,TS val 6767151 ecr

2812743846,nop,wscale 7], length 0

13:47:56.525200 IP 192.168.1.53.42544 > 192.168.1.63.22: Flags ., ack 1, win 502,

options nop,nop,TS val 2812743847 ecr 6767151, length 0

注:Flags S 中的 S 表示为 SYN 标志位为 1

client 主机返回 ACK,包序号为 ack=1 ,这是相对序号,如果需要看绝对序号,可以在 tcpdump

命令中加-S

┌──(root

x)-\~

└─# tcpdump -n -c 3 port 22 -i eth0 -S

tcpdump: verbose output suppressed, use -vv... for full protocol decode

listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes

13:56:53.720739 IP 192.168.1.53.42546 > 192.168.1.63.22: Flags S, seq 4191281358,

win 64240, options mss 1460,sackOK,TS val 2813281042 ecr 0,nop,wscale 7, length 0

13:56:53.721168 IP 192.168.1.63.22 > 192.168.1.53.42546: Flags S., seq 4015819851,

ack 4191281359, win 28960, options [mss 1460,sackOK,TS val 7304354 ecr

2813281042,nop,wscale 7], length 0

13:56:53.721187 IP 192.168.1.53.42546 > 192.168.1.63.22: Flags ., ack 4015819852,

win 502, options nop,nop,TS val 2813281043 ecr 7304354, length 0

TCP 三次握手连接状态详解:

TCP 连接状态详解:

服务器端:LISTEN:侦听来自远方的 TCP 端口的连接请求

客户端:SYN-SENT:在发送连接请求后等待匹配的连接请求

服务器端:SYN-RECEIVED:在收到和发送一个连接请求后等待对方对连接请求的确认

客户端/服务器端:ESTABLISHED:代表一个打开的连接

相关推荐
zzzzzz31012 小时前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
大树884 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
小宇宙Zz4 天前
Maven依赖冲突
java·服务器·maven
网络研究院4 天前
2026年网络安全
网络·安全·法律·法规·趋势·发展
酣大智4 天前
ARP代理--工作原理
运维·网络·arp·arp代理
treesforest4 天前
AI安全系统如何识别异常访问?IP风险识别正在成为关键能力
网络·人工智能·tcp/ip·安全·web安全
shushangyun_4 天前
2026年快消品B2B系统推荐:支持终端门店订货、促销政策自动化的工具?
java·运维·网络·数据库·人工智能·spring·自动化
古城小栈4 天前
Unix 与 Linux 异同小叙
linux·服务器·unix
2601_961845154 天前
粉笔行测题库|系统班|刷题
网络·百度·微信·微信公众平台·facebook·新浪微博
零零信安4 天前
零零信安荣登数世咨询《新质·数字安全专精百强(2026)》暗网情报领域,彰显专业实力与创新引领
安全·网络安全·数据泄露·暗网·零零信安