dissect.target.plugins.apps.vpns.wireguard#

Module Contents#

Classes#

WireGuardPlugin

WireGuard configuration parser.

MultiDict

dict() -> new empty dictionary

Attributes#

dissect.target.plugins.apps.vpns.wireguard.WireGuardInterfaceRecord#
dissect.target.plugins.apps.vpns.wireguard.WireGuardPeerRecord#
class dissect.target.plugins.apps.vpns.wireguard.WireGuardPlugin(target)#

Bases: dissect.target.plugin.Plugin

WireGuard configuration parser.

Resources: - https://manpages.debian.org/testing/wireguard-tools/wg.8.en.html#CONFIGURATION_FILE_FORMAT - https://github.com/pirate/wireguard-docs

__namespace__ = 'wireguard'#
NetworkManager uses a different stanza format

“/etc/NetworkManager/system-connections/Wireguard*”,

TODO: systemd uses a different stanza format

“/etc/systemd/network/wg*.netdev”, “/etc/systemd/network/wg.netdev”,

TODO: other locations such as $HOME/.config/wireguard TODO: parse native network manager formats from MacOS, Ubuntu and Windows. TODO: parse Windows dpapi files at:

  • C:WindowsSystem32configsystemprofileAppDataLocalWireGuardConfigurations

  • C:Program FilesWireGuardDataConfigurations

Type:

TODO

config_globs = ['/etc/wireguard/*.conf', '/usr/local/etc/wireguard/*.conf', '/opt/homebrew/etc/wireguard/*.conf']#
check_compatible() bool#

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.

config() Iterator[Union[WireGuardInterfaceRecord, WireGuardPeerRecord]]#

Parses interface config files from wireguard installations.

class dissect.target.plugins.apps.vpns.wireguard.MultiDict(*args, **kwargs)#

Bases: collections.OrderedDict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

__setitem__(key, val)#

Set self[key] to value.