sshmitm.tutorial.tutorials.ssh_exec package

Tutorial: SSH Command Execution Interception.

class sshmitm.tutorial.tutorials.ssh_exec.SSHExecTutorial

Bases: Tutorial

category: ClassVar[str] = 'Command Execution'
description: ClassVar[str] = 'Learn how SSH-MITM intercepts commands executed non-interactively via ssh.'
generate_exec_outputs(session_data)

Return mock exec outputs {command: stdout} for this session.

Override in subclasses that use an SSH exec victim action. Only registered commands return output; all others return an empty response with exit status 1 — no real subprocess is ever spawned on the mock server.

Parameters:

session_data (dict[str, object])

Return type:

dict[str, bytes]

generate_tutorial_session_data()

Return tutorial-specific values merged into the session data at start.

Override in subclasses to inject randomized values (e.g. filenames, commands) that UserInput conditions check against.

Return type:

dict[str, object]

id: ClassVar[str] = '04-ssh-exec'
steps: list[Step] = [Step(id='intro', title='What you will learn', content='', condition=<sshmitm.tutorial._conditions.TRUE object>, victim_action=None, command=None, copyable=[], hint_waiting='', hint_done='Introduction read. ✓'), Step(id='start-sshmitm', title='Start SSH-MITM', content='', condition=<sshmitm.tutorial._conditions.PortOpen object>, victim_action=None, command='ssh-mitm server --remote-host 127.0.0.1 --remote-port {mock_port} --listen-port {sshmitm_port}', copyable=[], hint_waiting='Waiting for SSH-MITM to start on port {sshmitm_port}…', hint_done='SSH-MITM is running on port {sshmitm_port}. ✓'), Step(id='intercept', title='Find the executed command', content='', condition=<sshmitm.tutorial._conditions.UserInput object>, victim_action=<sshmitm.tutorial._client_actions.SSHExecAction object>, command=None, copyable=[], hint_waiting='A developer is running a command through SSH-MITM. Check the terminal and enter the command above.', hint_done='Correct! You intercepted the command execution. ✓')]
title: ClassVar[str] = 'SSH Command Execution Interception'