Пример #1
0
  def testProcess(self):
    """Tests the Process function on a Skype History database file.

    The History file contains 24 events:
      3 call events
      4 transfers file events
      1 sms event
      1 account event
      15 chat events

    Events used:
      id = 16 -> SMS
      id = 22 -> Call
      id = 18 -> File
      id =  1 -> Chat
      id = 14 -> ChatRoom
    """
    plugin = skype.SkypePlugin()
    storage_writer = self._ParseDatabaseFileWithPlugin(
        ['skype_main.db'], plugin)

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

    events = list(storage_writer.GetEvents())

    number_of_calls = 0
    number_of_files = 0
    number_of_sms = 0
    number_of_chats = 0
    number_of_account_events = 0
    for event in events:
      event_data = self._GetEventDataOfEvent(storage_writer, event)
      if event_data.data_type == 'skype:event:call':
        number_of_calls += 1
      if event_data.data_type == 'skype:event:transferfile':
        number_of_files += 1
      if event_data.data_type == 'skype:event:sms':
        number_of_sms += 1
      if event_data.data_type == 'skype:event:chat':
        number_of_chats += 1
      if event_data.data_type == 'skype:event:account':
        number_of_account_events += 1

    self.assertEqual(number_of_files, 4)
    self.assertEqual(number_of_sms, 1)
    self.assertEqual(number_of_chats, 15)
    self.assertEqual(number_of_calls, 3)

    # Test cache processing and format strings.
    event = events[17]

    event_data = self._GetEventDataOfEvent(storage_writer, event)

    expected_message = (
        'Source: gen.beringer <Gen Beringer> Destination: '
        'european.bbq.competitor <European BBQ> File: secret-project.pdf '
        '[SENDSOLICITUDE]')
    expected_short_message = '{0:s}...'.format(expected_message[:77])

    self._TestGetMessageStrings(
        event_data, expected_message, expected_short_message)

    sms_event = events[16]

    self.CheckTimestamp(sms_event.timestamp, '2013-07-01 22:14:22.000000')

    sms_event_data = self._GetEventDataOfEvent(storage_writer, sms_event)
    text_sms = (
        'If you want I can copy '
        'some documents for you, '
        'if you can pay it... ;)')
    self.assertEqual(sms_event_data.text, text_sms)
    self.assertEqual(sms_event_data.number, '+34123456789')

    file_event = events[18]

    self.CheckTimestamp(file_event.timestamp, '2013-10-24 21:49:35.000000')

    file_event_data = self._GetEventDataOfEvent(storage_writer, file_event)
    self.assertEqual(file_event_data.action_type, 'GETSOLICITUDE')
    self.assertEqual(
        file_event_data.source, 'gen.beringer <Gen Beringer>')
    self.assertEqual(
        file_event_data.destination, 'european.bbq.competitor <European BBQ>')
    self.assertEqual(
        file_event_data.transferred_filename, 'secret-project.pdf')
    self.assertEqual(
        file_event_data.transferred_filepath,
        '/Users/gberinger/Desktop/secret-project.pdf')
    self.assertEqual(file_event_data.transferred_filesize, 69986)

    chat_event = events[1]

    self.CheckTimestamp(chat_event.timestamp, '2013-07-30 21:27:11.000000')

    chat_event_data = self._GetEventDataOfEvent(storage_writer, chat_event)
    self.assertEqual(
        chat_event_data.title,
        'European Competitor | need to know if you got it..')
    self.assertEqual(
        chat_event_data.text, 'need to know if you got it this time.')
    self.assertEqual(
        chat_event_data.from_account, 'Gen Beringer <gen.beringer>')
    self.assertEqual(chat_event_data.to_account, 'european.bbq.competitor')

    chat_room_event = events[14]

    self.CheckTimestamp(chat_room_event.timestamp, '2013-10-27 15:29:19.000000')

    chat_room_event_data = self._GetEventDataOfEvent(
        storage_writer, chat_room_event)
    self.assertEqual(chat_room_event_data.title, 'European Competitor, Echo123')
    self.assertEqual(chat_room_event_data.text, 'He is our new employee')
    self.assertEqual(
        chat_room_event_data.from_account,
        'European Competitor <european.bbq.competitor>')
    self.assertEqual(chat_room_event_data.to_account, 'gen.beringer, echo123')

    call_event = events[22]

    self.CheckTimestamp(call_event.timestamp, '2013-07-01 22:12:17.000000')

    call_event_data = self._GetEventDataOfEvent(storage_writer, call_event)
    self.assertEqual(call_event_data.dst_call, 'european.bbq.competitor')
    self.assertEqual(call_event_data.src_call, 'gen.beringer')
    self.assertEqual(call_event_data.user_start_call, False)
    self.assertEqual(call_event_data.video_conference, False)
Пример #2
0
 def setUp(self):
     """Makes preparations before running an individual test."""
     self._plugin = skype.SkypePlugin()
Пример #3
0
  def testProcess(self):
    """Tests the Process function on a Skype History database file.

      The History file contains 24 events:
      4 call events
      4 transfers file events
      1 sms events
      15 chat events

      Events used:
      id = 16 -> SMS
      id = 22 -> Call
      id = 18 -> File
      id =  1 -> Chat
      id = 14 -> ChatRoom
    """
    plugin = skype.SkypePlugin()
    storage_writer = self._ParseDatabaseFileWithPlugin(
        ['skype_main.db'], plugin)

    self.assertEqual(storage_writer.number_of_events, 24)

    events = list(storage_writer.GetEvents())

    number_of_calls = 0
    number_of_files = 0
    number_of_sms = 0
    number_of_chats = 0
    for event in events:
      if event.data_type == 'skype:event:call':
        number_of_calls += 1
      if event.data_type == 'skype:event:transferfile':
        number_of_files += 1
      if event.data_type == 'skype:event:sms':
        number_of_sms += 1
      if event.data_type == 'skype:event:chat':
        number_of_chats += 1

    self.assertEqual(number_of_files, 4)
    self.assertEqual(number_of_sms, 1)
    self.assertEqual(number_of_chats, 15)
    self.assertEqual(number_of_calls, 3)

    # TODO: Split this up into separate functions for testing each type of
    # event, e.g. testSMS, etc.
    sms_event = events[16]
    call_event = events[22]
    event_file = events[18]
    chat_event = events[1]
    chat_room_event = events[14]

    # Test cache processing and format strings.
    event = events[17]

    expected_message = (
        'Source: gen.beringer <Gen Beringer> Destination: '
        'european.bbq.competitor <European BBQ> File: secret-project.pdf '
        '[SENDSOLICITUDE]')
    expected_short_message = '{0:s}...'.format(expected_message[:77])

    self._TestGetMessageStrings(event, expected_message, expected_short_message)

    expected_timestamp = timelib.Timestamp.CopyFromString(
        '2013-07-01 22:14:22')
    self.assertEqual(sms_event.timestamp, expected_timestamp)

    text_sms = (
        'If you want I can copy '
        'some documents for you, '
        'if you can pay it... ;)')
    self.assertEqual(sms_event.text, text_sms)

    self.assertEqual(sms_event.number, '+34123456789')

    expected_timestamp = timelib.Timestamp.CopyFromString(
        '2013-10-24 21:49:35')
    self.assertEqual(event_file.timestamp, expected_timestamp)

    action_type = 'GETSOLICITUDE'
    self.assertEqual(event_file.action_type, action_type)
    source = 'gen.beringer <Gen Beringer>'
    self.assertEqual(event_file.source, source)
    destination = 'european.bbq.competitor <European BBQ>'
    self.assertEqual(event_file.destination, destination)
    transferred_filename = 'secret-project.pdf'
    self.assertEqual(event_file.transferred_filename, transferred_filename)
    filepath = '/Users/gberinger/Desktop/secret-project.pdf'
    self.assertEqual(event_file.transferred_filepath, filepath)
    self.assertEqual(event_file.transferred_filesize, 69986)

    expected_timestamp = timelib.Timestamp.CopyFromString(
        '2013-07-30 21:27:11')
    self.assertEqual(chat_event.timestamp, expected_timestamp)

    title = 'European Competitor | need to know if you got it..'
    self.assertEqual(chat_event.title, title)
    expected_message = 'need to know if you got it this time.'
    self.assertEqual(chat_event.text, expected_message)
    from_account = 'Gen Beringer <gen.beringer>'
    self.assertEqual(chat_event.from_account, from_account)
    self.assertEqual(chat_event.to_account, 'european.bbq.competitor')

    expected_timestamp = timelib.Timestamp.CopyFromString(
        '2013-10-27 15:29:19')
    self.assertEqual(chat_room_event.timestamp, expected_timestamp)

    title = 'European Competitor, Echo123'
    self.assertEqual(chat_room_event.title, title)
    expected_message = 'He is our new employee'
    self.assertEqual(chat_room_event.text, expected_message)
    from_account = 'European Competitor <european.bbq.competitor>'
    self.assertEqual(chat_room_event.from_account, from_account)
    to_account = 'gen.beringer, echo123'
    self.assertEqual(chat_room_event.to_account, to_account)

    expected_timestamp = timelib.Timestamp.CopyFromString(
        '2013-07-01 22:12:17')
    self.assertEqual(call_event.timestamp, expected_timestamp)

    self.assertEqual(call_event.dst_call, 'european.bbq.competitor')
    self.assertEqual(call_event.src_call, 'gen.beringer')
    self.assertEqual(call_event.user_start_call, False)
    self.assertEqual(call_event.video_conference, False)
Пример #4
0
    def testProcess(self):
        """Tests the Process function on a Skype History database file.

    The History file contains 24 events:
      3 call events
      4 transfers file events
      1 sms event
      1 account event
      15 chat events

    Events used:
      id = 16 -> SMS
      id = 22 -> Call
      id = 18 -> File
      id =  1 -> Chat
      id = 14 -> ChatRoom
    """
        plugin = skype.SkypePlugin()
        storage_writer = self._ParseDatabaseFileWithPlugin(['skype_main.db'],
                                                           plugin)

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

        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())

        number_of_calls = 0
        number_of_files = 0
        number_of_sms = 0
        number_of_chats = 0
        number_of_account_events = 0
        for event in events:
            event_data = self._GetEventDataOfEvent(storage_writer, event)
            if event_data.data_type == 'skype:event:call':
                number_of_calls += 1
            if event_data.data_type == 'skype:event:transferfile':
                number_of_files += 1
            if event_data.data_type == 'skype:event:sms':
                number_of_sms += 1
            if event_data.data_type == 'skype:event:chat':
                number_of_chats += 1
            if event_data.data_type == 'skype:event:account':
                number_of_account_events += 1

        self.assertEqual(number_of_files, 4)
        self.assertEqual(number_of_sms, 1)
        self.assertEqual(number_of_chats, 15)
        self.assertEqual(number_of_calls, 3)

        # Test transfer file event.
        expected_event_values = {
            'action_type': 'SENDSOLICITUDE',
            'data_type': 'skype:event:transferfile',
            'date_time': '2013-10-24 21:49:32',
            'destination': 'european.bbq.competitor <European BBQ>',
            'source': 'gen.beringer <Gen Beringer>',
            'transferred_filename': 'secret-project.pdf'
        }

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

        # Test SMS event.
        expected_event_values = {
            'data_type':
            'skype:event:sms',
            'date_time':
            '2013-07-01 22:14:22',
            'number':
            '+34123456789',
            'text':
            ('If you want I can copy some documents for you, if you can pay '
             'it... ;)')
        }

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

        # Test file event.
        expected_event_values = {
            'action_type': 'GETSOLICITUDE',
            'data_type': 'skype:event:transferfile',
            'date_time': '2013-10-24 21:49:35',
            'destination': 'european.bbq.competitor <European BBQ>',
            'source': 'gen.beringer <Gen Beringer>',
            'transferred_filename': 'secret-project.pdf',
            'transferred_filepath':
            '/Users/gberinger/Desktop/secret-project.pdf',
            'transferred_filesize': 69986
        }

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

        # Test chat event.
        expected_event_values = {
            'data_type': 'skype:event:chat',
            'date_time': '2013-07-30 21:27:11',
            'from_account': 'Gen Beringer <gen.beringer>',
            'text': 'need to know if you got it this time.',
            'title': 'European Competitor | need to know if you got it..',
            'to_account': 'european.bbq.competitor'
        }

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

        # Test chat room event.
        expected_event_values = {
            'data_type': 'skype:event:chat',
            'date_time': '2013-10-27 15:29:19',
            'from_account': 'European Competitor <european.bbq.competitor>',
            'text': 'He is our new employee',
            'title': 'European Competitor, Echo123',
            'to_account': 'gen.beringer, echo123'
        }

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

        # Test call event.
        expected_event_values = {
            'data_type': 'skype:event:call',
            'date_time': '2013-07-01 22:12:17',
            'dst_call': 'european.bbq.competitor',
            'src_call': 'gen.beringer',
            'user_start_call': False,
            'video_conference': False
        }

        self.CheckEventValues(storage_writer, events[22],
                              expected_event_values)
Пример #5
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     pre_obj = event.PreprocessObject()
     self._plugin = skype.SkypePlugin(pre_obj)
Пример #6
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     self._plugin = skype.SkypePlugin()