当前位置:网站首页>FTP protocol
FTP protocol
2022-07-26 16:12:00 【InfoQ】
Working mode :
Passive mode (PASV):
Active mode (PORT):
The data transfer :( Put the concept in front of it )
data structure :
Establish data connection
Data connection management
transmission mode
Flow mode :
Block mode :
Compression mode :
FTP command
1. Access control commands
Return to the upper directory (CDUP)
2. Transfer parameter command
3.FTP The service command
4.FTP Respond to
The meaning of the first digit in the response code :
5. Caught analysis :
Packet capture analysis in passive mode
Packet capture analysis in active mode If active mode is used , So the data transfer port is 20;
If passive mode is used , The specific final port to use needs to be decided by the server and the client through negotiation .Working mode :
Passive mode (PASV):
1、FTP The client uses a random port N( Generally greater than 1024) towards FTP Server's 21 Port send connection request ;
2、ftp After the server main process receives the request , Derive a server-side control process , Establish a control connection with the client control process , Start session ;
3、ftp Client and ftp The server performs user name and password verification and other operations through their respective control processes ;
4、 When ftp When the client wants to initiate data file transmission ,ftp The client control process initiates to the server control process pasv command ;
5、ftp The server control process received pasv After the request , Derived from a data transmission process ,< And inform the client of the port number > Control process , return 227 entering passive mode (h1,h2,h3,h4,p1,p2), Where the port number is p1*256+p2,ip The address is h1.h2.h3.h4;《 The server informs the client 》
6、 ftp After the client control process receives the response , Derived from a client-side data transmission process , along with Client data transmission port , The data transmission port number of the connection server ( That is ip+ Port number ), Then transfer the data file ;
7、 When the data is transferred , The data transmission process of the server returns that the transmission is completed , The data connection channel will be closed , Keep the control connection channel ;
8、 If there is no other file transfer at this time , The control channels will also be closed one after another .
Active mode (PORT):
1、FTP The client uses a random port N( Generally greater than 1024) towards FTP Server's 21 Port send connection request ;
2、ftp After the server main process receives the request , Derive a server-side control process , Establish a control connection with the client control process , Start session ;
3、ftp Client and ftp The server performs user name and password verification and other operations through their respective control processes ;
4、 When ftp When the client wants to initiate data file transmission , The client derives a data transmission process , And connect the data through the client control process port Tell the server to control the process .< The client tells the server >
5、 When ftp After the server receives the request , Derive a server-side data transmission process , Generate a service port number , Then according to the request ftp The port number of the client data transmission program establishes the data transmission connection .
6、ftp After the client receives the response from the server , Transfer data files .
7、 When the data is transferred , The data transmission process of the server returns that the transmission is completed , The data connection channel will be closed , Keep the control connection channel ;
8、 If there is no other file transfer at this time , The control channels will also be closed one after another .
The data transfer :( Put the concept in front of it )
data structure :
To provide different page sizes and related information , Each page will be transmitted with an additional header . The header has the following defined fields :
Head length : The logical length of the header including this byte . The minimum head length is 4.
Page index : Logical page number of the file area . Not the serial number of the transmission , It is the index number that identifies this page .
Data length : Number of logical bytes of data in the page . The minimum data length is 0.
Page type : Identifies the type of page . As follows :
0 = Last page
Used to identify the end of page structure transmission . The header length must be 4, The data length must be 0.
1 = Separate page
This is a common type for individual pages without page related control information . The header length must be 4.
2 = Description page
This type is used to transfer the description information of the whole file
3 = Access control page
This type includes an additional header field that specifies page access information . The head length must be 5.
Optional fields :
Other header fields may be used to provide control information for each page , Such as access control of each page .
All fields are a logical byte . The length of logical bytes is determined by TYPE Command to specify .Data connection management
transmission mode
Flow mode :
Block mode :
Compression mode :
FTP command
1. Access control commands
Some sites may need an account to log in , Other sites are only for special access , Such as storing files .
When you have to fill in the account information in the login process ,PASS The successful response code of the command is 332; If the login process does not require account information ,PASS The successful response code of the command 230; If the account information needs to be given in the subsequent dialog command , The server should be reserved according to the time ( wait for ACCT command ) Or give up the command and return accordingly 332 perhaps 532.、
Return to the upper directory (CDUP)
2. Transfer parameter command
PORT h1,h2,h3,h4,p1,p2
h1 It is the height of Internet host 8 position
3.FTP The service command
get (RETR)—— This command causes the server DTP Send a copy of the file specified by the path to the server at the other end of the data connection
Or user DTP. The status and content of the server file should not be affected .
preservation (STOP)—— This command causes the server DTP Accept the data transmitted through the data connection and store these data as the server
A document of . If the file specified in the path parameter already exists on the server , Then this file will be transferred
Data coverage from . If the specified file does not exist, a new file will be created on the server .
Only save (STOU)
Additional ( Including the creation of )(APPE)
Distribute (ALLO)
restart (REST)—— Specifies the location mark of the file that needs to restart the transfer . This command will not cause file transfer , Just ignore the data before the specified mark point in the file .
Rename start (RNFR)—— Specifies the original pathname of the file to be renamed . It must be followed by ” Rename it to “ command , To specify a new file path .
Rename it to (RNTO)
give up (ABOR)—— This command tells the server to abandon the previous FTP Service commands and related transmitted data .
Delete (DELE)—— Delete the specified file on the server .
Delete directory (RMD)
new directory (MKD)
Print working directory (PWD)
list (LIST)
List of names (NLST)
Site parameters (SITE)—— The server uses this command to provide special services that the system may be helpful for transmission .
System (SYST)—— This command is used to get the type of server-side operating system .
state (STAT)—— This command returns status information in the form of response code through control connection .
help (HELP)
Empty operation (NOOP)—— Do not specify any action , Just ask the server to return OK Respond to .
Delete (DELE)—— Delete the specified file on the server .
Delete directory (RMD)
new directory (MKD)
Print working directory (PWD)
list (LIST)
List of names (NLST)
Site parameters (SITE)—— The server uses this command to provide special services that the system may be helpful for transmission .
System (SYST)—— This command is used to get the type of server-side operating system .
state (STAT)—— This command returns status information in the form of response code through control connection .
help (HELP)
Empty operation (NOOP)—— Do not specify any action , Just ask the server to return OK Respond to .
4.FTP Respond to
The meaning of the first digit in the response code :
1xx: Ready state —— The requested action has been initiated , Before the next new command , Expect a response . This type of response is used to indicate that the command has been accepted .
2xx: Completion status —— The request action was successfully completed . A new request can start .
3xx: In the middle —— The order was accepted , But the request action has not been executed for the time being , Waiting for further information . The user should send another command to specify this information . This response is used in command combinations .
4xx: Temporarily reject status —— The order was not accepted , The request action did not occur . But this error state is temporary , Action can be requested again . The user should return to the beginning of the command queue .
5xx: Permanent rejection status —— Orders are not accepted , The request action will not happen . The user process cannot repeat the same request .
Distinguish which response should belong to 4xx still 5xx One rule of is : See if this command can be unmodified , And in the same user 、 Repeat again in the server state .
The meaning of the second digit in the response code :
x0x: Grammar mistakes —— The command given does not exist 、 Not implemented or redundant .
x1x: Information —— Response to request information , Such as a request for status or help .
x2x: Connect —— About the response of control connection and data connection .
x3x: Authentication and accounts —— Response to login process and account processing .
x4x: Not currently used .
x5x: file system —— The status of the server file system or other file system actions when requesting transmission .5. Caught analysis :
Packet capture analysis in passive mode


Packet capture analysis in active mode

边栏推荐
- 提问征集丨快来向NLLB作者提问啦!(智源Live第24期)
- 初识OpenGL (3)片段着色器(Fragment Shader)
- 国元期货网上开户安全吗?开户办理流程是怎样的?
- 基于sisotool极点配置PI参数及基于Plecs的三相电压源逆变器仿真
- Understanding weight sharing in convolutional neural networks
- Question collection come and ask nllb authors! (Zhiyuan live issue 24)
- 2022年全国最新消防设施操作员(高级消防设施操作员)考试试题及答案
- parker电磁阀D1VW020DNYPZ5
- Google Earth engine - merra-2 m2t1nxlv: 1980 present global pressure, temperature, wind and other data sets
- Google Earth Engine——MERRA-2 M2T1NXAER:1980-2022年气溶胶逐日数据集
猜你喜欢

Re9:读论文 DEAL Inductive Link Prediction for Nodes Having Only Attribute Information

German EMG electric actuator eb800-60ii

spark-streaming状态流之mapWithState

SQL statement -- single line comment and multi line comment

Bugku login2

Bugku login1
![[RCTF2015]EasySQL](/img/68/328ee5cffc8b267b6b0f284eb8db2c.png)
[RCTF2015]EasySQL

基于sisotool极点配置PI参数及基于Plecs的三相电压源逆变器仿真

大型仿人机器人整机构型研究与应用

2022你的安全感是什么?沃尔沃年中问道
随机推荐
基于NoCode构建简历编辑器
Operating system migration practice: deploying MySQL database on openeuler
Vs2019debug mode too laggy can't enter the breakpoint
Is CICC Fortune Securities safe? How long does it take to open an account
Google Earth Engine——MERRA-2 M2T1NXSLV:1980-至今全球压力、温度、风等数据集
Finally, someone explained the red blue confrontation clearly
Sql语句——单行注释与多行注释
tensorboard多个events文件显示紊乱的解决办法
PAT甲级 1047 Student List for Course
[physical simulation] the principle and practice of the simplest shape matching
FTP协议
《From SICP to Lisp》视频回播
SAP ABAP 守护进程的实现方式
一文搞懂│XSS攻击、SQL注入、CSRF攻击、DDOS攻击、DNS劫持
马斯克被曝绿了谷歌创始人:导致挚友二婚破裂,曾下跪求原谅
C # set different text watermarks for each page of word
2022 latest Beijing Construction Safety Officer simulation question bank and answers
2022 test questions and answers for the latest national fire facility operator (senior fire facility operator)
Summary of key knowledge of C language
A coal mine in Yangquan, Shanxi Province, suffered a safety accident that killed one person and was ordered to stop production for rectification