heimdall.cli package

Submodules

heimdall.cli.cli_common module

heimdall.cli.cli_common.cb_isf(ctx: click.Context, param: click.Parameter, value: str | None) Path | None[source]

Retrieve ISF path from provided value, or from ISF manager based on VM name in context.

heimdall.cli.cli_common.cb_kvmi_socket(ctx: click.Context, param: click.Parameter, value: str | None) dict[str, str] | None[source]

Return a dictionary with KVMI_SOCKET key if value is provided, else None.

heimdall.cli.cli_common.prompt_selection(choices: list[str], prompt_message: str, return_index: bool = False) str | int | None[source]

Prompt the user to select from a list of choices. Returns the choice or its index if specified.

heimdall.cli.cli_common.sudo_required(func: Callable[[...], Any]) Callable[[...], Any][source]

Decorator to ensure the function is run with root permissions.

heimdall.cli.connect module

heimdall.cli.connect.cli() None

Main CLI group for Heimdall commands.

heimdall.cli.isf module

heimdall.cli.isf.cli()

Entry point for the CLI.

heimdall.cli.isf.isf()

Group for ISF-related commands.

heimdall.cli.isf.isf_callback(ctx, param, value)[source]

Callback to select an ISF file.

heimdall.cli.isf.isf_list()

List all available ISF files.

heimdall.cli.isf.isf_purge()

Purge all ISF files.

heimdall.cli.isf.select_file(isf_files: dict, value: str = None) str[source]

Select an ISF file from the list or prompt the user.

heimdall.cli.isf_manager module

class heimdall.cli.isf_manager.ISFManager(profiles_directory: Path)[source]

Bases: object

Manager class for handling ISF profiles.

__init__(profiles_directory: Path) None[source]

Initialize ISFManager with the provided profile’s directory.

Parameters:

profiles_directory (Path) – The directory where ISF profiles are stored.

create(vm_name: str, kvmi_socket: dict) None[source]

Create an ISF profile for a specified VM.

Parameters:
  • vm_name (str) – The name of the virtual machine.

  • kvmi_socket (dict) – KVMI socket data for communication with the VM.

delete(profile_name: str) None[source]

Delete a specific ISF profile.

Parameters:

profile_name (str) – The name of the profile to delete.

Raises:

FileExistsError – If the specified profile does not exist.

static detect(vm_name: str, kvmi_socket: dict) Tuple[str, str] | None[source]

Detect the kernel signature of a VM.

Parameters:
  • vm_name (str) – The name of the virtual machine.

  • kvmi_socket (dict) – KVMI socket data for communication with the VM.

Returns:

A tuple containing the decoded banner and its base64-encoded version, or None if detection fails.

Return type:

tuple of (str, str) or None

download(banner: str, outfile: str) None[source]

Download and extract an ISF profile.

Parameters:
  • banner (str) – Base64-encoded OS banner to identify the ISF file.

  • outfile (str) – Name for the downloaded ISF file.

Raises:

SymbolsFileRemoteNotFoundError – If the banner is not found in the repository.

list() dict[str, Path][source]

List all available ISF profiles.

Returns:

dict of str – A dictionary mapping profile names to their file paths.

Return type:

Path

Raises:

SymbolsFileNotFoundError – If the profiles directory does not exist.

purge() None[source]

Purge all ISF profiles.

Deletes all profiles found in the profiles directory.

Module contents