Ejemplo n.º 1
0
 def RunChecks(self, responses):
     if not responses.success:
         raise RuntimeError("Checks did not run successfully.")
     # Hand host data across to checks. Do this after all data has been collected
     # in case some checks require multiple artifacts/results.
     for finding in checks.CheckHost(
             self.state.host_data,
             os_name=self.state.knowledge_base.os,
             restrict_checks=self.args.restrict_checks):
         self.state.checks_run.append(finding.check_id)
         if finding.anomaly:
             self.state.checks_with_findings.append(finding.check_id)
         self.SendReply(finding)
Ejemplo n.º 2
0
  def RunChecks(self, host_data, labels=None, restrict_checks=None):
    """Runs the registered checks against the provided host data.

    Args:
      host_data: A dictionary of artifact_names and results. Results are, in
        turn, a dictionary of {'ANOMALY': [], 'PARSED': [], 'RAW': []} items.
      labels: Additional labels attached to the host.
      restrict_checks: A list specifying a subset of check_ids to run.

    Returns:
      An iterator of check results.
    """
    return {
        r.check_id: r for r in checks.CheckHost(
            host_data, labels=labels, restrict_checks=restrict_checks)
    }