예제 #1
0
    def testProcess(self):
        """Tests the Process function on a LS Quarantine database file."""
        plugin = ls_quarantine.LsQuarantinePlugin()
        storage_writer = self._ParseDatabaseFileWithPlugin(['quarantine.db'],
                                                           plugin)

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

        events = list(storage_writer.GetEvents())

        # Examine a VLC event.
        expected_event_values = {
            'agent':
            'Google Chrome',
            'data_type':
            'macosx:lsquarantine',
            'timestamp':
            '2013-07-08 21:12:03.000000',
            'url':
            ('http://download.cnet.com/VLC-Media-Player/'
             '3001-2139_4-10210434.html?spi=40ab24d3c71594a5017d74be3b0c946c')
        }

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

        # Examine a MacKeeper event.
        expected_event_values = {
            'agent': 'Google Chrome',
            'data_type': 'macosx:lsquarantine',
            'timestamp': '2013-07-12 19:28:58.000000'
        }

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

        # Examine a SpeedTest event.
        expected_event_values = {
            'agent':
            'Google Chrome',
            'data_type':
            'macosx:lsquarantine',
            'data': ('http://download.mackeeper.zeobit.com/package.php?'
                     'key=460245286&trt=5&landpr=Speedtest'),
            'timestamp':
            '2013-07-12 19:30:16.000000',
            'url':
            ('http://mackeeperapp.zeobit.com/aff/speedtest.net.6/download.php?'
             'affid=460245286&trt=5&utm_campaign=3ES&tid_ext=P107fSKcSfqpMbcP3'
             'sI4fhKmeMchEB3dkAGpX4YIsvM;US;L;1')
        }

        self.CheckEventValues(storage_writer, events[10],
                              expected_event_values)
예제 #2
0
    def testProcess(self):
        """Tests the Process function on a LS Quarantine database file."""
        plugin = ls_quarantine.LsQuarantinePlugin()
        storage_writer = self._ParseDatabaseFileWithPlugin(['quarantine.db'],
                                                           plugin)

        # The quarantine database contains 14 events.
        self.assertEqual(storage_writer.number_of_events, 14)

        events = list(storage_writer.GetEvents())

        # Examine a VLC event.
        event = events[3]

        expected_timestamp = timelib.Timestamp.CopyFromString(
            '2013-07-08 21:12:03')
        self.assertEqual(event.timestamp, expected_timestamp)

        self.assertEqual(event.agent, 'Google Chrome')
        expected_url = (
            'http://download.cnet.com/VLC-Media-Player/3001-2139_4-10210434.html'
            '?spi=40ab24d3c71594a5017d74be3b0c946c')
        self.assertEqual(event.url, expected_url)

        self.assertTrue('vlc-2.0.7-intel64.dmg' in event.data)

        # Examine a MacKeeper event.
        event = events[9]

        expected_timestamp = timelib.Timestamp.CopyFromString(
            '2013-07-12 19:28:58')
        self.assertEqual(event.timestamp, expected_timestamp)

        # Examine a SpeedTest event.
        event = events[10]

        expected_timestamp = timelib.Timestamp.CopyFromString(
            '2013-07-12 19:30:16')
        self.assertEqual(event.timestamp, expected_timestamp)

        expected_message = (
            '[Google Chrome] Downloaded: http://mackeeperapp.zeobit.com/aff/'
            'speedtest.net.6/download.php?affid=460245286&trt=5&utm_campaign='
            '3ES&tid_ext=P107fSKcSfqpMbcP3sI4fhKmeMchEB3dkAGpX4YIsvM;US;L;1 '
            '<http://download.mackeeper.zeobit.com/package.php?'
            'key=460245286&trt=5&landpr=Speedtest>')
        expected_short_message = (
            'http://mackeeperapp.zeobit.com/aff/speedtest.net.6/download.php?'
            'affid=4602452...')

        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)
예제 #3
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     self._plugin = ls_quarantine.LsQuarantinePlugin()
예제 #4
0
 def setUp(self):
   """Makes preparations before running an individual test."""
   self._plugin = ls_quarantine.LsQuarantinePlugin()
예제 #5
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     pre_obj = event.PreprocessObject()
     self._plugin = ls_quarantine.LsQuarantinePlugin(pre_obj)