:py:mod:`dissect.target.plugins.apps.ssh.openssh` ================================================= .. py:module:: dissect.target.plugins.apps.ssh.openssh Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.target.plugins.apps.ssh.openssh.OpenSSHPlugin Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: dissect.target.plugins.apps.ssh.openssh.find_sshd_directory dissect.target.plugins.apps.ssh.openssh.parse_ssh_public_key_file dissect.target.plugins.apps.ssh.openssh.parse_ssh_key dissect.target.plugins.apps.ssh.openssh.parse_known_host .. py:function:: find_sshd_directory(target: dissect.target.Target) -> dissect.target.helpers.fsutil.TargetPath .. py:class:: OpenSSHPlugin(target: dissect.target.Target) Bases: :py:obj:`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 :func:`register`: - ``__plugin__`` - ``__functions__`` - ``__exports__`` Additionally, the methods and attributes of :class:`Plugin` receive more private attributes by using decorators. The :func:`export` decorator adds the following private attributes - ``__exported__`` - ``__output__``: Set with the :func:`export` decorator. - ``__record__``: Set with the :func:`export` decorator. The :func:`internal` decorator and :class:`InternalPlugin` set the ``__internal__`` attribute. Finally. :func:`args` decorator sets the ``__args__`` attribute. :param target: The :class:`~dissect.target.target.Target` object to load the plugin for. .. py:attribute:: __namespace__ :value: 'openssh' .. py:attribute:: SSHD_DIRECTORIES :value: ['/sysvol/ProgramData/ssh', '/etc/ssh'] .. py:method:: 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. .. py:method:: ssh_directory_globs(glob_user: str, glob_sshd: str) -> list[tuple[str, dissect.target.helpers.fsutil.TargetPath]] .. py:method:: authorized_keys() -> Iterator[dissect.target.plugins.apps.ssh.ssh.AuthorizedKeysRecord] Yields the content of the authorized_keys files on a target for each user. .. py:method:: known_hosts() -> Iterator[dissect.target.plugins.apps.ssh.ssh.KnownHostRecord] Yields the content of the known_hosts files on a target for each user. .. py:method:: private_keys() -> Iterator[dissect.target.plugins.apps.ssh.ssh.PrivateKeyRecord] Yields OpenSSH private keys on a target for each user. .. py:method:: 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. .. py:function:: parse_ssh_public_key_file(path: pathlib.Path) -> tuple[str, str, str] .. py:function:: parse_ssh_key(key_string: str) -> tuple[str, str, str, str] .. py:function:: parse_known_host(known_host_string: str) -> tuple[str, list, str, str, str]