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/server/grr_response_server/maintenance_utils.py | UploadSignedConfigBlob | def UploadSignedConfigBlob(content,
aff4_path,
client_context=None,
limit=None,
token=None):
"""Upload a signed blob into the datastore.
Args:
content: File content to upload.
aff4_path: aff4 path to... | python | def UploadSignedConfigBlob(content,
aff4_path,
client_context=None,
limit=None,
token=None):
"""Upload a signed blob into the datastore.
Args:
content: File content to upload.
aff4_path: aff4 path to... | [
"def",
"UploadSignedConfigBlob",
"(",
"content",
",",
"aff4_path",
",",
"client_context",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"if",
"limit",
"is",
"None",
":",
"limit",
"=",
"config",
".",
"CONFIG",
"[",
"\"Datast... | Upload a signed blob into the datastore.
Args:
content: File content to upload.
aff4_path: aff4 path to upload to.
client_context: The configuration contexts to use.
limit: The maximum size of the chunk to use.
token: A security token.
Raises:
IOError: On failure to write. | [
"Upload",
"a",
"signed",
"blob",
"into",
"the",
"datastore",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/maintenance_utils.py#L40-L83 | train | Uploads a signed blob into the datastore. | 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/maintenance_utils.py | RotateServerKey | def RotateServerKey(cn=u"grr", keylength=4096):
"""This function creates and installs a new server key.
Note that
- Clients might experience intermittent connection problems after
the server keys rotated.
- It's not possible to go back to an earlier key. Clients that see a
new certificate will rememb... | python | def RotateServerKey(cn=u"grr", keylength=4096):
"""This function creates and installs a new server key.
Note that
- Clients might experience intermittent connection problems after
the server keys rotated.
- It's not possible to go back to an earlier key. Clients that see a
new certificate will rememb... | [
"def",
"RotateServerKey",
"(",
"cn",
"=",
"u\"grr\"",
",",
"keylength",
"=",
"4096",
")",
":",
"ca_certificate",
"=",
"config",
".",
"CONFIG",
"[",
"\"CA.certificate\"",
"]",
"ca_private_key",
"=",
"config",
".",
"CONFIG",
"[",
"\"PrivateKeys.ca_key\"",
"]",
"... | This function creates and installs a new server key.
Note that
- Clients might experience intermittent connection problems after
the server keys rotated.
- It's not possible to go back to an earlier key. Clients that see a
new certificate will remember the cert's serial number and refuse
to accept ... | [
"This",
"function",
"creates",
"and",
"installs",
"a",
"new",
"server",
"key",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/maintenance_utils.py#L86-L133 | train | This function creates and installs a new server key. | 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/api_call_router_with_approval_checks.py | RelDBChecker._CheckAccess | def _CheckAccess(self, username, subject_id, approval_type):
"""Checks access to a given subject by a given user."""
precondition.AssertType(subject_id, Text)
cache_key = (username, subject_id, approval_type)
try:
self.acl_cache.Get(cache_key)
stats_collector_instance.Get().IncrementCounter... | python | def _CheckAccess(self, username, subject_id, approval_type):
"""Checks access to a given subject by a given user."""
precondition.AssertType(subject_id, Text)
cache_key = (username, subject_id, approval_type)
try:
self.acl_cache.Get(cache_key)
stats_collector_instance.Get().IncrementCounter... | [
"def",
"_CheckAccess",
"(",
"self",
",",
"username",
",",
"subject_id",
",",
"approval_type",
")",
":",
"precondition",
".",
"AssertType",
"(",
"subject_id",
",",
"Text",
")",
"cache_key",
"=",
"(",
"username",
",",
"subject_id",
",",
"approval_type",
")",
"... | Checks access to a given subject by a given user. | [
"Checks",
"access",
"to",
"a",
"given",
"subject",
"by",
"a",
"given",
"user",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L64-L96 | train | Checks access to a given subject by a given user. | 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/api_call_router_with_approval_checks.py | RelDBChecker.CheckClientAccess | def CheckClientAccess(self, username, client_id):
"""Checks whether a given user can access given client."""
self._CheckAccess(
username, str(client_id),
rdf_objects.ApprovalRequest.ApprovalType.APPROVAL_TYPE_CLIENT) | python | def CheckClientAccess(self, username, client_id):
"""Checks whether a given user can access given client."""
self._CheckAccess(
username, str(client_id),
rdf_objects.ApprovalRequest.ApprovalType.APPROVAL_TYPE_CLIENT) | [
"def",
"CheckClientAccess",
"(",
"self",
",",
"username",
",",
"client_id",
")",
":",
"self",
".",
"_CheckAccess",
"(",
"username",
",",
"str",
"(",
"client_id",
")",
",",
"rdf_objects",
".",
"ApprovalRequest",
".",
"ApprovalType",
".",
"APPROVAL_TYPE_CLIENT",
... | Checks whether a given user can access given client. | [
"Checks",
"whether",
"a",
"given",
"user",
"can",
"access",
"given",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L98-L102 | train | Checks whether a given user can access 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/gui/api_call_router_with_approval_checks.py | RelDBChecker.CheckHuntAccess | def CheckHuntAccess(self, username, hunt_id):
"""Checks whether a given user can access given hunt."""
self._CheckAccess(
username, str(hunt_id),
rdf_objects.ApprovalRequest.ApprovalType.APPROVAL_TYPE_HUNT) | python | def CheckHuntAccess(self, username, hunt_id):
"""Checks whether a given user can access given hunt."""
self._CheckAccess(
username, str(hunt_id),
rdf_objects.ApprovalRequest.ApprovalType.APPROVAL_TYPE_HUNT) | [
"def",
"CheckHuntAccess",
"(",
"self",
",",
"username",
",",
"hunt_id",
")",
":",
"self",
".",
"_CheckAccess",
"(",
"username",
",",
"str",
"(",
"hunt_id",
")",
",",
"rdf_objects",
".",
"ApprovalRequest",
".",
"ApprovalType",
".",
"APPROVAL_TYPE_HUNT",
")"
] | Checks whether a given user can access given hunt. | [
"Checks",
"whether",
"a",
"given",
"user",
"can",
"access",
"given",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L104-L109 | train | Checks whether a given user can access 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/gui/api_call_router_with_approval_checks.py | RelDBChecker.CheckCronJobAccess | def CheckCronJobAccess(self, username, cron_job_id):
"""Checks whether a given user can access given cron job."""
self._CheckAccess(
username, str(cron_job_id),
rdf_objects.ApprovalRequest.ApprovalType.APPROVAL_TYPE_CRON_JOB) | python | def CheckCronJobAccess(self, username, cron_job_id):
"""Checks whether a given user can access given cron job."""
self._CheckAccess(
username, str(cron_job_id),
rdf_objects.ApprovalRequest.ApprovalType.APPROVAL_TYPE_CRON_JOB) | [
"def",
"CheckCronJobAccess",
"(",
"self",
",",
"username",
",",
"cron_job_id",
")",
":",
"self",
".",
"_CheckAccess",
"(",
"username",
",",
"str",
"(",
"cron_job_id",
")",
",",
"rdf_objects",
".",
"ApprovalRequest",
".",
"ApprovalType",
".",
"APPROVAL_TYPE_CRON_... | Checks whether a given user can access given cron job. | [
"Checks",
"whether",
"a",
"given",
"user",
"can",
"access",
"given",
"cron",
"job",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L111-L116 | train | Checks whether a given user can access given cron job. | 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/api_call_router_with_approval_checks.py | RelDBChecker.CheckIfCanStartClientFlow | def CheckIfCanStartClientFlow(self, username, flow_name):
"""Checks whether a given user can start a given flow."""
del username # Unused.
flow_cls = flow.GRRFlow.GetPlugin(flow_name)
if not flow_cls.category:
raise access_control.UnauthorizedAccess(
"Flow %s can't be started via the ... | python | def CheckIfCanStartClientFlow(self, username, flow_name):
"""Checks whether a given user can start a given flow."""
del username # Unused.
flow_cls = flow.GRRFlow.GetPlugin(flow_name)
if not flow_cls.category:
raise access_control.UnauthorizedAccess(
"Flow %s can't be started via the ... | [
"def",
"CheckIfCanStartClientFlow",
"(",
"self",
",",
"username",
",",
"flow_name",
")",
":",
"del",
"username",
"# Unused.",
"flow_cls",
"=",
"flow",
".",
"GRRFlow",
".",
"GetPlugin",
"(",
"flow_name",
")",
"if",
"not",
"flow_cls",
".",
"category",
":",
"ra... | Checks whether a given user can start a given flow. | [
"Checks",
"whether",
"a",
"given",
"user",
"can",
"start",
"a",
"given",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L118-L126 | train | Checks whether a given user can start 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/gui/api_call_router_with_approval_checks.py | RelDBChecker.CheckIfUserIsAdmin | def CheckIfUserIsAdmin(self, username):
"""Checks whether the user is an admin."""
user_obj = data_store.REL_DB.ReadGRRUser(username)
if user_obj.user_type != user_obj.UserType.USER_TYPE_ADMIN:
raise access_control.UnauthorizedAccess("User %s is not an admin." %
... | python | def CheckIfUserIsAdmin(self, username):
"""Checks whether the user is an admin."""
user_obj = data_store.REL_DB.ReadGRRUser(username)
if user_obj.user_type != user_obj.UserType.USER_TYPE_ADMIN:
raise access_control.UnauthorizedAccess("User %s is not an admin." %
... | [
"def",
"CheckIfUserIsAdmin",
"(",
"self",
",",
"username",
")",
":",
"user_obj",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadGRRUser",
"(",
"username",
")",
"if",
"user_obj",
".",
"user_type",
"!=",
"user_obj",
".",
"UserType",
".",
"USER_TYPE_ADMIN",
":",
"... | Checks whether the user is an admin. | [
"Checks",
"whether",
"the",
"user",
"is",
"an",
"admin",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L128-L134 | train | Checks whether the user is an admin. | 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/check_lib/triggers.py | Condition.Artifacts | def Artifacts(self, os_name=None, cpe=None, label=None):
"""Whether the conditions applies, modulo host data.
Args:
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
True if os_name, cpe or labels match. Empty values are ignored.
"""
hit = lambda x: ... | python | def Artifacts(self, os_name=None, cpe=None, label=None):
"""Whether the conditions applies, modulo host data.
Args:
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
True if os_name, cpe or labels match. Empty values are ignored.
"""
hit = lambda x: ... | [
"def",
"Artifacts",
"(",
"self",
",",
"os_name",
"=",
"None",
",",
"cpe",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"hit",
"=",
"lambda",
"x",
":",
"x",
"[",
"0",
"]",
"==",
"x",
"[",
"1",
"]",
"or",
"not",
"x",
"[",
"0",
"]",
"seq"... | Whether the conditions applies, modulo host data.
Args:
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
True if os_name, cpe or labels match. Empty values are ignored. | [
"Whether",
"the",
"conditions",
"applies",
"modulo",
"host",
"data",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L88-L101 | train | Determines if the conditions applies to the host 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/check_lib/triggers.py | Condition.Search | def Search(self, artifact, os_name=None, cpe=None, label=None):
"""Whether the condition contains the specified values.
Args:
artifact: A string identifier for the artifact.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
True if the values match the... | python | def Search(self, artifact, os_name=None, cpe=None, label=None):
"""Whether the condition contains the specified values.
Args:
artifact: A string identifier for the artifact.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
True if the values match the... | [
"def",
"Search",
"(",
"self",
",",
"artifact",
",",
"os_name",
"=",
"None",
",",
"cpe",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"hit",
"=",
"lambda",
"x",
":",
"x",
"[",
"0",
"]",
"==",
"x",
"[",
"1",
"]",
"or",
"not",
"x",
"[",
"... | Whether the condition contains the specified values.
Args:
artifact: A string identifier for the artifact.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
True if the values match the non-empty query attributes.
Empty query attributes are ignored i... | [
"Whether",
"the",
"condition",
"contains",
"the",
"specified",
"values",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L103-L119 | train | Searches the condition for the specified values. | 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/check_lib/triggers.py | Triggers._Register | def _Register(self, conditions, callback):
"""Map functions that should be called if the condition applies."""
for condition in conditions:
registered = self._registry.setdefault(condition, [])
if callback and callback not in registered:
registered.append(callback) | python | def _Register(self, conditions, callback):
"""Map functions that should be called if the condition applies."""
for condition in conditions:
registered = self._registry.setdefault(condition, [])
if callback and callback not in registered:
registered.append(callback) | [
"def",
"_Register",
"(",
"self",
",",
"conditions",
",",
"callback",
")",
":",
"for",
"condition",
"in",
"conditions",
":",
"registered",
"=",
"self",
".",
"_registry",
".",
"setdefault",
"(",
"condition",
",",
"[",
"]",
")",
"if",
"callback",
"and",
"ca... | Map functions that should be called if the condition applies. | [
"Map",
"functions",
"that",
"should",
"be",
"called",
"if",
"the",
"condition",
"applies",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L132-L137 | train | Register a callback for the 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/check_lib/triggers.py | Triggers.Add | def Add(self, artifact=None, target=None, callback=None):
"""Add criteria for a check.
Args:
artifact: An artifact name.
target: A tuple of artifact necessary to process the data.
callback: Entities that should be called if the condition matches.
"""
# Cases where a target field is un... | python | def Add(self, artifact=None, target=None, callback=None):
"""Add criteria for a check.
Args:
artifact: An artifact name.
target: A tuple of artifact necessary to process the data.
callback: Entities that should be called if the condition matches.
"""
# Cases where a target field is un... | [
"def",
"Add",
"(",
"self",
",",
"artifact",
"=",
"None",
",",
"target",
"=",
"None",
",",
"callback",
"=",
"None",
")",
":",
"# Cases where a target field is undefined or empty need special handling.",
"# Repeated field helper in target yields results, so expand this out into a... | Add criteria for a check.
Args:
artifact: An artifact name.
target: A tuple of artifact necessary to process the data.
callback: Entities that should be called if the condition matches. | [
"Add",
"criteria",
"for",
"a",
"check",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L139-L160 | train | Adds a condition to the check list. | 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/check_lib/triggers.py | Triggers.Update | def Update(self, other, callback):
"""Adds existing triggers to this set, optionally rebuilding the registry.
Used to aggregate trigger methods from Probes to Methods to Checks.
Args:
other: Another Triggers object.
callback: Registers all the updated triggers to the specified function.
""... | python | def Update(self, other, callback):
"""Adds existing triggers to this set, optionally rebuilding the registry.
Used to aggregate trigger methods from Probes to Methods to Checks.
Args:
other: Another Triggers object.
callback: Registers all the updated triggers to the specified function.
""... | [
"def",
"Update",
"(",
"self",
",",
"other",
",",
"callback",
")",
":",
"self",
".",
"conditions",
".",
"update",
"(",
"other",
".",
"conditions",
")",
"self",
".",
"_Register",
"(",
"other",
".",
"conditions",
",",
"callback",
")"
] | Adds existing triggers to this set, optionally rebuilding the registry.
Used to aggregate trigger methods from Probes to Methods to Checks.
Args:
other: Another Triggers object.
callback: Registers all the updated triggers to the specified function. | [
"Adds",
"existing",
"triggers",
"to",
"this",
"set",
"optionally",
"rebuilding",
"the",
"registry",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L162-L172 | train | Updates the set of existing triggers with the contents of the other set. | 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/check_lib/triggers.py | Triggers.Match | def Match(self, artifact=None, os_name=None, cpe=None, label=None):
"""Test if host data should trigger a check.
Args:
artifact: An artifact name.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of conditions that match.
"""
return [
... | python | def Match(self, artifact=None, os_name=None, cpe=None, label=None):
"""Test if host data should trigger a check.
Args:
artifact: An artifact name.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of conditions that match.
"""
return [
... | [
"def",
"Match",
"(",
"self",
",",
"artifact",
"=",
"None",
",",
"os_name",
"=",
"None",
",",
"cpe",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"return",
"[",
"c",
"for",
"c",
"in",
"self",
".",
"conditions",
"if",
"c",
".",
"Match",
"(",
... | Test if host data should trigger a check.
Args:
artifact: An artifact name.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of conditions that match. | [
"Test",
"if",
"host",
"data",
"should",
"trigger",
"a",
"check",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L174-L188 | train | Test if host data should trigger a check. | 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/check_lib/triggers.py | Triggers.Search | def Search(self, artifact=None, os_name=None, cpe=None, label=None):
"""Find the host attributes that trigger data collection.
Args:
artifact: An artifact name.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of conditions that contain the spe... | python | def Search(self, artifact=None, os_name=None, cpe=None, label=None):
"""Find the host attributes that trigger data collection.
Args:
artifact: An artifact name.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of conditions that contain the spe... | [
"def",
"Search",
"(",
"self",
",",
"artifact",
"=",
"None",
",",
"os_name",
"=",
"None",
",",
"cpe",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"return",
"[",
"c",
"for",
"c",
"in",
"self",
".",
"conditions",
"if",
"c",
".",
"Search",
"(",... | Find the host attributes that trigger data collection.
Args:
artifact: An artifact name.
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of conditions that contain the specified attributes. | [
"Find",
"the",
"host",
"attributes",
"that",
"trigger",
"data",
"collection",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L190-L204 | train | Search the host attributes that trigger data collection. | 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/check_lib/triggers.py | Triggers.Artifacts | def Artifacts(self, os_name=None, cpe=None, label=None):
"""Find the artifacts that correspond with other trigger conditions.
Args:
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of artifacts to be processed.
"""
return [
c.artifact... | python | def Artifacts(self, os_name=None, cpe=None, label=None):
"""Find the artifacts that correspond with other trigger conditions.
Args:
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of artifacts to be processed.
"""
return [
c.artifact... | [
"def",
"Artifacts",
"(",
"self",
",",
"os_name",
"=",
"None",
",",
"cpe",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"return",
"[",
"c",
".",
"artifact",
"for",
"c",
"in",
"self",
".",
"conditions",
"if",
"c",
".",
"Artifacts",
"(",
"os_name... | Find the artifacts that correspond with other trigger conditions.
Args:
os_name: An OS string.
cpe: A CPE string.
label: A label string.
Returns:
A list of artifacts to be processed. | [
"Find",
"the",
"artifacts",
"that",
"correspond",
"with",
"other",
"trigger",
"conditions",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L206-L219 | train | Returns a list of artifacts that correspond with other trigger 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/check_lib/triggers.py | Triggers.Calls | def Calls(self, conditions=None):
"""Find the methods that evaluate data that meets this condition.
Args:
conditions: A tuple of (artifact, os_name, cpe, label)
Returns:
A list of methods that evaluate the data.
"""
results = set()
if conditions is None:
conditions = [None]
... | python | def Calls(self, conditions=None):
"""Find the methods that evaluate data that meets this condition.
Args:
conditions: A tuple of (artifact, os_name, cpe, label)
Returns:
A list of methods that evaluate the data.
"""
results = set()
if conditions is None:
conditions = [None]
... | [
"def",
"Calls",
"(",
"self",
",",
"conditions",
"=",
"None",
")",
":",
"results",
"=",
"set",
"(",
")",
"if",
"conditions",
"is",
"None",
":",
"conditions",
"=",
"[",
"None",
"]",
"for",
"condition",
"in",
"conditions",
":",
"for",
"c",
"in",
"self",... | Find the methods that evaluate data that meets this condition.
Args:
conditions: A tuple of (artifact, os_name, cpe, label)
Returns:
A list of methods that evaluate the data. | [
"Find",
"the",
"methods",
"that",
"evaluate",
"data",
"that",
"meets",
"this",
"condition",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/triggers.py#L221-L236 | train | Find the methods that evaluate the data that meets the condition. | 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/api_plugins/report_plugins/report_plugin_base.py | ReportPluginBase.GetReportDescriptor | def GetReportDescriptor(cls):
"""Returns plugins' metadata in ApiReportDescriptor."""
if cls.TYPE is None:
raise ValueError("%s.TYPE is unintialized." % cls)
if cls.TITLE is None:
raise ValueError("%s.TITLE is unintialized." % cls)
if cls.SUMMARY is None:
raise ValueError("%s.SUMMARY... | python | def GetReportDescriptor(cls):
"""Returns plugins' metadata in ApiReportDescriptor."""
if cls.TYPE is None:
raise ValueError("%s.TYPE is unintialized." % cls)
if cls.TITLE is None:
raise ValueError("%s.TITLE is unintialized." % cls)
if cls.SUMMARY is None:
raise ValueError("%s.SUMMARY... | [
"def",
"GetReportDescriptor",
"(",
"cls",
")",
":",
"if",
"cls",
".",
"TYPE",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"%s.TYPE is unintialized.\"",
"%",
"cls",
")",
"if",
"cls",
".",
"TITLE",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"%s.TI... | Returns plugins' metadata in ApiReportDescriptor. | [
"Returns",
"plugins",
"metadata",
"in",
"ApiReportDescriptor",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/report_plugin_base.py#L31-L47 | train | Returns plugins metadata in ApiReportDescriptor. | 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/key_utils.py | MakeCASignedCert | def MakeCASignedCert(common_name,
private_key,
ca_cert,
ca_private_key,
serial_number=2):
"""Make a cert and sign it with the CA's private key."""
public_key = private_key.GetPublicKey()
builder = x509.CertificateBuilder()
bui... | python | def MakeCASignedCert(common_name,
private_key,
ca_cert,
ca_private_key,
serial_number=2):
"""Make a cert and sign it with the CA's private key."""
public_key = private_key.GetPublicKey()
builder = x509.CertificateBuilder()
bui... | [
"def",
"MakeCASignedCert",
"(",
"common_name",
",",
"private_key",
",",
"ca_cert",
",",
"ca_private_key",
",",
"serial_number",
"=",
"2",
")",
":",
"public_key",
"=",
"private_key",
".",
"GetPublicKey",
"(",
")",
"builder",
"=",
"x509",
".",
"CertificateBuilder"... | Make a cert and sign it with the CA's private key. | [
"Make",
"a",
"cert",
"and",
"sign",
"it",
"with",
"the",
"CA",
"s",
"private",
"key",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/key_utils.py#L16-L46 | train | Makes a certificate and sign it with the CA s private key. | 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/key_utils.py | MakeCACert | def MakeCACert(private_key,
common_name=u"grr",
issuer_cn=u"grr_test",
issuer_c=u"US"):
"""Generate a CA certificate.
Args:
private_key: The private key to use.
common_name: Name for cert.
issuer_cn: Name for issuer.
issuer_c: Country for issuer.
Retu... | python | def MakeCACert(private_key,
common_name=u"grr",
issuer_cn=u"grr_test",
issuer_c=u"US"):
"""Generate a CA certificate.
Args:
private_key: The private key to use.
common_name: Name for cert.
issuer_cn: Name for issuer.
issuer_c: Country for issuer.
Retu... | [
"def",
"MakeCACert",
"(",
"private_key",
",",
"common_name",
"=",
"u\"grr\"",
",",
"issuer_cn",
"=",
"u\"grr_test\"",
",",
"issuer_c",
"=",
"u\"US\"",
")",
":",
"public_key",
"=",
"private_key",
".",
"GetPublicKey",
"(",
")",
"builder",
"=",
"x509",
".",
"Ce... | Generate a CA certificate.
Args:
private_key: The private key to use.
common_name: Name for cert.
issuer_cn: Name for issuer.
issuer_c: Country for issuer.
Returns:
The certificate. | [
"Generate",
"a",
"CA",
"certificate",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/key_utils.py#L49-L94 | train | Generates a CA certificate. | 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/api_plugins/report_plugins/server_report_plugins.py | _LoadAuditEvents | def _LoadAuditEvents(handlers,
get_report_args,
actions=None,
token=None,
transformers=None):
"""Returns AuditEvents for given handlers, actions, and timerange."""
if transformers is None:
transformers = {}
if data_store.Rela... | python | def _LoadAuditEvents(handlers,
get_report_args,
actions=None,
token=None,
transformers=None):
"""Returns AuditEvents for given handlers, actions, and timerange."""
if transformers is None:
transformers = {}
if data_store.Rela... | [
"def",
"_LoadAuditEvents",
"(",
"handlers",
",",
"get_report_args",
",",
"actions",
"=",
"None",
",",
"token",
"=",
"None",
",",
"transformers",
"=",
"None",
")",
":",
"if",
"transformers",
"is",
"None",
":",
"transformers",
"=",
"{",
"}",
"if",
"data_stor... | Returns AuditEvents for given handlers, actions, and timerange. | [
"Returns",
"AuditEvents",
"for",
"given",
"handlers",
"actions",
"and",
"timerange",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L27-L51 | train | Loads audit events for given handlers actions and timerange. | 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/api_plugins/report_plugins/server_report_plugins.py | _EntryToEvent | def _EntryToEvent(entry, handlers, transformers):
"""Converts an APIAuditEntry to a legacy AuditEvent."""
event = rdf_events.AuditEvent(
timestamp=entry.timestamp,
user=entry.username,
action=handlers[entry.router_method_name])
for fn in transformers:
fn(entry, event)
return event | python | def _EntryToEvent(entry, handlers, transformers):
"""Converts an APIAuditEntry to a legacy AuditEvent."""
event = rdf_events.AuditEvent(
timestamp=entry.timestamp,
user=entry.username,
action=handlers[entry.router_method_name])
for fn in transformers:
fn(entry, event)
return event | [
"def",
"_EntryToEvent",
"(",
"entry",
",",
"handlers",
",",
"transformers",
")",
":",
"event",
"=",
"rdf_events",
".",
"AuditEvent",
"(",
"timestamp",
"=",
"entry",
".",
"timestamp",
",",
"user",
"=",
"entry",
".",
"username",
",",
"action",
"=",
"handlers... | Converts an APIAuditEntry to a legacy AuditEvent. | [
"Converts",
"an",
"APIAuditEntry",
"to",
"a",
"legacy",
"AuditEvent",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L54-L64 | train | Converts an APIAuditEntry to an AuditEvent. | 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/api_plugins/report_plugins/server_report_plugins.py | _ExtractClientIdFromPath | def _ExtractClientIdFromPath(entry, event):
"""Extracts a Client ID from an APIAuditEntry's HTTP request path."""
match = re.match(r".*(C\.[0-9a-fA-F]{16}).*", entry.http_request_path)
if match:
event.client = match.group(1) | python | def _ExtractClientIdFromPath(entry, event):
"""Extracts a Client ID from an APIAuditEntry's HTTP request path."""
match = re.match(r".*(C\.[0-9a-fA-F]{16}).*", entry.http_request_path)
if match:
event.client = match.group(1) | [
"def",
"_ExtractClientIdFromPath",
"(",
"entry",
",",
"event",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"r\".*(C\\.[0-9a-fA-F]{16}).*\"",
",",
"entry",
".",
"http_request_path",
")",
"if",
"match",
":",
"event",
".",
"client",
"=",
"match",
".",
"gro... | Extracts a Client ID from an APIAuditEntry's HTTP request path. | [
"Extracts",
"a",
"Client",
"ID",
"from",
"an",
"APIAuditEntry",
"s",
"HTTP",
"request",
"path",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L67-L71 | train | Extracts a Client ID from an APIAuditEntry s HTTP request path. | 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/api_plugins/report_plugins/server_report_plugins.py | _ExtractCronJobIdFromPath | def _ExtractCronJobIdFromPath(entry, event):
"""Extracts a CronJob ID from an APIAuditEntry's HTTP request path."""
match = re.match(r".*cron-job/([^/]+).*", entry.http_request_path)
if match:
event.urn = "aff4:/cron/{}".format(match.group(1)) | python | def _ExtractCronJobIdFromPath(entry, event):
"""Extracts a CronJob ID from an APIAuditEntry's HTTP request path."""
match = re.match(r".*cron-job/([^/]+).*", entry.http_request_path)
if match:
event.urn = "aff4:/cron/{}".format(match.group(1)) | [
"def",
"_ExtractCronJobIdFromPath",
"(",
"entry",
",",
"event",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"r\".*cron-job/([^/]+).*\"",
",",
"entry",
".",
"http_request_path",
")",
"if",
"match",
":",
"event",
".",
"urn",
"=",
"\"aff4:/cron/{}\"",
".",
... | Extracts a CronJob ID from an APIAuditEntry's HTTP request path. | [
"Extracts",
"a",
"CronJob",
"ID",
"from",
"an",
"APIAuditEntry",
"s",
"HTTP",
"request",
"path",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L75-L79 | train | Extracts a CronJob ID from an APIAuditEntry s HTTP request path. | 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/api_plugins/report_plugins/server_report_plugins.py | _ExtractHuntIdFromPath | def _ExtractHuntIdFromPath(entry, event):
"""Extracts a Hunt ID from an APIAuditEntry's HTTP request path."""
match = re.match(r".*hunt/([^/]+).*", entry.http_request_path)
if match:
event.urn = "aff4:/hunts/{}".format(match.group(1)) | python | def _ExtractHuntIdFromPath(entry, event):
"""Extracts a Hunt ID from an APIAuditEntry's HTTP request path."""
match = re.match(r".*hunt/([^/]+).*", entry.http_request_path)
if match:
event.urn = "aff4:/hunts/{}".format(match.group(1)) | [
"def",
"_ExtractHuntIdFromPath",
"(",
"entry",
",",
"event",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"r\".*hunt/([^/]+).*\"",
",",
"entry",
".",
"http_request_path",
")",
"if",
"match",
":",
"event",
".",
"urn",
"=",
"\"aff4:/hunts/{}\"",
".",
"form... | Extracts a Hunt ID from an APIAuditEntry's HTTP request path. | [
"Extracts",
"a",
"Hunt",
"ID",
"from",
"an",
"APIAuditEntry",
"s",
"HTTP",
"request",
"path",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L82-L86 | train | Extracts a Hunt ID from an APIAuditEntry s HTTP request path. | 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/api_plugins/report_plugins/server_report_plugins.py | ClientApprovalsReportPlugin.GetReportData | def GetReportData(self, get_report_args, token=None):
"""Filter the cron job approvals in the given timerange."""
ret = rdf_report_plugins.ApiReportData(
representation_type=RepresentationType.AUDIT_CHART,
audit_chart=rdf_report_plugins.ApiAuditChartReportData(
used_fields=self.USED_... | python | def GetReportData(self, get_report_args, token=None):
"""Filter the cron job approvals in the given timerange."""
ret = rdf_report_plugins.ApiReportData(
representation_type=RepresentationType.AUDIT_CHART,
audit_chart=rdf_report_plugins.ApiAuditChartReportData(
used_fields=self.USED_... | [
"def",
"GetReportData",
"(",
"self",
",",
"get_report_args",
",",
"token",
"=",
"None",
")",
":",
"ret",
"=",
"rdf_report_plugins",
".",
"ApiReportData",
"(",
"representation_type",
"=",
"RepresentationType",
".",
"AUDIT_CHART",
",",
"audit_chart",
"=",
"rdf_repor... | Filter the cron job approvals in the given timerange. | [
"Filter",
"the",
"cron",
"job",
"approvals",
"in",
"the",
"given",
"timerange",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L107-L119 | train | Returns the data for the given timerange. | 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/api_plugins/report_plugins/server_report_plugins.py | MostActiveUsersReportPlugin.GetReportData | def GetReportData(self, get_report_args, token):
"""Filter the last week of user actions."""
ret = rdf_report_plugins.ApiReportData(
representation_type=RepresentationType.PIE_CHART)
counts = self._GetUserCounts(get_report_args, token)
for username in aff4_users.GRRUser.SYSTEM_USERS:
del ... | python | def GetReportData(self, get_report_args, token):
"""Filter the last week of user actions."""
ret = rdf_report_plugins.ApiReportData(
representation_type=RepresentationType.PIE_CHART)
counts = self._GetUserCounts(get_report_args, token)
for username in aff4_users.GRRUser.SYSTEM_USERS:
del ... | [
"def",
"GetReportData",
"(",
"self",
",",
"get_report_args",
",",
"token",
")",
":",
"ret",
"=",
"rdf_report_plugins",
".",
"ApiReportData",
"(",
"representation_type",
"=",
"RepresentationType",
".",
"PIE_CHART",
")",
"counts",
"=",
"self",
".",
"_GetUserCounts",... | Filter the last week of user actions. | [
"Filter",
"the",
"last",
"week",
"of",
"user",
"actions",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L240-L254 | train | Filter the last week of user actions. | 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/api_plugins/report_plugins/server_report_plugins.py | UserActivityReportPlugin.GetReportData | def GetReportData(self, get_report_args, token):
"""Filter the last week of user actions."""
ret = rdf_report_plugins.ApiReportData(
representation_type=RepresentationType.STACK_CHART)
week_duration = rdfvalue.Duration("7d")
num_weeks = math.ceil(get_report_args.duration.seconds /
... | python | def GetReportData(self, get_report_args, token):
"""Filter the last week of user actions."""
ret = rdf_report_plugins.ApiReportData(
representation_type=RepresentationType.STACK_CHART)
week_duration = rdfvalue.Duration("7d")
num_weeks = math.ceil(get_report_args.duration.seconds /
... | [
"def",
"GetReportData",
"(",
"self",
",",
"get_report_args",
",",
"token",
")",
":",
"ret",
"=",
"rdf_report_plugins",
".",
"ApiReportData",
"(",
"representation_type",
"=",
"RepresentationType",
".",
"STACK_CHART",
")",
"week_duration",
"=",
"rdfvalue",
".",
"Dur... | Filter the last week of user actions. | [
"Filter",
"the",
"last",
"week",
"of",
"user",
"actions",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L360-L394 | train | Returns the last 7 days of the user actions. | 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/client_report_utils.py | _GetAFF4AttributeForReportType | def _GetAFF4AttributeForReportType(report_type
):
"""Returns the corresponding AFF4 attribute for the given report type."""
if report_type == rdf_stats.ClientGraphSeries.ReportType.GRR_VERSION:
return aff4_stats.ClientFleetStats.SchemaCls.GRRVERSION_HISTOGRAM
elif report_type... | python | def _GetAFF4AttributeForReportType(report_type
):
"""Returns the corresponding AFF4 attribute for the given report type."""
if report_type == rdf_stats.ClientGraphSeries.ReportType.GRR_VERSION:
return aff4_stats.ClientFleetStats.SchemaCls.GRRVERSION_HISTOGRAM
elif report_type... | [
"def",
"_GetAFF4AttributeForReportType",
"(",
"report_type",
")",
":",
"if",
"report_type",
"==",
"rdf_stats",
".",
"ClientGraphSeries",
".",
"ReportType",
".",
"GRR_VERSION",
":",
"return",
"aff4_stats",
".",
"ClientFleetStats",
".",
"SchemaCls",
".",
"GRRVERSION_HIS... | Returns the corresponding AFF4 attribute for the given report type. | [
"Returns",
"the",
"corresponding",
"AFF4",
"attribute",
"for",
"the",
"given",
"report",
"type",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_report_utils.py#L33-L45 | train | Returns the corresponding AFF4 attribute for the given report 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/client_report_utils.py | WriteGraphSeries | def WriteGraphSeries(graph_series,
label,
token = None):
"""Writes graph series for a particular client label to the DB.
Args:
graph_series: A series of rdf_stats.Graphs containing aggregated data for a
particular report-type.
label: Client label by which dat... | python | def WriteGraphSeries(graph_series,
label,
token = None):
"""Writes graph series for a particular client label to the DB.
Args:
graph_series: A series of rdf_stats.Graphs containing aggregated data for a
particular report-type.
label: Client label by which dat... | [
"def",
"WriteGraphSeries",
"(",
"graph_series",
",",
"label",
",",
"token",
"=",
"None",
")",
":",
"if",
"data_store",
".",
"RelationalDBEnabled",
"(",
")",
":",
"data_store",
".",
"REL_DB",
".",
"WriteClientGraphSeries",
"(",
"graph_series",
",",
"label",
")"... | Writes graph series for a particular client label to the DB.
Args:
graph_series: A series of rdf_stats.Graphs containing aggregated data for a
particular report-type.
label: Client label by which data in the graph_series was aggregated.
token: ACL token to use for writing to the legacy (non-relatio... | [
"Writes",
"graph",
"series",
"for",
"a",
"particular",
"client",
"label",
"to",
"the",
"DB",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_report_utils.py#L48-L87 | train | Writes graph series for a particular client label 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/client_report_utils.py | FetchAllGraphSeries | def FetchAllGraphSeries(
label,
report_type,
period = None,
token = None
):
"""Fetches graph series for the given label and report-type from the DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
period: rdfvalue.Durat... | python | def FetchAllGraphSeries(
label,
report_type,
period = None,
token = None
):
"""Fetches graph series for the given label and report-type from the DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
period: rdfvalue.Durat... | [
"def",
"FetchAllGraphSeries",
"(",
"label",
",",
"report_type",
",",
"period",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"if",
"_ShouldUseLegacyDatastore",
"(",
")",
":",
"return",
"_FetchAllGraphSeriesFromTheLegacyDB",
"(",
"label",
",",
"report_type",
... | Fetches graph series for the given label and report-type from the DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
period: rdfvalue.Duration specifying how far back in time to fetch data. If
not provided, all data for the given ... | [
"Fetches",
"graph",
"series",
"for",
"the",
"given",
"label",
"and",
"report",
"-",
"type",
"from",
"the",
"DB",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_report_utils.py#L90-L125 | train | Fetches all graph series for the given label and report - type from 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/client_report_utils.py | _FetchAllGraphSeriesFromTheLegacyDB | def _FetchAllGraphSeriesFromTheLegacyDB(
label,
report_type,
period = None,
token = None
):
"""Fetches graph-series from the legacy DB [see FetchAllGraphSeries()]."""
if period is None:
time_range = aff4.ALL_TIMES
else:
range_end = rdfvalue.RDFDatetime.Now()
time_range = (range_end - p... | python | def _FetchAllGraphSeriesFromTheLegacyDB(
label,
report_type,
period = None,
token = None
):
"""Fetches graph-series from the legacy DB [see FetchAllGraphSeries()]."""
if period is None:
time_range = aff4.ALL_TIMES
else:
range_end = rdfvalue.RDFDatetime.Now()
time_range = (range_end - p... | [
"def",
"_FetchAllGraphSeriesFromTheLegacyDB",
"(",
"label",
",",
"report_type",
",",
"period",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"if",
"period",
"is",
"None",
":",
"time_range",
"=",
"aff4",
".",
"ALL_TIMES",
"else",
":",
"range_end",
"=",
... | Fetches graph-series from the legacy DB [see FetchAllGraphSeries()]. | [
"Fetches",
"graph",
"-",
"series",
"from",
"the",
"legacy",
"DB",
"[",
"see",
"FetchAllGraphSeries",
"()",
"]",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_report_utils.py#L128-L165 | train | Fetches all graph - series from the legacy DB [ see FetchAllGraphSeries() ] | 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/client_report_utils.py | FetchMostRecentGraphSeries | def FetchMostRecentGraphSeries(label,
report_type,
token = None
):
"""Fetches the latest graph series for a client label from the DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSe... | python | def FetchMostRecentGraphSeries(label,
report_type,
token = None
):
"""Fetches the latest graph series for a client label from the DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSe... | [
"def",
"FetchMostRecentGraphSeries",
"(",
"label",
",",
"report_type",
",",
"token",
"=",
"None",
")",
":",
"if",
"_ShouldUseLegacyDatastore",
"(",
")",
":",
"return",
"_FetchMostRecentGraphSeriesFromTheLegacyDB",
"(",
"label",
",",
"report_type",
",",
"token",
"=",... | Fetches the latest graph series for a client label from the DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
token: ACL token to use for reading from the legacy (non-relational)
datastore.
Raises:
AFF4AttributeTypeError: ... | [
"Fetches",
"the",
"latest",
"graph",
"series",
"for",
"a",
"client",
"label",
"from",
"the",
"DB",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_report_utils.py#L168-L193 | train | Fetches the latest graph series for a given label and report type from 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/client_report_utils.py | _FetchMostRecentGraphSeriesFromTheLegacyDB | def _FetchMostRecentGraphSeriesFromTheLegacyDB(
label,
report_type,
token = None
):
"""Fetches the latest graph-series for a client label from the legacy DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
token: ACL token ... | python | def _FetchMostRecentGraphSeriesFromTheLegacyDB(
label,
report_type,
token = None
):
"""Fetches the latest graph-series for a client label from the legacy DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
token: ACL token ... | [
"def",
"_FetchMostRecentGraphSeriesFromTheLegacyDB",
"(",
"label",
",",
"report_type",
",",
"token",
"=",
"None",
")",
":",
"try",
":",
"stats_for_label",
"=",
"aff4",
".",
"FACTORY",
".",
"Open",
"(",
"GetAFF4ClientReportsURN",
"(",
")",
".",
"Add",
"(",
"lab... | Fetches the latest graph-series for a client label from the legacy DB.
Args:
label: Client label to fetch data for.
report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
token: ACL token to use for reading from the DB.
Raises:
AFF4AttributeTypeError: If an unexpected report-data t... | [
"Fetches",
"the",
"latest",
"graph",
"-",
"series",
"for",
"a",
"client",
"label",
"from",
"the",
"legacy",
"DB",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_report_utils.py#L196-L240 | train | Fetches the latest graph - series for a given label and report - type from the legacy 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/core/grr_response_core/lib/rdfvalues/flows.py | GrrMessage.GenerateTaskID | def GenerateTaskID(self):
"""Generates a new, unique task_id."""
# Random number can not be zero since next_id_base must increment.
random_number = random.PositiveUInt16()
# 16 bit random numbers
with GrrMessage.lock:
next_id_base = GrrMessage.next_id_base
id_base = (next_id_base + ran... | python | def GenerateTaskID(self):
"""Generates a new, unique task_id."""
# Random number can not be zero since next_id_base must increment.
random_number = random.PositiveUInt16()
# 16 bit random numbers
with GrrMessage.lock:
next_id_base = GrrMessage.next_id_base
id_base = (next_id_base + ran... | [
"def",
"GenerateTaskID",
"(",
"self",
")",
":",
"# Random number can not be zero since next_id_base must increment.",
"random_number",
"=",
"random",
".",
"PositiveUInt16",
"(",
")",
"# 16 bit random numbers",
"with",
"GrrMessage",
".",
"lock",
":",
"next_id_base",
"=",
"... | Generates a new, unique task_id. | [
"Generates",
"a",
"new",
"unique",
"task_id",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/flows.py#L50-L71 | train | Generates a new unique task_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/core/grr_response_core/lib/rdfvalues/flows.py | GrrMessage.payload | def payload(self):
"""The payload property automatically decodes the encapsulated data."""
if self.args_rdf_name:
# Now try to create the correct RDFValue.
result_cls = self.classes.get(self.args_rdf_name, rdfvalue.RDFString)
result = result_cls.FromSerializedString(
self.Get("args"... | python | def payload(self):
"""The payload property automatically decodes the encapsulated data."""
if self.args_rdf_name:
# Now try to create the correct RDFValue.
result_cls = self.classes.get(self.args_rdf_name, rdfvalue.RDFString)
result = result_cls.FromSerializedString(
self.Get("args"... | [
"def",
"payload",
"(",
"self",
")",
":",
"if",
"self",
".",
"args_rdf_name",
":",
"# Now try to create the correct RDFValue.",
"result_cls",
"=",
"self",
".",
"classes",
".",
"get",
"(",
"self",
".",
"args_rdf_name",
",",
"rdfvalue",
".",
"RDFString",
")",
"re... | The payload property automatically decodes the encapsulated data. | [
"The",
"payload",
"property",
"automatically",
"decodes",
"the",
"encapsulated",
"data",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/flows.py#L98-L106 | train | The payload property automatically decodes the encapsulated 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/core/grr_response_core/lib/rdfvalues/flows.py | GrrMessage.payload | def payload(self, value):
"""Automatically encode RDFValues into the message."""
if not isinstance(value, rdfvalue.RDFValue):
raise RuntimeError("Payload must be an RDFValue.")
self.Set("args", value.SerializeToString())
# pylint: disable=protected-access
if value._age is not None:
sel... | python | def payload(self, value):
"""Automatically encode RDFValues into the message."""
if not isinstance(value, rdfvalue.RDFValue):
raise RuntimeError("Payload must be an RDFValue.")
self.Set("args", value.SerializeToString())
# pylint: disable=protected-access
if value._age is not None:
sel... | [
"def",
"payload",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"rdfvalue",
".",
"RDFValue",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Payload must be an RDFValue.\"",
")",
"self",
".",
"Set",
"(",
"\"args\"",
",",
"va... | Automatically encode RDFValues into the message. | [
"Automatically",
"encode",
"RDFValues",
"into",
"the",
"message",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/flows.py#L109-L121 | train | Automatically encode RDFValues into the message. | 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/file_store.py | AddFilesWithUnknownHashes | def AddFilesWithUnknownHashes(
client_path_blob_refs,
use_external_stores = True
):
"""Adds new files consisting of given blob references.
Args:
client_path_blob_refs: A dictionary mapping `db.ClientPath` instances to
lists of blob references.
use_external_stores: A flag indicating if the fil... | python | def AddFilesWithUnknownHashes(
client_path_blob_refs,
use_external_stores = True
):
"""Adds new files consisting of given blob references.
Args:
client_path_blob_refs: A dictionary mapping `db.ClientPath` instances to
lists of blob references.
use_external_stores: A flag indicating if the fil... | [
"def",
"AddFilesWithUnknownHashes",
"(",
"client_path_blob_refs",
",",
"use_external_stores",
"=",
"True",
")",
":",
"hash_id_blob_refs",
"=",
"dict",
"(",
")",
"client_path_hash_id",
"=",
"dict",
"(",
")",
"metadatas",
"=",
"dict",
"(",
")",
"all_client_path_blob_r... | Adds new files consisting of given blob references.
Args:
client_path_blob_refs: A dictionary mapping `db.ClientPath` instances to
lists of blob references.
use_external_stores: A flag indicating if the files should also be added to
external file stores.
Returns:
A dictionary mapping `db.C... | [
"Adds",
"new",
"files",
"consisting",
"of",
"given",
"blob",
"references",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L211-L304 | train | Adds new files consisting of 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/file_store.py | AddFileWithUnknownHash | def AddFileWithUnknownHash(client_path, blob_refs, use_external_stores=True):
"""Add a new file consisting of given blob IDs."""
precondition.AssertType(client_path, db.ClientPath)
precondition.AssertIterableType(blob_refs, rdf_objects.BlobReference)
return AddFilesWithUnknownHashes(
{client_path: blob_re... | python | def AddFileWithUnknownHash(client_path, blob_refs, use_external_stores=True):
"""Add a new file consisting of given blob IDs."""
precondition.AssertType(client_path, db.ClientPath)
precondition.AssertIterableType(blob_refs, rdf_objects.BlobReference)
return AddFilesWithUnknownHashes(
{client_path: blob_re... | [
"def",
"AddFileWithUnknownHash",
"(",
"client_path",
",",
"blob_refs",
",",
"use_external_stores",
"=",
"True",
")",
":",
"precondition",
".",
"AssertType",
"(",
"client_path",
",",
"db",
".",
"ClientPath",
")",
"precondition",
".",
"AssertIterableType",
"(",
"blo... | Add a new file consisting of given blob IDs. | [
"Add",
"a",
"new",
"file",
"consisting",
"of",
"given",
"blob",
"IDs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L307-L313 | train | Adds a new file consisting of given blob IDs. | 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/file_store.py | CheckHashes | def CheckHashes(hash_ids):
"""Checks if files with given hashes are present in the file store.
Args:
hash_ids: A list of SHA256HashID objects.
Returns:
A dict where SHA256HashID objects are keys. Corresponding values
may be False (if hash id is not present) or True if it is not present.
"""
retu... | python | def CheckHashes(hash_ids):
"""Checks if files with given hashes are present in the file store.
Args:
hash_ids: A list of SHA256HashID objects.
Returns:
A dict where SHA256HashID objects are keys. Corresponding values
may be False (if hash id is not present) or True if it is not present.
"""
retu... | [
"def",
"CheckHashes",
"(",
"hash_ids",
")",
":",
"return",
"{",
"k",
":",
"bool",
"(",
"v",
")",
"for",
"k",
",",
"v",
"in",
"data_store",
".",
"REL_DB",
".",
"ReadHashBlobReferences",
"(",
"hash_ids",
")",
".",
"items",
"(",
")",
"}"
] | Checks if files with given hashes are present in the file store.
Args:
hash_ids: A list of SHA256HashID objects.
Returns:
A dict where SHA256HashID objects are keys. Corresponding values
may be False (if hash id is not present) or True if it is not present. | [
"Checks",
"if",
"files",
"with",
"given",
"hashes",
"are",
"present",
"in",
"the",
"file",
"store",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L316-L329 | train | Checks if files with given hashes are present in the file store. | 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/file_store.py | OpenFile | def OpenFile(client_path, max_timestamp=None):
"""Opens latest content of a given file for reading.
Args:
client_path: A db.ClientPath object describing path to a file.
max_timestamp: If specified, will open the last collected version with a
timestamp equal or lower than max_timestamp. If not specifi... | python | def OpenFile(client_path, max_timestamp=None):
"""Opens latest content of a given file for reading.
Args:
client_path: A db.ClientPath object describing path to a file.
max_timestamp: If specified, will open the last collected version with a
timestamp equal or lower than max_timestamp. If not specifi... | [
"def",
"OpenFile",
"(",
"client_path",
",",
"max_timestamp",
"=",
"None",
")",
":",
"path_info",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadLatestPathInfosWithHashBlobReferences",
"(",
"[",
"client_path",
"]",
",",
"max_timestamp",
"=",
"max_timestamp",
")",
"[",... | Opens latest content of a given file for reading.
Args:
client_path: A db.ClientPath object describing path to a file.
max_timestamp: If specified, will open the last collected version with a
timestamp equal or lower than max_timestamp. If not specified, will simply
open the latest version.
Re... | [
"Opens",
"latest",
"content",
"of",
"a",
"given",
"file",
"for",
"reading",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L369-L401 | train | Opens the latest content of a given file for reading. | 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/file_store.py | StreamFilesChunks | def StreamFilesChunks(client_paths, max_timestamp=None, max_size=None):
"""Streams contents of given files.
Args:
client_paths: db.ClientPath objects describing paths to files.
max_timestamp: If specified, then for every requested file will open the
last collected version of the file with a timestamp... | python | def StreamFilesChunks(client_paths, max_timestamp=None, max_size=None):
"""Streams contents of given files.
Args:
client_paths: db.ClientPath objects describing paths to files.
max_timestamp: If specified, then for every requested file will open the
last collected version of the file with a timestamp... | [
"def",
"StreamFilesChunks",
"(",
"client_paths",
",",
"max_timestamp",
"=",
"None",
",",
"max_size",
"=",
"None",
")",
":",
"path_infos_by_cp",
"=",
"(",
"data_store",
".",
"REL_DB",
".",
"ReadLatestPathInfosWithHashBlobReferences",
"(",
"client_paths",
",",
"max_ti... | Streams contents of given files.
Args:
client_paths: db.ClientPath objects describing paths to files.
max_timestamp: If specified, then for every requested file will open the
last collected version of the file with a timestamp equal or lower than
max_timestamp. If not specified, will simply open ... | [
"Streams",
"contents",
"of",
"given",
"files",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L431-L492 | train | Streams contents of given files. | 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/file_store.py | ExternalFileStore.AddFiles | def AddFiles(self, hash_id_metadatas):
"""Adds multiple files to the file store.
Args:
hash_id_metadatas: A dictionary mapping hash ids to file metadata (a tuple
of hash client path and blob references).
"""
for hash_id, metadata in iteritems(hash_id_metadatas):
self.AddFile(hash_id... | python | def AddFiles(self, hash_id_metadatas):
"""Adds multiple files to the file store.
Args:
hash_id_metadatas: A dictionary mapping hash ids to file metadata (a tuple
of hash client path and blob references).
"""
for hash_id, metadata in iteritems(hash_id_metadatas):
self.AddFile(hash_id... | [
"def",
"AddFiles",
"(",
"self",
",",
"hash_id_metadatas",
")",
":",
"for",
"hash_id",
",",
"metadata",
"in",
"iteritems",
"(",
"hash_id_metadatas",
")",
":",
"self",
".",
"AddFile",
"(",
"hash_id",
",",
"metadata",
")"
] | Adds multiple files to the file store.
Args:
hash_id_metadatas: A dictionary mapping hash ids to file metadata (a tuple
of hash client path and blob references). | [
"Adds",
"multiple",
"files",
"to",
"the",
"file",
"store",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L69-L77 | train | Adds multiple files to the file store. | 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/file_store.py | BlobStream._GetChunk | def _GetChunk(self):
"""Fetches a chunk corresponding to the current offset."""
found_ref = None
for ref in self._blob_refs:
if self._offset >= ref.offset and self._offset < (ref.offset + ref.size):
found_ref = ref
break
if not found_ref:
return None, None
# If self._c... | python | def _GetChunk(self):
"""Fetches a chunk corresponding to the current offset."""
found_ref = None
for ref in self._blob_refs:
if self._offset >= ref.offset and self._offset < (ref.offset + ref.size):
found_ref = ref
break
if not found_ref:
return None, None
# If self._c... | [
"def",
"_GetChunk",
"(",
"self",
")",
":",
"found_ref",
"=",
"None",
"for",
"ref",
"in",
"self",
".",
"_blob_refs",
":",
"if",
"self",
".",
"_offset",
">=",
"ref",
".",
"offset",
"and",
"self",
".",
"_offset",
"<",
"(",
"ref",
".",
"offset",
"+",
"... | Fetches a chunk corresponding to the current offset. | [
"Fetches",
"a",
"chunk",
"corresponding",
"to",
"the",
"current",
"offset",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L125-L145 | train | Fetches a chunk corresponding to the current offset. | 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/file_store.py | BlobStream.Read | def Read(self, length=None):
"""Reads data."""
if length is None:
length = self._length - self._offset
if length > self._max_unbound_read:
raise OversizedReadError("Attempted to read %d bytes when "
"Server.max_unbound_read_size is %d" %
... | python | def Read(self, length=None):
"""Reads data."""
if length is None:
length = self._length - self._offset
if length > self._max_unbound_read:
raise OversizedReadError("Attempted to read %d bytes when "
"Server.max_unbound_read_size is %d" %
... | [
"def",
"Read",
"(",
"self",
",",
"length",
"=",
"None",
")",
":",
"if",
"length",
"is",
"None",
":",
"length",
"=",
"self",
".",
"_length",
"-",
"self",
".",
"_offset",
"if",
"length",
">",
"self",
".",
"_max_unbound_read",
":",
"raise",
"OversizedRead... | Reads data. | [
"Reads",
"data",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L147-L171 | train | Reads data from the 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/file_store.py | BlobStream.Seek | def Seek(self, offset, whence=os.SEEK_SET):
"""Moves the reading cursor."""
if whence == os.SEEK_SET:
self._offset = offset
elif whence == os.SEEK_CUR:
self._offset += offset
elif whence == os.SEEK_END:
self._offset = self._length + offset
else:
raise ValueError("Invalid whe... | python | def Seek(self, offset, whence=os.SEEK_SET):
"""Moves the reading cursor."""
if whence == os.SEEK_SET:
self._offset = offset
elif whence == os.SEEK_CUR:
self._offset += offset
elif whence == os.SEEK_END:
self._offset = self._length + offset
else:
raise ValueError("Invalid whe... | [
"def",
"Seek",
"(",
"self",
",",
"offset",
",",
"whence",
"=",
"os",
".",
"SEEK_SET",
")",
":",
"if",
"whence",
"==",
"os",
".",
"SEEK_SET",
":",
"self",
".",
"_offset",
"=",
"offset",
"elif",
"whence",
"==",
"os",
".",
"SEEK_CUR",
":",
"self",
"."... | Moves the reading cursor. | [
"Moves",
"the",
"reading",
"cursor",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L178-L188 | train | Moves the reading cursor. | 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_utils/uploading.py | TransferStoreUploader.UploadFilePath | def UploadFilePath(self, filepath, offset=0, amount=None):
"""Uploads chunks of a file on a given path to the transfer store flow.
Args:
filepath: A path to the file to upload.
offset: An integer offset at which the file upload should start on.
amount: An upper bound on number of bytes to str... | python | def UploadFilePath(self, filepath, offset=0, amount=None):
"""Uploads chunks of a file on a given path to the transfer store flow.
Args:
filepath: A path to the file to upload.
offset: An integer offset at which the file upload should start on.
amount: An upper bound on number of bytes to str... | [
"def",
"UploadFilePath",
"(",
"self",
",",
"filepath",
",",
"offset",
"=",
"0",
",",
"amount",
"=",
"None",
")",
":",
"return",
"self",
".",
"_UploadChunkStream",
"(",
"self",
".",
"_streamer",
".",
"StreamFilePath",
"(",
"filepath",
",",
"offset",
"=",
... | Uploads chunks of a file on a given path to the transfer store flow.
Args:
filepath: A path to the file to upload.
offset: An integer offset at which the file upload should start on.
amount: An upper bound on number of bytes to stream. If it is `None` then
the whole file is uploaded.
... | [
"Uploads",
"chunks",
"of",
"a",
"file",
"on",
"a",
"given",
"path",
"to",
"the",
"transfer",
"store",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder_utils/uploading.py#L40-L53 | train | Uploads chunks of a file on a given path to the transfer store 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/client/grr_response_client/client_actions/file_finder_utils/uploading.py | TransferStoreUploader.UploadFile | def UploadFile(self, fd, offset=0, amount=None):
"""Uploads chunks of a given file descriptor to the transfer store flow.
Args:
fd: A file descriptor to upload.
offset: An integer offset at which the file upload should start on.
amount: An upper bound on number of bytes to stream. If it is `N... | python | def UploadFile(self, fd, offset=0, amount=None):
"""Uploads chunks of a given file descriptor to the transfer store flow.
Args:
fd: A file descriptor to upload.
offset: An integer offset at which the file upload should start on.
amount: An upper bound on number of bytes to stream. If it is `N... | [
"def",
"UploadFile",
"(",
"self",
",",
"fd",
",",
"offset",
"=",
"0",
",",
"amount",
"=",
"None",
")",
":",
"return",
"self",
".",
"_UploadChunkStream",
"(",
"self",
".",
"_streamer",
".",
"StreamFile",
"(",
"fd",
",",
"offset",
"=",
"offset",
",",
"... | Uploads chunks of a given file descriptor to the transfer store flow.
Args:
fd: A file descriptor to upload.
offset: An integer offset at which the file upload should start on.
amount: An upper bound on number of bytes to stream. If it is `None` then
the whole file is uploaded.
Retur... | [
"Uploads",
"chunks",
"of",
"a",
"given",
"file",
"descriptor",
"to",
"the",
"transfer",
"store",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder_utils/uploading.py#L55-L68 | train | Uploads a chunk of a given file descriptor to the transfer store 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/client/grr_response_client/client_actions/file_finder_utils/uploading.py | TransferStoreUploader._UploadChunk | def _UploadChunk(self, chunk):
"""Uploads a single chunk to the transfer store flow.
Args:
chunk: A chunk to upload.
Returns:
A `BlobImageChunkDescriptor` object.
"""
blob = _CompressedDataBlob(chunk)
self._action.ChargeBytesToSession(len(chunk.data))
self._action.SendReply(bl... | python | def _UploadChunk(self, chunk):
"""Uploads a single chunk to the transfer store flow.
Args:
chunk: A chunk to upload.
Returns:
A `BlobImageChunkDescriptor` object.
"""
blob = _CompressedDataBlob(chunk)
self._action.ChargeBytesToSession(len(chunk.data))
self._action.SendReply(bl... | [
"def",
"_UploadChunk",
"(",
"self",
",",
"chunk",
")",
":",
"blob",
"=",
"_CompressedDataBlob",
"(",
"chunk",
")",
"self",
".",
"_action",
".",
"ChargeBytesToSession",
"(",
"len",
"(",
"chunk",
".",
"data",
")",
")",
"self",
".",
"_action",
".",
"SendRep... | Uploads a single chunk to the transfer store flow.
Args:
chunk: A chunk to upload.
Returns:
A `BlobImageChunkDescriptor` object. | [
"Uploads",
"a",
"single",
"chunk",
"to",
"the",
"transfer",
"store",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder_utils/uploading.py#L78-L95 | train | Uploads a single chunk to the transfer store 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/prometheus_stats_collector.py | _DistributionFromHistogram | def _DistributionFromHistogram(metric, values_by_suffix):
"""Instantiate a rdf_stats.Distribution from a Prometheus Histogram.
Prometheus Histogram uses cumulative "buckets" lower or equal to an upper
bound. At instantiation, +Inf is implicitly appended to the upper bounds.
The delimiters [0.0, 0.1, 0.2 (, +In... | python | def _DistributionFromHistogram(metric, values_by_suffix):
"""Instantiate a rdf_stats.Distribution from a Prometheus Histogram.
Prometheus Histogram uses cumulative "buckets" lower or equal to an upper
bound. At instantiation, +Inf is implicitly appended to the upper bounds.
The delimiters [0.0, 0.1, 0.2 (, +In... | [
"def",
"_DistributionFromHistogram",
"(",
"metric",
",",
"values_by_suffix",
")",
":",
"dist",
"=",
"rdf_stats",
".",
"Distribution",
"(",
"bins",
"=",
"list",
"(",
"metric",
".",
"metadata",
".",
"bins",
")",
")",
"if",
"metric",
".",
"metadata",
".",
"bi... | Instantiate a rdf_stats.Distribution from a Prometheus Histogram.
Prometheus Histogram uses cumulative "buckets" lower or equal to an upper
bound. At instantiation, +Inf is implicitly appended to the upper bounds.
The delimiters [0.0, 0.1, 0.2 (, +Inf)] produce the following buckets:
Bucket "0.0" : -Inf <= val... | [
"Instantiate",
"a",
"rdf_stats",
".",
"Distribution",
"from",
"a",
"Prometheus",
"Histogram",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/prometheus_stats_collector.py#L97-L147 | train | Instantiate a rdf_stats. Distribution from a Prometheus Histogram. | 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/core/grr_response_core/lib/parsers/cron_file_parser.py | CronTabParser.Parse | def Parse(self, stat, file_object, knowledge_base):
"""Parse the crontab file."""
_ = knowledge_base
entries = []
crondata = file_object.read().decode("utf-8")
jobs = crontab.CronTab(tab=crondata)
for job in jobs:
entries.append(
rdf_cronjobs.CronTabEntry(
minute=... | python | def Parse(self, stat, file_object, knowledge_base):
"""Parse the crontab file."""
_ = knowledge_base
entries = []
crondata = file_object.read().decode("utf-8")
jobs = crontab.CronTab(tab=crondata)
for job in jobs:
entries.append(
rdf_cronjobs.CronTabEntry(
minute=... | [
"def",
"Parse",
"(",
"self",
",",
"stat",
",",
"file_object",
",",
"knowledge_base",
")",
":",
"_",
"=",
"knowledge_base",
"entries",
"=",
"[",
"]",
"crondata",
"=",
"file_object",
".",
"read",
"(",
")",
".",
"decode",
"(",
"\"utf-8\"",
")",
"jobs",
"=... | Parse the crontab file. | [
"Parse",
"the",
"crontab",
"file",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/cron_file_parser.py#L23-L47 | train | Parse the crontab file. | 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_utils/conditions.py | MetadataCondition.Parse | def Parse(conditions):
"""Parses the file finder condition types into the condition objects.
Args:
conditions: An iterator over `FileFinderCondition` objects.
Yields:
`MetadataCondition` objects that correspond to the file-finder conditions.
"""
kind = rdf_file_finder.FileFinderConditi... | python | def Parse(conditions):
"""Parses the file finder condition types into the condition objects.
Args:
conditions: An iterator over `FileFinderCondition` objects.
Yields:
`MetadataCondition` objects that correspond to the file-finder conditions.
"""
kind = rdf_file_finder.FileFinderConditi... | [
"def",
"Parse",
"(",
"conditions",
")",
":",
"kind",
"=",
"rdf_file_finder",
".",
"FileFinderCondition",
".",
"Type",
"classes",
"=",
"{",
"kind",
".",
"MODIFICATION_TIME",
":",
"ModificationTimeCondition",
",",
"kind",
".",
"ACCESS_TIME",
":",
"AccessTimeConditio... | Parses the file finder condition types into the condition objects.
Args:
conditions: An iterator over `FileFinderCondition` objects.
Yields:
`MetadataCondition` objects that correspond to the file-finder conditions. | [
"Parses",
"the",
"file",
"finder",
"condition",
"types",
"into",
"the",
"condition",
"objects",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder_utils/conditions.py#L40-L62 | train | Parses the file finder condition types into the condition 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/client/grr_response_client/client_actions/file_finder_utils/conditions.py | ContentCondition.Parse | def Parse(conditions):
"""Parses the file finder condition types into the condition objects.
Args:
conditions: An iterator over `FileFinderCondition` objects.
Yields:
`ContentCondition` objects that correspond to the file-finder conditions.
"""
kind = rdf_file_finder.FileFinderConditio... | python | def Parse(conditions):
"""Parses the file finder condition types into the condition objects.
Args:
conditions: An iterator over `FileFinderCondition` objects.
Yields:
`ContentCondition` objects that correspond to the file-finder conditions.
"""
kind = rdf_file_finder.FileFinderConditio... | [
"def",
"Parse",
"(",
"conditions",
")",
":",
"kind",
"=",
"rdf_file_finder",
".",
"FileFinderCondition",
".",
"Type",
"classes",
"=",
"{",
"kind",
".",
"CONTENTS_LITERAL_MATCH",
":",
"LiteralMatchCondition",
",",
"kind",
".",
"CONTENTS_REGEX_MATCH",
":",
"RegexMat... | Parses the file finder condition types into the condition objects.
Args:
conditions: An iterator over `FileFinderCondition` objects.
Yields:
`ContentCondition` objects that correspond to the file-finder conditions. | [
"Parses",
"the",
"file",
"finder",
"condition",
"types",
"into",
"the",
"condition",
"objects",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder_utils/conditions.py#L160-L179 | train | Parses the file finder condition types into the condition 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/client/grr_response_client/client_actions/file_finder_utils/conditions.py | ContentCondition.Scan | def Scan(self, fd,
matcher):
"""Scans given file searching for occurrences of given pattern.
Args:
fd: A file descriptor of the file that needs to be searched.
matcher: A matcher object specifying a pattern to search for.
Yields:
`BufferReference` objects pointing to file part... | python | def Scan(self, fd,
matcher):
"""Scans given file searching for occurrences of given pattern.
Args:
fd: A file descriptor of the file that needs to be searched.
matcher: A matcher object specifying a pattern to search for.
Yields:
`BufferReference` objects pointing to file part... | [
"def",
"Scan",
"(",
"self",
",",
"fd",
",",
"matcher",
")",
":",
"streamer",
"=",
"streaming",
".",
"Streamer",
"(",
"chunk_size",
"=",
"self",
".",
"CHUNK_SIZE",
",",
"overlap_size",
"=",
"self",
".",
"OVERLAP_SIZE",
")",
"offset",
"=",
"self",
".",
"... | Scans given file searching for occurrences of given pattern.
Args:
fd: A file descriptor of the file that needs to be searched.
matcher: A matcher object specifying a pattern to search for.
Yields:
`BufferReference` objects pointing to file parts with matching content. | [
"Scans",
"given",
"file",
"searching",
"for",
"occurrences",
"of",
"given",
"pattern",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder_utils/conditions.py#L184-L212 | train | Scans given file for occurrences of given pattern. | 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/server_logging.py | ServerLoggingStartupInit | def ServerLoggingStartupInit():
"""Initialize the server logging configuration."""
global LOGGER
if local_log:
logging.debug("Using local LogInit from %s", local_log)
local_log.LogInit()
logging.debug("Using local AppLogInit from %s", local_log)
LOGGER = local_log.AppLogInit()
else:
LogInit(... | python | def ServerLoggingStartupInit():
"""Initialize the server logging configuration."""
global LOGGER
if local_log:
logging.debug("Using local LogInit from %s", local_log)
local_log.LogInit()
logging.debug("Using local AppLogInit from %s", local_log)
LOGGER = local_log.AppLogInit()
else:
LogInit(... | [
"def",
"ServerLoggingStartupInit",
"(",
")",
":",
"global",
"LOGGER",
"if",
"local_log",
":",
"logging",
".",
"debug",
"(",
"\"Using local LogInit from %s\"",
",",
"local_log",
")",
"local_log",
".",
"LogInit",
"(",
")",
"logging",
".",
"debug",
"(",
"\"Using lo... | Initialize the server logging configuration. | [
"Initialize",
"the",
"server",
"logging",
"configuration",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/server_logging.py#L236-L246 | train | Initialize the server logging configuration. | 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/server_logging.py | GrrApplicationLogger.GetNewEventId | def GetNewEventId(self, event_time=None):
"""Return a unique Event ID string."""
if event_time is None:
event_time = int(time.time() * 1e6)
return "%s:%s:%s" % (event_time, socket.gethostname(), os.getpid()) | python | def GetNewEventId(self, event_time=None):
"""Return a unique Event ID string."""
if event_time is None:
event_time = int(time.time() * 1e6)
return "%s:%s:%s" % (event_time, socket.gethostname(), os.getpid()) | [
"def",
"GetNewEventId",
"(",
"self",
",",
"event_time",
"=",
"None",
")",
":",
"if",
"event_time",
"is",
"None",
":",
"event_time",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
"*",
"1e6",
")",
"return",
"\"%s:%s:%s\"",
"%",
"(",
"event_time",
",",
... | Return a unique Event ID string. | [
"Return",
"a",
"unique",
"Event",
"ID",
"string",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/server_logging.py#L43-L48 | train | Return a unique Event ID string. | 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/server_logging.py | GrrApplicationLogger.LogHttpAdminUIAccess | def LogHttpAdminUIAccess(self, request, response):
"""Log an http based api call.
Args:
request: A WSGI request object.
response: A WSGI response object.
"""
# TODO(user): generate event_id elsewhere and use it for all the log
# messages that have to do with handling corresponding reque... | python | def LogHttpAdminUIAccess(self, request, response):
"""Log an http based api call.
Args:
request: A WSGI request object.
response: A WSGI response object.
"""
# TODO(user): generate event_id elsewhere and use it for all the log
# messages that have to do with handling corresponding reque... | [
"def",
"LogHttpAdminUIAccess",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"# TODO(user): generate event_id elsewhere and use it for all the log",
"# messages that have to do with handling corresponding request.",
"event_id",
"=",
"self",
".",
"GetNewEventId",
"(",
")... | Log an http based api call.
Args:
request: A WSGI request object.
response: A WSGI response object. | [
"Log",
"an",
"http",
"based",
"api",
"call",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/server_logging.py#L50-L72 | train | Logs an http based API call. | 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/server_logging.py | GrrApplicationLogger.LogHttpFrontendAccess | def LogHttpFrontendAccess(self, request, source=None, message_count=None):
"""Write a log entry for a Frontend or UI Request.
Args:
request: A HttpRequest protobuf.
source: Client id of the client initiating the request. Optional.
message_count: Number of messages received from the client. Op... | python | def LogHttpFrontendAccess(self, request, source=None, message_count=None):
"""Write a log entry for a Frontend or UI Request.
Args:
request: A HttpRequest protobuf.
source: Client id of the client initiating the request. Optional.
message_count: Number of messages received from the client. Op... | [
"def",
"LogHttpFrontendAccess",
"(",
"self",
",",
"request",
",",
"source",
"=",
"None",
",",
"message_count",
"=",
"None",
")",
":",
"# TODO(user): generate event_id elsewhere and use it for all the log",
"# messages that have to do with handling corresponding request.",
"event_... | Write a log entry for a Frontend or UI Request.
Args:
request: A HttpRequest protobuf.
source: Client id of the client initiating the request. Optional.
message_count: Number of messages received from the client. Optional. | [
"Write",
"a",
"log",
"entry",
"for",
"a",
"Frontend",
"or",
"UI",
"Request",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/server_logging.py#L74-L89 | train | Writes a log entry for a Frontend or UI Request. | 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/core/grr_response_core/lib/package.py | _GetPkgResources | def _GetPkgResources(package_name, filepath):
"""A wrapper for the `pkg_resource.resource_filename` function."""
requirement = pkg_resources.Requirement.parse(package_name)
try:
return pkg_resources.resource_filename(requirement, filepath)
except pkg_resources.DistributionNotFound:
# It may be that the ... | python | def _GetPkgResources(package_name, filepath):
"""A wrapper for the `pkg_resource.resource_filename` function."""
requirement = pkg_resources.Requirement.parse(package_name)
try:
return pkg_resources.resource_filename(requirement, filepath)
except pkg_resources.DistributionNotFound:
# It may be that the ... | [
"def",
"_GetPkgResources",
"(",
"package_name",
",",
"filepath",
")",
":",
"requirement",
"=",
"pkg_resources",
".",
"Requirement",
".",
"parse",
"(",
"package_name",
")",
"try",
":",
"return",
"pkg_resources",
".",
"resource_filename",
"(",
"requirement",
",",
... | A wrapper for the `pkg_resource.resource_filename` function. | [
"A",
"wrapper",
"for",
"the",
"pkg_resource",
".",
"resource_filename",
"function",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/package.py#L20-L33 | train | A wrapper for the pkg_resources. resource_filename 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/core/grr_response_core/lib/package.py | ResourcePath | def ResourcePath(package_name, filepath):
"""Computes a path to the specified package resource.
Args:
package_name: A name of the package where the resource is located.
filepath: A path to the resource relative to the package location.
Returns:
A path to the resource or `None` if the resource cannot... | python | def ResourcePath(package_name, filepath):
"""Computes a path to the specified package resource.
Args:
package_name: A name of the package where the resource is located.
filepath: A path to the resource relative to the package location.
Returns:
A path to the resource or `None` if the resource cannot... | [
"def",
"ResourcePath",
"(",
"package_name",
",",
"filepath",
")",
":",
"# If we are running a pyinstaller-built binary we rely on the sys.prefix",
"# code below and avoid running this which will generate confusing error",
"# messages.",
"if",
"not",
"getattr",
"(",
"sys",
",",
"\"f... | Computes a path to the specified package resource.
Args:
package_name: A name of the package where the resource is located.
filepath: A path to the resource relative to the package location.
Returns:
A path to the resource or `None` if the resource cannot be found. | [
"Computes",
"a",
"path",
"to",
"the",
"specified",
"package",
"resource",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/package.py#L36-L62 | train | Computes a path to the specified resource in the specified package. | 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/core/grr_response_core/lib/package.py | ModulePath | def ModulePath(module_name):
"""Computes a path to the specified module.
Args:
module_name: A name of the module to get the path for.
Returns:
A path to the specified module.
Raises:
ImportError: If specified module cannot be imported.
"""
module = importlib.import_module(module_name)
path ... | python | def ModulePath(module_name):
"""Computes a path to the specified module.
Args:
module_name: A name of the module to get the path for.
Returns:
A path to the specified module.
Raises:
ImportError: If specified module cannot be imported.
"""
module = importlib.import_module(module_name)
path ... | [
"def",
"ModulePath",
"(",
"module_name",
")",
":",
"module",
"=",
"importlib",
".",
"import_module",
"(",
"module_name",
")",
"path",
"=",
"inspect",
".",
"getfile",
"(",
"module",
")",
"# TODO: In Python 2 `inspect.getfile` returns a byte string, so",
"# we have to dec... | Computes a path to the specified module.
Args:
module_name: A name of the module to get the path for.
Returns:
A path to the specified module.
Raises:
ImportError: If specified module cannot be imported. | [
"Computes",
"a",
"path",
"to",
"the",
"specified",
"module",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/package.py#L67-L95 | train | Computes a path to the specified module. | 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/core/grr_response_core/lib/util/cache.py | WithLimitedCallFrequency | def WithLimitedCallFrequency(min_time_between_calls):
"""Function call rate-limiting decorator.
This decorator ensures that the wrapped function will be called at most
once in min_time_between_calls time for the same set of arguments. For all
excessive calls a previous cached return value will be returned.
... | python | def WithLimitedCallFrequency(min_time_between_calls):
"""Function call rate-limiting decorator.
This decorator ensures that the wrapped function will be called at most
once in min_time_between_calls time for the same set of arguments. For all
excessive calls a previous cached return value will be returned.
... | [
"def",
"WithLimitedCallFrequency",
"(",
"min_time_between_calls",
")",
":",
"def",
"Decorated",
"(",
"f",
")",
":",
"\"\"\"Actual decorator implementation.\"\"\"",
"lock",
"=",
"threading",
".",
"RLock",
"(",
")",
"prev_times",
"=",
"{",
"}",
"prev_results",
"=",
... | Function call rate-limiting decorator.
This decorator ensures that the wrapped function will be called at most
once in min_time_between_calls time for the same set of arguments. For all
excessive calls a previous cached return value will be returned.
Suppose we use the decorator like this:
@cache.WithLimite... | [
"Function",
"call",
"rate",
"-",
"limiting",
"decorator",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/cache.py#L17-L117 | train | A Python function decorator that returns a cached version of the passed - in function f. | 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/core/grr_response_core/stats/stats_utils.py | FieldDefinitionProtosFromTuples | def FieldDefinitionProtosFromTuples(field_def_tuples):
"""Converts (field-name, type) tuples to MetricFieldDefinition protos."""
# TODO: This needs fixing for Python 3.
field_def_protos = []
for field_name, field_type in field_def_tuples:
if field_type in (int, long):
field_type = rdf_stats.MetricFiel... | python | def FieldDefinitionProtosFromTuples(field_def_tuples):
"""Converts (field-name, type) tuples to MetricFieldDefinition protos."""
# TODO: This needs fixing for Python 3.
field_def_protos = []
for field_name, field_type in field_def_tuples:
if field_type in (int, long):
field_type = rdf_stats.MetricFiel... | [
"def",
"FieldDefinitionProtosFromTuples",
"(",
"field_def_tuples",
")",
":",
"# TODO: This needs fixing for Python 3.",
"field_def_protos",
"=",
"[",
"]",
"for",
"field_name",
",",
"field_type",
"in",
"field_def_tuples",
":",
"if",
"field_type",
"in",
"(",
"int",
",",
... | Converts (field-name, type) tuples to MetricFieldDefinition protos. | [
"Converts",
"(",
"field",
"-",
"name",
"type",
")",
"tuples",
"to",
"MetricFieldDefinition",
"protos",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/stats_utils.py#L78-L92 | train | Converts tuple field - name type to MetricFieldDefinition protos. | 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/core/grr_response_core/stats/stats_utils.py | FieldDefinitionTuplesFromProtos | def FieldDefinitionTuplesFromProtos(field_def_protos):
"""Converts MetricFieldDefinition protos to (field-name, type) tuples."""
# TODO: This needs fixing for Python 3.
field_def_tuples = []
for proto in field_def_protos:
if proto.field_type == rdf_stats.MetricFieldDefinition.FieldType.INT:
field_type... | python | def FieldDefinitionTuplesFromProtos(field_def_protos):
"""Converts MetricFieldDefinition protos to (field-name, type) tuples."""
# TODO: This needs fixing for Python 3.
field_def_tuples = []
for proto in field_def_protos:
if proto.field_type == rdf_stats.MetricFieldDefinition.FieldType.INT:
field_type... | [
"def",
"FieldDefinitionTuplesFromProtos",
"(",
"field_def_protos",
")",
":",
"# TODO: This needs fixing for Python 3.",
"field_def_tuples",
"=",
"[",
"]",
"for",
"proto",
"in",
"field_def_protos",
":",
"if",
"proto",
".",
"field_type",
"==",
"rdf_stats",
".",
"MetricFie... | Converts MetricFieldDefinition protos to (field-name, type) tuples. | [
"Converts",
"MetricFieldDefinition",
"protos",
"to",
"(",
"field",
"-",
"name",
"type",
")",
"tuples",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/stats_utils.py#L95-L108 | train | Converts a list of MetricFieldDefinition protos to a list of tuples. | 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/core/grr_response_core/stats/stats_utils.py | MetricValueTypeFromPythonType | def MetricValueTypeFromPythonType(python_type):
"""Converts Python types to MetricMetadata.ValueType enum values."""
if python_type in (int, long):
return rdf_stats.MetricMetadata.ValueType.INT
elif python_type == float:
return rdf_stats.MetricMetadata.ValueType.FLOAT
else:
raise ValueError("Invalid... | python | def MetricValueTypeFromPythonType(python_type):
"""Converts Python types to MetricMetadata.ValueType enum values."""
if python_type in (int, long):
return rdf_stats.MetricMetadata.ValueType.INT
elif python_type == float:
return rdf_stats.MetricMetadata.ValueType.FLOAT
else:
raise ValueError("Invalid... | [
"def",
"MetricValueTypeFromPythonType",
"(",
"python_type",
")",
":",
"if",
"python_type",
"in",
"(",
"int",
",",
"long",
")",
":",
"return",
"rdf_stats",
".",
"MetricMetadata",
".",
"ValueType",
".",
"INT",
"elif",
"python_type",
"==",
"float",
":",
"return",... | Converts Python types to MetricMetadata.ValueType enum values. | [
"Converts",
"Python",
"types",
"to",
"MetricMetadata",
".",
"ValueType",
"enum",
"values",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/stats_utils.py#L111-L118 | train | Converts Python types to MetricMetadata. ValueType enum values. | 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/core/grr_response_core/stats/stats_utils.py | PythonTypeFromMetricValueType | def PythonTypeFromMetricValueType(value_type):
"""Converts MetricMetadata.ValueType enums to corresponding Python types."""
if value_type == rdf_stats.MetricMetadata.ValueType.INT:
return int
elif value_type == rdf_stats.MetricMetadata.ValueType.FLOAT:
return float
else:
raise ValueError("Unknown va... | python | def PythonTypeFromMetricValueType(value_type):
"""Converts MetricMetadata.ValueType enums to corresponding Python types."""
if value_type == rdf_stats.MetricMetadata.ValueType.INT:
return int
elif value_type == rdf_stats.MetricMetadata.ValueType.FLOAT:
return float
else:
raise ValueError("Unknown va... | [
"def",
"PythonTypeFromMetricValueType",
"(",
"value_type",
")",
":",
"if",
"value_type",
"==",
"rdf_stats",
".",
"MetricMetadata",
".",
"ValueType",
".",
"INT",
":",
"return",
"int",
"elif",
"value_type",
"==",
"rdf_stats",
".",
"MetricMetadata",
".",
"ValueType",... | Converts MetricMetadata.ValueType enums to corresponding Python types. | [
"Converts",
"MetricMetadata",
".",
"ValueType",
"enums",
"to",
"corresponding",
"Python",
"types",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/stats_utils.py#L121-L128 | train | Converts MetricMetadata. ValueType enums to corresponding Python types. | 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/core/grr_response_core/stats/stats_utils.py | CreateCounterMetadata | def CreateCounterMetadata(metric_name, fields=None, docstring=None, units=None):
"""Helper function for creating MetricMetadata for counter metrics."""
return rdf_stats.MetricMetadata(
varname=metric_name,
metric_type=rdf_stats.MetricMetadata.MetricType.COUNTER,
value_type=rdf_stats.MetricMetadata... | python | def CreateCounterMetadata(metric_name, fields=None, docstring=None, units=None):
"""Helper function for creating MetricMetadata for counter metrics."""
return rdf_stats.MetricMetadata(
varname=metric_name,
metric_type=rdf_stats.MetricMetadata.MetricType.COUNTER,
value_type=rdf_stats.MetricMetadata... | [
"def",
"CreateCounterMetadata",
"(",
"metric_name",
",",
"fields",
"=",
"None",
",",
"docstring",
"=",
"None",
",",
"units",
"=",
"None",
")",
":",
"return",
"rdf_stats",
".",
"MetricMetadata",
"(",
"varname",
"=",
"metric_name",
",",
"metric_type",
"=",
"rd... | Helper function for creating MetricMetadata for counter metrics. | [
"Helper",
"function",
"for",
"creating",
"MetricMetadata",
"for",
"counter",
"metrics",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/stats_utils.py#L131-L139 | train | Helper function for creating MetricMetadata for counter metrics. | 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/core/grr_response_core/stats/stats_utils.py | CreateEventMetadata | def CreateEventMetadata(metric_name,
bins=None,
fields=None,
docstring=None,
units=None):
"""Helper function for creating MetricMetadata for event metrics."""
return rdf_stats.MetricMetadata(
varname=metric_name,
... | python | def CreateEventMetadata(metric_name,
bins=None,
fields=None,
docstring=None,
units=None):
"""Helper function for creating MetricMetadata for event metrics."""
return rdf_stats.MetricMetadata(
varname=metric_name,
... | [
"def",
"CreateEventMetadata",
"(",
"metric_name",
",",
"bins",
"=",
"None",
",",
"fields",
"=",
"None",
",",
"docstring",
"=",
"None",
",",
"units",
"=",
"None",
")",
":",
"return",
"rdf_stats",
".",
"MetricMetadata",
"(",
"varname",
"=",
"metric_name",
",... | Helper function for creating MetricMetadata for event metrics. | [
"Helper",
"function",
"for",
"creating",
"MetricMetadata",
"for",
"event",
"metrics",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/stats_utils.py#L142-L155 | train | Helper function for creating MetricMetadata for event metrics. | 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/core/grr_response_core/stats/stats_utils.py | CreateGaugeMetadata | def CreateGaugeMetadata(metric_name,
value_type,
fields=None,
docstring=None,
units=None):
"""Helper function for creating MetricMetadata for gauge metrics."""
return rdf_stats.MetricMetadata(
varname=metric_name,
... | python | def CreateGaugeMetadata(metric_name,
value_type,
fields=None,
docstring=None,
units=None):
"""Helper function for creating MetricMetadata for gauge metrics."""
return rdf_stats.MetricMetadata(
varname=metric_name,
... | [
"def",
"CreateGaugeMetadata",
"(",
"metric_name",
",",
"value_type",
",",
"fields",
"=",
"None",
",",
"docstring",
"=",
"None",
",",
"units",
"=",
"None",
")",
":",
"return",
"rdf_stats",
".",
"MetricMetadata",
"(",
"varname",
"=",
"metric_name",
",",
"metri... | Helper function for creating MetricMetadata for gauge metrics. | [
"Helper",
"function",
"for",
"creating",
"MetricMetadata",
"for",
"gauge",
"metrics",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/stats_utils.py#L158-L170 | train | Helper function for creating MetricMetadata for gauge metrics. | 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/bin/import_nsrl_hashes.py | ImportFile | def ImportFile(store, filename, start):
"""Import hashes from 'filename' into 'store'."""
with io.open(filename, "r") as fp:
reader = csv.Reader(fp.read())
i = 0
current_row = None
product_code_list = []
op_system_code_list = []
for row in reader:
# Skip first row.
i += 1
i... | python | def ImportFile(store, filename, start):
"""Import hashes from 'filename' into 'store'."""
with io.open(filename, "r") as fp:
reader = csv.Reader(fp.read())
i = 0
current_row = None
product_code_list = []
op_system_code_list = []
for row in reader:
# Skip first row.
i += 1
i... | [
"def",
"ImportFile",
"(",
"store",
",",
"filename",
",",
"start",
")",
":",
"with",
"io",
".",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"fp",
":",
"reader",
"=",
"csv",
".",
"Reader",
"(",
"fp",
".",
"read",
"(",
")",
")",
"i",
"=",
"0... | Import hashes from 'filename' into 'store'. | [
"Import",
"hashes",
"from",
"filename",
"into",
"store",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/bin/import_nsrl_hashes.py#L41-L84 | train | Imports hashes from filename into store. | 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/bin/import_nsrl_hashes.py | main | def main(argv):
"""Main."""
del argv # Unused.
server_startup.Init()
filename = flags.FLAGS.filename
if not os.path.exists(filename):
print("File %s does not exist" % filename)
return
with aff4.FACTORY.Create(
filestore.NSRLFileStore.PATH,
filestore.NSRLFileStore,
mode="rw",
... | python | def main(argv):
"""Main."""
del argv # Unused.
server_startup.Init()
filename = flags.FLAGS.filename
if not os.path.exists(filename):
print("File %s does not exist" % filename)
return
with aff4.FACTORY.Create(
filestore.NSRLFileStore.PATH,
filestore.NSRLFileStore,
mode="rw",
... | [
"def",
"main",
"(",
"argv",
")",
":",
"del",
"argv",
"# Unused.",
"server_startup",
".",
"Init",
"(",
")",
"filename",
"=",
"flags",
".",
"FLAGS",
".",
"filename",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"print",
"("... | Main. | [
"Main",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/bin/import_nsrl_hashes.py#L87-L104 | train | Main function. Import a file into the file store. | 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_utils_windows.py | CanonicalPathToLocalPath | def CanonicalPathToLocalPath(path):
r"""Converts the canonical paths as used by GRR to OS specific paths.
Due to the inconsistencies between handling paths in windows we need to
convert a path to an OS specific version prior to using it. This function
should be called just before any OS specific functions.
... | python | def CanonicalPathToLocalPath(path):
r"""Converts the canonical paths as used by GRR to OS specific paths.
Due to the inconsistencies between handling paths in windows we need to
convert a path to an OS specific version prior to using it. This function
should be called just before any OS specific functions.
... | [
"def",
"CanonicalPathToLocalPath",
"(",
"path",
")",
":",
"# Account for raw devices",
"path",
"=",
"path",
".",
"replace",
"(",
"\"/\\\\\"",
",",
"\"\\\\\"",
")",
"path",
"=",
"path",
".",
"replace",
"(",
"\"/\"",
",",
"\"\\\\\"",
")",
"m",
"=",
"re",
"."... | r"""Converts the canonical paths as used by GRR to OS specific paths.
Due to the inconsistencies between handling paths in windows we need to
convert a path to an OS specific version prior to using it. This function
should be called just before any OS specific functions.
Canonical paths on windows have:
-... | [
"r",
"Converts",
"the",
"canonical",
"paths",
"as",
"used",
"by",
"GRR",
"to",
"OS",
"specific",
"paths",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L33-L57 | train | Converts the canonical path as used by GRR to the local path. | 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_utils_windows.py | LocalPathToCanonicalPath | def LocalPathToCanonicalPath(path):
"""Converts path from the local system's convention to the canonical."""
path_components = path.split("/")
result = []
for component in path_components:
# Devices must maintain their \\ so they do not get broken up.
m = re.match(r"\\\\.\\", component)
# The compo... | python | def LocalPathToCanonicalPath(path):
"""Converts path from the local system's convention to the canonical."""
path_components = path.split("/")
result = []
for component in path_components:
# Devices must maintain their \\ so they do not get broken up.
m = re.match(r"\\\\.\\", component)
# The compo... | [
"def",
"LocalPathToCanonicalPath",
"(",
"path",
")",
":",
"path_components",
"=",
"path",
".",
"split",
"(",
"\"/\"",
")",
"result",
"=",
"[",
"]",
"for",
"component",
"in",
"path_components",
":",
"# Devices must maintain their \\\\ so they do not get broken up.",
"m... | Converts path from the local system's convention to the canonical. | [
"Converts",
"path",
"from",
"the",
"local",
"system",
"s",
"convention",
"to",
"the",
"canonical",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L60-L74 | train | Converts a local path from the local system s convention to the canonical path. | 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_utils_windows.py | WinChmod | def WinChmod(filename, acl_list, user=None):
"""Provide chmod-like functionality for windows.
Doco links:
goo.gl/n7YR1
goo.gl/rDv81
goo.gl/hDobb
Args:
filename: target filename for acl
acl_list: list of ntsecuritycon acl strings to be applied with bitwise OR.
e.g. ["FILE_GENER... | python | def WinChmod(filename, acl_list, user=None):
"""Provide chmod-like functionality for windows.
Doco links:
goo.gl/n7YR1
goo.gl/rDv81
goo.gl/hDobb
Args:
filename: target filename for acl
acl_list: list of ntsecuritycon acl strings to be applied with bitwise OR.
e.g. ["FILE_GENER... | [
"def",
"WinChmod",
"(",
"filename",
",",
"acl_list",
",",
"user",
"=",
"None",
")",
":",
"if",
"user",
"is",
"None",
":",
"user",
"=",
"win32api",
".",
"GetUserName",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":... | Provide chmod-like functionality for windows.
Doco links:
goo.gl/n7YR1
goo.gl/rDv81
goo.gl/hDobb
Args:
filename: target filename for acl
acl_list: list of ntsecuritycon acl strings to be applied with bitwise OR.
e.g. ["FILE_GENERIC_READ", "FILE_GENERIC_WRITE"]
user: usernam... | [
"Provide",
"chmod",
"-",
"like",
"functionality",
"for",
"windows",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L77-L119 | train | Provide chmod - like functionality for windows. | 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_utils_windows.py | FindProxies | def FindProxies():
"""Tries to find proxies by interrogating all the user's settings.
This function is a modified urillib.getproxies_registry() from the
standard library. We just store the proxy value in the environment
for urllib to find it.
TODO(user): Iterate through all the possible values if one proxy
... | python | def FindProxies():
"""Tries to find proxies by interrogating all the user's settings.
This function is a modified urillib.getproxies_registry() from the
standard library. We just store the proxy value in the environment
for urllib to find it.
TODO(user): Iterate through all the possible values if one proxy
... | [
"def",
"FindProxies",
"(",
")",
":",
"proxies",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"100",
")",
":",
"try",
":",
"sid",
"=",
"winreg",
".",
"EnumKey",
"(",
"winreg",
".",
"HKEY_USERS",
",",
"i",
")",
"except",
"OSError",
":",... | Tries to find proxies by interrogating all the user's settings.
This function is a modified urillib.getproxies_registry() from the
standard library. We just store the proxy value in the environment
for urllib to find it.
TODO(user): Iterate through all the possible values if one proxy
fails, in case more th... | [
"Tries",
"to",
"find",
"proxies",
"by",
"interrogating",
"all",
"the",
"user",
"s",
"settings",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L134-L193 | train | This function attempts to find proxies in the user s settings. | 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_utils_windows.py | GetRawDevice | def GetRawDevice(path):
"""Resolves the raw device that contains the path.
Args:
path: A path to examine.
Returns:
A pathspec to read the raw device as well as the modified path to read
within the raw device. This is usually the path without the mount point.
Raises:
IOError: if the path does ... | python | def GetRawDevice(path):
"""Resolves the raw device that contains the path.
Args:
path: A path to examine.
Returns:
A pathspec to read the raw device as well as the modified path to read
within the raw device. This is usually the path without the mount point.
Raises:
IOError: if the path does ... | [
"def",
"GetRawDevice",
"(",
"path",
")",
":",
"path",
"=",
"CanonicalPathToLocalPath",
"(",
"path",
")",
"# Try to expand the shortened paths",
"try",
":",
"path",
"=",
"win32file",
".",
"GetLongPathName",
"(",
"path",
")",
"except",
"pywintypes",
".",
"error",
... | Resolves the raw device that contains the path.
Args:
path: A path to examine.
Returns:
A pathspec to read the raw device as well as the modified path to read
within the raw device. This is usually the path without the mount point.
Raises:
IOError: if the path does not exist or some unexpected ... | [
"Resolves",
"the",
"raw",
"device",
"that",
"contains",
"the",
"path",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L196-L239 | train | Resolves the raw device that contains the path. | 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_utils_windows.py | _GetServiceKey | def _GetServiceKey():
"""Returns the service key."""
global _service_key
if _service_key is None:
hive = getattr(winreg, config.CONFIG["Client.config_hive"])
path = config.CONFIG["Client.config_key"]
# Don't use winreg.KEY_WOW64_64KEY since it breaks on Windows 2000
_service_key = winreg.CreateK... | python | def _GetServiceKey():
"""Returns the service key."""
global _service_key
if _service_key is None:
hive = getattr(winreg, config.CONFIG["Client.config_hive"])
path = config.CONFIG["Client.config_key"]
# Don't use winreg.KEY_WOW64_64KEY since it breaks on Windows 2000
_service_key = winreg.CreateK... | [
"def",
"_GetServiceKey",
"(",
")",
":",
"global",
"_service_key",
"if",
"_service_key",
"is",
"None",
":",
"hive",
"=",
"getattr",
"(",
"winreg",
",",
"config",
".",
"CONFIG",
"[",
"\"Client.config_hive\"",
"]",
")",
"path",
"=",
"config",
".",
"CONFIG",
"... | Returns the service key. | [
"Returns",
"the",
"service",
"key",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L245-L256 | train | Returns the service key. | 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_utils_windows.py | RtlGetVersion | def RtlGetVersion(os_version_info_struct):
"""Wraps the lowlevel RtlGetVersion routine.
Args:
os_version_info_struct: instance of either a RTL_OSVERSIONINFOW structure
or a RTL_OSVERSIONINFOEXW structure,
ctypes.Structure-wrapped, with the
... | python | def RtlGetVersion(os_version_info_struct):
"""Wraps the lowlevel RtlGetVersion routine.
Args:
os_version_info_struct: instance of either a RTL_OSVERSIONINFOW structure
or a RTL_OSVERSIONINFOEXW structure,
ctypes.Structure-wrapped, with the
... | [
"def",
"RtlGetVersion",
"(",
"os_version_info_struct",
")",
":",
"rc",
"=",
"ctypes",
".",
"windll",
".",
"Ntdll",
".",
"RtlGetVersion",
"(",
"ctypes",
".",
"byref",
"(",
"os_version_info_struct",
")",
")",
"if",
"rc",
"!=",
"0",
":",
"raise",
"OSError",
"... | Wraps the lowlevel RtlGetVersion routine.
Args:
os_version_info_struct: instance of either a RTL_OSVERSIONINFOW structure
or a RTL_OSVERSIONINFOEXW structure,
ctypes.Structure-wrapped, with the
dwOSVersionInfoSize field preset to... | [
"Wraps",
"the",
"lowlevel",
"RtlGetVersion",
"routine",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L379-L397 | train | Wraps the lowlevel RtlGetVersion routine. | 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_utils_windows.py | KernelVersion | def KernelVersion():
"""Gets the kernel version as string, eg. "5.1.2600".
Returns:
The kernel version, or "unknown" in the case of failure.
"""
rtl_osversioninfoexw = RtlOSVersionInfoExw()
try:
RtlGetVersion(rtl_osversioninfoexw)
except OSError:
return "unknown"
return "%d.%d.%d" % (rtl_osv... | python | def KernelVersion():
"""Gets the kernel version as string, eg. "5.1.2600".
Returns:
The kernel version, or "unknown" in the case of failure.
"""
rtl_osversioninfoexw = RtlOSVersionInfoExw()
try:
RtlGetVersion(rtl_osversioninfoexw)
except OSError:
return "unknown"
return "%d.%d.%d" % (rtl_osv... | [
"def",
"KernelVersion",
"(",
")",
":",
"rtl_osversioninfoexw",
"=",
"RtlOSVersionInfoExw",
"(",
")",
"try",
":",
"RtlGetVersion",
"(",
"rtl_osversioninfoexw",
")",
"except",
"OSError",
":",
"return",
"\"unknown\"",
"return",
"\"%d.%d.%d\"",
"%",
"(",
"rtl_osversioni... | Gets the kernel version as string, eg. "5.1.2600".
Returns:
The kernel version, or "unknown" in the case of failure. | [
"Gets",
"the",
"kernel",
"version",
"as",
"string",
"eg",
".",
"5",
".",
"1",
".",
"2600",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L425-L439 | train | Gets the kernel version as string eg. 5. 1. 2600. | 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_utils_windows.py | NannyController.Heartbeat | def Heartbeat(self):
"""Writes a heartbeat to the registry."""
service_key = _GetServiceKey()
try:
winreg.SetValueEx(service_key, "Nanny.heartbeat", 0, winreg.REG_DWORD,
int(time.time()))
except OSError as e:
logging.debug("Failed to heartbeat nanny at %s: %s", servic... | python | def Heartbeat(self):
"""Writes a heartbeat to the registry."""
service_key = _GetServiceKey()
try:
winreg.SetValueEx(service_key, "Nanny.heartbeat", 0, winreg.REG_DWORD,
int(time.time()))
except OSError as e:
logging.debug("Failed to heartbeat nanny at %s: %s", servic... | [
"def",
"Heartbeat",
"(",
"self",
")",
":",
"service_key",
"=",
"_GetServiceKey",
"(",
")",
"try",
":",
"winreg",
".",
"SetValueEx",
"(",
"service_key",
",",
"\"Nanny.heartbeat\"",
",",
"0",
",",
"winreg",
".",
"REG_DWORD",
",",
"int",
"(",
"time",
".",
"... | Writes a heartbeat to the registry. | [
"Writes",
"a",
"heartbeat",
"to",
"the",
"registry",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L262-L269 | train | Writes a heartbeat to the registry. | 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_utils_windows.py | TransactionLog.Write | def Write(self, grr_message):
"""Write the message into the transaction log.
Args:
grr_message: A GrrMessage instance.
"""
grr_message = grr_message.SerializeToString()
try:
winreg.SetValueEx(_GetServiceKey(), "Transaction", 0, winreg.REG_BINARY,
grr_message)
... | python | def Write(self, grr_message):
"""Write the message into the transaction log.
Args:
grr_message: A GrrMessage instance.
"""
grr_message = grr_message.SerializeToString()
try:
winreg.SetValueEx(_GetServiceKey(), "Transaction", 0, winreg.REG_BINARY,
grr_message)
... | [
"def",
"Write",
"(",
"self",
",",
"grr_message",
")",
":",
"grr_message",
"=",
"grr_message",
".",
"SerializeToString",
"(",
")",
"try",
":",
"winreg",
".",
"SetValueEx",
"(",
"_GetServiceKey",
"(",
")",
",",
"\"Transaction\"",
",",
"0",
",",
"winreg",
"."... | Write the message into the transaction log.
Args:
grr_message: A GrrMessage instance. | [
"Write",
"the",
"message",
"into",
"the",
"transaction",
"log",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L328-L340 | train | Writes the message into the transaction log. | 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_utils_windows.py | TransactionLog.Get | def Get(self):
"""Return a GrrMessage instance from the transaction log or None."""
try:
value, reg_type = winreg.QueryValueEx(_GetServiceKey(), "Transaction")
except OSError:
return
if reg_type != winreg.REG_BINARY:
return
try:
return rdf_flows.GrrMessage.FromSerializedStr... | python | def Get(self):
"""Return a GrrMessage instance from the transaction log or None."""
try:
value, reg_type = winreg.QueryValueEx(_GetServiceKey(), "Transaction")
except OSError:
return
if reg_type != winreg.REG_BINARY:
return
try:
return rdf_flows.GrrMessage.FromSerializedStr... | [
"def",
"Get",
"(",
"self",
")",
":",
"try",
":",
"value",
",",
"reg_type",
"=",
"winreg",
".",
"QueryValueEx",
"(",
"_GetServiceKey",
"(",
")",
",",
"\"Transaction\"",
")",
"except",
"OSError",
":",
"return",
"if",
"reg_type",
"!=",
"winreg",
".",
"REG_B... | Return a GrrMessage instance from the transaction log or None. | [
"Return",
"a",
"GrrMessage",
"instance",
"from",
"the",
"transaction",
"log",
"or",
"None",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_windows.py#L355-L368 | train | Returns a GrrMessage instance from the transaction log or None. | 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/core/grr_response_core/lib/util/filesystem.py | Stat.FromPath | def FromPath(cls, path, follow_symlink = True):
"""Returns stat information about the given OS path, calling os.[l]stat.
Args:
path: A path to perform `stat` on.
follow_symlink: True if `stat` of a symlink should be returned instead of
a file that it points to. For non-symlinks this setting... | python | def FromPath(cls, path, follow_symlink = True):
"""Returns stat information about the given OS path, calling os.[l]stat.
Args:
path: A path to perform `stat` on.
follow_symlink: True if `stat` of a symlink should be returned instead of
a file that it points to. For non-symlinks this setting... | [
"def",
"FromPath",
"(",
"cls",
",",
"path",
",",
"follow_symlink",
"=",
"True",
")",
":",
"# Note that we do not add type assertion for `path` here. The reason is that",
"# many of the existing system calls (e.g. `os.listdir`) return results as",
"# bytestrings in Python 2. This is fine ... | Returns stat information about the given OS path, calling os.[l]stat.
Args:
path: A path to perform `stat` on.
follow_symlink: True if `stat` of a symlink should be returned instead of
a file that it points to. For non-symlinks this setting has no effect.
Returns:
Stat instance, with... | [
"Returns",
"stat",
"information",
"about",
"the",
"given",
"OS",
"path",
"calling",
"os",
".",
"[",
"l",
"]",
"stat",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/filesystem.py#L36-L60 | train | Creates a new stat object from a given path. | 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/core/grr_response_core/lib/util/filesystem.py | Stat._FetchLinuxFlags | def _FetchLinuxFlags(self):
"""Fetches Linux extended file flags."""
if platform.system() != "Linux":
return 0
# Since we open a file in the next step we do not want to open a symlink.
# `lsattr` returns an error when trying to check flags of a symlink, so we
# assume that symlinks cannot hav... | python | def _FetchLinuxFlags(self):
"""Fetches Linux extended file flags."""
if platform.system() != "Linux":
return 0
# Since we open a file in the next step we do not want to open a symlink.
# `lsattr` returns an error when trying to check flags of a symlink, so we
# assume that symlinks cannot hav... | [
"def",
"_FetchLinuxFlags",
"(",
"self",
")",
":",
"if",
"platform",
".",
"system",
"(",
")",
"!=",
"\"Linux\"",
":",
"return",
"0",
"# Since we open a file in the next step we do not want to open a symlink.",
"# `lsattr` returns an error when trying to check flags of a symlink, s... | Fetches Linux extended file flags. | [
"Fetches",
"Linux",
"extended",
"file",
"flags",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/filesystem.py#L120-L159 | train | Fetches Linux extended file flags. | 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/core/grr_response_core/lib/util/filesystem.py | StatCache.Get | def Get(self, path, follow_symlink = True):
"""Stats given file or returns a cached result if available.
Args:
path: A path to the file to perform `stat` on.
follow_symlink: True if `stat` of a symlink should be returned instead of
a file that it points to. For non-symlinks this setting has... | python | def Get(self, path, follow_symlink = True):
"""Stats given file or returns a cached result if available.
Args:
path: A path to the file to perform `stat` on.
follow_symlink: True if `stat` of a symlink should be returned instead of
a file that it points to. For non-symlinks this setting has... | [
"def",
"Get",
"(",
"self",
",",
"path",
",",
"follow_symlink",
"=",
"True",
")",
":",
"key",
"=",
"self",
".",
"_Key",
"(",
"path",
"=",
"path",
",",
"follow_symlink",
"=",
"follow_symlink",
")",
"try",
":",
"return",
"self",
".",
"_cache",
"[",
"key... | Stats given file or returns a cached result if available.
Args:
path: A path to the file to perform `stat` on.
follow_symlink: True if `stat` of a symlink should be returned instead of
a file that it points to. For non-symlinks this setting has no effect.
Returns:
`Stat` object corre... | [
"Stats",
"given",
"file",
"or",
"returns",
"a",
"cached",
"result",
"if",
"available",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/filesystem.py#L187-L211 | train | Get a stat object corresponding to the given path. | 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/core/grr_response_core/lib/parser.py | Parser.GetClassesByArtifact | def GetClassesByArtifact(cls, artifact_name):
"""Get the classes that support parsing a given artifact."""
return [
cls.classes[c]
for c in cls.classes
if artifact_name in cls.classes[c].supported_artifacts
] | python | def GetClassesByArtifact(cls, artifact_name):
"""Get the classes that support parsing a given artifact."""
return [
cls.classes[c]
for c in cls.classes
if artifact_name in cls.classes[c].supported_artifacts
] | [
"def",
"GetClassesByArtifact",
"(",
"cls",
",",
"artifact_name",
")",
":",
"return",
"[",
"cls",
".",
"classes",
"[",
"c",
"]",
"for",
"c",
"in",
"cls",
".",
"classes",
"if",
"artifact_name",
"in",
"cls",
".",
"classes",
"[",
"c",
"]",
".",
"supported_... | Get the classes that support parsing a given artifact. | [
"Get",
"the",
"classes",
"that",
"support",
"parsing",
"a",
"given",
"artifact",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parser.py#L130-L136 | train | Get the classes that support parsing a given artifact. | 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/core/grr_response_core/lib/parsers/linux_pam_parser.py | PAMFieldParser.EnumerateAllConfigs | def EnumerateAllConfigs(self, stats, file_objects):
"""Generate RDFs for the fully expanded configs.
Args:
stats: A list of RDF StatEntries corresponding to the file_objects.
file_objects: A list of file handles.
Returns:
A tuple of a list of RDFValue PamConfigEntries found & a list of s... | python | def EnumerateAllConfigs(self, stats, file_objects):
"""Generate RDFs for the fully expanded configs.
Args:
stats: A list of RDF StatEntries corresponding to the file_objects.
file_objects: A list of file handles.
Returns:
A tuple of a list of RDFValue PamConfigEntries found & a list of s... | [
"def",
"EnumerateAllConfigs",
"(",
"self",
",",
"stats",
",",
"file_objects",
")",
":",
"# Convert the stats & file_objects into a cache of a",
"# simple path keyed dict of file contents.",
"cache",
"=",
"{",
"}",
"for",
"stat_obj",
",",
"file_obj",
"in",
"zip",
"(",
"s... | Generate RDFs for the fully expanded configs.
Args:
stats: A list of RDF StatEntries corresponding to the file_objects.
file_objects: A list of file handles.
Returns:
A tuple of a list of RDFValue PamConfigEntries found & a list of strings
which are the external config references found... | [
"Generate",
"RDFs",
"for",
"the",
"fully",
"expanded",
"configs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_pam_parser.py#L47-L84 | train | Enumerate all the configs in the given stats and file_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/core/grr_response_core/lib/parsers/linux_pam_parser.py | PAMFieldParser.EnumerateConfig | def EnumerateConfig(self, service, path, cache, filter_type=None):
"""Return PamConfigEntries it finds as it recursively follows PAM configs.
Args:
service: A string containing the service name we are processing.
path: A string containing the file path name we want.
cache: A dictionary keyed ... | python | def EnumerateConfig(self, service, path, cache, filter_type=None):
"""Return PamConfigEntries it finds as it recursively follows PAM configs.
Args:
service: A string containing the service name we are processing.
path: A string containing the file path name we want.
cache: A dictionary keyed ... | [
"def",
"EnumerateConfig",
"(",
"self",
",",
"service",
",",
"path",
",",
"cache",
",",
"filter_type",
"=",
"None",
")",
":",
"result",
"=",
"[",
"]",
"external",
"=",
"[",
"]",
"path",
"=",
"self",
".",
"_FixPath",
"(",
"path",
")",
"# Make sure we onl... | Return PamConfigEntries it finds as it recursively follows PAM configs.
Args:
service: A string containing the service name we are processing.
path: A string containing the file path name we want.
cache: A dictionary keyed on path, with the file contents (list of str).
filter_type: A string... | [
"Return",
"PamConfigEntries",
"it",
"finds",
"as",
"it",
"recursively",
"follows",
"PAM",
"configs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_pam_parser.py#L86-L184 | train | Enumerate PAM configs. | 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_fingerprint.py | FingerprintFile.Run | def Run(self, args):
"""Fingerprint a file."""
with vfs.VFSOpen(
args.pathspec, progress_callback=self.Progress) as file_obj:
fingerprinter = Fingerprinter(self.Progress, file_obj)
response = rdf_client_action.FingerprintResponse()
response.pathspec = file_obj.pathspec
if args.tu... | python | def Run(self, args):
"""Fingerprint a file."""
with vfs.VFSOpen(
args.pathspec, progress_callback=self.Progress) as file_obj:
fingerprinter = Fingerprinter(self.Progress, file_obj)
response = rdf_client_action.FingerprintResponse()
response.pathspec = file_obj.pathspec
if args.tu... | [
"def",
"Run",
"(",
"self",
",",
"args",
")",
":",
"with",
"vfs",
".",
"VFSOpen",
"(",
"args",
".",
"pathspec",
",",
"progress_callback",
"=",
"self",
".",
"Progress",
")",
"as",
"file_obj",
":",
"fingerprinter",
"=",
"Fingerprinter",
"(",
"self",
".",
... | Fingerprint a file. | [
"Fingerprint",
"a",
"file",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_fingerprint.py#L46-L97 | train | Fingerprint a file. | 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.py | _ValidateAFF4Type | def _ValidateAFF4Type(aff4_type):
"""Validates an AFF4 type."""
if aff4_type is None:
return
if not isinstance(aff4_type, type):
raise TypeError("aff4_type=%s must be a type" % aff4_type)
if not issubclass(aff4_type, AFF4Object):
raise TypeError("aff4_type=%s must be a subclass of AFF4Object." %
... | python | def _ValidateAFF4Type(aff4_type):
"""Validates an AFF4 type."""
if aff4_type is None:
return
if not isinstance(aff4_type, type):
raise TypeError("aff4_type=%s must be a type" % aff4_type)
if not issubclass(aff4_type, AFF4Object):
raise TypeError("aff4_type=%s must be a subclass of AFF4Object." %
... | [
"def",
"_ValidateAFF4Type",
"(",
"aff4_type",
")",
":",
"if",
"aff4_type",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"aff4_type",
",",
"type",
")",
":",
"raise",
"TypeError",
"(",
"\"aff4_type=%s must be a type\"",
"%",
"aff4_type",
")",
"if... | Validates an AFF4 type. | [
"Validates",
"an",
"AFF4",
"type",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L272-L281 | train | Validates an AFF4 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/aff4.py | DeletionPool.Open | def Open(self, urn, aff4_type=None, mode="r"):
"""Opens the named object.
DeletionPool will only open the object if it's not in the pool already.
Otherwise it will just return the cached version. Objects are cached
based on their urn and mode. I.e. same object opened with mode="r" and
mode="rw" wil... | python | def Open(self, urn, aff4_type=None, mode="r"):
"""Opens the named object.
DeletionPool will only open the object if it's not in the pool already.
Otherwise it will just return the cached version. Objects are cached
based on their urn and mode. I.e. same object opened with mode="r" and
mode="rw" wil... | [
"def",
"Open",
"(",
"self",
",",
"urn",
",",
"aff4_type",
"=",
"None",
",",
"mode",
"=",
"\"r\"",
")",
":",
"key",
"=",
"self",
".",
"_ObjectKey",
"(",
"urn",
",",
"mode",
")",
"try",
":",
"obj",
"=",
"self",
".",
"_objects_cache",
"[",
"key",
"]... | Opens the named object.
DeletionPool will only open the object if it's not in the pool already.
Otherwise it will just return the cached version. Objects are cached
based on their urn and mode. I.e. same object opened with mode="r" and
mode="rw" will be actually opened two times and cached separately.
... | [
"Opens",
"the",
"named",
"object",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L106-L142 | train | Opens the named object in the pool. | 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.py | DeletionPool.MultiOpen | def MultiOpen(self, urns, aff4_type=None, mode="r"):
"""Opens many urns efficiently, returning cached objects when possible."""
not_opened_urns = []
_ValidateAFF4Type(aff4_type)
for urn in urns:
key = self._ObjectKey(urn, mode)
try:
result = self._objects_cache[key]
if aff4_... | python | def MultiOpen(self, urns, aff4_type=None, mode="r"):
"""Opens many urns efficiently, returning cached objects when possible."""
not_opened_urns = []
_ValidateAFF4Type(aff4_type)
for urn in urns:
key = self._ObjectKey(urn, mode)
try:
result = self._objects_cache[key]
if aff4_... | [
"def",
"MultiOpen",
"(",
"self",
",",
"urns",
",",
"aff4_type",
"=",
"None",
",",
"mode",
"=",
"\"r\"",
")",
":",
"not_opened_urns",
"=",
"[",
"]",
"_ValidateAFF4Type",
"(",
"aff4_type",
")",
"for",
"urn",
"in",
"urns",
":",
"key",
"=",
"self",
".",
... | Opens many urns efficiently, returning cached objects when possible. | [
"Opens",
"many",
"urns",
"efficiently",
"returning",
"cached",
"objects",
"when",
"possible",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L144-L169 | train | Opens many urns efficiently returning cached objects when possible. | 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.py | DeletionPool.ListChildren | def ListChildren(self, urn):
"""Lists children of a given urn. Resulting list is cached."""
result = self.MultiListChildren([urn])
try:
return result[urn]
except KeyError:
return [] | python | def ListChildren(self, urn):
"""Lists children of a given urn. Resulting list is cached."""
result = self.MultiListChildren([urn])
try:
return result[urn]
except KeyError:
return [] | [
"def",
"ListChildren",
"(",
"self",
",",
"urn",
")",
":",
"result",
"=",
"self",
".",
"MultiListChildren",
"(",
"[",
"urn",
"]",
")",
"try",
":",
"return",
"result",
"[",
"urn",
"]",
"except",
"KeyError",
":",
"return",
"[",
"]"
] | Lists children of a given urn. Resulting list is cached. | [
"Lists",
"children",
"of",
"a",
"given",
"urn",
".",
"Resulting",
"list",
"is",
"cached",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L171-L177 | train | Lists children of a given 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.py | DeletionPool.MultiListChildren | def MultiListChildren(self, urns):
"""Lists children of a bunch of given urns. Results are cached."""
result = {}
not_listed_urns = []
for urn in urns:
try:
result[urn] = self._children_lists_cache[urn]
except KeyError:
not_listed_urns.append(urn)
if not_listed_urns:
... | python | def MultiListChildren(self, urns):
"""Lists children of a bunch of given urns. Results are cached."""
result = {}
not_listed_urns = []
for urn in urns:
try:
result[urn] = self._children_lists_cache[urn]
except KeyError:
not_listed_urns.append(urn)
if not_listed_urns:
... | [
"def",
"MultiListChildren",
"(",
"self",
",",
"urns",
")",
":",
"result",
"=",
"{",
"}",
"not_listed_urns",
"=",
"[",
"]",
"for",
"urn",
"in",
"urns",
":",
"try",
":",
"result",
"[",
"urn",
"]",
"=",
"self",
".",
"_children_lists_cache",
"[",
"urn",
... | Lists children of a bunch of given urns. Results are cached. | [
"Lists",
"children",
"of",
"a",
"bunch",
"of",
"given",
"urns",
".",
"Results",
"are",
"cached",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L179-L198 | train | Lists children of a bunch of given urns. Results are cached. | 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.py | DeletionPool.RecursiveMultiListChildren | def RecursiveMultiListChildren(self, urns):
"""Recursively lists given urns. Results are cached."""
result = {}
checked_urns = set()
not_cached_urns = []
urns_to_check = urns
while True:
found_children = []
for urn in urns_to_check:
try:
children = result[urn] = s... | python | def RecursiveMultiListChildren(self, urns):
"""Recursively lists given urns. Results are cached."""
result = {}
checked_urns = set()
not_cached_urns = []
urns_to_check = urns
while True:
found_children = []
for urn in urns_to_check:
try:
children = result[urn] = s... | [
"def",
"RecursiveMultiListChildren",
"(",
"self",
",",
"urns",
")",
":",
"result",
"=",
"{",
"}",
"checked_urns",
"=",
"set",
"(",
")",
"not_cached_urns",
"=",
"[",
"]",
"urns_to_check",
"=",
"urns",
"while",
"True",
":",
"found_children",
"=",
"[",
"]",
... | Recursively lists given urns. Results are cached. | [
"Recursively",
"lists",
"given",
"urns",
".",
"Results",
"are",
"cached",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L200-L226 | train | Recursively lists given urns. Results are cached. | 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.py | DeletionPool.MultiMarkForDeletion | def MultiMarkForDeletion(self, urns):
"""Marks multiple urns (and their children) for deletion."""
all_children_urns = self.RecursiveMultiListChildren(urns)
urns.extend(collection.Flatten(itervalues(all_children_urns)))
self._urns_for_deletion.update(urns)
for obj in self.MultiOpen(urns):
ob... | python | def MultiMarkForDeletion(self, urns):
"""Marks multiple urns (and their children) for deletion."""
all_children_urns = self.RecursiveMultiListChildren(urns)
urns.extend(collection.Flatten(itervalues(all_children_urns)))
self._urns_for_deletion.update(urns)
for obj in self.MultiOpen(urns):
ob... | [
"def",
"MultiMarkForDeletion",
"(",
"self",
",",
"urns",
")",
":",
"all_children_urns",
"=",
"self",
".",
"RecursiveMultiListChildren",
"(",
"urns",
")",
"urns",
".",
"extend",
"(",
"collection",
".",
"Flatten",
"(",
"itervalues",
"(",
"all_children_urns",
")",
... | Marks multiple urns (and their children) for deletion. | [
"Marks",
"multiple",
"urns",
"(",
"and",
"their",
"children",
")",
"for",
"deletion",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L232-L240 | train | Marks multiple urns for deletion. | 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.py | DeletionPool.root_urns_for_deletion | def root_urns_for_deletion(self):
"""Roots of the graph of urns marked for deletion."""
roots = set()
for urn in self._urns_for_deletion:
new_root = True
str_urn = utils.SmartUnicode(urn)
fake_roots = []
for root in roots:
str_root = utils.SmartUnicode(root)
if str_... | python | def root_urns_for_deletion(self):
"""Roots of the graph of urns marked for deletion."""
roots = set()
for urn in self._urns_for_deletion:
new_root = True
str_urn = utils.SmartUnicode(urn)
fake_roots = []
for root in roots:
str_root = utils.SmartUnicode(root)
if str_... | [
"def",
"root_urns_for_deletion",
"(",
"self",
")",
":",
"roots",
"=",
"set",
"(",
")",
"for",
"urn",
"in",
"self",
".",
"_urns_for_deletion",
":",
"new_root",
"=",
"True",
"str_urn",
"=",
"utils",
".",
"SmartUnicode",
"(",
"urn",
")",
"fake_roots",
"=",
... | Roots of the graph of urns marked for deletion. | [
"Roots",
"of",
"the",
"graph",
"of",
"urns",
"marked",
"for",
"deletion",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L243-L264 | train | Returns a set of all the root urns marked for deletion. | 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.py | Factory.ParseAgeSpecification | def ParseAgeSpecification(cls, age):
"""Parses an aff4 age and returns a datastore age specification."""
try:
return (0, int(age))
except (ValueError, TypeError):
pass
if age == NEWEST_TIME:
return data_store.DB.NEWEST_TIMESTAMP
elif age == ALL_TIMES:
return data_store.DB.AL... | python | def ParseAgeSpecification(cls, age):
"""Parses an aff4 age and returns a datastore age specification."""
try:
return (0, int(age))
except (ValueError, TypeError):
pass
if age == NEWEST_TIME:
return data_store.DB.NEWEST_TIMESTAMP
elif age == ALL_TIMES:
return data_store.DB.AL... | [
"def",
"ParseAgeSpecification",
"(",
"cls",
",",
"age",
")",
":",
"try",
":",
"return",
"(",
"0",
",",
"int",
"(",
"age",
")",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
":",
"pass",
"if",
"age",
"==",
"NEWEST_TIME",
":",
"return",
"dat... | Parses an aff4 age and returns a datastore age specification. | [
"Parses",
"an",
"aff4",
"age",
"and",
"returns",
"a",
"datastore",
"age",
"specification",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L303-L319 | train | Parses an aff4 age and returns a datastore age specification. | 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.py | Factory.GetAttributes | def GetAttributes(self, urns, age=NEWEST_TIME):
"""Retrieves all the attributes for all the urns."""
urns = set([utils.SmartUnicode(u) for u in urns])
to_read = {urn: self._MakeCacheInvariant(urn, age) for urn in urns}
# Urns not present in the cache we need to get from the database.
if to_read:
... | python | def GetAttributes(self, urns, age=NEWEST_TIME):
"""Retrieves all the attributes for all the urns."""
urns = set([utils.SmartUnicode(u) for u in urns])
to_read = {urn: self._MakeCacheInvariant(urn, age) for urn in urns}
# Urns not present in the cache we need to get from the database.
if to_read:
... | [
"def",
"GetAttributes",
"(",
"self",
",",
"urns",
",",
"age",
"=",
"NEWEST_TIME",
")",
":",
"urns",
"=",
"set",
"(",
"[",
"utils",
".",
"SmartUnicode",
"(",
"u",
")",
"for",
"u",
"in",
"urns",
"]",
")",
"to_read",
"=",
"{",
"urn",
":",
"self",
".... | Retrieves all the attributes for all the urns. | [
"Retrieves",
"all",
"the",
"attributes",
"for",
"all",
"the",
"urns",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L321-L337 | train | Retrieves all the attributes for all the urns. | 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.py | Factory.SetAttributes | def SetAttributes(self,
urn,
attributes,
to_delete,
add_child_index=True,
mutation_pool=None):
"""Sets the attributes in the data store."""
attributes[AFF4Object.SchemaCls.LAST] = [
rdfvalue.RDFDatetime.... | python | def SetAttributes(self,
urn,
attributes,
to_delete,
add_child_index=True,
mutation_pool=None):
"""Sets the attributes in the data store."""
attributes[AFF4Object.SchemaCls.LAST] = [
rdfvalue.RDFDatetime.... | [
"def",
"SetAttributes",
"(",
"self",
",",
"urn",
",",
"attributes",
",",
"to_delete",
",",
"add_child_index",
"=",
"True",
",",
"mutation_pool",
"=",
"None",
")",
":",
"attributes",
"[",
"AFF4Object",
".",
"SchemaCls",
".",
"LAST",
"]",
"=",
"[",
"rdfvalue... | Sets the attributes in the data store. | [
"Sets",
"the",
"attributes",
"in",
"the",
"data",
"store",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L339-L361 | train | Sets the attributes in the data store. | 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.