repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
google/grr | grr/client/grr_response_client/client_actions/searching.py | Grep.Run | def Run(self, args):
"""Search the file for the pattern.
This implements the grep algorithm used to scan files. It reads
the data in chunks of BUFF_SIZE (10 MB currently) and can use
different functions to search for matching patterns. In every
step, a buffer that is a bit bigger than the block siz... | python | def Run(self, args):
"""Search the file for the pattern.
This implements the grep algorithm used to scan files. It reads
the data in chunks of BUFF_SIZE (10 MB currently) and can use
different functions to search for matching patterns. In every
step, a buffer that is a bit bigger than the block siz... | [
"def",
"Run",
"(",
"self",
",",
"args",
")",
":",
"fd",
"=",
"vfs",
".",
"VFSOpen",
"(",
"args",
".",
"target",
",",
"progress_callback",
"=",
"self",
".",
"Progress",
")",
"fd",
".",
"Seek",
"(",
"args",
".",
"start_offset",
")",
"base_offset",
"=",... | Search the file for the pattern.
This implements the grep algorithm used to scan files. It reads
the data in chunks of BUFF_SIZE (10 MB currently) and can use
different functions to search for matching patterns. In every
step, a buffer that is a bit bigger than the block size is used in
order to re... | [
"Search",
"the",
"file",
"for",
"the",
"pattern",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/searching.py#L220-L352 | train | This function searches the file for a pattern and returns the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | StopHuntIfCrashLimitExceeded | def StopHuntIfCrashLimitExceeded(hunt_id):
"""Stops the hunt if number of crashes exceeds the limit."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
# Do nothing if the hunt is already stopped.
if hunt_obj.hunt_state == rdf_hunt_objects.Hunt.HuntState.STOPPED:
return hunt_obj
if hunt_obj.crash_l... | python | def StopHuntIfCrashLimitExceeded(hunt_id):
"""Stops the hunt if number of crashes exceeds the limit."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
# Do nothing if the hunt is already stopped.
if hunt_obj.hunt_state == rdf_hunt_objects.Hunt.HuntState.STOPPED:
return hunt_obj
if hunt_obj.crash_l... | [
"def",
"StopHuntIfCrashLimitExceeded",
"(",
"hunt_id",
")",
":",
"hunt_obj",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"# Do nothing if the hunt is already stopped.",
"if",
"hunt_obj",
".",
"hunt_state",
"==",
"rdf_hunt_objects",
".",... | Stops the hunt if number of crashes exceeds the limit. | [
"Stops",
"the",
"hunt",
"if",
"number",
"of",
"crashes",
"exceeds",
"the",
"limit",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L94-L111 | train | Stops the hunt if number of crashes exceeds the limit. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | StopHuntIfCPUOrNetworkLimitsExceeded | def StopHuntIfCPUOrNetworkLimitsExceeded(hunt_id):
"""Stops the hunt if average limites are exceeded."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
# Do nothing if the hunt is already stopped.
if hunt_obj.hunt_state == rdf_hunt_objects.Hunt.HuntState.STOPPED:
return hunt_obj
hunt_counters = da... | python | def StopHuntIfCPUOrNetworkLimitsExceeded(hunt_id):
"""Stops the hunt if average limites are exceeded."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
# Do nothing if the hunt is already stopped.
if hunt_obj.hunt_state == rdf_hunt_objects.Hunt.HuntState.STOPPED:
return hunt_obj
hunt_counters = da... | [
"def",
"StopHuntIfCPUOrNetworkLimitsExceeded",
"(",
"hunt_id",
")",
":",
"hunt_obj",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"# Do nothing if the hunt is already stopped.",
"if",
"hunt_obj",
".",
"hunt_state",
"==",
"rdf_hunt_objects"... | Stops the hunt if average limites are exceeded. | [
"Stops",
"the",
"hunt",
"if",
"average",
"limites",
"are",
"exceeded",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L118-L177 | train | Stops the hunt if CPU or network limits are exceeded. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | CompleteHuntIfExpirationTimeReached | def CompleteHuntIfExpirationTimeReached(hunt_obj):
"""Marks the hunt as complete if it's past its expiry time."""
# TODO(hanuszczak): This should not set the hunt state to `COMPLETED` but we
# should have a sparate `EXPIRED` state instead and set that.
if (hunt_obj.hunt_state not in [
rdf_hunt_objects.Hun... | python | def CompleteHuntIfExpirationTimeReached(hunt_obj):
"""Marks the hunt as complete if it's past its expiry time."""
# TODO(hanuszczak): This should not set the hunt state to `COMPLETED` but we
# should have a sparate `EXPIRED` state instead and set that.
if (hunt_obj.hunt_state not in [
rdf_hunt_objects.Hun... | [
"def",
"CompleteHuntIfExpirationTimeReached",
"(",
"hunt_obj",
")",
":",
"# TODO(hanuszczak): This should not set the hunt state to `COMPLETED` but we",
"# should have a sparate `EXPIRED` state instead and set that.",
"if",
"(",
"hunt_obj",
".",
"hunt_state",
"not",
"in",
"[",
"rdf_h... | Marks the hunt as complete if it's past its expiry time. | [
"Marks",
"the",
"hunt",
"as",
"complete",
"if",
"it",
"s",
"past",
"its",
"expiry",
"time",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L180-L194 | train | Marks the hunt as complete if it s past its expiry time. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | CreateHunt | def CreateHunt(hunt_obj):
"""Creates a hunt using a given hunt object."""
data_store.REL_DB.WriteHuntObject(hunt_obj)
if hunt_obj.HasField("output_plugins"):
output_plugins_states = flow.GetOutputPluginStates(
hunt_obj.output_plugins,
source="hunts/%s" % hunt_obj.hunt_id,
token=access... | python | def CreateHunt(hunt_obj):
"""Creates a hunt using a given hunt object."""
data_store.REL_DB.WriteHuntObject(hunt_obj)
if hunt_obj.HasField("output_plugins"):
output_plugins_states = flow.GetOutputPluginStates(
hunt_obj.output_plugins,
source="hunts/%s" % hunt_obj.hunt_id,
token=access... | [
"def",
"CreateHunt",
"(",
"hunt_obj",
")",
":",
"data_store",
".",
"REL_DB",
".",
"WriteHuntObject",
"(",
"hunt_obj",
")",
"if",
"hunt_obj",
".",
"HasField",
"(",
"\"output_plugins\"",
")",
":",
"output_plugins_states",
"=",
"flow",
".",
"GetOutputPluginStates",
... | Creates a hunt using a given hunt object. | [
"Creates",
"a",
"hunt",
"using",
"a",
"given",
"hunt",
"object",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L197-L207 | train | Creates a hunt using a given hunt object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | CreateAndStartHunt | def CreateAndStartHunt(flow_name, flow_args, creator, **kwargs):
"""Creates and starts a new hunt."""
# This interface takes a time when the hunt expires. However, the legacy hunt
# starting interface took an rdfvalue.Duration object which was then added to
# the current time to get the expiry. This check exis... | python | def CreateAndStartHunt(flow_name, flow_args, creator, **kwargs):
"""Creates and starts a new hunt."""
# This interface takes a time when the hunt expires. However, the legacy hunt
# starting interface took an rdfvalue.Duration object which was then added to
# the current time to get the expiry. This check exis... | [
"def",
"CreateAndStartHunt",
"(",
"flow_name",
",",
"flow_args",
",",
"creator",
",",
"*",
"*",
"kwargs",
")",
":",
"# This interface takes a time when the hunt expires. However, the legacy hunt",
"# starting interface took an rdfvalue.Duration object which was then added to",
"# the... | Creates and starts a new hunt. | [
"Creates",
"and",
"starts",
"a",
"new",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L210-L234 | train | Creates and starts a new hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | _ScheduleGenericHunt | def _ScheduleGenericHunt(hunt_obj):
"""Adds foreman rules for a generic hunt."""
# TODO: Migrate foreman conditions to use relation expiration
# durations instead of absolute timestamps.
foreman_condition = foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.Now(),
expiration_time=hun... | python | def _ScheduleGenericHunt(hunt_obj):
"""Adds foreman rules for a generic hunt."""
# TODO: Migrate foreman conditions to use relation expiration
# durations instead of absolute timestamps.
foreman_condition = foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.Now(),
expiration_time=hun... | [
"def",
"_ScheduleGenericHunt",
"(",
"hunt_obj",
")",
":",
"# TODO: Migrate foreman conditions to use relation expiration",
"# durations instead of absolute timestamps.",
"foreman_condition",
"=",
"foreman_rules",
".",
"ForemanCondition",
"(",
"creation_time",
"=",
"rdfvalue",
".",
... | Adds foreman rules for a generic hunt. | [
"Adds",
"foreman",
"rules",
"for",
"a",
"generic",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L237-L251 | train | Schedules foreman rules for a generic hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | _ScheduleVariableHunt | def _ScheduleVariableHunt(hunt_obj):
"""Schedules flows for a variable hunt."""
if hunt_obj.client_rate != 0:
raise VariableHuntCanNotHaveClientRateError(hunt_obj.hunt_id,
hunt_obj.client_rate)
seen_clients = set()
for flow_group in hunt_obj.args.variable.flo... | python | def _ScheduleVariableHunt(hunt_obj):
"""Schedules flows for a variable hunt."""
if hunt_obj.client_rate != 0:
raise VariableHuntCanNotHaveClientRateError(hunt_obj.hunt_id,
hunt_obj.client_rate)
seen_clients = set()
for flow_group in hunt_obj.args.variable.flo... | [
"def",
"_ScheduleVariableHunt",
"(",
"hunt_obj",
")",
":",
"if",
"hunt_obj",
".",
"client_rate",
"!=",
"0",
":",
"raise",
"VariableHuntCanNotHaveClientRateError",
"(",
"hunt_obj",
".",
"hunt_id",
",",
"hunt_obj",
".",
"client_rate",
")",
"seen_clients",
"=",
"set"... | Schedules flows for a variable hunt. | [
"Schedules",
"flows",
"for",
"a",
"variable",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L254-L285 | train | Schedules flows for a variable hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | StartHunt | def StartHunt(hunt_id):
"""Starts a hunt with a given id."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
num_hunt_clients = data_store.REL_DB.CountHuntFlows(hunt_id)
if hunt_obj.hunt_state != hunt_obj.HuntState.PAUSED:
raise OnlyPausedHuntCanBeStartedError(hunt_obj)
data_store.REL_DB.UpdateHun... | python | def StartHunt(hunt_id):
"""Starts a hunt with a given id."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
num_hunt_clients = data_store.REL_DB.CountHuntFlows(hunt_id)
if hunt_obj.hunt_state != hunt_obj.HuntState.PAUSED:
raise OnlyPausedHuntCanBeStartedError(hunt_obj)
data_store.REL_DB.UpdateHun... | [
"def",
"StartHunt",
"(",
"hunt_id",
")",
":",
"hunt_obj",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"num_hunt_clients",
"=",
"data_store",
".",
"REL_DB",
".",
"CountHuntFlows",
"(",
"hunt_id",
")",
"if",
"hunt_obj",
".",
"... | Starts a hunt with a given id. | [
"Starts",
"a",
"hunt",
"with",
"a",
"given",
"id",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L288-L313 | train | Starts a hunt with a given id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | PauseHunt | def PauseHunt(hunt_id, reason=None):
"""Pauses a hunt with a given id."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
if hunt_obj.hunt_state != hunt_obj.HuntState.STARTED:
raise OnlyStartedHuntCanBePausedError(hunt_obj)
data_store.REL_DB.UpdateHuntObject(
hunt_id, hunt_state=hunt_obj.HuntSt... | python | def PauseHunt(hunt_id, reason=None):
"""Pauses a hunt with a given id."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
if hunt_obj.hunt_state != hunt_obj.HuntState.STARTED:
raise OnlyStartedHuntCanBePausedError(hunt_obj)
data_store.REL_DB.UpdateHuntObject(
hunt_id, hunt_state=hunt_obj.HuntSt... | [
"def",
"PauseHunt",
"(",
"hunt_id",
",",
"reason",
"=",
"None",
")",
":",
"hunt_obj",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"if",
"hunt_obj",
".",
"hunt_state",
"!=",
"hunt_obj",
".",
"HuntState",
".",
"STARTED",
":"... | Pauses a hunt with a given id. | [
"Pauses",
"a",
"hunt",
"with",
"a",
"given",
"id",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L316-L327 | train | Pauses a hunt with a given id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | StopHunt | def StopHunt(hunt_id, reason=None):
"""Stops a hunt with a given id."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
if hunt_obj.hunt_state not in [
hunt_obj.HuntState.STARTED, hunt_obj.HuntState.PAUSED
]:
raise OnlyStartedOrPausedHuntCanBeStoppedError(hunt_obj)
data_store.REL_DB.UpdateHun... | python | def StopHunt(hunt_id, reason=None):
"""Stops a hunt with a given id."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
if hunt_obj.hunt_state not in [
hunt_obj.HuntState.STARTED, hunt_obj.HuntState.PAUSED
]:
raise OnlyStartedOrPausedHuntCanBeStoppedError(hunt_obj)
data_store.REL_DB.UpdateHun... | [
"def",
"StopHunt",
"(",
"hunt_id",
",",
"reason",
"=",
"None",
")",
":",
"hunt_obj",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"if",
"hunt_obj",
".",
"hunt_state",
"not",
"in",
"[",
"hunt_obj",
".",
"HuntState",
".",
"... | Stops a hunt with a given id. | [
"Stops",
"a",
"hunt",
"with",
"a",
"given",
"id",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L330-L352 | train | Stops a hunt with a given id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | UpdateHunt | def UpdateHunt(hunt_id, client_limit=None, client_rate=None, duration=None):
"""Updates a hunt (it must be paused to be updated)."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
if hunt_obj.hunt_state != hunt_obj.HuntState.PAUSED:
raise OnlyPausedHuntCanBeModifiedError(hunt_obj)
data_store.REL_DB.... | python | def UpdateHunt(hunt_id, client_limit=None, client_rate=None, duration=None):
"""Updates a hunt (it must be paused to be updated)."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
if hunt_obj.hunt_state != hunt_obj.HuntState.PAUSED:
raise OnlyPausedHuntCanBeModifiedError(hunt_obj)
data_store.REL_DB.... | [
"def",
"UpdateHunt",
"(",
"hunt_id",
",",
"client_limit",
"=",
"None",
",",
"client_rate",
"=",
"None",
",",
"duration",
"=",
"None",
")",
":",
"hunt_obj",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"if",
"hunt_obj",
".",... | Updates a hunt (it must be paused to be updated). | [
"Updates",
"a",
"hunt",
"(",
"it",
"must",
"be",
"paused",
"to",
"be",
"updated",
")",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L355-L367 | train | Updates a hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunt.py | StartHuntFlowOnClient | def StartHuntFlowOnClient(client_id, hunt_id):
"""Starts a flow corresponding to a given hunt on a given client."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
hunt_obj = CompleteHuntIfExpirationTimeReached(hunt_obj)
# There may be a little race between foreman rules being removed and
# foreman sche... | python | def StartHuntFlowOnClient(client_id, hunt_id):
"""Starts a flow corresponding to a given hunt on a given client."""
hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
hunt_obj = CompleteHuntIfExpirationTimeReached(hunt_obj)
# There may be a little race between foreman rules being removed and
# foreman sche... | [
"def",
"StartHuntFlowOnClient",
"(",
"client_id",
",",
"hunt_id",
")",
":",
"hunt_obj",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"hunt_obj",
"=",
"CompleteHuntIfExpirationTimeReached",
"(",
"hunt_obj",
")",
"# There may be a little... | Starts a flow corresponding to a given hunt on a given client. | [
"Starts",
"a",
"flow",
"corresponding",
"to",
"a",
"given",
"hunt",
"on",
"a",
"given",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunt.py#L378-L432 | train | Starts a flow corresponding to a given hunt on a given client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/rdfvalues/hunt_objects.py | Hunt.expired | def expired(self):
"""Checks if the hunt has expired."""
expiry_time = self.expiry_time
if expiry_time is not None:
return expiry_time < rdfvalue.RDFDatetime.Now()
else:
return False | python | def expired(self):
"""Checks if the hunt has expired."""
expiry_time = self.expiry_time
if expiry_time is not None:
return expiry_time < rdfvalue.RDFDatetime.Now()
else:
return False | [
"def",
"expired",
"(",
"self",
")",
":",
"expiry_time",
"=",
"self",
".",
"expiry_time",
"if",
"expiry_time",
"is",
"not",
"None",
":",
"return",
"expiry_time",
"<",
"rdfvalue",
".",
"RDFDatetime",
".",
"Now",
"(",
")",
"else",
":",
"return",
"False"
] | Checks if the hunt has expired. | [
"Checks",
"if",
"the",
"hunt",
"has",
"expired",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/hunt_objects.py#L124-L130 | train | Checks if the hunt has expired. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | Approval.GetApprovalForObject | def GetApprovalForObject(object_urn, token=None, username=""):
"""Looks for approvals for an object and returns available valid tokens.
Args:
object_urn: Urn of the object we want access to.
token: The token to use to lookup the ACLs.
username: The user to get the approval for, if "" we get... | python | def GetApprovalForObject(object_urn, token=None, username=""):
"""Looks for approvals for an object and returns available valid tokens.
Args:
object_urn: Urn of the object we want access to.
token: The token to use to lookup the ACLs.
username: The user to get the approval for, if "" we get... | [
"def",
"GetApprovalForObject",
"(",
"object_urn",
",",
"token",
"=",
"None",
",",
"username",
"=",
"\"\"",
")",
":",
"if",
"token",
"is",
"None",
":",
"raise",
"access_control",
".",
"UnauthorizedAccess",
"(",
"\"No token given, cannot authenticate.\"",
")",
"if",... | Looks for approvals for an object and returns available valid tokens.
Args:
object_urn: Urn of the object we want access to.
token: The token to use to lookup the ACLs.
username: The user to get the approval for, if "" we get it from the
token.
Returns:
A token for access to ... | [
"Looks",
"for",
"approvals",
"for",
"an",
"object",
"and",
"returns",
"available",
"valid",
"tokens",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L93-L154 | train | Returns a list of tokens that can be used to access an object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | ApprovalWithApproversAndReason.CheckAccess | def CheckAccess(self, token):
"""Enforce a dual approver policy for access."""
namespace, _ = self.urn.Split(2)
if namespace != "ACL":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
subject=self.urn,
requested_access=token.requ... | python | def CheckAccess(self, token):
"""Enforce a dual approver policy for access."""
namespace, _ = self.urn.Split(2)
if namespace != "ACL":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
subject=self.urn,
requested_access=token.requ... | [
"def",
"CheckAccess",
"(",
"self",
",",
"token",
")",
":",
"namespace",
",",
"_",
"=",
"self",
".",
"urn",
".",
"Split",
"(",
"2",
")",
"if",
"namespace",
"!=",
"\"ACL\"",
":",
"raise",
"access_control",
".",
"UnauthorizedAccess",
"(",
"\"Approval object h... | Enforce a dual approver policy for access. | [
"Enforce",
"a",
"dual",
"approver",
"policy",
"for",
"access",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L213-L274 | train | Enforce a dual approver policy for access. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | ApprovalWithApproversAndReason.GetNonExpiredApprovers | def GetNonExpiredApprovers(self):
"""Returns a list of usernames of approvers who approved this approval."""
lifetime = rdfvalue.Duration(
self.Get(self.Schema.LIFETIME) or config.CONFIG["ACL.token_expiry"])
# Check that there are enough approvers.
#
# TODO(user): approvals have to be open... | python | def GetNonExpiredApprovers(self):
"""Returns a list of usernames of approvers who approved this approval."""
lifetime = rdfvalue.Duration(
self.Get(self.Schema.LIFETIME) or config.CONFIG["ACL.token_expiry"])
# Check that there are enough approvers.
#
# TODO(user): approvals have to be open... | [
"def",
"GetNonExpiredApprovers",
"(",
"self",
")",
":",
"lifetime",
"=",
"rdfvalue",
".",
"Duration",
"(",
"self",
".",
"Get",
"(",
"self",
".",
"Schema",
".",
"LIFETIME",
")",
"or",
"config",
".",
"CONFIG",
"[",
"\"ACL.token_expiry\"",
"]",
")",
"# Check ... | Returns a list of usernames of approvers who approved this approval. | [
"Returns",
"a",
"list",
"of",
"usernames",
"of",
"approvers",
"who",
"approved",
"this",
"approval",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L276-L293 | train | Returns a list of usernames of approvers who approved this approval. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | ClientApproval.InferUserAndSubjectFromUrn | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, client_id, user, _ = self.urn.Split(4)
return (user, rdf_client.ClientURN(client_id)) | python | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, client_id, user, _ = self.urn.Split(4)
return (user, rdf_client.ClientURN(client_id)) | [
"def",
"InferUserAndSubjectFromUrn",
"(",
"self",
")",
":",
"_",
",",
"client_id",
",",
"user",
",",
"_",
"=",
"self",
".",
"urn",
".",
"Split",
"(",
"4",
")",
"return",
"(",
"user",
",",
"rdf_client",
".",
"ClientURN",
"(",
"client_id",
")",
")"
] | Infers user name and subject urn from self.urn. | [
"Infers",
"user",
"name",
"and",
"subject",
"urn",
"from",
"self",
".",
"urn",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L306-L309 | train | Infers user name and subject urn from self. urn. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | HuntApproval.InferUserAndSubjectFromUrn | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, hunts_str, hunt_id, user, _ = self.urn.Split(5)
if hunts_str != "hunts":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
requested_access=self.... | python | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, hunts_str, hunt_id, user, _ = self.urn.Split(5)
if hunts_str != "hunts":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
requested_access=self.... | [
"def",
"InferUserAndSubjectFromUrn",
"(",
"self",
")",
":",
"_",
",",
"hunts_str",
",",
"hunt_id",
",",
"user",
",",
"_",
"=",
"self",
".",
"urn",
".",
"Split",
"(",
"5",
")",
"if",
"hunts_str",
"!=",
"\"hunts\"",
":",
"raise",
"access_control",
".",
"... | Infers user name and subject urn from self.urn. | [
"Infers",
"user",
"name",
"and",
"subject",
"urn",
"from",
"self",
".",
"urn",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L352-L361 | train | Infers user name and subject urn from self. urn. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | CronJobApproval.InferUserAndSubjectFromUrn | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, cron_str, cron_job_name, user, _ = self.urn.Split(5)
if cron_str != "cron":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
requested_access=se... | python | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, cron_str, cron_job_name, user, _ = self.urn.Split(5)
if cron_str != "cron":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
requested_access=se... | [
"def",
"InferUserAndSubjectFromUrn",
"(",
"self",
")",
":",
"_",
",",
"cron_str",
",",
"cron_job_name",
",",
"user",
",",
"_",
"=",
"self",
".",
"urn",
".",
"Split",
"(",
"5",
")",
"if",
"cron_str",
"!=",
"\"cron\"",
":",
"raise",
"access_control",
".",
... | Infers user name and subject urn from self.urn. | [
"Infers",
"user",
"name",
"and",
"subject",
"urn",
"from",
"self",
".",
"urn",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L375-L384 | train | Infers user name and subject urn from self. urn. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | AbstractApprovalBase.ApprovalUrnBuilder | def ApprovalUrnBuilder(subject, user, approval_id):
"""Encode an approval URN."""
return aff4.ROOT_URN.Add("ACL").Add(subject).Add(user).Add(approval_id) | python | def ApprovalUrnBuilder(subject, user, approval_id):
"""Encode an approval URN."""
return aff4.ROOT_URN.Add("ACL").Add(subject).Add(user).Add(approval_id) | [
"def",
"ApprovalUrnBuilder",
"(",
"subject",
",",
"user",
",",
"approval_id",
")",
":",
"return",
"aff4",
".",
"ROOT_URN",
".",
"Add",
"(",
"\"ACL\"",
")",
".",
"Add",
"(",
"subject",
")",
".",
"Add",
"(",
"user",
")",
".",
"Add",
"(",
"approval_id",
... | Encode an approval URN. | [
"Encode",
"an",
"approval",
"URN",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L400-L402 | train | Encode an approval URN. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | AbstractApprovalBase.ApprovalSymlinkUrnBuilder | def ApprovalSymlinkUrnBuilder(approval_type, subject_id, user, approval_id):
"""Build an approval symlink URN."""
return aff4.ROOT_URN.Add("users").Add(user).Add("approvals").Add(
approval_type).Add(subject_id).Add(approval_id) | python | def ApprovalSymlinkUrnBuilder(approval_type, subject_id, user, approval_id):
"""Build an approval symlink URN."""
return aff4.ROOT_URN.Add("users").Add(user).Add("approvals").Add(
approval_type).Add(subject_id).Add(approval_id) | [
"def",
"ApprovalSymlinkUrnBuilder",
"(",
"approval_type",
",",
"subject_id",
",",
"user",
",",
"approval_id",
")",
":",
"return",
"aff4",
".",
"ROOT_URN",
".",
"Add",
"(",
"\"users\"",
")",
".",
"Add",
"(",
"user",
")",
".",
"Add",
"(",
"\"approvals\"",
")... | Build an approval symlink URN. | [
"Build",
"an",
"approval",
"symlink",
"URN",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L405-L408 | train | Builds an approval symlink URN. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | ApprovalRequestor.Request | def Request(self):
"""Create the Approval object and notify the Approval Granter."""
approval_id = "approval:%X" % random.UInt32()
approval_urn = self.BuildApprovalUrn(approval_id)
email_msg_id = email.utils.make_msgid()
with aff4.FACTORY.Create(
approval_urn, self.approval_type, mode="w"... | python | def Request(self):
"""Create the Approval object and notify the Approval Granter."""
approval_id = "approval:%X" % random.UInt32()
approval_urn = self.BuildApprovalUrn(approval_id)
email_msg_id = email.utils.make_msgid()
with aff4.FACTORY.Create(
approval_urn, self.approval_type, mode="w"... | [
"def",
"Request",
"(",
"self",
")",
":",
"approval_id",
"=",
"\"approval:%X\"",
"%",
"random",
".",
"UInt32",
"(",
")",
"approval_urn",
"=",
"self",
".",
"BuildApprovalUrn",
"(",
"approval_id",
")",
"email_msg_id",
"=",
"email",
".",
"utils",
".",
"make_msgi... | Create the Approval object and notify the Approval Granter. | [
"Create",
"the",
"Approval",
"object",
"and",
"notify",
"the",
"Approval",
"Granter",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L444-L489 | train | Create the Approval object and notify the Approval Granter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | ApprovalGrantor.Grant | def Grant(self):
"""Create the Approval object and notify the Approval Granter."""
approvals_root_urn = aff4.ROOT_URN.Add("ACL").Add(
self.subject_urn.Path()).Add(self.delegate)
children_urns = list(aff4.FACTORY.ListChildren(approvals_root_urn))
if not children_urns:
raise access_control.... | python | def Grant(self):
"""Create the Approval object and notify the Approval Granter."""
approvals_root_urn = aff4.ROOT_URN.Add("ACL").Add(
self.subject_urn.Path()).Add(self.delegate)
children_urns = list(aff4.FACTORY.ListChildren(approvals_root_urn))
if not children_urns:
raise access_control.... | [
"def",
"Grant",
"(",
"self",
")",
":",
"approvals_root_urn",
"=",
"aff4",
".",
"ROOT_URN",
".",
"Add",
"(",
"\"ACL\"",
")",
".",
"Add",
"(",
"self",
".",
"subject_urn",
".",
"Path",
"(",
")",
")",
".",
"Add",
"(",
"self",
".",
"delegate",
")",
"chi... | Create the Approval object and notify the Approval Granter. | [
"Create",
"the",
"Approval",
"object",
"and",
"notify",
"the",
"Approval",
"Granter",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L514-L558 | train | Create the Approval object and notify the Approval Granter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | ClientApprovalRequestor.BuildApprovalUrn | def BuildApprovalUrn(self, approval_id):
"""Builds approval object urn."""
event = rdf_events.AuditEvent(
user=self.token.username,
action="CLIENT_APPROVAL_REQUEST",
client=self.subject_urn,
description=self.reason)
events.Events.PublishEvent("Audit", event, token=self.token)... | python | def BuildApprovalUrn(self, approval_id):
"""Builds approval object urn."""
event = rdf_events.AuditEvent(
user=self.token.username,
action="CLIENT_APPROVAL_REQUEST",
client=self.subject_urn,
description=self.reason)
events.Events.PublishEvent("Audit", event, token=self.token)... | [
"def",
"BuildApprovalUrn",
"(",
"self",
",",
"approval_id",
")",
":",
"event",
"=",
"rdf_events",
".",
"AuditEvent",
"(",
"user",
"=",
"self",
".",
"token",
".",
"username",
",",
"action",
"=",
"\"CLIENT_APPROVAL_REQUEST\"",
",",
"client",
"=",
"self",
".",
... | Builds approval object urn. | [
"Builds",
"approval",
"object",
"urn",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L571-L581 | train | Builds approval object urn. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/aff4_objects/security.py | CronJobApprovalRequestor.BuildApprovalSymlinksUrns | def BuildApprovalSymlinksUrns(self, approval_id):
"""Builds list of symlinks URNs for the approval object."""
return [
self.ApprovalSymlinkUrnBuilder("cron", self.subject_urn.Basename(),
self.token.username, approval_id)
] | python | def BuildApprovalSymlinksUrns(self, approval_id):
"""Builds list of symlinks URNs for the approval object."""
return [
self.ApprovalSymlinkUrnBuilder("cron", self.subject_urn.Basename(),
self.token.username, approval_id)
] | [
"def",
"BuildApprovalSymlinksUrns",
"(",
"self",
",",
"approval_id",
")",
":",
"return",
"[",
"self",
".",
"ApprovalSymlinkUrnBuilder",
"(",
"\"cron\"",
",",
"self",
".",
"subject_urn",
".",
"Basename",
"(",
")",
",",
"self",
".",
"token",
".",
"username",
"... | Builds list of symlinks URNs for the approval object. | [
"Builds",
"list",
"of",
"symlinks",
"URNs",
"for",
"the",
"approval",
"object",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L696-L701 | train | Builds the list of symlinks URNs for the approval object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_blobs.py | InMemoryDBBlobsMixin.ReadBlobs | def ReadBlobs(self, blob_ids):
"""Reads given blobs."""
result = {}
for blob_id in blob_ids:
result[blob_id] = self.blobs.get(blob_id, None)
return result | python | def ReadBlobs(self, blob_ids):
"""Reads given blobs."""
result = {}
for blob_id in blob_ids:
result[blob_id] = self.blobs.get(blob_id, None)
return result | [
"def",
"ReadBlobs",
"(",
"self",
",",
"blob_ids",
")",
":",
"result",
"=",
"{",
"}",
"for",
"blob_id",
"in",
"blob_ids",
":",
"result",
"[",
"blob_id",
"]",
"=",
"self",
".",
"blobs",
".",
"get",
"(",
"blob_id",
",",
"None",
")",
"return",
"result"
] | Reads given blobs. | [
"Reads",
"given",
"blobs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_blobs.py#L35-L42 | train | Reads given blobs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_blobs.py | InMemoryDBBlobsMixin.CheckBlobsExist | def CheckBlobsExist(self, blob_ids):
"""Checks if given blobs exit."""
result = {}
for blob_id in blob_ids:
result[blob_id] = blob_id in self.blobs
return result | python | def CheckBlobsExist(self, blob_ids):
"""Checks if given blobs exit."""
result = {}
for blob_id in blob_ids:
result[blob_id] = blob_id in self.blobs
return result | [
"def",
"CheckBlobsExist",
"(",
"self",
",",
"blob_ids",
")",
":",
"result",
"=",
"{",
"}",
"for",
"blob_id",
"in",
"blob_ids",
":",
"result",
"[",
"blob_id",
"]",
"=",
"blob_id",
"in",
"self",
".",
"blobs",
"return",
"result"
] | Checks if given blobs exit. | [
"Checks",
"if",
"given",
"blobs",
"exit",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_blobs.py#L45-L52 | train | Checks if given blobs exist. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/client/grr_response_client/client_actions/file_finder.py | FileFinderOSFromClient | def FileFinderOSFromClient(args):
"""This function expands paths from the args and returns related stat entries.
Args:
args: An `rdf_file_finder.FileFinderArgs` object.
Yields:
`rdf_paths.PathSpec` instances.
"""
stat_cache = filesystem.StatCache()
opts = args.action.stat
for path in GetExpand... | python | def FileFinderOSFromClient(args):
"""This function expands paths from the args and returns related stat entries.
Args:
args: An `rdf_file_finder.FileFinderArgs` object.
Yields:
`rdf_paths.PathSpec` instances.
"""
stat_cache = filesystem.StatCache()
opts = args.action.stat
for path in GetExpand... | [
"def",
"FileFinderOSFromClient",
"(",
"args",
")",
":",
"stat_cache",
"=",
"filesystem",
".",
"StatCache",
"(",
")",
"opts",
"=",
"args",
".",
"action",
".",
"stat",
"for",
"path",
"in",
"GetExpandedPaths",
"(",
"args",
")",
":",
"try",
":",
"content_condi... | This function expands paths from the args and returns related stat entries.
Args:
args: An `rdf_file_finder.FileFinderArgs` object.
Yields:
`rdf_paths.PathSpec` instances. | [
"This",
"function",
"expands",
"paths",
"from",
"the",
"args",
"and",
"returns",
"related",
"stat",
"entries",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L28-L55 | train | This function expands paths from the args and returns related stat entries. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/client/grr_response_client/client_actions/file_finder.py | GetExpandedPaths | def GetExpandedPaths(
args):
"""Expands given path patterns.
Args:
args: A `FileFinderArgs` instance that dictates the behaviour of the path
expansion.
Yields:
Absolute paths (as string objects) derived from input patterns.
Raises:
ValueError: For unsupported path types.
"""
if args... | python | def GetExpandedPaths(
args):
"""Expands given path patterns.
Args:
args: A `FileFinderArgs` instance that dictates the behaviour of the path
expansion.
Yields:
Absolute paths (as string objects) derived from input patterns.
Raises:
ValueError: For unsupported path types.
"""
if args... | [
"def",
"GetExpandedPaths",
"(",
"args",
")",
":",
"if",
"args",
".",
"pathtype",
"==",
"rdf_paths",
".",
"PathSpec",
".",
"PathType",
".",
"OS",
":",
"pathtype",
"=",
"rdf_paths",
".",
"PathSpec",
".",
"PathType",
".",
"OS",
"else",
":",
"raise",
"ValueE... | Expands given path patterns.
Args:
args: A `FileFinderArgs` instance that dictates the behaviour of the path
expansion.
Yields:
Absolute paths (as string objects) derived from input patterns.
Raises:
ValueError: For unsupported path types. | [
"Expands",
"given",
"path",
"patterns",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L140-L166 | train | Returns an iterator that yields absolute paths derived from input patterns. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/client/grr_response_client/client_actions/file_finder.py | _GetMountpoints | def _GetMountpoints(only_physical=True):
"""Fetches a list of mountpoints.
Args:
only_physical: Determines whether only mountpoints for physical devices
(e.g. hard disks) should be listed. If false, mountpoints for things such
as memory partitions or `/dev/shm` will be returned as well.
Returns:... | python | def _GetMountpoints(only_physical=True):
"""Fetches a list of mountpoints.
Args:
only_physical: Determines whether only mountpoints for physical devices
(e.g. hard disks) should be listed. If false, mountpoints for things such
as memory partitions or `/dev/shm` will be returned as well.
Returns:... | [
"def",
"_GetMountpoints",
"(",
"only_physical",
"=",
"True",
")",
":",
"partitions",
"=",
"psutil",
".",
"disk_partitions",
"(",
"all",
"=",
"not",
"only_physical",
")",
"return",
"set",
"(",
"partition",
".",
"mountpoint",
"for",
"partition",
"in",
"partition... | Fetches a list of mountpoints.
Args:
only_physical: Determines whether only mountpoints for physical devices
(e.g. hard disks) should be listed. If false, mountpoints for things such
as memory partitions or `/dev/shm` will be returned as well.
Returns:
A set of mountpoints. | [
"Fetches",
"a",
"list",
"of",
"mountpoints",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L169-L181 | train | Fetches a list of mountpoints. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/client/grr_response_client/client_actions/file_finder.py | _GetMountpointBlacklist | def _GetMountpointBlacklist(xdev):
"""Builds a list of mountpoints to ignore during recursive searches.
Args:
xdev: A `XDev` value that determines policy for crossing device boundaries.
Returns:
A set of mountpoints to ignore.
Raises:
ValueError: If `xdev` value is invalid.
"""
if xdev == rdf... | python | def _GetMountpointBlacklist(xdev):
"""Builds a list of mountpoints to ignore during recursive searches.
Args:
xdev: A `XDev` value that determines policy for crossing device boundaries.
Returns:
A set of mountpoints to ignore.
Raises:
ValueError: If `xdev` value is invalid.
"""
if xdev == rdf... | [
"def",
"_GetMountpointBlacklist",
"(",
"xdev",
")",
":",
"if",
"xdev",
"==",
"rdf_file_finder",
".",
"FileFinderArgs",
".",
"XDev",
".",
"NEVER",
":",
"# Never cross device boundaries, stop at all mount points.",
"return",
"_GetMountpoints",
"(",
"only_physical",
"=",
"... | Builds a list of mountpoints to ignore during recursive searches.
Args:
xdev: A `XDev` value that determines policy for crossing device boundaries.
Returns:
A set of mountpoints to ignore.
Raises:
ValueError: If `xdev` value is invalid. | [
"Builds",
"a",
"list",
"of",
"mountpoints",
"to",
"ignore",
"during",
"recursive",
"searches",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L184-L209 | train | Returns a list of mountpoints to ignore during recursive searches. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.WriteHuntObject | def WriteHuntObject(self, hunt_obj):
"""Writes a hunt object to the database."""
if hunt_obj.hunt_id in self.hunts:
raise db.DuplicatedHuntError(hunt_id=hunt_obj.hunt_id)
clone = self._DeepCopy(hunt_obj)
clone.create_time = rdfvalue.RDFDatetime.Now()
clone.last_update_time = rdfvalue.RDFDatet... | python | def WriteHuntObject(self, hunt_obj):
"""Writes a hunt object to the database."""
if hunt_obj.hunt_id in self.hunts:
raise db.DuplicatedHuntError(hunt_id=hunt_obj.hunt_id)
clone = self._DeepCopy(hunt_obj)
clone.create_time = rdfvalue.RDFDatetime.Now()
clone.last_update_time = rdfvalue.RDFDatet... | [
"def",
"WriteHuntObject",
"(",
"self",
",",
"hunt_obj",
")",
":",
"if",
"hunt_obj",
".",
"hunt_id",
"in",
"self",
".",
"hunts",
":",
"raise",
"db",
".",
"DuplicatedHuntError",
"(",
"hunt_id",
"=",
"hunt_obj",
".",
"hunt_id",
")",
"clone",
"=",
"self",
".... | Writes a hunt object to the database. | [
"Writes",
"a",
"hunt",
"object",
"to",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L30-L38 | train | Writes a hunt object to the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.UpdateHuntObject | def UpdateHuntObject(self, hunt_id, start_time=None, **kwargs):
"""Updates the hunt object by applying the update function."""
hunt_obj = self.ReadHuntObject(hunt_id)
delta_suffix = "_delta"
for k, v in kwargs.items():
if v is None:
continue
if k.endswith(delta_suffix):
ke... | python | def UpdateHuntObject(self, hunt_id, start_time=None, **kwargs):
"""Updates the hunt object by applying the update function."""
hunt_obj = self.ReadHuntObject(hunt_id)
delta_suffix = "_delta"
for k, v in kwargs.items():
if v is None:
continue
if k.endswith(delta_suffix):
ke... | [
"def",
"UpdateHuntObject",
"(",
"self",
",",
"hunt_id",
",",
"start_time",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"hunt_obj",
"=",
"self",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"delta_suffix",
"=",
"\"_delta\"",
"for",
"k",
",",
"v",
"in",... | Updates the hunt object by applying the update function. | [
"Updates",
"the",
"hunt",
"object",
"by",
"applying",
"the",
"update",
"function",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L41-L63 | train | Updates the hunt object by applying the update function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.UpdateHuntOutputPluginState | def UpdateHuntOutputPluginState(self, hunt_id, state_index, update_fn):
"""Updates hunt output plugin state for a given output plugin."""
if hunt_id not in self.hunts:
raise db.UnknownHuntError(hunt_id)
try:
state = rdf_flow_runner.OutputPluginState.FromSerializedString(
self.hunt_ou... | python | def UpdateHuntOutputPluginState(self, hunt_id, state_index, update_fn):
"""Updates hunt output plugin state for a given output plugin."""
if hunt_id not in self.hunts:
raise db.UnknownHuntError(hunt_id)
try:
state = rdf_flow_runner.OutputPluginState.FromSerializedString(
self.hunt_ou... | [
"def",
"UpdateHuntOutputPluginState",
"(",
"self",
",",
"hunt_id",
",",
"state_index",
",",
"update_fn",
")",
":",
"if",
"hunt_id",
"not",
"in",
"self",
".",
"hunts",
":",
"raise",
"db",
".",
"UnknownHuntError",
"(",
"hunt_id",
")",
"try",
":",
"state",
"=... | Updates hunt output plugin state for a given output plugin. | [
"Updates",
"hunt",
"output",
"plugin",
"state",
"for",
"a",
"given",
"output",
"plugin",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L87-L104 | train | Updates hunt output plugin state for a given hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntObject | def ReadHuntObject(self, hunt_id):
"""Reads a hunt object from the database."""
try:
return self._DeepCopy(self.hunts[hunt_id])
except KeyError:
raise db.UnknownHuntError(hunt_id) | python | def ReadHuntObject(self, hunt_id):
"""Reads a hunt object from the database."""
try:
return self._DeepCopy(self.hunts[hunt_id])
except KeyError:
raise db.UnknownHuntError(hunt_id) | [
"def",
"ReadHuntObject",
"(",
"self",
",",
"hunt_id",
")",
":",
"try",
":",
"return",
"self",
".",
"_DeepCopy",
"(",
"self",
".",
"hunts",
"[",
"hunt_id",
"]",
")",
"except",
"KeyError",
":",
"raise",
"db",
".",
"UnknownHuntError",
"(",
"hunt_id",
")"
] | Reads a hunt object from the database. | [
"Reads",
"a",
"hunt",
"object",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L114-L119 | train | Reads a hunt object from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntObjects | def ReadHuntObjects(self,
offset,
count,
with_creator=None,
created_after=None,
with_description_match=None):
"""Reads all hunt objects from the database."""
filter_fns = []
if with_creator is not N... | python | def ReadHuntObjects(self,
offset,
count,
with_creator=None,
created_after=None,
with_description_match=None):
"""Reads all hunt objects from the database."""
filter_fns = []
if with_creator is not N... | [
"def",
"ReadHuntObjects",
"(",
"self",
",",
"offset",
",",
"count",
",",
"with_creator",
"=",
"None",
",",
"created_after",
"=",
"None",
",",
"with_description_match",
"=",
"None",
")",
":",
"filter_fns",
"=",
"[",
"]",
"if",
"with_creator",
"is",
"not",
"... | Reads all hunt objects from the database. | [
"Reads",
"all",
"hunt",
"objects",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L122-L141 | train | Reads all hunt objects from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntLogEntries | def ReadHuntLogEntries(self, hunt_id, offset, count, with_substring=None):
"""Reads hunt log entries of a given hunt using given query options."""
all_entries = []
for flow_obj in self._GetHuntFlows(hunt_id):
for entry in self.ReadFlowLogEntries(
flow_obj.client_id,
flow_obj.flow_i... | python | def ReadHuntLogEntries(self, hunt_id, offset, count, with_substring=None):
"""Reads hunt log entries of a given hunt using given query options."""
all_entries = []
for flow_obj in self._GetHuntFlows(hunt_id):
for entry in self.ReadFlowLogEntries(
flow_obj.client_id,
flow_obj.flow_i... | [
"def",
"ReadHuntLogEntries",
"(",
"self",
",",
"hunt_id",
",",
"offset",
",",
"count",
",",
"with_substring",
"=",
"None",
")",
":",
"all_entries",
"=",
"[",
"]",
"for",
"flow_obj",
"in",
"self",
".",
"_GetHuntFlows",
"(",
"hunt_id",
")",
":",
"for",
"en... | Reads hunt log entries of a given hunt using given query options. | [
"Reads",
"hunt",
"log",
"entries",
"of",
"a",
"given",
"hunt",
"using",
"given",
"query",
"options",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L144-L163 | train | Reads hunt log entries of a given hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntResults | def ReadHuntResults(self,
hunt_id,
offset,
count,
with_tag=None,
with_type=None,
with_substring=None,
with_timestamp=None):
"""Reads hunt results of a given hunt ... | python | def ReadHuntResults(self,
hunt_id,
offset,
count,
with_tag=None,
with_type=None,
with_substring=None,
with_timestamp=None):
"""Reads hunt results of a given hunt ... | [
"def",
"ReadHuntResults",
"(",
"self",
",",
"hunt_id",
",",
"offset",
",",
"count",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
",",
"with_substring",
"=",
"None",
",",
"with_timestamp",
"=",
"None",
")",
":",
"all_results",
"=",
"[",
"]... | Reads hunt results of a given hunt using given query options. | [
"Reads",
"hunt",
"results",
"of",
"a",
"given",
"hunt",
"using",
"given",
"query",
"options",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L171-L202 | train | Reads hunt results of a given hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.CountHuntResults | def CountHuntResults(self, hunt_id, with_tag=None, with_type=None):
"""Counts hunt results of a given hunt using given query options."""
return len(
self.ReadHuntResults(
hunt_id, 0, sys.maxsize, with_tag=with_tag, with_type=with_type)) | python | def CountHuntResults(self, hunt_id, with_tag=None, with_type=None):
"""Counts hunt results of a given hunt using given query options."""
return len(
self.ReadHuntResults(
hunt_id, 0, sys.maxsize, with_tag=with_tag, with_type=with_type)) | [
"def",
"CountHuntResults",
"(",
"self",
",",
"hunt_id",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadHuntResults",
"(",
"hunt_id",
",",
"0",
",",
"sys",
".",
"maxsize",
",",
"with_tag",
... | Counts hunt results of a given hunt using given query options. | [
"Counts",
"hunt",
"results",
"of",
"a",
"given",
"hunt",
"using",
"given",
"query",
"options",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L205-L209 | train | Counts hunt results of a given hunt using given query options. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntFlows | 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
... | python | 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
... | [
"def",
"ReadHuntFlows",
"(",
"self",
",",
"hunt_id",
",",
"offset",
",",
"count",
",",
"filter_condition",
"=",
"db",
".",
"HuntFlowsCondition",
".",
"UNSET",
")",
":",
"if",
"filter_condition",
"==",
"db",
".",
"HuntFlowsCondition",
".",
"UNSET",
":",
"filt... | Reads hunt flows matching given conditins. | [
"Reads",
"hunt",
"flows",
"matching",
"given",
"conditins",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L221-L248 | train | Reads hunt flows matching given conditins. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.CountHuntFlows | def CountHuntFlows(self,
hunt_id,
filter_condition=db.HuntFlowsCondition.UNSET):
"""Counts hunt flows matching given conditions."""
return len(
self.ReadHuntFlows(
hunt_id, 0, sys.maxsize, filter_condition=filter_condition)) | python | def CountHuntFlows(self,
hunt_id,
filter_condition=db.HuntFlowsCondition.UNSET):
"""Counts hunt flows matching given conditions."""
return len(
self.ReadHuntFlows(
hunt_id, 0, sys.maxsize, filter_condition=filter_condition)) | [
"def",
"CountHuntFlows",
"(",
"self",
",",
"hunt_id",
",",
"filter_condition",
"=",
"db",
".",
"HuntFlowsCondition",
".",
"UNSET",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadHuntFlows",
"(",
"hunt_id",
",",
"0",
",",
"sys",
".",
"maxsize",
",",
"f... | Counts hunt flows matching given conditions. | [
"Counts",
"hunt",
"flows",
"matching",
"given",
"conditions",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L251-L258 | train | Counts the number of hunt flows matching given conditions. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntCounters | def ReadHuntCounters(self, hunt_id):
"""Reads hunt counters."""
num_clients = self.CountHuntFlows(hunt_id)
num_successful_clients = self.CountHuntFlows(
hunt_id, filter_condition=db.HuntFlowsCondition.SUCCEEDED_FLOWS_ONLY)
num_failed_clients = self.CountHuntFlows(
hunt_id, filter_conditi... | python | def ReadHuntCounters(self, hunt_id):
"""Reads hunt counters."""
num_clients = self.CountHuntFlows(hunt_id)
num_successful_clients = self.CountHuntFlows(
hunt_id, filter_condition=db.HuntFlowsCondition.SUCCEEDED_FLOWS_ONLY)
num_failed_clients = self.CountHuntFlows(
hunt_id, filter_conditi... | [
"def",
"ReadHuntCounters",
"(",
"self",
",",
"hunt_id",
")",
":",
"num_clients",
"=",
"self",
".",
"CountHuntFlows",
"(",
"hunt_id",
")",
"num_successful_clients",
"=",
"self",
".",
"CountHuntFlows",
"(",
"hunt_id",
",",
"filter_condition",
"=",
"db",
".",
"Hu... | Reads hunt counters. | [
"Reads",
"hunt",
"counters",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L261-L291 | train | Reads hunt counters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntClientResourcesStats | def ReadHuntClientResourcesStats(self, hunt_id):
"""Read/calculate hunt client resources stats."""
result = rdf_stats.ClientResourcesStats()
for f in self._GetHuntFlows(hunt_id):
cr = rdf_client_stats.ClientResources(
session_id="%s/%s" % (f.client_id, f.flow_id),
client_id=f.clie... | python | def ReadHuntClientResourcesStats(self, hunt_id):
"""Read/calculate hunt client resources stats."""
result = rdf_stats.ClientResourcesStats()
for f in self._GetHuntFlows(hunt_id):
cr = rdf_client_stats.ClientResources(
session_id="%s/%s" % (f.client_id, f.flow_id),
client_id=f.clie... | [
"def",
"ReadHuntClientResourcesStats",
"(",
"self",
",",
"hunt_id",
")",
":",
"result",
"=",
"rdf_stats",
".",
"ClientResourcesStats",
"(",
")",
"for",
"f",
"in",
"self",
".",
"_GetHuntFlows",
"(",
"hunt_id",
")",
":",
"cr",
"=",
"rdf_client_stats",
".",
"Cl... | Read/calculate hunt client resources stats. | [
"Read",
"/",
"calculate",
"hunt",
"client",
"resources",
"stats",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L294-L309 | train | Reads and calculates hunt client resources stats. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntFlowsStatesAndTimestamps | def ReadHuntFlowsStatesAndTimestamps(self, hunt_id):
"""Reads hunt flows states and timestamps."""
result = []
for f in self._GetHuntFlows(hunt_id):
result.append(
db.FlowStateAndTimestamps(
flow_state=f.flow_state,
create_time=f.create_time,
last_u... | python | def ReadHuntFlowsStatesAndTimestamps(self, hunt_id):
"""Reads hunt flows states and timestamps."""
result = []
for f in self._GetHuntFlows(hunt_id):
result.append(
db.FlowStateAndTimestamps(
flow_state=f.flow_state,
create_time=f.create_time,
last_u... | [
"def",
"ReadHuntFlowsStatesAndTimestamps",
"(",
"self",
",",
"hunt_id",
")",
":",
"result",
"=",
"[",
"]",
"for",
"f",
"in",
"self",
".",
"_GetHuntFlows",
"(",
"hunt_id",
")",
":",
"result",
".",
"append",
"(",
"db",
".",
"FlowStateAndTimestamps",
"(",
"fl... | Reads hunt flows states and timestamps. | [
"Reads",
"hunt",
"flows",
"states",
"and",
"timestamps",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L312-L323 | train | Reads hunt flows states and timestamps. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.ReadHuntOutputPluginLogEntries | def ReadHuntOutputPluginLogEntries(self,
hunt_id,
output_plugin_id,
offset,
count,
with_type=None):
"""Reads hunt output plugin log... | python | def ReadHuntOutputPluginLogEntries(self,
hunt_id,
output_plugin_id,
offset,
count,
with_type=None):
"""Reads hunt output plugin log... | [
"def",
"ReadHuntOutputPluginLogEntries",
"(",
"self",
",",
"hunt_id",
",",
"output_plugin_id",
",",
"offset",
",",
"count",
",",
"with_type",
"=",
"None",
")",
":",
"all_entries",
"=",
"[",
"]",
"for",
"flow_obj",
"in",
"self",
".",
"_GetHuntFlows",
"(",
"hu... | Reads hunt output plugin log entries. | [
"Reads",
"hunt",
"output",
"plugin",
"log",
"entries",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L326-L353 | train | Reads hunt output plugin log entries. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_hunts.py | InMemoryDBHuntMixin.CountHuntOutputPluginLogEntries | def CountHuntOutputPluginLogEntries(self,
hunt_id,
output_plugin_id,
with_type=None):
"""Counts hunt output plugin log entries."""
return len(
self.ReadHuntOutputPluginLogEntries(
... | python | def CountHuntOutputPluginLogEntries(self,
hunt_id,
output_plugin_id,
with_type=None):
"""Counts hunt output plugin log entries."""
return len(
self.ReadHuntOutputPluginLogEntries(
... | [
"def",
"CountHuntOutputPluginLogEntries",
"(",
"self",
",",
"hunt_id",
",",
"output_plugin_id",
",",
"with_type",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadHuntOutputPluginLogEntries",
"(",
"hunt_id",
",",
"output_plugin_id",
",",
"0",
",",
... | Counts hunt output plugin log entries. | [
"Counts",
"hunt",
"output",
"plugin",
"log",
"entries",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L356-L364 | train | Counts hunt output plugin log entries. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mysql_foreman_rules.py | MySQLDBForemanRulesMixin.WriteForemanRule | def WriteForemanRule(self, rule, cursor=None):
"""Writes a foreman rule to the database."""
query = ("INSERT INTO foreman_rules "
" (hunt_id, expiration_time, rule) "
"VALUES (%s, FROM_UNIXTIME(%s), %s) "
"ON DUPLICATE KEY UPDATE "
" expiration_time=FROM_UNI... | python | def WriteForemanRule(self, rule, cursor=None):
"""Writes a foreman rule to the database."""
query = ("INSERT INTO foreman_rules "
" (hunt_id, expiration_time, rule) "
"VALUES (%s, FROM_UNIXTIME(%s), %s) "
"ON DUPLICATE KEY UPDATE "
" expiration_time=FROM_UNI... | [
"def",
"WriteForemanRule",
"(",
"self",
",",
"rule",
",",
"cursor",
"=",
"None",
")",
":",
"query",
"=",
"(",
"\"INSERT INTO foreman_rules \"",
"\" (hunt_id, expiration_time, rule) \"",
"\"VALUES (%s, FROM_UNIXTIME(%s), %s) \"",
"\"ON DUPLICATE KEY UPDATE \"",
"\" expiration_... | Writes a foreman rule to the database. | [
"Writes",
"a",
"foreman",
"rule",
"to",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_foreman_rules.py#L16-L26 | train | Writes a foreman rule to the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/gui/admin_ui.py | main | def main(_):
"""Run the main test harness."""
if flags.FLAGS.version:
print("GRR Admin UI {}".format(config_server.VERSION["packageversion"]))
return
config.CONFIG.AddContext(
contexts.ADMIN_UI_CONTEXT,
"Context applied when running the admin user interface GUI.")
server_startup.Init()
... | python | def main(_):
"""Run the main test harness."""
if flags.FLAGS.version:
print("GRR Admin UI {}".format(config_server.VERSION["packageversion"]))
return
config.CONFIG.AddContext(
contexts.ADMIN_UI_CONTEXT,
"Context applied when running the admin user interface GUI.")
server_startup.Init()
... | [
"def",
"main",
"(",
"_",
")",
":",
"if",
"flags",
".",
"FLAGS",
".",
"version",
":",
"print",
"(",
"\"GRR Admin UI {}\"",
".",
"format",
"(",
"config_server",
".",
"VERSION",
"[",
"\"packageversion\"",
"]",
")",
")",
"return",
"config",
".",
"CONFIG",
".... | Run the main test harness. | [
"Run",
"the",
"main",
"test",
"harness",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/admin_ui.py#L44-L111 | train | Main function for the main test harness. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flows/general/administrative.py | WriteAllCrashDetails | def WriteAllCrashDetails(client_id,
crash_details,
flow_session_id=None,
hunt_session_id=None,
token=None):
"""Updates the last crash attribute of the client."""
# AFF4.
if data_store.AFF4Enabled():
with aff4.F... | python | def WriteAllCrashDetails(client_id,
crash_details,
flow_session_id=None,
hunt_session_id=None,
token=None):
"""Updates the last crash attribute of the client."""
# AFF4.
if data_store.AFF4Enabled():
with aff4.F... | [
"def",
"WriteAllCrashDetails",
"(",
"client_id",
",",
"crash_details",
",",
"flow_session_id",
"=",
"None",
",",
"hunt_session_id",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"# AFF4.",
"if",
"data_store",
".",
"AFF4Enabled",
"(",
")",
":",
"with",
"a... | Updates the last crash attribute of the client. | [
"Updates",
"the",
"last",
"crash",
"attribute",
"of",
"the",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L56-L114 | train | Writes the last crash information for a given client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flows/general/administrative.py | ClientCrashHandler.ProcessMessages | def ProcessMessages(self, msgs=None, token=None):
"""Processes this event."""
nanny_msg = ""
for crash_details in msgs:
client_urn = crash_details.client_id
client_id = client_urn.Basename()
# The session id of the flow that crashed.
session_id = crash_details.session_id
# L... | python | def ProcessMessages(self, msgs=None, token=None):
"""Processes this event."""
nanny_msg = ""
for crash_details in msgs:
client_urn = crash_details.client_id
client_id = client_urn.Basename()
# The session id of the flow that crashed.
session_id = crash_details.session_id
# L... | [
"def",
"ProcessMessages",
"(",
"self",
",",
"msgs",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"nanny_msg",
"=",
"\"\"",
"for",
"crash_details",
"in",
"msgs",
":",
"client_urn",
"=",
"crash_details",
".",
"client_id",
"client_id",
"=",
"client_urn",
... | Processes this event. | [
"Processes",
"this",
"event",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L137-L232 | train | Processes the given messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flows/general/administrative.py | GetClientStatsProcessResponseMixin.ProcessResponse | def ProcessResponse(self, client_id, response):
"""Actually processes the contents of the response."""
precondition.AssertType(client_id, Text)
downsampled = rdf_client_stats.ClientStats.Downsampled(response)
if data_store.AFF4Enabled():
urn = rdf_client.ClientURN(client_id).Add("stats")
w... | python | def ProcessResponse(self, client_id, response):
"""Actually processes the contents of the response."""
precondition.AssertType(client_id, Text)
downsampled = rdf_client_stats.ClientStats.Downsampled(response)
if data_store.AFF4Enabled():
urn = rdf_client.ClientURN(client_id).Add("stats")
w... | [
"def",
"ProcessResponse",
"(",
"self",
",",
"client_id",
",",
"response",
")",
":",
"precondition",
".",
"AssertType",
"(",
"client_id",
",",
"Text",
")",
"downsampled",
"=",
"rdf_client_stats",
".",
"ClientStats",
".",
"Downsampled",
"(",
"response",
")",
"if... | Actually processes the contents of the response. | [
"Actually",
"processes",
"the",
"contents",
"of",
"the",
"response",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L238-L254 | train | Processes the response of a client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flows/general/administrative.py | GetClientStatsAuto.ProcessMessage | def ProcessMessage(self, message):
"""Processes a stats response from the client."""
self.ProcessResponse(message.source.Basename(), message.payload) | python | def ProcessMessage(self, message):
"""Processes a stats response from the client."""
self.ProcessResponse(message.source.Basename(), message.payload) | [
"def",
"ProcessMessage",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"ProcessResponse",
"(",
"message",
".",
"source",
".",
"Basename",
"(",
")",
",",
"message",
".",
"payload",
")"
] | Processes a stats response from the client. | [
"Processes",
"a",
"stats",
"response",
"from",
"the",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L287-L289 | train | Processes a stats response from the client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flows/general/administrative.py | Foreman.ProcessMessage | def ProcessMessage(self, message):
"""Run the foreman on the client."""
# Only accept authenticated messages
if (message.auth_state !=
rdf_flows.GrrMessage.AuthorizationState.AUTHENTICATED):
return
now = time.time()
# Maintain a cache of the foreman
with self.lock:
if (self... | python | def ProcessMessage(self, message):
"""Run the foreman on the client."""
# Only accept authenticated messages
if (message.auth_state !=
rdf_flows.GrrMessage.AuthorizationState.AUTHENTICATED):
return
now = time.time()
# Maintain a cache of the foreman
with self.lock:
if (self... | [
"def",
"ProcessMessage",
"(",
"self",
",",
"message",
")",
":",
"# Only accept authenticated messages",
"if",
"(",
"message",
".",
"auth_state",
"!=",
"rdf_flows",
".",
"GrrMessage",
".",
"AuthorizationState",
".",
"AUTHENTICATED",
")",
":",
"return",
"now",
"=",
... | Run the foreman on the client. | [
"Run",
"the",
"foreman",
"on",
"the",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L530-L548 | train | Process a message from the client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flows/general/administrative.py | NannyMessageHandlerMixin.SendEmail | def SendEmail(self, client_id, message):
"""Processes this event."""
logging.info(self.logline, client_id, message)
client_info = None
hostname = None
# Write crash data.
if data_store.RelationalDBEnabled():
client = data_store.REL_DB.ReadClientSnapshot(client_id)
if client is not ... | python | def SendEmail(self, client_id, message):
"""Processes this event."""
logging.info(self.logline, client_id, message)
client_info = None
hostname = None
# Write crash data.
if data_store.RelationalDBEnabled():
client = data_store.REL_DB.ReadClientSnapshot(client_id)
if client is not ... | [
"def",
"SendEmail",
"(",
"self",
",",
"client_id",
",",
"message",
")",
":",
"logging",
".",
"info",
"(",
"self",
".",
"logline",
",",
"client_id",
",",
"message",
")",
"client_info",
"=",
"None",
"hostname",
"=",
"None",
"# Write crash data.",
"if",
"data... | Processes this event. | [
"Processes",
"this",
"event",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L795-L837 | train | Sends an email to the GRR server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flows/general/administrative.py | ClientStartupHandlerMixin.WriteClientStartupInfo | def WriteClientStartupInfo(self, client_id, new_si):
"""Handle a startup event."""
drift = rdfvalue.Duration("5m")
if data_store.RelationalDBEnabled():
current_si = data_store.REL_DB.ReadClientStartupInfo(client_id)
# We write the updated record if the client_info has any changes
# or th... | python | def WriteClientStartupInfo(self, client_id, new_si):
"""Handle a startup event."""
drift = rdfvalue.Duration("5m")
if data_store.RelationalDBEnabled():
current_si = data_store.REL_DB.ReadClientStartupInfo(client_id)
# We write the updated record if the client_info has any changes
# or th... | [
"def",
"WriteClientStartupInfo",
"(",
"self",
",",
"client_id",
",",
"new_si",
")",
":",
"drift",
"=",
"rdfvalue",
".",
"Duration",
"(",
"\"5m\"",
")",
"if",
"data_store",
".",
"RelationalDBEnabled",
"(",
")",
":",
"current_si",
"=",
"data_store",
".",
"REL_... | Handle a startup event. | [
"Handle",
"a",
"startup",
"event",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L903-L947 | train | Write a startup info record for a given client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WriteMessageHandlerRequests | def WriteMessageHandlerRequests(self, requests):
"""Writes a list of message handler requests to the database."""
now = rdfvalue.RDFDatetime.Now()
for r in requests:
flow_dict = self.message_handler_requests.setdefault(r.handler_name, {})
cloned_request = r.Copy()
cloned_request.timestamp ... | python | def WriteMessageHandlerRequests(self, requests):
"""Writes a list of message handler requests to the database."""
now = rdfvalue.RDFDatetime.Now()
for r in requests:
flow_dict = self.message_handler_requests.setdefault(r.handler_name, {})
cloned_request = r.Copy()
cloned_request.timestamp ... | [
"def",
"WriteMessageHandlerRequests",
"(",
"self",
",",
"requests",
")",
":",
"now",
"=",
"rdfvalue",
".",
"RDFDatetime",
".",
"Now",
"(",
")",
"for",
"r",
"in",
"requests",
":",
"flow_dict",
"=",
"self",
".",
"message_handler_requests",
".",
"setdefault",
"... | Writes a list of message handler requests to the database. | [
"Writes",
"a",
"list",
"of",
"message",
"handler",
"requests",
"to",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L40-L47 | train | Writes a list of message handler requests to the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadMessageHandlerRequests | def ReadMessageHandlerRequests(self):
"""Reads all message handler requests from the database."""
res = []
leases = self.message_handler_leases
for requests in itervalues(self.message_handler_requests):
for r in itervalues(requests):
res.append(r.Copy())
existing_lease = leases.get... | python | def ReadMessageHandlerRequests(self):
"""Reads all message handler requests from the database."""
res = []
leases = self.message_handler_leases
for requests in itervalues(self.message_handler_requests):
for r in itervalues(requests):
res.append(r.Copy())
existing_lease = leases.get... | [
"def",
"ReadMessageHandlerRequests",
"(",
"self",
")",
":",
"res",
"=",
"[",
"]",
"leases",
"=",
"self",
".",
"message_handler_leases",
"for",
"requests",
"in",
"itervalues",
"(",
"self",
".",
"message_handler_requests",
")",
":",
"for",
"r",
"in",
"itervalues... | Reads all message handler requests from the database. | [
"Reads",
"all",
"message",
"handler",
"requests",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L50-L60 | train | Reads all message handler requests from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.DeleteMessageHandlerRequests | def DeleteMessageHandlerRequests(self, requests):
"""Deletes a list of message handler requests from the database."""
for r in requests:
flow_dict = self.message_handler_requests.get(r.handler_name, {})
if r.request_id in flow_dict:
del flow_dict[r.request_id]
flow_dict = self.message... | python | def DeleteMessageHandlerRequests(self, requests):
"""Deletes a list of message handler requests from the database."""
for r in requests:
flow_dict = self.message_handler_requests.get(r.handler_name, {})
if r.request_id in flow_dict:
del flow_dict[r.request_id]
flow_dict = self.message... | [
"def",
"DeleteMessageHandlerRequests",
"(",
"self",
",",
"requests",
")",
":",
"for",
"r",
"in",
"requests",
":",
"flow_dict",
"=",
"self",
".",
"message_handler_requests",
".",
"get",
"(",
"r",
".",
"handler_name",
",",
"{",
"}",
")",
"if",
"r",
".",
"r... | Deletes a list of message handler requests from the database. | [
"Deletes",
"a",
"list",
"of",
"message",
"handler",
"requests",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L63-L72 | train | Deletes a list of message handler requests from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.RegisterMessageHandler | def RegisterMessageHandler(self, handler, lease_time, limit=1000):
"""Leases a number of message handler requests up to the indicated limit."""
self.UnregisterMessageHandler()
self.handler_stop = False
self.handler_thread = threading.Thread(
name="message_handler",
target=self._MessageH... | python | def RegisterMessageHandler(self, handler, lease_time, limit=1000):
"""Leases a number of message handler requests up to the indicated limit."""
self.UnregisterMessageHandler()
self.handler_stop = False
self.handler_thread = threading.Thread(
name="message_handler",
target=self._MessageH... | [
"def",
"RegisterMessageHandler",
"(",
"self",
",",
"handler",
",",
"lease_time",
",",
"limit",
"=",
"1000",
")",
":",
"self",
".",
"UnregisterMessageHandler",
"(",
")",
"self",
".",
"handler_stop",
"=",
"False",
"self",
".",
"handler_thread",
"=",
"threading",... | Leases a number of message handler requests up to the indicated limit. | [
"Leases",
"a",
"number",
"of",
"message",
"handler",
"requests",
"up",
"to",
"the",
"indicated",
"limit",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L74-L84 | train | Registers a message handler. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.UnregisterMessageHandler | def UnregisterMessageHandler(self, timeout=None):
"""Unregisters any registered message handler."""
if self.handler_thread:
self.handler_stop = True
self.handler_thread.join(timeout)
if self.handler_thread.isAlive():
raise RuntimeError("Message handler thread did not join in time.")
... | python | def UnregisterMessageHandler(self, timeout=None):
"""Unregisters any registered message handler."""
if self.handler_thread:
self.handler_stop = True
self.handler_thread.join(timeout)
if self.handler_thread.isAlive():
raise RuntimeError("Message handler thread did not join in time.")
... | [
"def",
"UnregisterMessageHandler",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"self",
".",
"handler_thread",
":",
"self",
".",
"handler_stop",
"=",
"True",
"self",
".",
"handler_thread",
".",
"join",
"(",
"timeout",
")",
"if",
"self",
".",
... | Unregisters any registered message handler. | [
"Unregisters",
"any",
"registered",
"message",
"handler",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L86-L93 | train | Unregisters any registered message handler. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin._LeaseMessageHandlerRequests | def _LeaseMessageHandlerRequests(self, lease_time, limit):
"""Read and lease some outstanding message handler requests."""
leased_requests = []
now = rdfvalue.RDFDatetime.Now()
zero = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(0)
expiration_time = now + lease_time
leases = self.message_handler... | python | def _LeaseMessageHandlerRequests(self, lease_time, limit):
"""Read and lease some outstanding message handler requests."""
leased_requests = []
now = rdfvalue.RDFDatetime.Now()
zero = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(0)
expiration_time = now + lease_time
leases = self.message_handler... | [
"def",
"_LeaseMessageHandlerRequests",
"(",
"self",
",",
"lease_time",
",",
"limit",
")",
":",
"leased_requests",
"=",
"[",
"]",
"now",
"=",
"rdfvalue",
".",
"RDFDatetime",
".",
"Now",
"(",
")",
"zero",
"=",
"rdfvalue",
".",
"RDFDatetime",
".",
"FromSecondsS... | Read and lease some outstanding message handler requests. | [
"Read",
"and",
"lease",
"some",
"outstanding",
"message",
"handler",
"requests",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L107-L127 | train | Read and lease some outstanding message handler requests. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadAllClientActionRequests | def ReadAllClientActionRequests(self, client_id):
"""Reads all client action requests available for a given client_id."""
res = []
for key, orig_request in iteritems(self.client_action_requests):
request_client_id, _, _ = key
if request_client_id != client_id:
continue
request = o... | python | def ReadAllClientActionRequests(self, client_id):
"""Reads all client action requests available for a given client_id."""
res = []
for key, orig_request in iteritems(self.client_action_requests):
request_client_id, _, _ = key
if request_client_id != client_id:
continue
request = o... | [
"def",
"ReadAllClientActionRequests",
"(",
"self",
",",
"client_id",
")",
":",
"res",
"=",
"[",
"]",
"for",
"key",
",",
"orig_request",
"in",
"iteritems",
"(",
"self",
".",
"client_action_requests",
")",
":",
"request_client_id",
",",
"_",
",",
"_",
"=",
"... | Reads all client action requests available for a given client_id. | [
"Reads",
"all",
"client",
"action",
"requests",
"available",
"for",
"a",
"given",
"client_id",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L130-L149 | train | Reads all client action requests available for a given client_id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.LeaseClientActionRequests | def LeaseClientActionRequests(self,
client_id,
lease_time=None,
limit=sys.maxsize):
"""Leases available client action requests for a client."""
leased_requests = []
now = rdfvalue.RDFDatetime.Now()
expirati... | python | def LeaseClientActionRequests(self,
client_id,
lease_time=None,
limit=sys.maxsize):
"""Leases available client action requests for a client."""
leased_requests = []
now = rdfvalue.RDFDatetime.Now()
expirati... | [
"def",
"LeaseClientActionRequests",
"(",
"self",
",",
"client_id",
",",
"lease_time",
"=",
"None",
",",
"limit",
"=",
"sys",
".",
"maxsize",
")",
":",
"leased_requests",
"=",
"[",
"]",
"now",
"=",
"rdfvalue",
".",
"RDFDatetime",
".",
"Now",
"(",
")",
"ex... | Leases available client action requests for a client. | [
"Leases",
"available",
"client",
"action",
"requests",
"for",
"a",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L171-L208 | train | Leases available client action requests for a client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WriteClientActionRequests | def WriteClientActionRequests(self, requests):
"""Writes messages that should go to the client to the db."""
for r in requests:
req_dict = self.flow_requests.get((r.client_id, r.flow_id), {})
if r.request_id not in req_dict:
request_keys = [(r.client_id, r.flow_id, r.request_id) for r in req... | python | def WriteClientActionRequests(self, requests):
"""Writes messages that should go to the client to the db."""
for r in requests:
req_dict = self.flow_requests.get((r.client_id, r.flow_id), {})
if r.request_id not in req_dict:
request_keys = [(r.client_id, r.flow_id, r.request_id) for r in req... | [
"def",
"WriteClientActionRequests",
"(",
"self",
",",
"requests",
")",
":",
"for",
"r",
"in",
"requests",
":",
"req_dict",
"=",
"self",
".",
"flow_requests",
".",
"get",
"(",
"(",
"r",
".",
"client_id",
",",
"r",
".",
"flow_id",
")",
",",
"{",
"}",
"... | Writes messages that should go to the client to the db. | [
"Writes",
"messages",
"that",
"should",
"go",
"to",
"the",
"client",
"to",
"the",
"db",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L211-L222 | train | Writes messages that should go to the client to the db. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WriteFlowObject | def WriteFlowObject(self, flow_obj):
"""Writes a flow object to the database."""
if flow_obj.client_id not in self.metadatas:
raise db.UnknownClientError(flow_obj.client_id)
clone = flow_obj.Copy()
clone.last_update_time = rdfvalue.RDFDatetime.Now()
self.flows[(flow_obj.client_id, flow_obj.fl... | python | def WriteFlowObject(self, flow_obj):
"""Writes a flow object to the database."""
if flow_obj.client_id not in self.metadatas:
raise db.UnknownClientError(flow_obj.client_id)
clone = flow_obj.Copy()
clone.last_update_time = rdfvalue.RDFDatetime.Now()
self.flows[(flow_obj.client_id, flow_obj.fl... | [
"def",
"WriteFlowObject",
"(",
"self",
",",
"flow_obj",
")",
":",
"if",
"flow_obj",
".",
"client_id",
"not",
"in",
"self",
".",
"metadatas",
":",
"raise",
"db",
".",
"UnknownClientError",
"(",
"flow_obj",
".",
"client_id",
")",
"clone",
"=",
"flow_obj",
".... | Writes a flow object to the database. | [
"Writes",
"a",
"flow",
"object",
"to",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L225-L232 | train | Writes a flow object to the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadFlowObject | def ReadFlowObject(self, client_id, flow_id):
"""Reads a flow object from the database."""
try:
return self.flows[(client_id, flow_id)].Copy()
except KeyError:
raise db.UnknownFlowError(client_id, flow_id) | python | def ReadFlowObject(self, client_id, flow_id):
"""Reads a flow object from the database."""
try:
return self.flows[(client_id, flow_id)].Copy()
except KeyError:
raise db.UnknownFlowError(client_id, flow_id) | [
"def",
"ReadFlowObject",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"try",
":",
"return",
"self",
".",
"flows",
"[",
"(",
"client_id",
",",
"flow_id",
")",
"]",
".",
"Copy",
"(",
")",
"except",
"KeyError",
":",
"raise",
"db",
".",
"Unkn... | Reads a flow object from the database. | [
"Reads",
"a",
"flow",
"object",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L235-L240 | train | Reads a flow object from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadAllFlowObjects | def ReadAllFlowObjects(
self,
client_id = None,
min_create_time = None,
max_create_time = None,
include_child_flows = True,
):
"""Returns all flow objects."""
res = []
for flow in itervalues(self.flows):
if ((client_id is None or flow.client_id == client_id) and
... | python | def ReadAllFlowObjects(
self,
client_id = None,
min_create_time = None,
max_create_time = None,
include_child_flows = True,
):
"""Returns all flow objects."""
res = []
for flow in itervalues(self.flows):
if ((client_id is None or flow.client_id == client_id) and
... | [
"def",
"ReadAllFlowObjects",
"(",
"self",
",",
"client_id",
"=",
"None",
",",
"min_create_time",
"=",
"None",
",",
"max_create_time",
"=",
"None",
",",
"include_child_flows",
"=",
"True",
",",
")",
":",
"res",
"=",
"[",
"]",
"for",
"flow",
"in",
"itervalue... | Returns all flow objects. | [
"Returns",
"all",
"flow",
"objects",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L242-L257 | train | Reads all flow objects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadChildFlowObjects | def ReadChildFlowObjects(self, client_id, flow_id):
"""Reads flows that were started by a given flow from the database."""
res = []
for flow in itervalues(self.flows):
if flow.client_id == client_id and flow.parent_flow_id == flow_id:
res.append(flow)
return res | python | def ReadChildFlowObjects(self, client_id, flow_id):
"""Reads flows that were started by a given flow from the database."""
res = []
for flow in itervalues(self.flows):
if flow.client_id == client_id and flow.parent_flow_id == flow_id:
res.append(flow)
return res | [
"def",
"ReadChildFlowObjects",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"res",
"=",
"[",
"]",
"for",
"flow",
"in",
"itervalues",
"(",
"self",
".",
"flows",
")",
":",
"if",
"flow",
".",
"client_id",
"==",
"client_id",
"and",
"flow",
".",... | Reads flows that were started by a given flow from the database. | [
"Reads",
"flows",
"that",
"were",
"started",
"by",
"a",
"given",
"flow",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L260-L266 | train | Reads child flows that were started by a given flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.LeaseFlowForProcessing | def LeaseFlowForProcessing(self, client_id, flow_id, processing_time):
"""Marks a flow as being processed on this worker and returns it."""
rdf_flow = self.ReadFlowObject(client_id, flow_id)
# TODO(user): remove the check for a legacy hunt prefix as soon as
# AFF4 is gone.
if rdf_flow.parent_hunt_id... | python | def LeaseFlowForProcessing(self, client_id, flow_id, processing_time):
"""Marks a flow as being processed on this worker and returns it."""
rdf_flow = self.ReadFlowObject(client_id, flow_id)
# TODO(user): remove the check for a legacy hunt prefix as soon as
# AFF4 is gone.
if rdf_flow.parent_hunt_id... | [
"def",
"LeaseFlowForProcessing",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"processing_time",
")",
":",
"rdf_flow",
"=",
"self",
".",
"ReadFlowObject",
"(",
"client_id",
",",
"flow_id",
")",
"# TODO(user): remove the check for a legacy hunt prefix as soon as",
... | Marks a flow as being processed on this worker and returns it. | [
"Marks",
"a",
"flow",
"as",
"being",
"processed",
"on",
"this",
"worker",
"and",
"returns",
"it",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L269-L297 | train | Leases a flow for processing. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.UpdateFlow | def UpdateFlow(self,
client_id,
flow_id,
flow_obj=db.Database.unchanged,
flow_state=db.Database.unchanged,
client_crash_info=db.Database.unchanged,
pending_termination=db.Database.unchanged,
processing... | python | def UpdateFlow(self,
client_id,
flow_id,
flow_obj=db.Database.unchanged,
flow_state=db.Database.unchanged,
client_crash_info=db.Database.unchanged,
pending_termination=db.Database.unchanged,
processing... | [
"def",
"UpdateFlow",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"flow_obj",
"=",
"db",
".",
"Database",
".",
"unchanged",
",",
"flow_state",
"=",
"db",
".",
"Database",
".",
"unchanged",
",",
"client_crash_info",
"=",
"db",
".",
"Database",
".",
... | Updates flow objects in the database. | [
"Updates",
"flow",
"objects",
"in",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L300-L333 | train | Updates the flow with the given client_id and flow_id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.UpdateFlows | def UpdateFlows(self,
client_id_flow_id_pairs,
pending_termination=db.Database.unchanged):
"""Updates flow objects in the database."""
for client_id, flow_id in client_id_flow_id_pairs:
try:
self.UpdateFlow(
client_id, flow_id, pending_termination=pe... | python | def UpdateFlows(self,
client_id_flow_id_pairs,
pending_termination=db.Database.unchanged):
"""Updates flow objects in the database."""
for client_id, flow_id in client_id_flow_id_pairs:
try:
self.UpdateFlow(
client_id, flow_id, pending_termination=pe... | [
"def",
"UpdateFlows",
"(",
"self",
",",
"client_id_flow_id_pairs",
",",
"pending_termination",
"=",
"db",
".",
"Database",
".",
"unchanged",
")",
":",
"for",
"client_id",
",",
"flow_id",
"in",
"client_id_flow_id_pairs",
":",
"try",
":",
"self",
".",
"UpdateFlow"... | Updates flow objects in the database. | [
"Updates",
"flow",
"objects",
"in",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L336-L345 | train | Updates the flow objects in the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WriteFlowRequests | def WriteFlowRequests(self, requests):
"""Writes a list of flow requests to the database."""
flow_processing_requests = []
for request in requests:
if (request.client_id, request.flow_id) not in self.flows:
raise db.AtLeastOneUnknownFlowError([(request.client_id,
... | python | def WriteFlowRequests(self, requests):
"""Writes a list of flow requests to the database."""
flow_processing_requests = []
for request in requests:
if (request.client_id, request.flow_id) not in self.flows:
raise db.AtLeastOneUnknownFlowError([(request.client_id,
... | [
"def",
"WriteFlowRequests",
"(",
"self",
",",
"requests",
")",
":",
"flow_processing_requests",
"=",
"[",
"]",
"for",
"request",
"in",
"requests",
":",
"if",
"(",
"request",
".",
"client_id",
",",
"request",
".",
"flow_id",
")",
"not",
"in",
"self",
".",
... | Writes a list of flow requests to the database. | [
"Writes",
"a",
"list",
"of",
"flow",
"requests",
"to",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L348-L373 | train | Writes a list of flow requests to the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.DeleteFlowRequests | def DeleteFlowRequests(self, requests):
"""Deletes a list of flow requests from the database."""
for request in requests:
if (request.client_id, request.flow_id) not in self.flows:
raise db.UnknownFlowError(request.client_id, request.flow_id)
for request in requests:
key = (request.clie... | python | def DeleteFlowRequests(self, requests):
"""Deletes a list of flow requests from the database."""
for request in requests:
if (request.client_id, request.flow_id) not in self.flows:
raise db.UnknownFlowError(request.client_id, request.flow_id)
for request in requests:
key = (request.clie... | [
"def",
"DeleteFlowRequests",
"(",
"self",
",",
"requests",
")",
":",
"for",
"request",
"in",
"requests",
":",
"if",
"(",
"request",
".",
"client_id",
",",
"request",
".",
"flow_id",
")",
"not",
"in",
"self",
".",
"flows",
":",
"raise",
"db",
".",
"Unkn... | Deletes a list of flow requests from the database. | [
"Deletes",
"a",
"list",
"of",
"flow",
"requests",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L376-L395 | train | Deletes a list of flow requests from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WriteFlowResponses | def WriteFlowResponses(self, responses):
"""Writes FlowMessages and updates corresponding requests."""
status_available = set()
requests_updated = set()
task_ids_by_request = {}
for response in responses:
flow_key = (response.client_id, response.flow_id)
if flow_key not in self.flows:
... | python | def WriteFlowResponses(self, responses):
"""Writes FlowMessages and updates corresponding requests."""
status_available = set()
requests_updated = set()
task_ids_by_request = {}
for response in responses:
flow_key = (response.client_id, response.flow_id)
if flow_key not in self.flows:
... | [
"def",
"WriteFlowResponses",
"(",
"self",
",",
"responses",
")",
":",
"status_available",
"=",
"set",
"(",
")",
"requests_updated",
"=",
"set",
"(",
")",
"task_ids_by_request",
"=",
"{",
"}",
"for",
"response",
"in",
"responses",
":",
"flow_key",
"=",
"(",
... | Writes FlowMessages and updates corresponding requests. | [
"Writes",
"FlowMessages",
"and",
"updates",
"corresponding",
"requests",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L398-L461 | train | Writes FlowMessages and updates corresponding requests. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadAllFlowRequestsAndResponses | def ReadAllFlowRequestsAndResponses(self, client_id, flow_id):
"""Reads all requests and responses for a given flow from the database."""
flow_key = (client_id, flow_id)
try:
self.flows[flow_key]
except KeyError:
return []
request_dict = self.flow_requests.get(flow_key, {})
response... | python | def ReadAllFlowRequestsAndResponses(self, client_id, flow_id):
"""Reads all requests and responses for a given flow from the database."""
flow_key = (client_id, flow_id)
try:
self.flows[flow_key]
except KeyError:
return []
request_dict = self.flow_requests.get(flow_key, {})
response... | [
"def",
"ReadAllFlowRequestsAndResponses",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"flow_key",
"=",
"(",
"client_id",
",",
"flow_id",
")",
"try",
":",
"self",
".",
"flows",
"[",
"flow_key",
"]",
"except",
"KeyError",
":",
"return",
"[",
"]"... | Reads all requests and responses for a given flow from the database. | [
"Reads",
"all",
"requests",
"and",
"responses",
"for",
"a",
"given",
"flow",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L464-L479 | train | Reads all requests and responses for a given flow from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.DeleteAllFlowRequestsAndResponses | def DeleteAllFlowRequestsAndResponses(self, client_id, flow_id):
"""Deletes all requests and responses for a given flow from the database."""
flow_key = (client_id, flow_id)
try:
self.flows[flow_key]
except KeyError:
raise db.UnknownFlowError(client_id, flow_id)
try:
del self.flow... | python | def DeleteAllFlowRequestsAndResponses(self, client_id, flow_id):
"""Deletes all requests and responses for a given flow from the database."""
flow_key = (client_id, flow_id)
try:
self.flows[flow_key]
except KeyError:
raise db.UnknownFlowError(client_id, flow_id)
try:
del self.flow... | [
"def",
"DeleteAllFlowRequestsAndResponses",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"flow_key",
"=",
"(",
"client_id",
",",
"flow_id",
")",
"try",
":",
"self",
".",
"flows",
"[",
"flow_key",
"]",
"except",
"KeyError",
":",
"raise",
"db",
"... | Deletes all requests and responses for a given flow from the database. | [
"Deletes",
"all",
"requests",
"and",
"responses",
"for",
"a",
"given",
"flow",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L482-L498 | train | Deletes all requests and responses for a given flow from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadFlowRequestsReadyForProcessing | def ReadFlowRequestsReadyForProcessing(self,
client_id,
flow_id,
next_needed_request=None):
"""Reads all requests for a flow that can be processed by the worker."""
request_dict = self.flow... | python | def ReadFlowRequestsReadyForProcessing(self,
client_id,
flow_id,
next_needed_request=None):
"""Reads all requests for a flow that can be processed by the worker."""
request_dict = self.flow... | [
"def",
"ReadFlowRequestsReadyForProcessing",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"next_needed_request",
"=",
"None",
")",
":",
"request_dict",
"=",
"self",
".",
"flow_requests",
".",
"get",
"(",
"(",
"client_id",
",",
"flow_id",
")",
",",
"{",
... | Reads all requests for a flow that can be processed by the worker. | [
"Reads",
"all",
"requests",
"for",
"a",
"flow",
"that",
"can",
"be",
"processed",
"by",
"the",
"worker",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L501-L536 | train | Reads all requests for a flow that can be processed by the worker. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReleaseProcessedFlow | def ReleaseProcessedFlow(self, flow_obj):
"""Releases a flow that the worker was processing to the database."""
key = (flow_obj.client_id, flow_obj.flow_id)
next_id_to_process = flow_obj.next_request_to_process
request_dict = self.flow_requests.get(key, {})
if (next_id_to_process in request_dict and... | python | def ReleaseProcessedFlow(self, flow_obj):
"""Releases a flow that the worker was processing to the database."""
key = (flow_obj.client_id, flow_obj.flow_id)
next_id_to_process = flow_obj.next_request_to_process
request_dict = self.flow_requests.get(key, {})
if (next_id_to_process in request_dict and... | [
"def",
"ReleaseProcessedFlow",
"(",
"self",
",",
"flow_obj",
")",
":",
"key",
"=",
"(",
"flow_obj",
".",
"client_id",
",",
"flow_obj",
".",
"flow_id",
")",
"next_id_to_process",
"=",
"flow_obj",
".",
"next_request_to_process",
"request_dict",
"=",
"self",
".",
... | Releases a flow that the worker was processing to the database. | [
"Releases",
"a",
"flow",
"that",
"the",
"worker",
"was",
"processing",
"to",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L539-L555 | train | Releases a flow that the worker was processing. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WriteFlowProcessingRequests | def WriteFlowProcessingRequests(self, requests):
"""Writes a list of flow processing requests to the database."""
# If we don't have a handler thread running, we might be able to process the
# requests inline. If we are not, we start the handler thread for real and
# queue the requests normally.
if ... | python | def WriteFlowProcessingRequests(self, requests):
"""Writes a list of flow processing requests to the database."""
# If we don't have a handler thread running, we might be able to process the
# requests inline. If we are not, we start the handler thread for real and
# queue the requests normally.
if ... | [
"def",
"WriteFlowProcessingRequests",
"(",
"self",
",",
"requests",
")",
":",
"# If we don't have a handler thread running, we might be able to process the",
"# requests inline. If we are not, we start the handler thread for real and",
"# queue the requests normally.",
"if",
"not",
"self",... | Writes a list of flow processing requests to the database. | [
"Writes",
"a",
"list",
"of",
"flow",
"processing",
"requests",
"to",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L564-L583 | train | Writes a list of flow processing requests to the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.AckFlowProcessingRequests | def AckFlowProcessingRequests(self, requests):
"""Deletes a list of flow processing requests from the database."""
for r in requests:
key = (r.client_id, r.flow_id)
if key in self.flow_processing_requests:
del self.flow_processing_requests[key] | python | def AckFlowProcessingRequests(self, requests):
"""Deletes a list of flow processing requests from the database."""
for r in requests:
key = (r.client_id, r.flow_id)
if key in self.flow_processing_requests:
del self.flow_processing_requests[key] | [
"def",
"AckFlowProcessingRequests",
"(",
"self",
",",
"requests",
")",
":",
"for",
"r",
"in",
"requests",
":",
"key",
"=",
"(",
"r",
".",
"client_id",
",",
"r",
".",
"flow_id",
")",
"if",
"key",
"in",
"self",
".",
"flow_processing_requests",
":",
"del",
... | Deletes a list of flow processing requests from the database. | [
"Deletes",
"a",
"list",
"of",
"flow",
"processing",
"requests",
"from",
"the",
"database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L591-L596 | train | Acknowledge flow processing requests from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin._RegisterFlowProcessingHandler | def _RegisterFlowProcessingHandler(self, handler):
"""Registers a handler to receive flow processing messages."""
self.flow_handler_stop = False
self.flow_handler_thread = threading.Thread(
name="flow_processing_handler",
target=self._HandleFlowProcessingRequestLoop,
args=(handler,))... | python | def _RegisterFlowProcessingHandler(self, handler):
"""Registers a handler to receive flow processing messages."""
self.flow_handler_stop = False
self.flow_handler_thread = threading.Thread(
name="flow_processing_handler",
target=self._HandleFlowProcessingRequestLoop,
args=(handler,))... | [
"def",
"_RegisterFlowProcessingHandler",
"(",
"self",
",",
"handler",
")",
":",
"self",
".",
"flow_handler_stop",
"=",
"False",
"self",
".",
"flow_handler_thread",
"=",
"threading",
".",
"Thread",
"(",
"name",
"=",
"\"flow_processing_handler\"",
",",
"target",
"="... | Registers a handler to receive flow processing messages. | [
"Registers",
"a",
"handler",
"to",
"receive",
"flow",
"processing",
"messages",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L610-L618 | train | Registers a handler to receive flow processing messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.UnregisterFlowProcessingHandler | def UnregisterFlowProcessingHandler(self, timeout=None):
"""Unregisters any registered flow processing handler."""
self.flow_handler_target = None
if self.flow_handler_thread:
self.flow_handler_stop = True
self.flow_handler_thread.join(timeout)
if self.flow_handler_thread.isAlive():
... | python | def UnregisterFlowProcessingHandler(self, timeout=None):
"""Unregisters any registered flow processing handler."""
self.flow_handler_target = None
if self.flow_handler_thread:
self.flow_handler_stop = True
self.flow_handler_thread.join(timeout)
if self.flow_handler_thread.isAlive():
... | [
"def",
"UnregisterFlowProcessingHandler",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"flow_handler_target",
"=",
"None",
"if",
"self",
".",
"flow_handler_thread",
":",
"self",
".",
"flow_handler_stop",
"=",
"True",
"self",
".",
"flow_handle... | Unregisters any registered flow processing handler. | [
"Unregisters",
"any",
"registered",
"flow",
"processing",
"handler",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L620-L629 | train | Unregisters any registered flow processing handler. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WaitUntilNoFlowsToProcess | def WaitUntilNoFlowsToProcess(self, timeout=None):
"""Waits until flow processing thread is done processing flows.
Args:
timeout: If specified, is a max number of seconds to spend waiting.
Raises:
TimeOutWhileWaitingForFlowsToBeProcessedError: if timeout is reached.
"""
t = self.flow_h... | python | def WaitUntilNoFlowsToProcess(self, timeout=None):
"""Waits until flow processing thread is done processing flows.
Args:
timeout: If specified, is a max number of seconds to spend waiting.
Raises:
TimeOutWhileWaitingForFlowsToBeProcessedError: if timeout is reached.
"""
t = self.flow_h... | [
"def",
"WaitUntilNoFlowsToProcess",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"t",
"=",
"self",
".",
"flow_handler_thread",
"if",
"not",
"t",
":",
"return",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"while",
"True",
":",
"with",
"self",... | Waits until flow processing thread is done processing flows.
Args:
timeout: If specified, is a max number of seconds to spend waiting.
Raises:
TimeOutWhileWaitingForFlowsToBeProcessedError: if timeout is reached. | [
"Waits",
"until",
"flow",
"processing",
"thread",
"is",
"done",
"processing",
"flows",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L641-L669 | train | Waits until all flows in the sequence are done processing flows. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin._HandleFlowProcessingRequestLoop | def _HandleFlowProcessingRequestLoop(self, handler):
"""Handler thread for the FlowProcessingRequest queue."""
while not self.flow_handler_stop:
with self.lock:
todo = self._GetFlowRequestsReadyForProcessing()
for request in todo:
self.flow_handler_num_being_processed += 1
... | python | def _HandleFlowProcessingRequestLoop(self, handler):
"""Handler thread for the FlowProcessingRequest queue."""
while not self.flow_handler_stop:
with self.lock:
todo = self._GetFlowRequestsReadyForProcessing()
for request in todo:
self.flow_handler_num_being_processed += 1
... | [
"def",
"_HandleFlowProcessingRequestLoop",
"(",
"self",
",",
"handler",
")",
":",
"while",
"not",
"self",
".",
"flow_handler_stop",
":",
"with",
"self",
".",
"lock",
":",
"todo",
"=",
"self",
".",
"_GetFlowRequestsReadyForProcessing",
"(",
")",
"for",
"request",... | Handler thread for the FlowProcessingRequest queue. | [
"Handler",
"thread",
"for",
"the",
"FlowProcessingRequest",
"queue",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L671-L686 | train | Handler thread for the FlowProcessingRequest queue. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WriteFlowResults | def WriteFlowResults(self, results):
"""Writes flow results for a given flow."""
for r in results:
dest = self.flow_results.setdefault((r.client_id, r.flow_id), [])
to_write = r.Copy()
to_write.timestamp = rdfvalue.RDFDatetime.Now()
dest.append(to_write) | python | def WriteFlowResults(self, results):
"""Writes flow results for a given flow."""
for r in results:
dest = self.flow_results.setdefault((r.client_id, r.flow_id), [])
to_write = r.Copy()
to_write.timestamp = rdfvalue.RDFDatetime.Now()
dest.append(to_write) | [
"def",
"WriteFlowResults",
"(",
"self",
",",
"results",
")",
":",
"for",
"r",
"in",
"results",
":",
"dest",
"=",
"self",
".",
"flow_results",
".",
"setdefault",
"(",
"(",
"r",
".",
"client_id",
",",
"r",
".",
"flow_id",
")",
",",
"[",
"]",
")",
"to... | Writes flow results for a given flow. | [
"Writes",
"flow",
"results",
"for",
"a",
"given",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L689-L695 | train | Writes results for a given flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadFlowResults | def ReadFlowResults(self,
client_id,
flow_id,
offset,
count,
with_tag=None,
with_type=None,
with_substring=None):
"""Reads flow results of a given flow using give... | python | def ReadFlowResults(self,
client_id,
flow_id,
offset,
count,
with_tag=None,
with_type=None,
with_substring=None):
"""Reads flow results of a given flow using give... | [
"def",
"ReadFlowResults",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"offset",
",",
"count",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
",",
"with_substring",
"=",
"None",
")",
":",
"results",
"=",
"sorted",
"(",
"[",
"x",
".... | Reads flow results of a given flow using given query options. | [
"Reads",
"flow",
"results",
"of",
"a",
"given",
"flow",
"using",
"given",
"query",
"options",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L698-L735 | train | Reads the flow results of a given flow using given query options. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.CountFlowResults | def CountFlowResults(self, client_id, flow_id, with_tag=None, with_type=None):
"""Counts flow results of a given flow using given query options."""
return len(
self.ReadFlowResults(
client_id,
flow_id,
0,
sys.maxsize,
with_tag=with_tag,
... | python | def CountFlowResults(self, client_id, flow_id, with_tag=None, with_type=None):
"""Counts flow results of a given flow using given query options."""
return len(
self.ReadFlowResults(
client_id,
flow_id,
0,
sys.maxsize,
with_tag=with_tag,
... | [
"def",
"CountFlowResults",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadFlowResults",
"(",
"client_id",
",",
"flow_id",
",",
"0",
",",
"sys",... | Counts flow results of a given flow using given query options. | [
"Counts",
"flow",
"results",
"of",
"a",
"given",
"flow",
"using",
"given",
"query",
"options",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L738-L747 | train | Counts the number of flow results of a given client and flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.CountFlowResultsByType | def CountFlowResultsByType(self, client_id, flow_id):
"""Returns counts of flow results grouped by result type."""
result = collections.Counter()
for hr in self.ReadFlowResults(client_id, flow_id, 0, sys.maxsize):
key = compatibility.GetName(hr.payload.__class__)
result[key] += 1
return res... | python | def CountFlowResultsByType(self, client_id, flow_id):
"""Returns counts of flow results grouped by result type."""
result = collections.Counter()
for hr in self.ReadFlowResults(client_id, flow_id, 0, sys.maxsize):
key = compatibility.GetName(hr.payload.__class__)
result[key] += 1
return res... | [
"def",
"CountFlowResultsByType",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"result",
"=",
"collections",
".",
"Counter",
"(",
")",
"for",
"hr",
"in",
"self",
".",
"ReadFlowResults",
"(",
"client_id",
",",
"flow_id",
",",
"0",
",",
"sys",
"... | Returns counts of flow results grouped by result type. | [
"Returns",
"counts",
"of",
"flow",
"results",
"grouped",
"by",
"result",
"type",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L750-L757 | train | Returns counts of flow results grouped by result type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.WriteFlowLogEntries | def WriteFlowLogEntries(self, entries):
"""Writes flow output plugin log entries for a given flow."""
flow_ids = [(e.client_id, e.flow_id) for e in entries]
for f in flow_ids:
if f not in self.flows:
raise db.AtLeastOneUnknownFlowError(flow_ids)
for e in entries:
dest = self.flow_lo... | python | def WriteFlowLogEntries(self, entries):
"""Writes flow output plugin log entries for a given flow."""
flow_ids = [(e.client_id, e.flow_id) for e in entries]
for f in flow_ids:
if f not in self.flows:
raise db.AtLeastOneUnknownFlowError(flow_ids)
for e in entries:
dest = self.flow_lo... | [
"def",
"WriteFlowLogEntries",
"(",
"self",
",",
"entries",
")",
":",
"flow_ids",
"=",
"[",
"(",
"e",
".",
"client_id",
",",
"e",
".",
"flow_id",
")",
"for",
"e",
"in",
"entries",
"]",
"for",
"f",
"in",
"flow_ids",
":",
"if",
"f",
"not",
"in",
"self... | Writes flow output plugin log entries for a given flow. | [
"Writes",
"flow",
"output",
"plugin",
"log",
"entries",
"for",
"a",
"given",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L760-L771 | train | Writes log entries for a given flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadFlowLogEntries | def ReadFlowLogEntries(self,
client_id,
flow_id,
offset,
count,
with_substring=None):
"""Reads flow log entries of a given flow using given query options."""
entries = sorted(
sel... | python | def ReadFlowLogEntries(self,
client_id,
flow_id,
offset,
count,
with_substring=None):
"""Reads flow log entries of a given flow using given query options."""
entries = sorted(
sel... | [
"def",
"ReadFlowLogEntries",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"offset",
",",
"count",
",",
"with_substring",
"=",
"None",
")",
":",
"entries",
"=",
"sorted",
"(",
"self",
".",
"flow_log_entries",
".",
"get",
"(",
"(",
"client_id",
",",
... | Reads flow log entries of a given flow using given query options. | [
"Reads",
"flow",
"log",
"entries",
"of",
"a",
"given",
"flow",
"using",
"given",
"query",
"options",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L774-L788 | train | Reads flow log entries of a given flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.CountFlowLogEntries | def CountFlowLogEntries(self, client_id, flow_id):
"""Returns number of flow log entries of a given flow."""
return len(self.ReadFlowLogEntries(client_id, flow_id, 0, sys.maxsize)) | python | def CountFlowLogEntries(self, client_id, flow_id):
"""Returns number of flow log entries of a given flow."""
return len(self.ReadFlowLogEntries(client_id, flow_id, 0, sys.maxsize)) | [
"def",
"CountFlowLogEntries",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadFlowLogEntries",
"(",
"client_id",
",",
"flow_id",
",",
"0",
",",
"sys",
".",
"maxsize",
")",
")"
] | Returns number of flow log entries of a given flow. | [
"Returns",
"number",
"of",
"flow",
"log",
"entries",
"of",
"a",
"given",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L791-L793 | train | Returns the number of flow log entries of a given flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.ReadFlowOutputPluginLogEntries | def ReadFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
offset,
count,
with... | python | def ReadFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
offset,
count,
with... | [
"def",
"ReadFlowOutputPluginLogEntries",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"output_plugin_id",
",",
"offset",
",",
"count",
",",
"with_type",
"=",
"None",
")",
":",
"entries",
"=",
"sorted",
"(",
"self",
".",
"flow_output_plugin_log_entries",
"... | Reads flow output plugin log entries. | [
"Reads",
"flow",
"output",
"plugin",
"log",
"entries",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L811-L828 | train | Reads flow output plugin log entries. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_flows.py | InMemoryDBFlowMixin.CountFlowOutputPluginLogEntries | def CountFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
with_type=None):
"""Returns number of flow output plugin log entries of a given flow... | python | def CountFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
with_type=None):
"""Returns number of flow output plugin log entries of a given flow... | [
"def",
"CountFlowOutputPluginLogEntries",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"output_plugin_id",
",",
"with_type",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadFlowOutputPluginLogEntries",
"(",
"client_id",
",",
"flow_id",
",",
... | Returns number of flow output plugin log entries of a given flow. | [
"Returns",
"number",
"of",
"flow",
"output",
"plugin",
"log",
"entries",
"of",
"a",
"given",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L831-L845 | train | Returns the number of flow output plugin log entries of a given flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_signed_binaries.py | InMemoryDBSignedBinariesMixin.WriteSignedBinaryReferences | def WriteSignedBinaryReferences(self, binary_id,
references):
"""See db.Database."""
self.signed_binary_references[_SignedBinaryKeyFromID(binary_id)] = (
references.Copy(), rdfvalue.RDFDatetime.Now()) | python | def WriteSignedBinaryReferences(self, binary_id,
references):
"""See db.Database."""
self.signed_binary_references[_SignedBinaryKeyFromID(binary_id)] = (
references.Copy(), rdfvalue.RDFDatetime.Now()) | [
"def",
"WriteSignedBinaryReferences",
"(",
"self",
",",
"binary_id",
",",
"references",
")",
":",
"self",
".",
"signed_binary_references",
"[",
"_SignedBinaryKeyFromID",
"(",
"binary_id",
")",
"]",
"=",
"(",
"references",
".",
"Copy",
"(",
")",
",",
"rdfvalue",
... | See db.Database. | [
"See",
"db",
".",
"Database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_signed_binaries.py#L45-L49 | train | Writes signed binary references. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mem_signed_binaries.py | InMemoryDBSignedBinariesMixin.ReadSignedBinaryReferences | def ReadSignedBinaryReferences(
self, binary_id
):
"""See db.Database."""
binary_key = _SignedBinaryKeyFromID(binary_id)
try:
references, timestamp = self.signed_binary_references[binary_key]
except KeyError:
raise db.UnknownSignedBinaryError(binary_id)
return references.Copy(), ... | python | def ReadSignedBinaryReferences(
self, binary_id
):
"""See db.Database."""
binary_key = _SignedBinaryKeyFromID(binary_id)
try:
references, timestamp = self.signed_binary_references[binary_key]
except KeyError:
raise db.UnknownSignedBinaryError(binary_id)
return references.Copy(), ... | [
"def",
"ReadSignedBinaryReferences",
"(",
"self",
",",
"binary_id",
")",
":",
"binary_key",
"=",
"_SignedBinaryKeyFromID",
"(",
"binary_id",
")",
"try",
":",
"references",
",",
"timestamp",
"=",
"self",
".",
"signed_binary_references",
"[",
"binary_key",
"]",
"exc... | See db.Database. | [
"See",
"db",
".",
"Database",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_signed_binaries.py#L52-L61 | train | Reads the signed binary references. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/output_plugins/sqlite_plugin.py | SqliteInstantOutputPlugin._GetSqliteSchema | def _GetSqliteSchema(self, proto_struct_class, prefix=""):
"""Returns a mapping of SQLite column names to Converter objects."""
schema = collections.OrderedDict()
for type_info in proto_struct_class.type_infos:
if type_info.__class__ is rdf_structs.ProtoEmbedded:
schema.update(
sel... | python | def _GetSqliteSchema(self, proto_struct_class, prefix=""):
"""Returns a mapping of SQLite column names to Converter objects."""
schema = collections.OrderedDict()
for type_info in proto_struct_class.type_infos:
if type_info.__class__ is rdf_structs.ProtoEmbedded:
schema.update(
sel... | [
"def",
"_GetSqliteSchema",
"(",
"self",
",",
"proto_struct_class",
",",
"prefix",
"=",
"\"\"",
")",
":",
"schema",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"for",
"type_info",
"in",
"proto_struct_class",
".",
"type_infos",
":",
"if",
"type_info",
".",... | Returns a mapping of SQLite column names to Converter objects. | [
"Returns",
"a",
"mapping",
"of",
"SQLite",
"column",
"names",
"to",
"Converter",
"objects",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/output_plugins/sqlite_plugin.py#L160-L171 | train | Returns a mapping of SQLite column names to Converter objects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/output_plugins/sqlite_plugin.py | SqliteInstantOutputPlugin._ConvertToCanonicalSqlDict | def _ConvertToCanonicalSqlDict(self, schema, raw_dict, prefix=""):
"""Converts a dict of RDF values into a SQL-ready form."""
flattened_dict = {}
for k, v in iteritems(raw_dict):
if isinstance(v, dict):
flattened_dict.update(
self._ConvertToCanonicalSqlDict(
schema,... | python | def _ConvertToCanonicalSqlDict(self, schema, raw_dict, prefix=""):
"""Converts a dict of RDF values into a SQL-ready form."""
flattened_dict = {}
for k, v in iteritems(raw_dict):
if isinstance(v, dict):
flattened_dict.update(
self._ConvertToCanonicalSqlDict(
schema,... | [
"def",
"_ConvertToCanonicalSqlDict",
"(",
"self",
",",
"schema",
",",
"raw_dict",
",",
"prefix",
"=",
"\"\"",
")",
":",
"flattened_dict",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
"raw_dict",
")",
":",
"if",
"isinstance",
"(",
"v",
"... | Converts a dict of RDF values into a SQL-ready form. | [
"Converts",
"a",
"dict",
"of",
"RDF",
"values",
"into",
"a",
"SQL",
"-",
"ready",
"form",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/output_plugins/sqlite_plugin.py#L182-L193 | train | Converts a dict of RDF values into a SQL - ready form. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/output_plugins/sqlite_plugin.py | SqliteInstantOutputPlugin._FlushAllRows | def _FlushAllRows(self, db_connection, table_name):
"""Copies rows from the given db into the output file then deletes them."""
for sql in db_connection.iterdump():
if (sql.startswith("CREATE TABLE") or
sql.startswith("BEGIN TRANSACTION") or sql.startswith("COMMIT")):
# These statements ... | python | def _FlushAllRows(self, db_connection, table_name):
"""Copies rows from the given db into the output file then deletes them."""
for sql in db_connection.iterdump():
if (sql.startswith("CREATE TABLE") or
sql.startswith("BEGIN TRANSACTION") or sql.startswith("COMMIT")):
# These statements ... | [
"def",
"_FlushAllRows",
"(",
"self",
",",
"db_connection",
",",
"table_name",
")",
":",
"for",
"sql",
"in",
"db_connection",
".",
"iterdump",
"(",
")",
":",
"if",
"(",
"sql",
".",
"startswith",
"(",
"\"CREATE TABLE\"",
")",
"or",
"sql",
".",
"startswith",
... | Copies rows from the given db into the output file then deletes them. | [
"Copies",
"rows",
"from",
"the",
"given",
"db",
"into",
"the",
"output",
"file",
"then",
"deletes",
"them",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/output_plugins/sqlite_plugin.py#L195-L206 | train | Copies all rows from the given db into the output file then deletes them. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/serialize.py | YamlDumper | def YamlDumper(aff4object):
"""Dumps the given aff4object into a yaml representation."""
aff4object.Flush()
result = {}
for attribute, values in iteritems(aff4object.synced_attributes):
result[attribute.predicate] = []
for value in values:
# This value is really a LazyDecoder() instance. We need ... | python | def YamlDumper(aff4object):
"""Dumps the given aff4object into a yaml representation."""
aff4object.Flush()
result = {}
for attribute, values in iteritems(aff4object.synced_attributes):
result[attribute.predicate] = []
for value in values:
# This value is really a LazyDecoder() instance. We need ... | [
"def",
"YamlDumper",
"(",
"aff4object",
")",
":",
"aff4object",
".",
"Flush",
"(",
")",
"result",
"=",
"{",
"}",
"for",
"attribute",
",",
"values",
"in",
"iteritems",
"(",
"aff4object",
".",
"synced_attributes",
")",
":",
"result",
"[",
"attribute",
".",
... | Dumps the given aff4object into a yaml representation. | [
"Dumps",
"the",
"given",
"aff4object",
"into",
"a",
"yaml",
"representation",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/serialize.py#L16-L38 | train | Dumps the given aff4object into a yaml representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.