def testProcess(self): """Tests the Process function.""" key_path = 'HKEY_CURRENT_USER\\Software\\WinRAR\\ArcHistory' time_string = '2012-08-28 09:23:49.002031' registry_key = self._CreateTestKey(key_path, time_string) plugin = winrar.WinRARHistoryPlugin() storage_writer = self._ParseKeyWithPlugin(registry_key, plugin) self.assertEqual(storage_writer.number_of_warnings, 0) self.assertEqual(storage_writer.number_of_events, 1) events = list(storage_writer.GetEvents()) expected_entries = ('0: C:\\Downloads\\The Sleeping Dragon CD1.iso ' '1: C:\\Downloads\\plaso-static.rar') expected_event_values = { 'data_type': 'winrar:history', 'entries': expected_entries, 'key_path': key_path, # This should just be the plugin name, as we're invoking it directly, # and not through the parser. 'parser': plugin.plugin_name, 'timestamp': '2012-08-28 09:23:49.002031' } self.CheckEventValues(storage_writer, events[0], expected_event_values)
def testProcess(self): """Tests the Process function.""" key_path = 'HKEY_CURRENT_USER\\Software\\WinRAR\\ArcHistory' time_string = '2012-08-28 09:23:49.002031' registry_key = self._CreateTestKey(key_path, time_string) plugin = winrar.WinRARHistoryPlugin() storage_writer = self._ParseKeyWithPlugin(registry_key, plugin) self.assertEqual(storage_writer.number_of_warnings, 0) self.assertEqual(storage_writer.number_of_events, 1) events = list(storage_writer.GetEvents()) event = events[0] self.CheckTimestamp(event.timestamp, '2012-08-28 09:23:49.002031') event_data = self._GetEventDataOfEvent(storage_writer, event) # This should just be the plugin name, as we're invoking it directly, # and not through the parser. self.assertEqual(event_data.parser, plugin.plugin_name) self.assertEqual(event_data.data_type, 'winrar:history') expected_message = ( '[{0:s}] ' '0: C:\\Downloads\\The Sleeping Dragon CD1.iso ' '1: C:\\Downloads\\plaso-static.rar').format(key_path) expected_short_message = '{0:s}...'.format(expected_message[:77]) self._TestGetMessageStrings(event, expected_message, expected_short_message)
def testFilters(self): """Tests the FILTERS class attribute.""" plugin = winrar.WinRARHistoryPlugin() key_path = 'HKEY_CURRENT_USER\\Software\\WinRAR\\ArcHistory' self._AssertFiltersOnKeyPath(plugin, key_path) self._AssertNotFiltersOnKeyPath(plugin, 'HKEY_LOCAL_MACHINE\\Bogus')