Beispiel #1
0
  def CheckFlow(self):
    pos = self.test_output_path.find("*")
    if pos > 0:
      prefix = self.client_id.Add(self.test_output_path[:pos])
      for urn in base.RecursiveListChildren(prefix=prefix):
        if re.search(self.test_output_path + "$", str(urn)):
          self.delete_urns.add(urn)
          return self.CheckFile(aff4.FACTORY.Open(urn, token=self.token))

      self.fail(("Output file not found. Maybe the GRR client "
                 "is not running with root privileges?"))

    else:
      urn = self.client_id.Add(self.test_output_path)
      fd = aff4.FACTORY.Open(urn, token=self.token)
      if isinstance(fd, aff4.BlobImage):
        return self.CheckFile(fd)
      self.fail("Output file %s not found." % urn)
Beispiel #2
0
    def CheckFlow(self):
        pos = self.output_path.find("*")
        urn = None
        if pos > 0:
            base_urn = self.client_id.Add(self.output_path[:pos])
            for urn in base.RecursiveListChildren(prefix=base_urn):
                if re.search(self.output_path + "$", str(urn)):
                    self.delete_urns.add(urn.Add(self.file_to_find))
                    self.delete_urns.add(urn)
                    break
            self.assertNotEqual(urn, None, "Could not locate Directory.")
        else:
            urn = self.client_id.Add(self.output_path)

        fd = aff4.FACTORY.Open(urn.Add(self.file_to_find),
                               mode="r",
                               token=self.token)
        if type(fd) == aff4.AFF4Volume:
            self.fail(
                ("No results were written to the data store. Maybe the GRR "
                 "client is not running with root privileges?"))
        self.assertEqual(type(fd), aff4.VFSFile)