pssht
latest
SSH server library written in PHP
|
Protected Attributes | |
$address | |
Address (ip:port) of the client. | |
$appFactory | |
Factory for the application. | |
$banner | |
SSH banner. | |
$compressor | |
Output compression. | |
$connected | |
Whether this client is still connected or not. | |
$context | |
Context for this SSH connection. | |
$decoder | |
SSH decoder. | |
$decryptor | |
Input cipher. | |
$encoder | |
SSH encoder. | |
$encryptor | |
Output cipher. | |
$handlers | |
Registered handlers for this SSH connection. | |
$inMAC | |
Input MAC. | |
$inSeqNo | |
Input sequence number. | |
$outMAC | |
Output MAC. | |
$outSeqNo | |
Output sequence number. | |
$rekeyingBytes | |
Maximum number of bytes exchanged before rekeying. | |
$rekeyingTime | |
Maximum duration before rekeying. | |
$uncompressor | |
Input compression. | |
Transport layer for the SSH protocol (RFC 4253).
Definition at line 19 of file Transport.php.
fpoirotte\Pssht\Transport::__construct | ( | array | $serverKeys, |
\fpoirotte\Pssht\Handlers\SERVICE\REQUEST | $authMethods, | ||
\fpoirotte\Pssht\Wire\Encoder | $encoder = null , |
||
\fpoirotte\Pssht\Wire\Decoder | $decoder = null , |
||
$rekeyingBytes = 1073741824 , |
|||
$rekeyingTime = 3600 |
|||
) |
Construct a new SSH transport layer.
array | $serverKeys | Keys presented by the server as an associated array where:
|
fpoirotte::Pssht::Handlers::SERVICE::REQUEST | $authMethods | Allowed authentication methods. |
fpoirotte::Pssht::Wire::Encoder | $encoder | (optional) Encoder to use when sending SSH messages. If omitted, a new encoder is automatically created. |
fpoirotte::Pssht::Wire::Decoder | $decoder | (optional) Decoder to use when sending SSH messages. If omitted, a new decoder is automatically created. |
int | $rekeyingBytes | (optional) Maximum number of bytes that may be exchanged before key re-exchange (aka. rekeying) is requested. |
int | $rekeyingTime | (optional) Maximum duration (in seconds) before key re-exchange (aka. rekeying) is requested. |
Definition at line 113 of file Transport.php.
References fpoirotte\Pssht\Transport\$decoder, fpoirotte\Pssht\Transport\$encoder, fpoirotte\Pssht\Transport\$rekeyingBytes, fpoirotte\Pssht\Transport\$rekeyingTime, fpoirotte\Pssht\Algorithms\factory(), fpoirotte\Pssht\Compression\CompressionInterface\MODE_COMPRESS, and fpoirotte\Pssht\Compression\CompressionInterface\MODE_UNCOMPRESS.
fpoirotte\Pssht\Transport::getAddress | ( | ) |
Get the client's IP address.
string | The client's IP address, as set. |
null | The client's IP has not been set yet. |
Definition at line 253 of file Transport.php.
References fpoirotte\Pssht\Transport\$address.
fpoirotte\Pssht\Transport::getApplicationFactory | ( | ) |
Get the factory used to create instances of the application layer.
callable | Factory for the application layer. |
Definition at line 503 of file Transport.php.
fpoirotte\Pssht\Transport::getBanner | ( | ) |
Get the SSH banner displayed to clients.
string | SSH banner. |
null | No SSH banner has been set. |
Definition at line 532 of file Transport.php.
References fpoirotte\Pssht\Transport\$banner.
fpoirotte\Pssht\Transport::getCompressor | ( | ) |
Get the object used to compress outgoing packets.
fpoirotte::Pssht::Compression::CompressionInterface | Outgoing packets' compressor. |
Definition at line 339 of file Transport.php.
References fpoirotte\Pssht\Transport\$compressor.
fpoirotte\Pssht\Transport::getDecoder | ( | ) |
Get the object used to decode incoming packets.
fpoirotte::Pssht::Wire::Decoder | Decoder used for receiving SSH messages. |
Definition at line 328 of file Transport.php.
References fpoirotte\Pssht\Transport\$decoder.
fpoirotte\Pssht\Transport::getDecryptor | ( | ) |
Get the object used to decrypt incoming packets.
fpoirotte::Pssht::Encryption::EncryptionInterface | Incoming packets' decryptor. |
Definition at line 425 of file Transport.php.
References fpoirotte\Pssht\Transport\$decryptor.
fpoirotte\Pssht\Transport::getEncoder | ( | ) |
Get the object used to encode outgoing packets.
fpoirotte::Pssht::Wire::Encoder | Encoder used for sending SSH messages. |
Definition at line 317 of file Transport.php.
References fpoirotte\Pssht\Transport\$encoder.
fpoirotte\Pssht\Transport::getEncryptor | ( | ) |
Get the object used to encrypt outgoing packets.
fpoirotte::Pssht::Encryption::EncryptionInterface | Outgoing packets' encryptor. |
Definition at line 399 of file Transport.php.
References fpoirotte\Pssht\Transport\$encryptor.
fpoirotte\Pssht\Transport::getHandler | ( | $type | ) |
Retrieve the current handler for a given message type.
int | $type | Message type. |
fpoirotte::Pssht::Handlers::HandlerInterface | Handler associated with the given message type. |
null | There is no handler currently registered for the given message type. |
Definition at line 569 of file Transport.php.
fpoirotte\Pssht\Transport::getInputMAC | ( | ) |
Get the object used to check integrity of incoming packets.
fpoirotte::Pssht::MAC::MACInterface | Incoming packets' MAC checker. |
Definition at line 451 of file Transport.php.
References fpoirotte\Pssht\Transport\$inMAC.
fpoirotte\Pssht\Transport::getOutputMAC | ( | ) |
Get the object used to check integrity of outgoing packets.
fpoirotte::Pssht::MAC::MACInterface | Outgoing packets' MAC generator. |
Definition at line 477 of file Transport.php.
References fpoirotte\Pssht\Transport\$outMAC.
fpoirotte\Pssht\Transport::getUncompressor | ( | ) |
Get the object used to uncompress incoming packets.
fpoirotte::Pssht::Compression::CompressionInterface | Incoming packets' uncompressor. |
Definition at line 369 of file Transport.php.
References fpoirotte\Pssht\Transport\$uncompressor.
fpoirotte\Pssht\Transport::readMessage | ( | ) |
Try to read and handle a single SSH message.
bool | true if a message was successfully read and handled, false otherwise. |
Definition at line 733 of file Transport.php.
References fpoirotte\Pssht\Transport\$decoder, and fpoirotte\Pssht\Transport\writeMessage().
fpoirotte\Pssht\Transport::setAddress | ( | $address | ) |
Set the IP address of the client associated with this transport layer.
string | $address | IP address of the client. |
Transport | Returns this transport layer. |
Definition at line 229 of file Transport.php.
References fpoirotte\Pssht\Transport\$address.
fpoirotte\Pssht\Transport::setApplicationFactory | ( | $factory | ) |
Set the factory to use to create instances of the application layer.
callable | $factory | Factory for the application layer. |
Transport | Returns this transport layer. |
Definition at line 517 of file Transport.php.
fpoirotte\Pssht\Transport::setBanner | ( | $message | ) |
Set the SSH banner presented by the server.
string | $message | SSH banner to display during connection. |
Transport | Returns this transport layer. |
Definition at line 546 of file Transport.php.
fpoirotte\Pssht\Transport::setCompressor | ( | CompressionInterface | $compressor | ) |
Set the object used to compress outgoing packets.
fpoirotte::Pssht::Compression::CompressionInterface | $compressor | Outgoing packets' compressor. |
Transport | Return this transport layer. |
Definition at line 353 of file Transport.php.
References fpoirotte\Pssht\Transport\$compressor, fpoirotte\Pssht\Compression\CompressionInterface\getMode(), and fpoirotte\Pssht\Compression\CompressionInterface\MODE_COMPRESS.
fpoirotte\Pssht\Transport::setDecryptor | ( | \fpoirotte\Pssht\Encryption\EncryptionInterface | $decryptor | ) |
Set the object used to decrypt incoming packets.
fpoirotte::Pssht::Encryption::EncryptionInterface | $decryptor | Incoming packets' decryptor. |
Transport | Return this transport layer. |
Definition at line 439 of file Transport.php.
References fpoirotte\Pssht\Transport\$decryptor.
fpoirotte\Pssht\Transport::setEncryptor | ( | \fpoirotte\Pssht\Encryption\EncryptionInterface | $encryptor | ) |
Set the object used to encrypt outgoing packets.
fpoirotte::Pssht::Encryption::EncryptionInterface | $encryptor | Outgoing packets' encryptor. |
Transport | Return this transport layer. |
Definition at line 413 of file Transport.php.
References fpoirotte\Pssht\Transport\$encryptor.
fpoirotte\Pssht\Transport::setHandler | ( | $type, | |
\fpoirotte\Pssht\Handlers\HandlerInterface | $handler | ||
) |
Register a handler for a specific SSH message type.
int | $type | Message type. |
fpoirotte::Pssht::Handlers::HandlerInterface | $handler | Handler to register for that message type. |
Transport | Returns this transport layer. |
Definition at line 597 of file Transport.php.
fpoirotte\Pssht\Transport::setInputMAC | ( | \fpoirotte\Pssht\MAC\MACInterface | $inputMAC | ) |
Set the object used to check integrity of incoming packets.
fpoirotte::Pssht::MAC::MACInterface | $inputMAC | Incoming packets' MAC checker. |
Transport | Return this transport layer. |
Definition at line 465 of file Transport.php.
fpoirotte\Pssht\Transport::setOutputMAC | ( | \fpoirotte\Pssht\MAC\MACInterface | $outputMAC | ) |
Set the object used to generate MACs for outgoing packets.
fpoirotte::Pssht::MAC::MACInterface | $outputMAC | Outgoing packets' MAC generator. |
Transport | Return this transport layer. |
Definition at line 491 of file Transport.php.
fpoirotte\Pssht\Transport::setUncompressor | ( | CompressionInterface | $uncompressor | ) |
Set the object used to uncompress incoming packets.
fpoirotte::Pssht::Compression::CompressionInterface | $uncompressor | Incoming packets' uncompressor. |
Transport | Return this transport layer. |
Definition at line 383 of file Transport.php.
References fpoirotte\Pssht\Transport\$uncompressor, fpoirotte\Pssht\Compression\CompressionInterface\getMode(), and fpoirotte\Pssht\Compression\CompressionInterface\MODE_UNCOMPRESS.
fpoirotte\Pssht\Transport::unsetHandler | ( | $type, | |
\fpoirotte\Pssht\Handlers\HandlerInterface | $handler | ||
) |
Unregister a handler for a specific SSH message type.
int | $type | Message type. |
fpoirotte::Pssht::Handlers::HandlerInterface | $handler | Handler to unregister for that message type. |
Transport | Returns this transport layer. |
Definition at line 619 of file Transport.php.
fpoirotte\Pssht\Transport::updateWriteStats | ( | $written | ) |
Update statistics about the number of bytes written to the client.
int | $written | Number of additional bytes written. |
Definition at line 268 of file Transport.php.
References fpoirotte\Pssht\Transport\$connected, and fpoirotte\Pssht\Transport\$rekeyingTime.
fpoirotte\Pssht\Transport::writeMessage | ( | \fpoirotte\Pssht\Messages\MessageInterface | $message | ) |
Write an SSH message into the output buffer.
fpoirotte::Pssht::Messages::MessageInterface | $message | Message to write into the output buffer. |
Transport | Returns this transport layer. |
Definition at line 640 of file Transport.php.
References fpoirotte\Pssht\Transport\$encoder.
Referenced by fpoirotte\Pssht\Transport\readMessage().