当前位置:网站首页>Technology sharing | packet capturing analysis TCP protocol
Technology sharing | packet capturing analysis TCP protocol
2022-07-06 21:18:00 【Hogwarts_ test】
This article is excerpted from the internal textbook of Hogwarts testing and development society
TCP The protocol is in the transport layer , A connection oriented 、 reliable 、 Transport layer communication protocol based on byte stream .
Environmental preparation
Classify interface testing tools , It can be classified as follows :
- Network sniffer tool :tcpdump,wireshark
- Agent tools :fiddler,charles,anyproxyburpsuite,mitmproxy
- Analysis tools :curl,postman,chrome Devtool
Caught analysis TCP agreement
tcpdump
tcpdump Is a The of packets transmitted over a network “ head ” Completely intercepted to provide analysis Tools for . It supports for network layer 、 agreement 、 host 、 Network or port filtering , And provide and、or、not And other logical statements to remove useless information .
Give Way tcpdump Always monitor 443 port , If there is any difference, enter it into log In file
sudo tcpdump port 443 -v -w /tmp/tcp.log
Use this command , Will put the report in the directory /tmp/tcp.log
in .
Common parameters | meaning |
---|---|
port 443 | monitor 443 port |
-v | Output more detailed information |
-w | Write data to log in |
wireshark
wireshark It is also a network sniffing tool , In addition to having tcpdump function , There are more extensions , For example, analysis tools , But in interface testing , The process of capturing packets is often carried out on the server , Servers generally do not provide UI Interface , therefore wireshark Unable to work on server , Can only use tcpdump Grab bag generation log, And then log Import wireshark Use , There is UI Analysis on the client of the interface .
Caught analysis TCP agreement
Grab one http Of get request :
- Search on Baidu mp3
http://www.baidu.com/s?wd=mp3
- use tcpdump Intercept this get request , And generate log
- use wireshark open tcpdump Generated log
Use wireshark see log:
log The first few messages are three handshakes . Because the channel is unreliable , Before sending the data , It is necessary to ensure channel stability , And three handshakes are like the following operations :
- The first handshake : When establishing a connection , The client sends syn package (syn=j) To the server , And enter SYN_SENT state , Wait for server to confirm .
- The second handshake : Server received syn package , Must confirm customer's SYN(ack=j+1), At the same time, I also send a SYN package (seq=k), namely SYN+ACK package , At this time, the server enters SYN_RECV state ;
- The third handshake : Client receives server's SYN+ACK package , Send confirmation package to server ACK(ack=k+1), This package has been sent , Client and server access ESTABLISHED(TCP Successful connection ) state , Complete three handshakes .
After three handshakes , Can further communicate , It looks like this :
At the end of the communication , Four waves are also required :
- First wave : The client sends a... To the server FIN, Request to turn off data transfer .
- Second wave : The server received... From the client FIN, Send a ACK, among ack The value is equal to the FIN+SEQ.
- Third wave : The server sends a... To the client FIN, Tell client application to close .
- Fourth wave : The client receives... From the server FIN, Reply to one ACK To the server . among ack The value is equal to the FIN+SEQ.
Be careful : A request may be divided into multiple packets , So is a data , So in wireshark You'll see a lot of bags .
边栏推荐
- Reference frame generation based on deep learning
- 正则表达式收集
- 代理和反向代理
- Seven original sins of embedded development
- ICML 2022 | Flowformer: 任务通用的线性复杂度Transformer
- El table table - sortable sorting & disordered sorting when decimal and% appear
- JS get array subscript through array content
- R language visualizes the relationship between more than two classification (category) variables, uses mosaic function in VCD package to create mosaic plots, and visualizes the relationship between tw
- Nodejs教程之让我们用 typescript 创建你的第一个 expressjs 应用程序
- Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
猜你喜欢
[in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
Pinduoduo lost the lawsuit, and the case of bargain price difference of 0.9% was sentenced; Wechat internal test, the same mobile phone number can register two account functions; 2022 fields Awards an
No Yum source to install SPuG monitoring
【mysql】游标的基本使用
基于深度学习的参考帧生成
Why do job hopping take more than promotion?
Introduction to the use of SAP Fiori application index tool and SAP Fiori tools
[MySQL] basic use of cursor
OneNote in-depth evaluation: using resources, plug-ins, templates
ICML 2022 | flowformer: task generic linear complexity transformer
随机推荐
In JS, string and array are converted to each other (II) -- the method of converting array into string
对话阿里巴巴副总裁贾扬清:追求大模型,并不是一件坏事
It's almost the new year, and my heart is lazy
R语言可视化两个以上的分类(类别)变量之间的关系、使用vcd包中的Mosaic函数创建马赛克图( Mosaic plots)、分别可视化两个、三个、四个分类变量的关系的马赛克图
js中,字符串和数组互转(一)——字符串转为数组的方法
Yyds dry inventory run kubeedge official example_ Counter demo counter
【深度学习】PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
Regular expression collection
[go][转载]vscode配置完go跑个helloworld例子
防火墙基础之外网服务器区部署和双机热备
document.write()的用法-写入文本——修改样式、位置控制
【滑动窗口】第九届蓝桥杯省赛B组:日志统计
【力扣刷题】32. 最长有效括号
Thinking about agile development
在最长的距离二叉树结点
【mysql】游标的基本使用
【力扣刷题】一维动态规划记录(53零钱兑换、300最长递增子序列、53最大子数组和)
快过年了,心也懒了
Is this the feeling of being spoiled by bytes?
数据湖(八):Iceberg数据存储格式