23 FtpLayer(
const std::string& command,
const std::string& option)
86 ABOR = (
'A') | (
'B' << 8) | (
'O' << 16) | (
'R' << 24),
88 ACCT = (
'A') | (
'C' << 8) | (
'C' << 16) | (
'T' << 24),
90 ADAT = (
'A') | (
'D' << 8) | (
'A' << 16) | (
'T' << 24),
92 ALLO = (
'A') | (
'L' << 8) | (
'L' << 16) | (
'O' << 24),
94 APPE = (
'A') | (
'P' << 8) | (
'P' << 16) | (
'E' << 24),
96 AUTH = (
'A') | (
'U' << 8) | (
'T' << 16) | (
'H' << 24),
98 AVBL = (
'A') | (
'V' << 8) | (
'B' << 16) | (
'L' << 24),
100 CCC = (
'C') | (
'C' << 8) | (
'C' << 16),
102 CDUP = (
'C') | (
'D' << 8) | (
'U' << 16) | (
'P' << 24),
104 CONF = (
'C') | (
'O' << 8) | (
'N' << 16) | (
'F' << 24),
106 CSID = (
'C') | (
'S' << 8) | (
'I' << 16) | (
'D' << 24),
108 CWD = (
'C') | (
'W' << 8) | (
'D' << 16),
110 DELE = (
'D') | (
'E' << 8) | (
'L' << 16) | (
'E' << 24),
112 DSIZ = (
'D') | (
'S' << 8) | (
'I' << 16) | (
'Z' << 24),
114 ENC = (
'E') | (
'N' << 8) | (
'C' << 16),
116 EPRT = (
'E') | (
'P' << 8) | (
'R' << 16) | (
'T' << 24),
118 EPSV = (
'E') | (
'P' << 8) | (
'S' << 16) | (
'V' << 24),
120 FEAT = (
'F') | (
'E' << 8) | (
'A' << 16) | (
'T' << 24),
122 HELP = (
'H') | (
'E' << 8) | (
'L' << 16) | (
'P' << 24),
124 HOST = (
'H') | (
'O' << 8) | (
'S' << 16) | (
'T' << 24),
126 LANG = (
'L') | (
'A' << 8) | (
'N' << 16) | (
'G' << 24),
129 LIST = (
'L') | (
'I' << 8) | (
'S' << 16) | (
'T' << 24),
131 LPRT = (
'L') | (
'P' << 8) | (
'R' << 16) | (
'T' << 24),
133 LPSV = (
'L') | (
'P' << 8) | (
'S' << 16) | (
'V' << 24),
135 MDTM = (
'M') | (
'D' << 8) | (
'T' << 16) | (
'M' << 24),
137 MFCT = (
'M') | (
'F' << 8) | (
'C' << 16) | (
'T' << 24),
139 MFF = (
'M') | (
'F' << 8) | (
'F' << 16),
141 MFMT = (
'M') | (
'F' << 8) | (
'M' << 16) | (
'T' << 24),
143 MIC = (
'M') | (
'I' << 8) | (
'C' << 16),
145 MKD = (
'M') | (
'K' << 8) | (
'D' << 16),
147 MLSD = (
'M') | (
'L' << 8) | (
'S' << 16) | (
'D' << 24),
150 MLST = (
'M') | (
'L' << 8) | (
'S' << 16) | (
'T' << 24),
152 MODE = (
'M') | (
'O' << 8) | (
'D' << 16) | (
'E' << 24),
154 NLST = (
'N') | (
'L' << 8) | (
'S' << 16) | (
'T' << 24),
156 NOOP = (
'N') | (
'O' << 8) | (
'O' << 16) | (
'P' << 24),
158 OPTS = (
'O') | (
'P' << 8) | (
'T' << 16) | (
'S' << 24),
160 PASS = (
'P') | (
'A' << 8) | (
'S' << 16) | (
'S' << 24),
162 PASV = (
'P') | (
'A' << 8) | (
'S' << 16) | (
'V' << 24),
164 PBSZ = (
'P') | (
'B' << 8) | (
'S' << 16) | (
'Z' << 24),
166 PORT = (
'P') | (
'O' << 8) | (
'R' << 16) | (
'T' << 24),
168 PROT = (
'P') | (
'R' << 8) | (
'O' << 16) | (
'T' << 24),
170 PWD = (
'P') | (
'W' << 8) | (
'D' << 16),
172 QUIT = (
'Q') | (
'U' << 8) | (
'I' << 16) | (
'T' << 24),
174 REIN = (
'R') | (
'E' << 8) | (
'I' << 16) | (
'N' << 24),
176 REST = (
'R') | (
'E' << 8) | (
'S' << 16) | (
'T' << 24),
178 RETR = (
'R') | (
'E' << 8) | (
'T' << 16) | (
'R' << 24),
180 RMD = (
'R') | (
'M' << 8) | (
'D' << 16),
182 RMDA = (
'R') | (
'M' << 8) | (
'D' << 16) | (
'A' << 24),
184 RNFR = (
'R') | (
'N' << 8) | (
'F' << 16) | (
'R' << 24),
186 RNTO = (
'R') | (
'N' << 8) | (
'T' << 16) | (
'O' << 24),
189 SITE = (
'S') | (
'I' << 8) | (
'T' << 16) | (
'E' << 24),
191 SIZE = (
'S') | (
'I' << 8) | (
'Z' << 16) | (
'E' << 24),
193 SMNT = (
'S') | (
'M' << 8) | (
'N' << 16) | (
'T' << 24),
196 SPSV = (
'S') | (
'P' << 8) | (
'S' << 16) | (
'V' << 24),
198 STAT = (
'S') | (
'T' << 8) | (
'A' << 16) | (
'T' << 24),
200 STOR = (
'S') | (
'T' << 8) | (
'O' << 16) | (
'R' << 24),
202 STOU = (
'S') | (
'T' << 8) | (
'O' << 16) | (
'U' << 24),
204 STRU = (
'S') | (
'T' << 8) | (
'R' << 16) | (
'U' << 24),
206 SYST = (
'S') | (
'Y' << 8) | (
'S' << 16) | (
'T' << 24),
208 THMB = (
'T') | (
'H' << 8) | (
'M' << 16) | (
'B' << 24),
210 TYPE = (
'T') | (
'Y' << 8) | (
'P' << 16) | (
'E' << 24),
212 USER = (
'U') | (
'S' << 8) | (
'E' << 16) | (
'R' << 24),
214 XCUP = (
'X') | (
'C' << 8) | (
'U' << 16) | (
'P' << 24),
216 XMKD = (
'X') | (
'M' << 8) | (
'K' << 16) | (
'D' << 24),
218 XPWD = (
'X') | (
'P' << 8) | (
'W' << 16) | (
'D' << 24),
220 XRCP = (
'X') | (
'R' << 8) | (
'C' << 16) | (
'P' << 24),
222 XRMD = (
'X') | (
'R' << 8) | (
'M' << 16) | (
'D' << 24),
224 XRSQ = (
'X') | (
'R' << 8) | (
'S' << 16) | (
'Q' << 24),
226 XSEM = (
'X') | (
'S' << 8) | (
'E' << 16) | (
'M' << 24),
228 XSEN = (
'X') | (
'S' << 8) | (
'E' << 16) | (
'N' << 24)
238 :
FtpLayer(data, dataLen, prevLayer, packet) {};
437 :
FtpLayer(data, dataLen, prevLayer, packet) {};
445 :
FtpLayer(std::to_string(int(code)), option) {};
Definition: FtpLayer.h:499
FtpDataLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: FtpLayer.h:507
std::string toString() const
Definition: FtpLayer.h:19
static bool isFtpDataPort(uint16_t port)
Definition: FtpLayer.h:40
void parseNextLayer()
FTP is the always last so does nothing for this layer.
Definition: FtpLayer.h:48
OsiModelLayer getOsiModelLayer() const
Definition: FtpLayer.h:66
static bool isFtpPort(uint16_t port)
Definition: FtpLayer.h:31
void computeCalculateFields()
Does nothing for this layer.
Definition: FtpLayer.h:60
size_t getHeaderLen() const
Definition: FtpLayer.h:54
Definition: FtpLayer.h:76
bool setCommandOption(const std::string &value)
static std::string getCommandAsString(FtpCommand code)
std::string toString() const
FtpRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: FtpLayer.h:237
FtpRequestLayer(const FtpCommand &command, const std::string &option="")
Definition: FtpLayer.h:245
FtpCommand getCommand() const
std::string getCommandOption(bool removeEscapeCharacters=true) const
FtpCommand
Definition: FtpLayer.h:82
@ APPE
Append (with create)
@ ALLO
Allocate sufficient disk space to receive a file.
@ PWD
Print working directory. Returns the current directory of the host.
@ AVBL
Get the available space.
@ MFCT
Modify the creation time of a file.
@ CDUP
Change to Parent Directory.
@ CSID
Client / Server Identification.
@ ABOR
Abort an active file transfer.
@ PBSZ
Protection Buffer Size.
@ USER
Authentication username.
@ PASV
Enter passive mode.
@ PORT
Specifies an address and port to which the server should connect.
@ NLST
Returns a list of file names in a specified directory.
@ HELP
Returns usage documentation on a command if specified, else a general help document is returned.
@ FEAT
Get the feature list implemented by the server.
@ REST
Restart transfer from the specified point.
@ REIN
Re initializes the connection.
@ SIZE
Return the size of a file.
@ RETR
Retrieve a copy of the file.
@ XPWD
Print the current working directory.
@ THMB
Get a thumbnail of a remote image file.
@ NOOP
No operation (dummy packet; used mostly on keepalives).
@ STAT
Returns information on the server status, including the status of the current connection.
@ STRU
Set file transfer structure.
@ DSIZ
Get the directory size.
@ PASS
Authentication password.
@ LPRT
Specifies a long address and port to which the server should connect.
@ MDTM
Return the last-modified time of a specified file.
@ LANG
Language Negotiation.
@ CONF
Confidentiality Protection Command.
@ TYPE
Sets the transfer mode (ASCII/Binary).
@ PROT
Data Channel Protection Level.
@ MIC
Integrity Protected Command.
@ OPTS
Select options for a feature (for example OPTS UTF8 ON).
@ ACCT
Account information.
@ MLSD
Lists the contents of a directory in a standardized machine-readable format.
@ EPRT
Specifies an extended address and port to which the server should connect.
@ ENC
Privacy Protected Channel.
@ RMDA
Remove a directory tree.
@ MODE
Sets the transfer mode (Stream, Block, or Compressed).
@ XCUP
Change to the parent of the current working directory.
@ HOST
Identify desired virtual host on server, by name.
@ SYST
Return system type.
@ MFF
Modify fact (the last modification time, creation time, UNIX group/owner/mode of a file).
@ ADAT
Authentication/Security Data.
@ STOU
Store file uniquely.
@ EPSV
Enter extended passive mode.
@ CCC
Clear Command Channel.
@ XRMD
Remove the directory.
@ CWD
Change working directory.
@ SMNT
Mount file structure.
@ XSEM
Send, mail if cannot.
@ AUTH
Authentication/Security Mechanism.
@ MFMT
Modify the last modification time of a file.
@ LPSV
Enter long passive mode.
@ STOR
Accept the data and to store the data as a file at the server site.
std::string getCommandString() const
bool setCommand(FtpCommand code)
static std::string getCommandInfo(FtpCommand code)
Definition: FtpLayer.h:307
FtpStatusCode getStatusCode() const
std::string toString() const
FtpResponseLayer(const FtpStatusCode &code, const std::string &option="")
Definition: FtpLayer.h:444
FtpResponseLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: FtpLayer.h:436
std::string getStatusOption(bool removeEscapeCharacters=true) const
bool setStatusCode(FtpStatusCode code)
static std::string getStatusCodeAsString(FtpStatusCode code)
std::string getStatusCodeString() const
bool setStatusOption(const std::string &value)
FtpStatusCode
Definition: FtpLayer.h:313
@ EXCEED_STORAGE_ALLOCATION
Requested file action aborted: Exceeded storage allocation.
@ COMMAND_PROTECTION_DENIED
Command protection level denied for policy reasons.
@ NOT_LOGGED_IN
Not logged in.
@ NEED_UNAVAILABLE_RESOURCE_TO_SEC
Need some unavailable resource to process security.
@ USER_OK_NEED_PASS_CHALLENGE
Username okay, need password. Challenge is ...
@ USER_LOG_IN_AUTHORIZED
User logged in, authorized by security data exchange.
@ HELP_MESSAGE
Help message.
@ SERVICE_CLOSING_CONTROL
Service closing control connection.
@ SERVICE_NOT_AVAILABLE
Service not available, closing control connection.
@ COMMAND_NOT_IMPLEMENTED
Command not implemented.
@ FILE_OK
File status okay; about to open data connection.
@ ENTERING_PASSIVE
Entering Passive Mode.
@ REQ_ACTION_ABORTED
Requested action aborted: local error in processing.
@ FILE_STATUS
File status.
@ SEC_IS_ACCEPTABLE
Security data is acceptable, more is required.
@ INTEGRITY_PROTECTED
Integrity protected reply.
@ SEC_DATA_EXCHANGE_COMPLETE_SUCCESS
Security data exchange completed successfully.
@ COMMAND_OK
Command okay.
@ SYSTEM_STATUS
System status, or system help reply.
@ USER_LOG_IN_PROCEED
User logged in, proceed.
@ ENTERING_EXTENDED_PASSIVE
Entering Extended Passive Mode.
@ DATA_OPEN_NO_TRANSFER
Data connection open; no transfer in progress.
@ FILENAME_NOT_ALLOWED
Requested action not taken: File name not allowed.
@ FILE_PENDING_ACTION
Requested file action pending further information.
@ UNKNOWN
Unknown status code.
@ SERVICE_READY_IN_MIN
Service ready in nnn minutes.
@ REQ_SEC_MECHANISM_OK
Requested security mechanism is ok.
@ CONNECTION_CLOSED
Connection closed; transfer aborted.
@ PATHNAME_CREATED
PATHNAME created.
@ FILE_UNAVAILABLE
Requested action not taken: File unavailable.
@ USER_OK_NEED_PASSWORD
User name okay, need password.
@ SYNTAX_ERROR_COMMAND_UNRECOGNIZED
Syntax error, command unrecognized.
@ COMMAND_NOT_IMPLEMENTED_FOR_PARAMETER
Command not implemented for that parameter.
@ NEED_ACCOUNT
Need account for login.
@ SYNTAX_ERROR_PARAMETER_OR_ARGUMENT
Syntax error in parameters or arguments.
@ REQUEST_DENIED
Request denied for policy reasons.
@ BAD_SEQUENCE_COMMANDS
Bad sequence of commands.
@ SEC_DATA_EXCHANGE_COMPLETE
Security data exchange complete.
@ CONFIDENTIALITY_PROTECTED
Confidentiality protected reply.
@ REQ_FILE_ACTION_NOT_TAKEN
Requested file action not taken.
@ NETWORK_PROTOCOL_NOT_SUPPORTED
Network protocol not supported.
@ NAME_SYSTEM_TYPE
NAME system type.
@ DIR_STATUS
Directory status.
@ COMMAND_NOT_IMPLEMENTED_SUPERFLUOUS
Command not implemented, superfluous at this site.
@ DATA_ALREADY_OPEN_START_TRANSFER
Data connection already open; transfer starting.
@ CLOSING_DATA
Closing data connection.
@ FAILED_SEC_CHECK
Failed security check (hash, sequence, etc)
@ SERVICE_READY_FOR_USER
Service ready for new user.
@ REQ_FILE_OK_COMPLETE
Requested file action okay, completed.
@ RESTART_MARKER
Restart marker reply.
@ NEED_ACCOUNT_FOR_STORE_FILE
Need account for storing files.
@ CONFIDENTIALITY_AND_INTEGRITY_PROTECTED
Confidentiality and integrity protected reply.
@ PAGE_TYPE_UNKNOWN
Requested action aborted: page type unknown.
@ CANT_OPEN_DATA_CONNECTION
Can't open data connection.
@ REQ_PROT_LEVEL_NOT_SUPPORTED
Requested PROT level not supported by mechanism.
@ COMMAND_PROTECTION_LEVEL_NOT_SUPPORTED
Command protection level not supported by security mechanism.
@ REQ_ACTION_NOT_TAKEN
Requested action not taken. Insufficient storage space in system.
Definition: PayloadLayer.h:19
Definition: SingleCommandTextProtocol.h:19
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelApplicationLayer
Definition: ProtocolType.h:368
const ProtocolType FTP
Definition: ProtocolType.h:273