simple_automation.remote_dispatch.Dispatcher

class simple_automation.remote_dispatch.Dispatcher

Bases: object

The main dispatcher. Parses the protocol and executes commands.

Methods

handle_exec

Handles the exec mode packet.

handle_set_debug

Handles the debugging mode packet.

handle_set_input

Handles the input mode packet.

handle_set_umask

Handles the umask mode packet.

handle_set_user

Handles the user mode packet.

main

Begin by changing directory to /tmp.

run_command

Runs a given command using the saved execution settings.

handle_exec()

Handles the exec mode packet. Reads a command, and executes it. stdout and stderr will be captured and returned to the client.

handle_set_debug()

Handles the debugging mode packet. If debugging is enabled, we will print every executed command and the relevant settings.

handle_set_input()

Handles the input mode packet. The given input will be used as stdin for the next command execution.

handle_set_umask()

Handles the umask mode packet. The given umask will be used for the next command execution.

handle_set_user()

Handles the user mode packet. Validates the given uid / resolves a username, which will then be used for the next command. The gid will be set to the primary gid of that user.

main()

Begin by changing directory to /tmp. Then listen for packets on stdin and loop until stdin is closed.

run_command(command)

Runs a given command using the saved execution settings. The settings will be reset afterwards.