grr/server/grr_response_server/databases/mem_hunts.py
def ReadHuntFlows(self,
                    hunt_id,
                    offset,
                    count,
                    filter_condition=db.HuntFlowsCondition.UNSET):
    """Reads hunt flows matching given conditins."""
    if filter_condition == db.HuntFlowsCondition.UNSET:
      filter_fn = lambda _: True
    elif filter_condition == db.HuntFlowsCondition.FAILED_FLOWS_ONLY:
      filter_fn = lambda f: f.flow_state == f.FlowState.ERROR
    elif filter_condition == db.HuntFlowsCondition.SUCCEEDED_FLOWS_ONLY:
      filter_fn = lambda f: f.flow_state == f.FlowState.FINISHED
    elif filter_condition == db.HuntFlowsCondition.COMPLETED_FLOWS_ONLY:
      filter_fn = (
          lambda f: f.flow_state in [f.FlowState.ERROR, f.FlowState.FINISHED])
    elif filter_condition == db.HuntFlowsCondition.FLOWS_IN_PROGRESS_ONLY:
      filter_fn = lambda f: f.flow_state == f.FlowState.RUNNING
    elif filter_condition == db.HuntFlowsCondition.CRASHED_FLOWS_ONLY:
      filter_fn = lambda f: f.HasField("client_crash_info")
    elif filter_condition == db.HuntFlowsCondition.FLOWS_WITH_RESULTS_ONLY:
      filter_fn = (lambda f: self.ReadFlowResults(f.client_id, f.flow_id, 0, sys
                                                  .maxsize))
    else:
      raise ValueError("Invalid filter condition: %d" % filter_condition)

    results = [
        flow_obj for flow_obj in self._GetHuntFlows(hunt_id)
        if filter_fn(flow_obj)
    ]
    results.sort(key=lambda f: f.last_update_time)
    return results[offset:offset + count]
Reads hunt flows matching given conditins.
Reads hunt flows matching given conditins.
Reads hunt flows matching given conditins .
def ReadHuntFlows(self,
                    hunt_id,
                    offset,
                    count,
                    filter_condition=db.HuntFlowsCondition.UNSET):
    if filter_condition == db.HuntFlowsCondition.UNSET:
      filter_fn = lambda _: True
    elif filter_condition == db.HuntFlowsCondition.FAILED_FLOWS_ONLY:
      filter_fn = lambda f: f.flow_state == f.FlowState.ERROR
    elif filter_condition == db.HuntFlowsCondition.SUCCEEDED_FLOWS_ONLY:
      filter_fn = lambda f: f.flow_state == f.FlowState.FINISHED
    elif filter_condition == db.HuntFlowsCondition.COMPLETED_FLOWS_ONLY:
      filter_fn = (
          lambda f: f.flow_state in [f.FlowState.ERROR, f.FlowState.FINISHED])
    elif filter_condition == db.HuntFlowsCondition.FLOWS_IN_PROGRESS_ONLY:
      filter_fn = lambda f: f.flow_state == f.FlowState.RUNNING
    elif filter_condition == db.HuntFlowsCondition.CRASHED_FLOWS_ONLY:
      filter_fn = lambda f: f.HasField("client_crash_info")
    elif filter_condition == db.HuntFlowsCondition.FLOWS_WITH_RESULTS_ONLY:
      filter_fn = (lambda f: self.ReadFlowResults(f.client_id, f.flow_id, 0, sys
                                                  .maxsize))
    else:
      raise ValueError("Invalid filter condition: %d" % filter_condition)
    results = [
        flow_obj for flow_obj in self._GetHuntFlows(hunt_id)
        if filter_fn(flow_obj)
    ]
    results.sort(key=lambda f: f.last_update_time)
    return results[offset:offset + count]
def ReadHuntFlows ( self , hunt_id , offset , count , filter_condition = db . HuntFlowsCondition . UNSET ) : if filter_condition == db . HuntFlowsCondition . UNSET : filter_fn = lambda _ : True elif filter_condition == db . HuntFlowsCondition . FAILED_FLOWS_ONLY : filter_fn = lambda f : f . flow_state == f . FlowState . ERROR elif filter_condition == db . HuntFlowsCondition . SUCCEEDED_FLOWS_ONLY : filter_fn = lambda f : f . flow_state == f . FlowState . FINISHED elif filter_condition == db . HuntFlowsCondition . COMPLETED_FLOWS_ONLY : filter_fn = ( lambda f : f . flow_state in [ f . FlowState . ERROR , f . FlowState . FINISHED ] ) elif filter_condition == db . HuntFlowsCondition . FLOWS_IN_PROGRESS_ONLY : filter_fn = lambda f : f . flow_state == f . FlowState . RUNNING elif filter_condition == db . HuntFlowsCondition . CRASHED_FLOWS_ONLY : filter_fn = lambda f : f . HasField ( "client_crash_info" ) elif filter_condition == db . HuntFlowsCondition . FLOWS_WITH_RESULTS_ONLY : filter_fn = ( lambda f : self . ReadFlowResults ( f . client_id , f . flow_id , 0 , sys . maxsize ) ) else : raise ValueError ( "Invalid filter condition: %d" % filter_condition ) results = [ flow_obj for flow_obj in self . _GetHuntFlows ( hunt_id ) if filter_fn ( flow_obj ) ] results . sort ( key = lambda f : f . last_update_time ) return results [ offset : offset + count ]
Reads hunt flows matching given conditins.
Reads hunt flows matching given conditins .
"""Reads hunt flows matching given conditins."""
self
hunt_id
offset
count
filter_condition