module documentation

SSH Client/Terminal App for Picoware Copyright (c) 2026 JBlanked GPL-3.0 License https://www.github.com/jblanked/Picoware Last Updated: 2026-09-19

Class SSHClient Full SSH-2 protocol client with multiple KEX algorithms
Function run Run the SSH app
Function start Start the SSH app
Function stop Stop the SSH app
Constant KEYBOARD_ENTERING Undocumented
Constant KEYBOARD_WAITING Undocumented
Constant MENU_ITEM_CONNECT Undocumented
Constant MENU_ITEM_SET_HOST Undocumented
Constant MENU_ITEM_SET_PASSWORD Undocumented
Constant MENU_ITEM_SET_PORT Undocumented
Constant MENU_ITEM_SET_USERNAME Undocumented
Constant SSH_MSG_CHANNEL_CLOSE Undocumented
Constant SSH_MSG_CHANNEL_DATA Undocumented
Constant SSH_MSG_CHANNEL_EOF Undocumented
Constant SSH_MSG_CHANNEL_EXTENDED_DATA Undocumented
Constant SSH_MSG_CHANNEL_FAILURE Undocumented
Constant SSH_MSG_CHANNEL_OPEN Undocumented
Constant SSH_MSG_CHANNEL_OPEN_CONFIRMATION Undocumented
Constant SSH_MSG_CHANNEL_OPEN_FAILURE Undocumented
Constant SSH_MSG_CHANNEL_REQUEST Undocumented
Constant SSH_MSG_CHANNEL_SUCCESS Undocumented
Constant SSH_MSG_CHANNEL_WINDOW_ADJUST Undocumented
Constant SSH_MSG_DEBUG Undocumented
Constant SSH_MSG_DISCONNECT Undocumented
Constant SSH_MSG_GLOBAL_REQUEST Undocumented
Constant SSH_MSG_IGNORE Undocumented
Constant SSH_MSG_KEX_DH_GEX_INIT Undocumented
Constant SSH_MSG_KEX_DH_GEX_REPLY Undocumented
Constant SSH_MSG_KEX_DH_GEX_REQUEST Undocumented
Constant SSH_MSG_KEXDH_INIT Undocumented
Constant SSH_MSG_KEXDH_REPLY Undocumented
Constant SSH_MSG_KEXINIT Undocumented
Constant SSH_MSG_NEWKEYS Undocumented
Constant SSH_MSG_REQUEST_FAILURE Undocumented
Constant SSH_MSG_SERVICE_ACCEPT Undocumented
Constant SSH_MSG_SERVICE_REQUEST Undocumented
Constant SSH_MSG_UNIMPLEMENTED Undocumented
Constant SSH_MSG_USERAUTH_BANNER Undocumented
Constant SSH_MSG_USERAUTH_FAILURE Undocumented
Constant SSH_MSG_USERAUTH_REQUEST Undocumented
Constant SSH_MSG_USERAUTH_SUCCESS Undocumented
Constant STATE_CONNECTED Undocumented
Constant STATE_CONNECTING Undocumented
Constant STATE_DISCONNECTED Undocumented
Constant STATE_ERROR Undocumented
Constant STATE_EXECUTING Undocumented
Constant VIEW_CONNECTING Undocumented
Constant VIEW_KEYBOARD_HOST Undocumented
Constant VIEW_KEYBOARD_PASSWORD Undocumented
Constant VIEW_KEYBOARD_PORT Undocumented
Constant VIEW_KEYBOARD_USERNAME Undocumented
Constant VIEW_MAIN_MENU Undocumented
Constant VIEW_TERMINAL Undocumented
Variable ssh_host Undocumented
Variable ssh_password Undocumented
Variable ssh_port Undocumented
Variable ssh_username Undocumented
Class _AES_CTR AES in Counter mode. Tries native CTR (mode 6) first, falls back to manual CTR built on ECB.
Function __load_ssh_credentials Load SSH credentials from storage
Function _handle_terminal_input Process key presses while in the interactive terminal view
Function _hmac_compute Compute HMAC with the given hash class and block size
Function _hmac_sha1 HMAC-SHA-1
Function _hmac_sha256 HMAC-SHA-256
Function _keyboard_run Start the keyboard view
Function _keyboard_save Keyboard callback function
Function _load_history Load command history from SD card
Function _loading_run Display loading screen
Function _menu_start Start the menu view
Function _parse_mpint Parse SSH mpint from data at offset, returns (int, new_offset)
Function _parse_name_list Parse SSH name-list, returns (list_of_strings, new_offset)
Function _parse_string Parse SSH string from data at offset, returns (bytes, new_offset)
Function _parse_uint32 Parse big-endian uint32 from data at offset
Function _render_terminal Render the interactive terminal: colored output lines + inline prompt
Function _save_history Persist in-memory command history to SD card
Function _ssh_mpint Pack integer as SSH mpint (big-endian, sign-extended)
Function _ssh_string Pack data as SSH string (uint32 length prefix + data)
Function _x25519 X25519 scalar multiplication with aggressive GC
Constant _DH_G Undocumented
Constant _DH_P Undocumented
Constant _HISTORY_FILE Undocumented
Constant _HISTORY_MAX Undocumented
Constant _X25519_A24 Undocumented
Constant _X25519_BASE Undocumented
Constant _X25519_P Undocumented
Variable _history Undocumented
Variable _history_index Undocumented
Variable _history_saved Undocumented
Variable _input_line Undocumented
Variable _loading Undocumented
Variable _menu Undocumented
Variable _selected_index Undocumented
Variable _ssh_client Undocumented
Variable _terminal_dirty Undocumented
def run(view_manager):

Run the SSH app

def start(view_manager) -> bool:

Start the SSH app

def stop(view_manager):

Stop the SSH app

KEYBOARD_ENTERING =

Undocumented

Value
const(0)
KEYBOARD_WAITING =

Undocumented

Value
const((-1))
MENU_ITEM_CONNECT =

Undocumented

Value
const(0)
MENU_ITEM_SET_HOST =

Undocumented

Value
const(1)
MENU_ITEM_SET_PASSWORD =

Undocumented

Value
const(4)
MENU_ITEM_SET_PORT =

Undocumented

Value
const(2)
MENU_ITEM_SET_USERNAME =

Undocumented

Value
const(3)
SSH_MSG_CHANNEL_CLOSE =

Undocumented

Value
const(97)
SSH_MSG_CHANNEL_DATA =

Undocumented

Value
const(94)
SSH_MSG_CHANNEL_EOF =

Undocumented

Value
const(96)
SSH_MSG_CHANNEL_EXTENDED_DATA =

Undocumented

Value
const(95)
SSH_MSG_CHANNEL_FAILURE =

Undocumented

Value
const(100)
SSH_MSG_CHANNEL_OPEN =

Undocumented

Value
const(90)
SSH_MSG_CHANNEL_OPEN_CONFIRMATION =

Undocumented

Value
const(91)
SSH_MSG_CHANNEL_OPEN_FAILURE =

Undocumented

Value
const(92)
SSH_MSG_CHANNEL_REQUEST =

Undocumented

Value
const(98)
SSH_MSG_CHANNEL_SUCCESS =

Undocumented

Value
const(99)
SSH_MSG_CHANNEL_WINDOW_ADJUST =

Undocumented

Value
const(93)
SSH_MSG_DEBUG =

Undocumented

Value
const(4)
SSH_MSG_DISCONNECT =

Undocumented

Value
const(1)
SSH_MSG_GLOBAL_REQUEST =

Undocumented

Value
const(80)
SSH_MSG_IGNORE =

Undocumented

Value
const(2)
SSH_MSG_KEX_DH_GEX_INIT =

Undocumented

Value
const(32)
SSH_MSG_KEX_DH_GEX_REPLY =

Undocumented

Value
const(33)
SSH_MSG_KEX_DH_GEX_REQUEST =

Undocumented

Value
const(34)
SSH_MSG_KEXDH_INIT =

Undocumented

Value
const(30)
SSH_MSG_KEXDH_REPLY =

Undocumented

Value
const(31)
SSH_MSG_KEXINIT =

Undocumented

Value
const(20)
SSH_MSG_NEWKEYS =

Undocumented

Value
const(21)
SSH_MSG_REQUEST_FAILURE =

Undocumented

Value
const(82)
SSH_MSG_SERVICE_ACCEPT =

Undocumented

Value
const(6)
SSH_MSG_SERVICE_REQUEST =

Undocumented

Value
const(5)
SSH_MSG_UNIMPLEMENTED =

Undocumented

Value
const(3)
SSH_MSG_USERAUTH_BANNER =

Undocumented

Value
const(53)
SSH_MSG_USERAUTH_FAILURE =

Undocumented

Value
const(51)
SSH_MSG_USERAUTH_REQUEST =

Undocumented

Value
const(50)
SSH_MSG_USERAUTH_SUCCESS =

Undocumented

Value
const(52)
STATE_CONNECTED =

Undocumented

Value
const(2)
STATE_CONNECTING =

Undocumented

Value
const(1)
STATE_DISCONNECTED =

Undocumented

Value
const(0)
STATE_ERROR =

Undocumented

Value
const(4)
STATE_EXECUTING =

Undocumented

Value
const(3)
VIEW_CONNECTING =

Undocumented

Value
const(6)
VIEW_KEYBOARD_HOST =

Undocumented

Value
const(1)
VIEW_KEYBOARD_PASSWORD =

Undocumented

Value
const(4)
VIEW_KEYBOARD_PORT =

Undocumented

Value
const(2)
VIEW_KEYBOARD_USERNAME =

Undocumented

Value
const(3)
VIEW_MAIN_MENU =

Undocumented

Value
const(0)
VIEW_TERMINAL =

Undocumented

Value
const(7)
ssh_host: str =

Undocumented

ssh_password: str =

Undocumented

ssh_port: str =

Undocumented

ssh_username: str =

Undocumented

def __load_ssh_credentials(view_manager) -> bool:

Load SSH credentials from storage

def _handle_terminal_input(view_manager):

Process key presses while in the interactive terminal view

def _hmac_compute(key, msg, hash_cls, block_size):

Compute HMAC with the given hash class and block size

def _hmac_sha1(key, msg):

HMAC-SHA-1

def _hmac_sha256(key, msg):

HMAC-SHA-256

def _keyboard_run(view_manager) -> bool:

Start the keyboard view

def _keyboard_save(view_manager) -> bool:

Keyboard callback function

def _load_history(storage) -> list:

Load command history from SD card

def _loading_run(view_manager, message: str = 'Connecting...'):

Display loading screen

def _menu_start(view_manager):

Start the menu view

def _parse_mpint(data, offset):

Parse SSH mpint from data at offset, returns (int, new_offset)

def _parse_name_list(data, offset):

Parse SSH name-list, returns (list_of_strings, new_offset)

def _parse_string(data, offset):

Parse SSH string from data at offset, returns (bytes, new_offset)

def _parse_uint32(data, offset):

Parse big-endian uint32 from data at offset

def _render_terminal(view_manager):

Render the interactive terminal: colored output lines + inline prompt

def _save_history(storage):

Persist in-memory command history to SD card

def _ssh_mpint(n):

Pack integer as SSH mpint (big-endian, sign-extended)

def _ssh_string(data):

Pack data as SSH string (uint32 length prefix + data)

def _x25519(k_bytes, u_bytes):

X25519 scalar multiplication with aggressive GC

_DH_G =

Undocumented

Value
const(2)
_DH_P =

Undocumented

Value
int('FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B1↵
39B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625↵
E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE↵
45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208↵
552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180↵
E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898F↵
A051015728E5A8AACAA68FFFFFFFFFFFFFFFF',
...
_HISTORY_FILE: str =

Undocumented

Value
'picoware/ssh/history.txt'
_HISTORY_MAX =

Undocumented

Value
const(50)
_X25519_A24 =

Undocumented

Value
const(121665)
_X25519_BASE =

Undocumented

Value
b'\t' + b'\x00' * 31
_X25519_P =

Undocumented

Value
(1 << 255) - 19
_history: list =

Undocumented

_history_index: int =

Undocumented

_history_saved: str =

Undocumented

_input_line: str =

Undocumented

_loading =

Undocumented

_menu =

Undocumented

_selected_index: int =

Undocumented

_ssh_client =

Undocumented

_terminal_dirty: bool =

Undocumented