Exemplo n.º 1
0
    def testParseWithTimeZone(self):
        """Tests the Parse function with a time zone."""
        parser = sophos_av.SophosAVLogParser()
        storage_writer = self._ParseFile(['sav.txt'], parser, timezone='CET')

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 9)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)

        events = list(storage_writer.GetEvents())

        expected_event_values = {
            'date_time':
            '2010-07-20 18:38:14',
            'data_type':
            'sophos:av:log',
            'text':
            ('File "C:\\Documents and Settings\\Administrator\\Desktop\\'
             'sxl_test_50.com" belongs to virus/spyware \'LiveProtectTest\'.'),
            'timestamp':
            '2010-07-20 16:38:14.000000'
        }

        self.CheckEventValues(storage_writer, events[0], expected_event_values)
Exemplo n.º 2
0
  def testParseWithTimeZone(self):
    """Tests the Parse function with a time zone."""
    parser = sophos_av.SophosAVLogParser()
    storage_writer = self._ParseFile(['sav.txt'], parser, timezone='CET')

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

    events = list(storage_writer.GetEvents())

    event = events[0]

    self.CheckTimestamp(event.timestamp, '2010-07-20 16:38:14.000000')
Exemplo n.º 3
0
  def testParse(self):
    """Tests the Parse function."""
    parser = sophos_av.SophosAVLogParser()
    storage_writer = self._ParseFile(['sav.txt'], parser)

    self.assertEqual(storage_writer.number_of_events, 9)

    events = list(storage_writer.GetEvents())

    event = events[0]

    self.CheckTimestamp(event.timestamp, '2010-07-20 18:38:14.000000')

    expected_message = (
        'File "C:\\Documents and Settings\\Administrator\\Desktop\\'
        'sxl_test_50.com" belongs to virus/spyware \'LiveProtectTest\'.')
    expected_short_message = '{0:s}...'.format(expected_message[:77])
    self._TestGetMessageStrings(event, expected_message, expected_short_message)
Exemplo n.º 4
0
  def testParse(self):
    """Tests the Parse function."""
    parser = sophos_av.SophosAVLogParser()
    storage_writer = self._ParseFile(['sav.txt'], parser)

    self.assertEqual(storage_writer.number_of_events, 9)
    self.assertEqual(storage_writer.number_of_extraction_warnings, 0)
    self.assertEqual(storage_writer.number_of_recovery_warnings, 0)

    events = list(storage_writer.GetEvents())

    expected_event_values = {
        'date_time': '2010-07-20 18:38:14',
        'data_type': 'sophos:av:log',
        'text': (
            'File "C:\\Documents and Settings\\Administrator\\Desktop\\'
            'sxl_test_50.com" belongs to virus/spyware \'LiveProtectTest\'.')}

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