# -*- coding: utf-8 -*-
"""This file contains the Terminal Server client Windows Registry plugins."""
import re
from plaso.containers import events
from plaso.parsers import winreg_parser
from plaso.parsers.winreg_plugins import interface
[docs]
class TerminalServerClientConnectionEventData(events.EventData):
"""Terminal Server client connection event data attribute container.
Attributes:
entries (str): most recently used (MRU) entries.
key_path (str): Windows Registry key path.
last_written_time (dfdatetime.DateTimeValues): entry last written date and
time.
username (str): username, provided by the UsernameHint value.
"""
DATA_TYPE = 'windows:registry:mstsc:connection'
[docs]
def __init__(self):
"""Initializes event data."""
super(TerminalServerClientConnectionEventData, self).__init__(
data_type=self.DATA_TYPE)
self.entries = None
self.key_path = None
self.last_written_time = None
self.username = None
[docs]
class TerminalServerClientMRUEventData(events.EventData):
"""Terminal Server client MRU event data attribute container.
Attributes:
entries (str): most recently used (MRU) entries.
key_path (str): Windows Registry key path.
last_written_time (dfdatetime.DateTimeValues): entry last written date and
time.
"""
DATA_TYPE = 'windows:registry:mstsc:mru'
[docs]
def __init__(self):
"""Initializes event data."""
super(TerminalServerClientMRUEventData, self).__init__(
data_type=self.DATA_TYPE)
self.entries = None
self.key_path = None
self.last_written_time = None
[docs]
class TerminalServerClientPlugin(interface.WindowsRegistryPlugin):
"""Windows Registry plugin for Terminal Server Client Connection keys."""
NAME = 'mstsc_rdp'
DATA_FORMAT = 'Terminal Server Client Connection Registry data'
FILTERS = frozenset([
interface.WindowsRegistryKeyPathFilter(
'HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\'
'Servers'),
interface.WindowsRegistryKeyPathFilter(
'HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\'
'Default\\AddIns\\RDPDR')])
[docs]
class TerminalServerClientMRUPlugin(interface.WindowsRegistryPlugin):
"""Windows Registry plugin for Terminal Server Client Connection MRU keys."""
NAME = 'mstsc_rdp_mru'
DATA_FORMAT = 'Terminal Server Client Most Recently Used (MRU) Registry data'
FILTERS = frozenset([
interface.WindowsRegistryKeyPathFilter(
'HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\'
'Default'),
interface.WindowsRegistryKeyPathFilter(
'HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\'
'LocalDevices')])
_RE_VALUE_DATA = re.compile(r'MRU[0-9]+')
winreg_parser.WinRegistryParser.RegisterPlugins([
TerminalServerClientPlugin, TerminalServerClientMRUPlugin])