Exemple #1
0
 def EficheckDumpImage(self, args):
     stderr = "Unable to connect to the kernel driver."
     exec_response = rdf_client_action.ExecuteBinaryResponse(
         stderr=stderr.encode("utf-8"), exit_status=1)
     response = rdf_apple_firmware.DumpEfiImageResponse(
         eficheck_version="1.9.6", response=exec_response)
     return [response]
Exemple #2
0
  def Run(self, args):
    """Use eficheck to extract the binary image of the flash.

    Args:
      args: EficheckConfig
    Returns:
      DumpEfiImageResponse

    This action executes eficheck multiple times:
      * First to get the binary version, using --version.
      * Use --save -b firmware.bin to save the image.
    """

    eficheck_version = self._GetVersion(args)
    if not eficheck_version:
      return False

    with tempfiles.TemporaryDirectory(cleanup=False) as tmp_dir:
      res = client_utils_common.Execute(
          args.cmd_path, ["--save", "-b", "firmware.bin"], cwd=tmp_dir.path)
      stdout, stderr, exit_status, time_used = res
      binary_response = rdf_client_action.ExecuteBinaryResponse(
          stdout=stdout,
          stderr=stderr,
          exit_status=exit_status,
          time_used=time_used)
      response = rdf_apple_firmware.DumpEfiImageResponse(
          eficheck_version=eficheck_version, response=binary_response)
      if exit_status:
        tmp_dir.cleanup = True
      else:
        response.path = rdf_paths.PathSpec(
            path=os.path.join(tmp_dir.path, "firmware.bin"),
            pathtype=rdf_paths.PathSpec.PathType.TMPFILE)
      self.SendReply(response)
Exemple #3
0
 def EficheckDumpImage(self, args):
     flash_fd, flash_path = tempfiles.CreateGRRTempFileVFS()
     flash_fd.close()
     stdout = "Image successfully written to firmware.bin."
     exec_response = rdf_client_action.ExecuteBinaryResponse(
         stdout=stdout.encode("utf-8"), exit_status=0)
     response = rdf_apple_firmware.DumpEfiImageResponse(
         eficheck_version="1.9.6", response=exec_response, path=flash_path)
     return [response]