Beispiel #1
0
 def testBaseSessionIdFlowRunnerArgumentIsNotRespected(self):
     args = cron_plugin.ApiCronJob(
         flow_name=standard.CreateAndRunGenericHuntFlow.__name__,
         flow_runner_args=rdf_flows.FlowRunnerArgs(
             base_session_id="aff4:/foo"))
     result = self.handler.Handle(args, token=self.token)
     self.assertFalse(result.flow_runner_args.HasField("base_session_id"))
Beispiel #2
0
  def Run(self):

    def ReplaceCronJobUrn():
      jobs = list(cronjobs.CRON_MANAGER.ListJobs(token=self.token))
      return {jobs[0].Basename(): "CreateAndRunGeneicHuntFlow_1234"}

    flow_args = standard.CreateGenericHuntFlowArgs()
    flow_args.hunt_args.flow_args = rdf_file_finder.FileFinderArgs(
        paths=["c:\\windows\\system32\\notepad.*"])
    flow_args.hunt_args.flow_runner_args.flow_name = (
        file_finder.FileFinder.__name__)
    flow_args.hunt_runner_args.client_rule_set.rules = [
        rdf_foreman.ForemanClientRule(os=rdf_foreman.ForemanOsClientRule(
            os_windows=True))
    ]
    flow_args.hunt_runner_args.description = "Foobar! (cron)"

    self.Check(
        "CreateCronJob",
        args=cron_plugin.ApiCronJob(
            description="Foobar!",
            flow_name=standard.CreateAndRunGenericHuntFlow.__name__,
            periodicity=604800,
            lifetime=3600,
            flow_args=flow_args),
        replace=ReplaceCronJobUrn)