Exemplo n.º 1
0
    def testFilters(self):
        """Tests the FILTERS class attribute."""
        plugin = networks.NetworksWindowsRegistryPlugin()

        key_path = (
            'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\'
            'NetworkList')
        self._AssertFiltersOnKeyPath(plugin, key_path)

        self._AssertNotFiltersOnKeyPath(plugin, 'HKEY_LOCAL_MACHINE\\Bogus')
Exemplo n.º 2
0
  def testProcess(self):
    """Tests the Process function on created key."""
    key_path = (
        'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion')
    time_string = '2013-01-30 10:47:57'
    registry_key = self._CreateTestKey(key_path, time_string)

    plugin = networks.NetworksWindowsRegistryPlugin()
    storage_writer = self._ParseKeyWithPlugin(registry_key, plugin)

    self.assertEqual(storage_writer.number_of_warnings, 0)
    self.assertEqual(storage_writer.number_of_events, 4)

    events = list(storage_writer.GetSortedEvents())

    event = events[0]

    self.CheckTimestamp(event.timestamp, '2014-05-06 17:02:19.795000')
    self.assertEqual(
        event.timestamp_desc, definitions.TIME_DESCRIPTION_CREATION)

    event_data = self._GetEventDataOfEvent(storage_writer, event)

    self.assertEqual(event_data.data_type, 'windows:registry:network')

    expected_message = (
        'SSID: Network '
        'Description: Network '
        'Connection Type: Wired '
        'Default Gateway Mac: 00:50:56:ea:6c:ec '
        'DNS Suffix: localdomain')
    expected_short_message = '{0:s}...'.format(expected_message[:77])

    self._TestGetMessageStrings(
        event_data, expected_message, expected_short_message)

    event = events[3]

    self.CheckTimestamp(event.timestamp, '2015-01-27 15:15:27.965000')
    self.assertEqual(
        event.timestamp_desc, definitions.TIME_DESCRIPTION_LAST_CONNECTED)

    event_data = self._GetEventDataOfEvent(storage_writer, event)

    self.assertEqual(event_data.data_type, 'windows:registry:network')

    expected_message = (
        'SSID: My Awesome Wifi Hotspot '
        'Description: My Awesome Wifi Hotspot '
        'Connection Type: Wireless')
    expected_short_message = '{0:s}...'.format(expected_message[:77])

    self._TestGetMessageStrings(
        event_data, expected_message, expected_short_message)
Exemplo n.º 3
0
    def testProcess(self):
        """Tests the Process function on created key."""
        key_path = (
            'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion'
        )
        time_string = '2013-01-30 10:47:57'
        registry_key = self._CreateTestKey(key_path, time_string)

        plugin = networks.NetworksWindowsRegistryPlugin()
        storage_writer = self._ParseKeyWithPlugin(registry_key, plugin)

        self.assertEqual(storage_writer.number_of_warnings, 0)
        self.assertEqual(storage_writer.number_of_events, 4)

        events = list(storage_writer.GetSortedEvents())

        expected_event_values = {
            'connection_type': 'Wired',
            'data_type': 'windows:registry:network',
            'default_gateway_mac': '00:50:56:ea:6c:ec',
            'description': 'Network',
            'dns_suffix': 'localdomain',
            'ssid': 'Network',
            'timestamp': '2014-05-06 17:02:19.795000',
            'timestamp_desc': definitions.TIME_DESCRIPTION_CREATION
        }

        self.CheckEventValues(storage_writer, events[0], expected_event_values)

        expected_event_values = {
            'connection_type': 'Wireless',
            'data_type': 'windows:registry:network',
            'description': 'My Awesome Wifi Hotspot',
            'ssid': 'My Awesome Wifi Hotspot',
            'timestamp': '2015-01-27 15:15:27.965000',
            'timestamp_desc': definitions.TIME_DESCRIPTION_LAST_CONNECTED
        }

        self.CheckEventValues(storage_writer, events[3], expected_event_values)