grr/server/grr_response_server/db_compat.py
def ProcessHuntClientCrash(flow_obj, client_crash_info):
  """Processes client crash triggerted by a given hunt-induced flow."""

  if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id):

    def UpdateFn(hunt_obj):
      hunt_obj.num_crashed_clients += 1
      return hunt_obj

    hunt_obj = data_store.REL_DB.UpdateHuntObject(flow_obj.parent_hunt_id,
                                                  UpdateFn)

    if (hunt_obj.crash_limit and
        hunt_obj.num_crashed_clients >= hunt_obj.crash_limit):
      # Remove our rules from the forman and cancel all the started flows.
      # Hunt will be hard-stopped and it will be impossible to restart it.
      reason = ("Hunt %s reached the crashes limit of %d "
                "and was stopped.") % (hunt_obj.hunt_id, hunt_obj.crash_limit)
      hunt.StopHunt(hunt_obj.hunt_id, reason=reason)

    hunt_obj = hunt.StopHuntIfAverageLimitsExceeded(hunt_obj)
    return

  hunt_urn = rdfvalue.RDFURN("hunts").Add(flow_obj.parent_hunt_id)

  with aff4.FACTORY.Open(hunt_urn, mode="rw") as fd:
    # Legacy AFF4 code expects token to be set.
    fd.token = access_control.ACLToken(username=fd.creator)
    fd.RegisterCrash(client_crash_info)
Processes client crash triggerted by a given hunt-induced flow.
Processes client crash triggerted by a given hunt-induced flow.
Processes client crash triggerted by a given hunt - induced flow .
def ProcessHuntClientCrash(flow_obj, client_crash_info):
  if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id):
    def UpdateFn(hunt_obj):
      hunt_obj.num_crashed_clients += 1
      return hunt_obj
    hunt_obj = data_store.REL_DB.UpdateHuntObject(flow_obj.parent_hunt_id,
                                                  UpdateFn)
    if (hunt_obj.crash_limit and
        hunt_obj.num_crashed_clients >= hunt_obj.crash_limit):
      reason = ("Hunt %s reached the crashes limit of %d "
                "and was stopped.") % (hunt_obj.hunt_id, hunt_obj.crash_limit)
      hunt.StopHunt(hunt_obj.hunt_id, reason=reason)
    hunt_obj = hunt.StopHuntIfAverageLimitsExceeded(hunt_obj)
    return
  hunt_urn = rdfvalue.RDFURN("hunts").Add(flow_obj.parent_hunt_id)
  with aff4.FACTORY.Open(hunt_urn, mode="rw") as fd:
    fd.token = access_control.ACLToken(username=fd.creator)
    fd.RegisterCrash(client_crash_info)
def ProcessHuntClientCrash ( flow_obj , client_crash_info ) : if not hunt . IsLegacyHunt ( flow_obj . parent_hunt_id ) : def UpdateFn ( hunt_obj ) : hunt_obj . num_crashed_clients += 1 return hunt_obj hunt_obj = data_store . REL_DB . UpdateHuntObject ( flow_obj . parent_hunt_id , UpdateFn ) if ( hunt_obj . crash_limit and hunt_obj . num_crashed_clients >= hunt_obj . crash_limit ) : reason = ( "Hunt %s reached the crashes limit of %d " "and was stopped." ) % ( hunt_obj . hunt_id , hunt_obj . crash_limit ) hunt . StopHunt ( hunt_obj . hunt_id , reason = reason ) hunt_obj = hunt . StopHuntIfAverageLimitsExceeded ( hunt_obj ) return hunt_urn = rdfvalue . RDFURN ( "hunts" ) . Add ( flow_obj . parent_hunt_id ) with aff4 . FACTORY . Open ( hunt_urn , mode = "rw" ) as fd : fd . token = access_control . ACLToken ( username = fd . creator ) fd . RegisterCrash ( client_crash_info )
Processes client crash triggerted by a given hunt-induced flow.
Processes client crash triggerted by a given hunt - induced flow .
"""Processes client crash triggerted by a given hunt-induced flow.""" # Remove our rules from the forman and cancel all the started flows. # Hunt will be hard-stopped and it will be impossible to restart it. # Legacy AFF4 code expects token to be set.
flow_obj
client_crash_info