dissect.target.plugins.apps.ssh.openssh#

Module Contents#

Classes#

OpenSSHPlugin

Base class for plugins.

Functions#

dissect.target.plugins.apps.ssh.openssh.find_sshd_directory(target: dissect.target.Target) dissect.target.helpers.fsutil.TargetPath#
class dissect.target.plugins.apps.ssh.openssh.OpenSSHPlugin(target: dissect.target.Target)#

Bases: dissect.target.plugins.apps.ssh.ssh.SSHPlugin

Base class for plugins.

Plugins can optionally be namespaced by specifying the __namespace__ class attribute. Namespacing results in your plugin needing to be prefixed with this namespace when being called. For example, if your plugin has specified test as namespace and a function called example, you must call your plugin with test.example:

A Plugin class has the following private class attributes:

  • __namespace__

  • __record_descriptors__

With the following three being assigned in register():

  • __plugin__

  • __functions__

  • __exports__

Additionally, the methods and attributes of Plugin receive more private attributes by using decorators.

The export() decorator adds the following private attributes

  • __exported__

  • __output__: Set with the export() decorator.

  • __record__: Set with the export() decorator.

The internal() decorator and InternalPlugin set the __internal__ attribute. Finally. args() decorator sets the __args__ attribute.

Parameters:

target – The Target object to load the plugin for.

__namespace__ = 'openssh'#
SSHD_DIRECTORIES = ['/sysvol/ProgramData/ssh', '/etc/ssh']#
check_compatible() None#

Perform a compatibility check with the target.

This function should return None if the plugin is compatible with the current target (self.target). For example, check if a certain file exists. Otherwise it should raise an UnsupportedPluginError.

Raises:

UnsupportedPluginError – If the plugin could not be loaded.

ssh_directory_globs(glob_user: str, glob_sshd: str) list[tuple[str, dissect.target.helpers.fsutil.TargetPath]]#
authorized_keys() Iterator[dissect.target.plugins.apps.ssh.ssh.AuthorizedKeysRecord]#

Yields the content of the authorized_keys files on a target for each user.

known_hosts() Iterator[dissect.target.plugins.apps.ssh.ssh.KnownHostRecord]#

Yields the content of the known_hosts files on a target for each user.

private_keys() Iterator[dissect.target.plugins.apps.ssh.ssh.PrivateKeyRecord]#

Yields OpenSSH private keys on a target for each user.

public_keys() Iterator[dissect.target.plugins.apps.ssh.ssh.PublicKeyRecord]#

Yields all OpenSSH public keys from all user home directories and the OpenSSH daemon directory.

dissect.target.plugins.apps.ssh.openssh.parse_ssh_public_key_file(path: pathlib.Path) tuple[str, str, str]#
dissect.target.plugins.apps.ssh.openssh.parse_ssh_key(key_string: str) tuple[str, str, str, str]#
dissect.target.plugins.apps.ssh.openssh.parse_known_host(known_host_string: str) tuple[str, list, str, str, str]#