fortrace.utility.applications.console package

Submodules

fortrace.utility.applications.console.linux_terminal module

class fortrace.utility.applications.console.linux_terminal.GenericLinuxTerminal(name: str, qs: QEMUMonitorSession, parent_notifier: ParentNotifier, shell_type: ShellType = ShellType.BASH, sudo_timeout: float = 300)[source]

Bases: GenericApplication

Representation of a generic Linux terminal window.

change_shell(shell_type: ShellType)[source]
send_command(command: str, get_output: bool = False, elevated: bool = False, password: str = '') str | None[source]

Send a command to the active terminal emulator.

Parameters:
  • command – the command to be sent

  • get_output – the clipboard is shared between host and guest, so we can get the output by piping the command to it. However, note that this will show in command history

  • elevated – run the command as sudo

  • password – if command should run as sudo, a password must be provided (even if timeout is active)

Returns:

output of entered command, if wished (currently only works with X due limitations of pyperclip

toggle_command_history()[source]

Toggle the generation of command history.

Note however, that the command to toggle will be in history.

fortrace.utility.applications.console.powershell module

class fortrace.utility.applications.console.powershell.PowerShell(qs: QEMUMonitorSession, parent_notifier: ParentNotifier, run_as_administrator: bool = False)[source]

Bases: GenericTerminal

close()[source]

Close an application with ‘alt-f4’ key combination.

send_command(command: str, get_output: bool = False, **kwargs) str | None[source]

Send a command to the terminal.

Parameters:
  • command – command to be entered

  • get_output – whether the output should be returned (might be computational expensive)

  • **kwargs – can be relevant for Linux terminals

Returns:

Optionally, if get_output is set the (OCR-ed) output of the command

fortrace.utility.applications.console.terminal module

class fortrace.utility.applications.console.terminal.GenericTerminal(name: str, qs: QEMUMonitorSession, parent_notifier: ParentNotifier, shell_type: ShellType)[source]

Bases: GenericApplication, ABC

Representation of a generic graphical terminal application.

abstractmethod send_command(command: str, get_output: bool = False, **kwargs) list[str] | None[source]

Send a command to the terminal.

Parameters:
  • command – command to be entered

  • get_output – whether the output should be returned (might be computational expensive)

  • **kwargs – can be relevant for Linux terminals

Returns:

Optionally, if get_output is set the (OCR-ed) output of the command

toggle_command_history()[source]

fortrace.utility.applications.console.terminal_factory module

fortrace.utility.applications.console.terminal_factory.get_terminal(name: str, qs: QEMUMonitorSession, parent_notifier: ParentNotifier, **kwargs)[source]

Module contents