# -*- coding: utf-8 -*-
"""This file contains the Run/RunOnce key plugins for Plaso."""
from plaso.containers import events
from plaso.parsers import winreg_parser
from plaso.parsers.winreg_plugins import interface
[docs]
class RunKeyEventData(events.EventData):
"""Run/RunOnce key event data attribute container.
Attributes:
entries (list[str]): Run/RunOnce entries.
key_path (str): Windows Registry key path.
last_written_time (dfdatetime.DateTimeValues): entry last written date and
time.
"""
DATA_TYPE = 'windows:registry:run'
[docs]
def __init__(self):
"""Initializes event data."""
super(RunKeyEventData, self).__init__(data_type=self.DATA_TYPE)
self.entries = None
self.key_path = None
self.last_written_time = None
[docs]
class AutoRunsPlugin(interface.WindowsRegistryPlugin):
"""Windows Registry plugin for parsing user specific auto runs."""
NAME = 'windows_run'
DATA_FORMAT = 'Run and run once Registry data'
FILTERS = frozenset([
interface.WindowsRegistryKeyPathFilter(
'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\'
'Run'),
interface.WindowsRegistryKeyPathFilter(
'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\'
'RunOnce'),
interface.WindowsRegistryKeyPathFilter(
'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\'
'Run'),
interface.WindowsRegistryKeyPathFilter(
'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\'
'RunOnce'),
interface.WindowsRegistryKeyPathFilter(
'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\'
'RunOnce\\Setup'),
interface.WindowsRegistryKeyPathFilter(
'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\'
'RunServices'),
interface.WindowsRegistryKeyPathFilter(
'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\'
'RunServicesOnce')])
winreg_parser.WinRegistryParser.RegisterPlugin(AutoRunsPlugin)