标签:linu 路由 来讲 解释 协议类型 bytes The root flag
? ? 经过前面的学习,tcpdump的用法相信应该都掌握了,今天我们来学习对tcpdump输出内容的学习和了解。我们以第一个示例进行讲解如下所示:
[root@localhost ~]# tcpdump -i ens5f1 -nn -X ‘port 22‘ -c 1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens5f1, link-type EN10MB (Ethernet), capture size 262144 bytes
22:34:11.334916 IP 192.168.8.8.22 > 112.64.61.186.37035: Flags [P.], seq 3341229570:3341229782, ack 1999159071, win 31152, length 212
0x0000: 4510 00fc 7e99 4000 4006 44a8 c0a8 0808 E...~.@.@.D.....
0x0010: 7040 3dba 0016 90ab c727 1e02 7728 bf1f p@=......‘..w(..
0x0020: 5018 79b0 7799 0000 0000 00b0 823d 4cf1 P.y.w........=L.
0x0030: 1108 58fc 3686 2bd2 5220 fe37 85ab 74cc ..X.6.+.R..7..t.
0x0040: bfb1 8831 7d1c 3b57 52ae aa91 28a2 67d8 ...1}.;WR...(.g.
0x0050: 08fb a257 7fc8 7186 39dc d266 3d32 cce8 ...W..q.9..f=2..
0x0060: 3eb7 130b a7d3 833b 59c9 bdf8 2141 6863 >......;Y...!Ahc
0x0070: 7cae 25ff 459e c94a a635 7098 6925 db48 |.%.E..J.5p.i%.H
0x0080: a9b0 32ab 5393 737f cf8c f2ed b47a 7d8b ..2.S.s......z}.
0x0090: 346c 39df 3ecc d2b0 e0ad 5104 272d 6513 4l9.>.....Q.‘-e.
0x00a0: 4b8d 5ee6 6c7d 9477 e40b 8637 996a bb5a K.^.l}.w...7.j.Z
0x00b0: 471a 2ac4 3335 266d 0485 2e52 b2c2 f6e8 G.*.35&m...R....
0x00c0: 0549 5ae0 9c7b ad45 da0a eef2 1ccb b2ac .IZ..{.E........
0x00d0: a4a2 0a96 cc5f 238c 9570 0d15 984e 6f58 ....._#..p...NoX
0x00e0: d8ff 8034 1165 cf44 02e4 ed6b 631e 2548 ...4.e.D...kc.%H
0x00f0: 56fd 4c8a 664c e5ee d845 2e50 V.L.fL...E.P
1 packet captured
1 packet received by filter
0 packets dropped by kernel
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens5f1, link-type EN10MB (Ethernet), capture size 262144 bytes
这里仅仅是提示如果想获取和查看更详细的命令可以尝试添加的参数。
listening on ens5f1, link-type EN10MB (Ethernet), capture size 262144 bytes
tcpdump监听的网络设备接口和链路层类型(以太网)要抓包的大小限制
22:34:11.334916 IP 192.168.8.8.22 > 112.64.61.186.37035: Flags [P.], seq 3341229570:3341229782, ack 1999159071, win 31152, length 212
>
:数据的传输方向 0x0000: 4510 00fc 7e99 4000 4006 44a8 c0a8 0808 E...~.@.@.D.....
0x0010: 7040 3dba 0016 90ab c727 1e02 7728 bf1f p@=......‘..w(..
0x0020: 5018 79b0 7799 0000 0000 00b0 823d 4cf1 P.y.w........=L.
0x0030: 1108 58fc 3686 2bd2 5220 fe37 85ab 74cc ..X.6.+.R..7..t.
0x0040: bfb1 8831 7d1c 3b57 52ae aa91 28a2 67d8 ...1}.;WR...(.g.
0x0050: 08fb a257 7fc8 7186 39dc d266 3d32 cce8 ...W..q.9..f=2..
0x0060: 3eb7 130b a7d3 833b 59c9 bdf8 2141 6863 >......;Y...!Ahc
0x0070: 7cae 25ff 459e c94a a635 7098 6925 db48 |.%.E..J.5p.i%.H
0x0080: a9b0 32ab 5393 737f cf8c f2ed b47a 7d8b ..2.S.s......z}.
0x0090: 346c 39df 3ecc d2b0 e0ad 5104 272d 6513 4l9.>.....Q.‘-e.
0x00a0: 4b8d 5ee6 6c7d 9477 e40b 8637 996a bb5a K.^.l}.w...7.j.Z
0x00b0: 471a 2ac4 3335 266d 0485 2e52 b2c2 f6e8 G.*.35&m...R....
0x00c0: 0549 5ae0 9c7b ad45 da0a eef2 1ccb b2ac .IZ..{.E........
0x00d0: a4a2 0a96 cc5f 238c 9570 0d15 984e 6f58 ....._#..p...NoX
0x00e0: d8ff 8034 1165 cf44 02e4 ed6b 631e 2548 ...4.e.D...kc.%H
0x00f0: 56fd 4c8a 664c e5ee d845 2e50 V.L.fL...E.P
以上这些是IP包的内容,左侧是16进制,右侧是ASCII部分。如果想看到这些具体的数据则需要查看前一期中TCP数据报的格式。
? ? 我们先来抓取一个UDP包,如下所示:
[root@localhost ~]# tcpdump -i ens5f1 -nn -X ‘udp‘ -c 1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens5f1, link-type EN10MB (Ethernet), capture size 262144 bytes
18:18:12.499924 IP 192.168.8.101.137 > 192.168.8.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
0x0000: 4500 004e 31ab 0000 8011 763f c0a8 0865 E..N1.....v?...e
0x0010: c0a8 08ff 0089 0089 003a 1277 ddc1 0110 .........:.w....
0x0020: 0001 0000 0000 0000 2046 4b46 4545 4643 .........FKFEEFC
0x0030: 4e44 4344 4144 4244 4744 4144 4944 4144 NDCDADBDGDADIDAD
0x0040: 4245 4945 4645 4841 4100 0020 0001 BEIEFEHAA.....
1 packet captured
1 packet received by filter
0 packets dropped by kernel
相对于IP包来讲,UDP的包要简单很多,其首部总共就8个字节。而UDP位于传输层,自然前面也增加了IP包相关的头部。
本文同步在微信订阅号上发布,如各位小伙伴们喜欢我的文章,也可以关注我的微信订阅号:woaitest,或扫描下面的二维码添加关注:
标签:linu 路由 来讲 解释 协议类型 bytes The root flag
原文地址:https://www.cnblogs.com/surpassme/p/9404297.html