准备好工具:
Wireshark
Telnet
ping
目标网站:www.baidu.com
开始:
通过ping获取ip地址
PS D:\桌面> ping www.baidu.com
正在 Ping www.a.shifen.com [183.2.172.42] 具有 32 字节的数据:
来自 183.2.172.42 的回复: 字节=32 时间=22ms TTL=51
来自 183.2.172.42 的回复: 字节=32 时间=21ms TTL=51
来自 183.2.172.42 的回复: 字节=32 时间=23ms TTL=51
开始设置Wireshark的过滤设置:
ip.addr == 183.2.172.42 and tcp
开始使用Telnet连接www.baidu.com,进行http连接!
#先连接
PS D:\桌面> telnet www.baidu.com 80
#按下ctrl+],进入控制模式,按下回车输入
GET /index.html HTTP/1.1
Host: www.baidu.com
#得到下面的回复
HTTP/1.1 302 Found
Bdpagetype: 3
Content-Length: 154
Content-Type: text/html
Date: Sat, 11 May 2024 07:53:01 GMT
Location: https://www.baidu.com/search/error.html
Server: BWS/1.1
Set-Cookie: BDSVRTM=0; path=/
Traceid: 1715413981153071309816512077002893694531
X-Ua-Compatible: IE=Edge,chrome=1
X-Xss-Protection: 1;mode=block
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
#继续按下ctrl+],输入close就可以关闭连接,成功完成四次挥手
成功抓包: