PcapPlusPlus
22.11
|
#include <TelnetLayer.h>
Public Member Functions | |
TelnetLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
std::string | getDataAsString (bool removeEscapeCharacters=true) |
size_t | getTotalNumberOfCommands () |
size_t | getNumberOfCommands (TelnetCommand command) |
TelnetCommand | getFirstCommand () |
TelnetCommand | getNextCommand () |
TelnetOption | getOption () |
TelnetOption | getOption (TelnetCommand command) |
uint8_t * | getOptionData (size_t &length) |
uint8_t * | getOptionData (TelnetCommand command, size_t &length) |
void | parseNextLayer () |
Parses the next layer. Telnet is the always last so does nothing for this layer. | |
size_t | getHeaderLen () const |
void | computeCalculateFields () |
Does nothing for this layer. | |
OsiModelLayer | getOsiModelLayer () const |
std::string | toString () const |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
uint8_t * | getData () const |
size_t | getDataLen () const |
uint8_t * | getLayerPayload () const |
size_t | getLayerPayloadSize () const |
bool | isAllocatedToPacket () const |
void | copyData (uint8_t *toArr) const |
uint8_t * | getDataPtr (size_t offset=0) const |
Static Public Member Functions | |
static std::string | getTelnetCommandAsString (TelnetCommand val) |
static std::string | getTelnetOptionAsString (TelnetOption val) |
static bool | isTelnetPort (uint16_t port) |
static bool | isDataValid (const uint8_t *data, size_t dataSize) |
Class for representing the Telnet Layer
Telnet Command Indicator
Telnet Options
Enumerator | |
---|---|
TelnetOptionNoOption | Internal return for no option detected. |
TransmitBinary | Binary Transmission RFC856 https://www.iana.org/go/rfc856. |
Echo | Echo RFC857 https://www.iana.org/go/rfc857. |
Reconnection | Reconnection. |
SuppressGoAhead | Suppress Go Ahead RFC858 https://www.iana.org/go/rfc858. |
ApproxMsgSizeNegotiation | Negotiate approximate message size. |
Status | Status RFC859 https://www.iana.org/go/rfc859. |
TimingMark | Timing Mark RFC860 https://www.iana.org/go/rfc860. |
RemoteControlledTransAndEcho | RCTE, Remote Controlled Transmission and Echo RFC726 https://www.iana.org/go/rfc726. |
OutputLineWidth | Output Line Width. |
OutputPageSize | Output Page Size. |
OutputCarriageReturnDisposition | NAOCRD, Negotiate About Output Carriage-Return Disposition RFC652 https://www.iana.org/go/rfc652. |
OutputHorizontalTabStops | NAOHTS, Negotiate About Output Horizontal Tabstops RFC653 https://www.iana.org/go/rfc653. |
OutputHorizontalTabDisposition | NAOHTD, Negotiate About Output Horizontal Tab Disposition RFC654 https://www.iana.org/go/rfc654. |
OutputFormfeedDisposition | NAOFFD, Negotiate About Output Formfeed Disposition RFC655 https://www.iana.org/go/rfc655. |
OutputVerticalTabStops | NAOVTS, Negotiate About Vertical Tabstops RFC656 https://www.iana.org/go/rfc656. |
OutputVerticalTabDisposition | NAOVTD, Negotiate About Output Vertcial Tab Disposition RFC657 https://www.iana.org/go/rfc657. |
OutputLinefeedDisposition | NAOLFD, Negotiate About Output Linefeed Disposition RFC658 https://www.iana.org/go/rfc658. |
ExtendedASCII | Extended ASCII RFC698 https://www.iana.org/go/rfc698. |
Logout | Logout RFC727 https://www.iana.org/go/rfc727. |
ByteMacro | BM, Byte Macro RFC735 https://www.iana.org/go/rfc735. |
DataEntryTerminal | Data Entry Terminal RFC1043 - RFC732 https://www.iana.org/go/rfc1043 https://www.iana.org/go/rfc732. |
SUPDUP | SUPDUP RFC736 - RFC734 https://www.iana.org/go/rfc736 https://www.iana.org/go/rfc734. |
SUPDUPOutput | SUPDUP Output RFC749 https://www.iana.org/go/rfc749. |
SendLocation | Send Location RFC779 https://www.iana.org/go/rfc779. |
TerminalType | Terminal Type RFC1091 https://www.iana.org/go/rfc1091. |
EndOfRecordOption | End of record RFC885 https://www.iana.org/go/rfc885. |
TACACSUserIdentification | TUID, TACACS User Identification RFC927 https://www.iana.org/go/rfc927. |
OutputMarking | OUTMRK, Output Marking RFC933 https://www.iana.org/go/rfc933. |
TerminalLocationNumber | TTYLOC, Terminal Location Number RFC946 https://www.iana.org/go/rfc946. |
Telnet3270Regime | Telnet 3270 Regime RFC1041 https://www.iana.org/go/rfc1041. |
X3Pad | X.3 PAD RFC1053 https://www.iana.org/go/rfc1053. |
NegotiateAboutWindowSize | NAWS, Negotiate About Window Size RFC1073 https://www.iana.org/go/rfc1073. |
TerminalSpeed | Terminal Speed RFC1079 https://www.iana.org/go/rfc1079. |
RemoteFlowControl | Remote Flow Control RFC1372 https://www.iana.org/go/rfc1372. |
Linemode | Line Mode RFC1184 https://www.iana.org/go/rfc1184. |
XDisplayLocation | X Display Location RFC1096 https://www.iana.org/go/rfc1096. |
EnvironmentOption | Environment Option RFC1408 https://www.iana.org/go/rfc1408. |
AuthenticationOption | Authentication Option RFC2941 https://www.iana.org/go/rfc2941. |
EncryptionOption | Encryption Option RFC2946 https://www.iana.org/go/rfc2946. |
NewEnvironmentOption | New Environment Option RFC1572 https://www.iana.org/go/rfc1572. |
TN3270E | TN3270E RFC2355 https://www.iana.org/go/rfc2355. |
XAuth | X Server Authentication. |
Charset | Charset RFC2066 https://www.iana.org/go/rfc2066. |
TelnetRemoteSerialPort | RSP, Telnet Remote Serial Port. |
ComPortControlOption | Com Port Control Option RFC2217 https://www.iana.org/go/rfc2217. |
TelnetSuppressLocalEcho | Telnet Suppress Local Echo. |
TelnetStartTLS | Telnet Start TLS. |
Kermit | Kermit RFC2840 https://www.iana.org/go/rfc2840. |
SendURL | Send URL. |
ForwardX | Forward X Server. |
TelOptPragmaLogon | Telnet Option Pragma Logon. |
TelOptSSPILogon | Telnet Option SSPI Logon. |
TelOptPragmaHeartbeat | Telnet Option Pragma Heartbeat. |
ExtendedOptions | Extended option list. |
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data |
[in] | dataLen | Size of the data in bytes |
[in] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
std::string pcpp::TelnetLayer::getDataAsString | ( | bool | removeEscapeCharacters = true | ) |
Get the Telnet data as readable string
[in] | removeEscapeCharacters | Whether non-alphanumerical characters should be removed or not |
TelnetCommand pcpp::TelnetLayer::getFirstCommand | ( | ) |
Returns the first command of packet
|
inlinevirtual |
Implements pcpp::Layer.
TelnetCommand pcpp::TelnetLayer::getNextCommand | ( | ) |
Returns the next command of packet. Uses an internal iterator. The iterator resets when reached end of packet.
size_t pcpp::TelnetLayer::getNumberOfCommands | ( | TelnetCommand | command | ) |
Returns the number of occurrences of provided command
[in] | command | Telnet command to count |
TelnetOption pcpp::TelnetLayer::getOption | ( | ) |
Returns the option of current command. Uses an internal iterator. Iterator can be moved with getNextCommand
TelnetOption pcpp::TelnetLayer::getOption | ( | TelnetCommand | command | ) |
Returns the option of provided command. It will return option of first occurrence of the command
[in] | command | Telnet command to search |
uint8_t* pcpp::TelnetLayer::getOptionData | ( | size_t & | length | ) |
Returns the data of current command. Uses an internal iterator. Iterator can be moved with getNextCommand
[out] | length | Length of the data of current command |
uint8_t* pcpp::TelnetLayer::getOptionData | ( | TelnetCommand | command, |
size_t & | length | ||
) |
Returns the data of provided command. It will return data of first occurrence of the command
[in] | command | Telnet command to search |
[out] | length | Length of the data of current command |
|
inlinevirtual |
Implements pcpp::Layer.
|
static |
Convert the Telnet Command to readable string
[in] | val | Value of the command |
|
static |
Convert the Telnet option to readable string
[in] | val | Value of the option |
size_t pcpp::TelnetLayer::getTotalNumberOfCommands | ( | ) |
Get the total number of detected Telnet commands
|
inlinestatic |
A static method that takes a byte array and detects whether it is a Telnet message
[in] | data | A byte array |
[in] | dataSize | The byte array size (in bytes) |
|
inlinestatic |
A static method that checks whether the port is considered as Telnet
[in] | port | The port number to be checked |
|
virtual |
Implements pcpp::Layer.