FTP - File Transfer Protocol

pcapkit.protocols.application.ftp contains FTP only, which implements extractor for File Transfer Protocol (FTP) *.

class pcapkit.protocols.application.ftp.FTP(file=None, length=None, **kwargs)[source]

Bases: pcapkit.protocols.application.application.Application

This class implements File Transfer Protocol.

make(**kwargs)[source]

Make (construct) packet data.

Keyword Arguments

**kwargs – Arbitrary keyword arguments.

Returns

Constructed packet data.

Return type

bytes

read(length=None, **kwargs)[source]

Read File Transfer Protocol (FTP).

Parameters

length (Optional[int]) – Length of packet data.

Keyword Arguments

**kwargs – Arbitrary keyword arguments.

Returns

Parsed packet data.

Return type

Union[DataType_FTP_Request, DataType_FTP_Response]

Raises

ProtocolError – If the packet is malformed.

property length

Header length of current protocol.

Raises

UnsupportedCall – This protocol doesn’t support length.

property name

Name of current protocol.

Return type

Literal[‘File Transfer Protocol’]

Data Structure

Important

Following classes are only for documentation purpose. They do NOT exist in the pcapkit module.

class pcapkit.protocols.application.ftp.DataType_FTP_Request
Bases

TypedDict

Structure of FTP request packet [RFC 959].

type: Literal[request]

Packet type.

command: pcapkit.corekit.infoclass.Info

FTP command.

arg: Optional[str]

FTP command arguments.

raw: bytes

Raw packet data.

class pcapkit.protocols.application.ftp.DataType_FTP_Response
Bases

TypedDict

Structure of FTP response packet [RFC 959].

type: Literal[response]

Packet type.

code: pcapkit.const.ftp.return_code.ReturnCode

FTP response code.

arg: Optional[str]

FTP response arguments (messages).

mf: bool

More fragmented messages flag.

raw: bytes

Raw packet data.


*

https://en.wikipedia.org/wiki/File_Transfer_Protocol