Ejemplo n.º 1
0
  def Handle(self, args, context=None):
    output_fname = re.sub("[^0-9a-zA-Z]+", "_", str(args.hunt_id))
    code_to_execute = ("""grrapi.Hunt("%s").GetFilesArchive()."""
                       """WriteToFile("./hunt_results_%s.zip")""") % (
                           args.hunt_id, output_fname)

    export_command_str = " ".join([
        config.CONFIG["AdminUI.export_command"], "--exec_code",
        utils.ShellQuote(code_to_execute)
    ])

    return ApiGetHuntResultsExportCommandResult(command=export_command_str)
Ejemplo n.º 2
0
Archivo: flow.py Proyecto: x35029/grr
  def Handle(self, args, token=None):
    output_fname = re.sub(
        "[^0-9a-zA-Z]+", "_", "%s_%s" %
        (utils.SmartStr(args.client_id), utils.SmartStr(args.flow_id)))
    code_to_execute = ("""grrapi.Client("%s").Flow("%s").GetFilesArchive()."""
                       """WriteToFile("./flow_results_%s.zip")""") % (
                           args.client_id, args.flow_id, output_fname)

    export_command_str = " ".join([
        config.CONFIG["AdminUI.export_command"], "--exec_code",
        utils.ShellQuote(code_to_execute)
    ])

    return ApiGetFlowResultsExportCommandResult(command=export_command_str)
Ejemplo n.º 3
0
    def Handle(self, args, token=None):
        ValidateVfsPath(args.file_path)

        output_fname = os.path.basename(args.file_path)

        code_to_execute = (
            """grrapi.Client("%s").File(r\"\"\"%s\"\"\").GetBlob()."""
            """WriteToFile("./%s")""") % (args.client_id, args.file_path,
                                          output_fname)

        export_command = u" ".join([
            config.CONFIG["AdminUI.export_command"], "--exec_code",
            utils.ShellQuote(code_to_execute)
        ])

        return ApiGetFileDownloadCommandResult(command=export_command)