示例#1
0
  def _CollectArtifact(self, artifact, apply_parsers):
    artifact_result = rdf_artifacts.CollectedArtifact(name=artifact.name)

    processors = []
    if apply_parsers:
      processors = parser.Parser.GetClassesByArtifact(artifact.name)

    for source in artifact.sources:
      for action, request in self._ParseSourceType(source):
        responses = self._RunClientAction(action, request, processors)
        for response in responses:
          action_result = rdf_artifacts.ClientActionResult()
          action_result.type = response.__class__.__name__
          action_result.value = response
          artifact_result.action_results.append(action_result)
    return artifact_result
示例#2
0
    def _CollectArtifact(self, artifact, apply_parsers):
        artifact_result = rdf_artifacts.CollectedArtifact(name=artifact.name)

        processors = []
        if apply_parsers:
            processors = parser.Parser.GetClassesByArtifact(artifact.name)

        for source_result_list in self._ProcessSources(artifact.sources,
                                                       processors):
            for response in source_result_list:
                action_result = rdf_artifacts.ClientActionResult()
                action_result.type = response.__class__.__name__
                action_result.value = response
                artifact_result.action_results.append(action_result)

        return artifact_result
示例#3
0
  def _CollectArtifact(self, artifact, apply_parsers):
    """Returns an `CollectedArtifact` rdf object for the requested artifact."""
    artifact_result = rdf_artifacts.CollectedArtifact(name=artifact.name)

    parsers = []
    if apply_parsers:
      parsers = parser_lib.Parser.GetClassesByArtifact(artifact.name)

    for source_result_list in self._ProcessSources(artifact.sources, parsers):
      for response in source_result_list:
        action_result = rdf_artifacts.ClientActionResult()
        action_result.type = response.__class__.__name__
        action_result.value = response
        artifact_result.action_results.append(action_result)
        self.UpdateKnowledgeBase(response, artifact.provides)

    return artifact_result
示例#4
0
    def _CollectArtifact(self, artifact, apply_parsers):
        """Returns an `CollectedArtifact` rdf object for the requested artifact."""
        artifact_result = rdf_artifacts.CollectedArtifact(name=artifact.name)

        if apply_parsers:
            parser_factory = parsers.ArtifactParserFactory(
                unicode(artifact.name))
        else:
            parser_factory = None

        for source_result_list in self._ProcessSources(artifact.sources,
                                                       parser_factory):
            for response in source_result_list:
                action_result = rdf_artifacts.ClientActionResult()
                action_result.type = response.__class__.__name__
                action_result.value = response
                artifact_result.action_results.append(action_result)
                self.UpdateKnowledgeBase(response, artifact.provides)

        return artifact_result