Esempio n. 1
0
    def _CreateTestEventObject(self, pe_event):
        """Create a test event object with a particular path.

    Args:
      service_event: A hash containing attributes of an event to add to the
                     queue.

    Returns:
      An event object (instance of EventObject) that contains the necessary
      attributes for testing.
    """
        test_pathspec = fake_path_spec.FakePathSpec(
            location=u'C:\\WINDOWS\\system32\\evil.exe')
        event_object = pe.PECompilationEvent(pe_event[u'timestamp'],
                                             u'Executable (EXE)', [], u'')
        event_object.pathspec = test_pathspec
        event_object.sha256_hash = pe_event[u'sha256_hash']
        event_object.uuid = pe_event[u'uuid']
        return event_object
Esempio n. 2
0
    def _CreateTestEventObject(self, event_dictionary):
        """Create a test event with a set of attributes.

    Args:
      event_dictionary (dict[str, str]): contains attributes of an event to add
          to the queue.

    Returns:
      EventObject: event with the appropriate attributes for testing.
    """
        event = pe.PECompilationEvent(event_dictionary[u'timestamp'],
                                      u'Executable (EXE)', [], u'')

        for attribute_name, attribute_value in event_dictionary.items():
            if attribute_name == u'timestamp':
                continue

            setattr(event, attribute_name, attribute_value)

        return event