partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Hunt.expired | Checks if the hunt has expired. | grr/server/grr_response_server/rdfvalues/hunt_objects.py | def expired(self):
"""Checks if the hunt has expired."""
expiry_time = self.expiry_time
if expiry_time is not None:
return expiry_time < rdfvalue.RDFDatetime.Now()
else:
return False | def expired(self):
"""Checks if the hunt has expired."""
expiry_time = self.expiry_time
if expiry_time is not None:
return expiry_time < rdfvalue.RDFDatetime.Now()
else:
return False | [
"Checks",
"if",
"the",
"hunt",
"has",
"expired",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/hunt_objects.py#L124-L130 | [
"def",
"expired",
"(",
"self",
")",
":",
"expiry_time",
"=",
"self",
".",
"expiry_time",
"if",
"expiry_time",
"is",
"not",
"None",
":",
"return",
"expiry_time",
"<",
"rdfvalue",
".",
"RDFDatetime",
".",
"Now",
"(",
")",
"else",
":",
"return",
"False"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | Approval.GetApprovalForObject | Looks for approvals for an object and returns available valid tokens.
Args:
object_urn: Urn of the object we want access to.
token: The token to use to lookup the ACLs.
username: The user to get the approval for, if "" we get it from the
token.
Returns:
A token for access to ... | grr/server/grr_response_server/aff4_objects/security.py | def GetApprovalForObject(object_urn, token=None, username=""):
"""Looks for approvals for an object and returns available valid tokens.
Args:
object_urn: Urn of the object we want access to.
token: The token to use to lookup the ACLs.
username: The user to get the approval for, if "" we get... | def GetApprovalForObject(object_urn, token=None, username=""):
"""Looks for approvals for an object and returns available valid tokens.
Args:
object_urn: Urn of the object we want access to.
token: The token to use to lookup the ACLs.
username: The user to get the approval for, if "" we get... | [
"Looks",
"for",
"approvals",
"for",
"an",
"object",
"and",
"returns",
"available",
"valid",
"tokens",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L93-L154 | [
"def",
"GetApprovalForObject",
"(",
"object_urn",
",",
"token",
"=",
"None",
",",
"username",
"=",
"\"\"",
")",
":",
"if",
"token",
"is",
"None",
":",
"raise",
"access_control",
".",
"UnauthorizedAccess",
"(",
"\"No token given, cannot authenticate.\"",
")",
"if",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ApprovalWithApproversAndReason.CheckAccess | Enforce a dual approver policy for access. | grr/server/grr_response_server/aff4_objects/security.py | def CheckAccess(self, token):
"""Enforce a dual approver policy for access."""
namespace, _ = self.urn.Split(2)
if namespace != "ACL":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
subject=self.urn,
requested_access=token.requ... | def CheckAccess(self, token):
"""Enforce a dual approver policy for access."""
namespace, _ = self.urn.Split(2)
if namespace != "ACL":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
subject=self.urn,
requested_access=token.requ... | [
"Enforce",
"a",
"dual",
"approver",
"policy",
"for",
"access",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L213-L274 | [
"def",
"CheckAccess",
"(",
"self",
",",
"token",
")",
":",
"namespace",
",",
"_",
"=",
"self",
".",
"urn",
".",
"Split",
"(",
"2",
")",
"if",
"namespace",
"!=",
"\"ACL\"",
":",
"raise",
"access_control",
".",
"UnauthorizedAccess",
"(",
"\"Approval object h... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ApprovalWithApproversAndReason.GetNonExpiredApprovers | Returns a list of usernames of approvers who approved this approval. | grr/server/grr_response_server/aff4_objects/security.py | def GetNonExpiredApprovers(self):
"""Returns a list of usernames of approvers who approved this approval."""
lifetime = rdfvalue.Duration(
self.Get(self.Schema.LIFETIME) or config.CONFIG["ACL.token_expiry"])
# Check that there are enough approvers.
#
# TODO(user): approvals have to be open... | def GetNonExpiredApprovers(self):
"""Returns a list of usernames of approvers who approved this approval."""
lifetime = rdfvalue.Duration(
self.Get(self.Schema.LIFETIME) or config.CONFIG["ACL.token_expiry"])
# Check that there are enough approvers.
#
# TODO(user): approvals have to be open... | [
"Returns",
"a",
"list",
"of",
"usernames",
"of",
"approvers",
"who",
"approved",
"this",
"approval",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L276-L293 | [
"def",
"GetNonExpiredApprovers",
"(",
"self",
")",
":",
"lifetime",
"=",
"rdfvalue",
".",
"Duration",
"(",
"self",
".",
"Get",
"(",
"self",
".",
"Schema",
".",
"LIFETIME",
")",
"or",
"config",
".",
"CONFIG",
"[",
"\"ACL.token_expiry\"",
"]",
")",
"# Check ... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ClientApproval.InferUserAndSubjectFromUrn | Infers user name and subject urn from self.urn. | grr/server/grr_response_server/aff4_objects/security.py | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, client_id, user, _ = self.urn.Split(4)
return (user, rdf_client.ClientURN(client_id)) | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, client_id, user, _ = self.urn.Split(4)
return (user, rdf_client.ClientURN(client_id)) | [
"Infers",
"user",
"name",
"and",
"subject",
"urn",
"from",
"self",
".",
"urn",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L306-L309 | [
"def",
"InferUserAndSubjectFromUrn",
"(",
"self",
")",
":",
"_",
",",
"client_id",
",",
"user",
",",
"_",
"=",
"self",
".",
"urn",
".",
"Split",
"(",
"4",
")",
"return",
"(",
"user",
",",
"rdf_client",
".",
"ClientURN",
"(",
"client_id",
")",
")"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | HuntApproval.InferUserAndSubjectFromUrn | Infers user name and subject urn from self.urn. | grr/server/grr_response_server/aff4_objects/security.py | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, hunts_str, hunt_id, user, _ = self.urn.Split(5)
if hunts_str != "hunts":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
requested_access=self.... | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, hunts_str, hunt_id, user, _ = self.urn.Split(5)
if hunts_str != "hunts":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
requested_access=self.... | [
"Infers",
"user",
"name",
"and",
"subject",
"urn",
"from",
"self",
".",
"urn",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L352-L361 | [
"def",
"InferUserAndSubjectFromUrn",
"(",
"self",
")",
":",
"_",
",",
"hunts_str",
",",
"hunt_id",
",",
"user",
",",
"_",
"=",
"self",
".",
"urn",
".",
"Split",
"(",
"5",
")",
"if",
"hunts_str",
"!=",
"\"hunts\"",
":",
"raise",
"access_control",
".",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | CronJobApproval.InferUserAndSubjectFromUrn | Infers user name and subject urn from self.urn. | grr/server/grr_response_server/aff4_objects/security.py | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, cron_str, cron_job_name, user, _ = self.urn.Split(5)
if cron_str != "cron":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
requested_access=se... | def InferUserAndSubjectFromUrn(self):
"""Infers user name and subject urn from self.urn."""
_, cron_str, cron_job_name, user, _ = self.urn.Split(5)
if cron_str != "cron":
raise access_control.UnauthorizedAccess(
"Approval object has invalid urn %s." % self.urn,
requested_access=se... | [
"Infers",
"user",
"name",
"and",
"subject",
"urn",
"from",
"self",
".",
"urn",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L375-L384 | [
"def",
"InferUserAndSubjectFromUrn",
"(",
"self",
")",
":",
"_",
",",
"cron_str",
",",
"cron_job_name",
",",
"user",
",",
"_",
"=",
"self",
".",
"urn",
".",
"Split",
"(",
"5",
")",
"if",
"cron_str",
"!=",
"\"cron\"",
":",
"raise",
"access_control",
".",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | AbstractApprovalBase.ApprovalUrnBuilder | Encode an approval URN. | grr/server/grr_response_server/aff4_objects/security.py | def ApprovalUrnBuilder(subject, user, approval_id):
"""Encode an approval URN."""
return aff4.ROOT_URN.Add("ACL").Add(subject).Add(user).Add(approval_id) | def ApprovalUrnBuilder(subject, user, approval_id):
"""Encode an approval URN."""
return aff4.ROOT_URN.Add("ACL").Add(subject).Add(user).Add(approval_id) | [
"Encode",
"an",
"approval",
"URN",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L400-L402 | [
"def",
"ApprovalUrnBuilder",
"(",
"subject",
",",
"user",
",",
"approval_id",
")",
":",
"return",
"aff4",
".",
"ROOT_URN",
".",
"Add",
"(",
"\"ACL\"",
")",
".",
"Add",
"(",
"subject",
")",
".",
"Add",
"(",
"user",
")",
".",
"Add",
"(",
"approval_id",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | AbstractApprovalBase.ApprovalSymlinkUrnBuilder | Build an approval symlink URN. | grr/server/grr_response_server/aff4_objects/security.py | def ApprovalSymlinkUrnBuilder(approval_type, subject_id, user, approval_id):
"""Build an approval symlink URN."""
return aff4.ROOT_URN.Add("users").Add(user).Add("approvals").Add(
approval_type).Add(subject_id).Add(approval_id) | def ApprovalSymlinkUrnBuilder(approval_type, subject_id, user, approval_id):
"""Build an approval symlink URN."""
return aff4.ROOT_URN.Add("users").Add(user).Add("approvals").Add(
approval_type).Add(subject_id).Add(approval_id) | [
"Build",
"an",
"approval",
"symlink",
"URN",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L405-L408 | [
"def",
"ApprovalSymlinkUrnBuilder",
"(",
"approval_type",
",",
"subject_id",
",",
"user",
",",
"approval_id",
")",
":",
"return",
"aff4",
".",
"ROOT_URN",
".",
"Add",
"(",
"\"users\"",
")",
".",
"Add",
"(",
"user",
")",
".",
"Add",
"(",
"\"approvals\"",
")... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ApprovalRequestor.Request | Create the Approval object and notify the Approval Granter. | grr/server/grr_response_server/aff4_objects/security.py | def Request(self):
"""Create the Approval object and notify the Approval Granter."""
approval_id = "approval:%X" % random.UInt32()
approval_urn = self.BuildApprovalUrn(approval_id)
email_msg_id = email.utils.make_msgid()
with aff4.FACTORY.Create(
approval_urn, self.approval_type, mode="w"... | def Request(self):
"""Create the Approval object and notify the Approval Granter."""
approval_id = "approval:%X" % random.UInt32()
approval_urn = self.BuildApprovalUrn(approval_id)
email_msg_id = email.utils.make_msgid()
with aff4.FACTORY.Create(
approval_urn, self.approval_type, mode="w"... | [
"Create",
"the",
"Approval",
"object",
"and",
"notify",
"the",
"Approval",
"Granter",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L444-L489 | [
"def",
"Request",
"(",
"self",
")",
":",
"approval_id",
"=",
"\"approval:%X\"",
"%",
"random",
".",
"UInt32",
"(",
")",
"approval_urn",
"=",
"self",
".",
"BuildApprovalUrn",
"(",
"approval_id",
")",
"email_msg_id",
"=",
"email",
".",
"utils",
".",
"make_msgi... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ApprovalGrantor.Grant | Create the Approval object and notify the Approval Granter. | grr/server/grr_response_server/aff4_objects/security.py | def Grant(self):
"""Create the Approval object and notify the Approval Granter."""
approvals_root_urn = aff4.ROOT_URN.Add("ACL").Add(
self.subject_urn.Path()).Add(self.delegate)
children_urns = list(aff4.FACTORY.ListChildren(approvals_root_urn))
if not children_urns:
raise access_control.... | def Grant(self):
"""Create the Approval object and notify the Approval Granter."""
approvals_root_urn = aff4.ROOT_URN.Add("ACL").Add(
self.subject_urn.Path()).Add(self.delegate)
children_urns = list(aff4.FACTORY.ListChildren(approvals_root_urn))
if not children_urns:
raise access_control.... | [
"Create",
"the",
"Approval",
"object",
"and",
"notify",
"the",
"Approval",
"Granter",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L514-L558 | [
"def",
"Grant",
"(",
"self",
")",
":",
"approvals_root_urn",
"=",
"aff4",
".",
"ROOT_URN",
".",
"Add",
"(",
"\"ACL\"",
")",
".",
"Add",
"(",
"self",
".",
"subject_urn",
".",
"Path",
"(",
")",
")",
".",
"Add",
"(",
"self",
".",
"delegate",
")",
"chi... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ClientApprovalRequestor.BuildApprovalUrn | Builds approval object urn. | grr/server/grr_response_server/aff4_objects/security.py | def BuildApprovalUrn(self, approval_id):
"""Builds approval object urn."""
event = rdf_events.AuditEvent(
user=self.token.username,
action="CLIENT_APPROVAL_REQUEST",
client=self.subject_urn,
description=self.reason)
events.Events.PublishEvent("Audit", event, token=self.token)... | def BuildApprovalUrn(self, approval_id):
"""Builds approval object urn."""
event = rdf_events.AuditEvent(
user=self.token.username,
action="CLIENT_APPROVAL_REQUEST",
client=self.subject_urn,
description=self.reason)
events.Events.PublishEvent("Audit", event, token=self.token)... | [
"Builds",
"approval",
"object",
"urn",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L571-L581 | [
"def",
"BuildApprovalUrn",
"(",
"self",
",",
"approval_id",
")",
":",
"event",
"=",
"rdf_events",
".",
"AuditEvent",
"(",
"user",
"=",
"self",
".",
"token",
".",
"username",
",",
"action",
"=",
"\"CLIENT_APPROVAL_REQUEST\"",
",",
"client",
"=",
"self",
".",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | CronJobApprovalRequestor.BuildApprovalSymlinksUrns | Builds list of symlinks URNs for the approval object. | grr/server/grr_response_server/aff4_objects/security.py | def BuildApprovalSymlinksUrns(self, approval_id):
"""Builds list of symlinks URNs for the approval object."""
return [
self.ApprovalSymlinkUrnBuilder("cron", self.subject_urn.Basename(),
self.token.username, approval_id)
] | def BuildApprovalSymlinksUrns(self, approval_id):
"""Builds list of symlinks URNs for the approval object."""
return [
self.ApprovalSymlinkUrnBuilder("cron", self.subject_urn.Basename(),
self.token.username, approval_id)
] | [
"Builds",
"list",
"of",
"symlinks",
"URNs",
"for",
"the",
"approval",
"object",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/security.py#L696-L701 | [
"def",
"BuildApprovalSymlinksUrns",
"(",
"self",
",",
"approval_id",
")",
":",
"return",
"[",
"self",
".",
"ApprovalSymlinkUrnBuilder",
"(",
"\"cron\"",
",",
"self",
".",
"subject_urn",
".",
"Basename",
"(",
")",
",",
"self",
".",
"token",
".",
"username",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBBlobsMixin.ReadBlobs | Reads given blobs. | grr/server/grr_response_server/databases/mem_blobs.py | def ReadBlobs(self, blob_ids):
"""Reads given blobs."""
result = {}
for blob_id in blob_ids:
result[blob_id] = self.blobs.get(blob_id, None)
return result | def ReadBlobs(self, blob_ids):
"""Reads given blobs."""
result = {}
for blob_id in blob_ids:
result[blob_id] = self.blobs.get(blob_id, None)
return result | [
"Reads",
"given",
"blobs",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_blobs.py#L35-L42 | [
"def",
"ReadBlobs",
"(",
"self",
",",
"blob_ids",
")",
":",
"result",
"=",
"{",
"}",
"for",
"blob_id",
"in",
"blob_ids",
":",
"result",
"[",
"blob_id",
"]",
"=",
"self",
".",
"blobs",
".",
"get",
"(",
"blob_id",
",",
"None",
")",
"return",
"result"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBBlobsMixin.CheckBlobsExist | Checks if given blobs exit. | grr/server/grr_response_server/databases/mem_blobs.py | def CheckBlobsExist(self, blob_ids):
"""Checks if given blobs exit."""
result = {}
for blob_id in blob_ids:
result[blob_id] = blob_id in self.blobs
return result | def CheckBlobsExist(self, blob_ids):
"""Checks if given blobs exit."""
result = {}
for blob_id in blob_ids:
result[blob_id] = blob_id in self.blobs
return result | [
"Checks",
"if",
"given",
"blobs",
"exit",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_blobs.py#L45-L52 | [
"def",
"CheckBlobsExist",
"(",
"self",
",",
"blob_ids",
")",
":",
"result",
"=",
"{",
"}",
"for",
"blob_id",
"in",
"blob_ids",
":",
"result",
"[",
"blob_id",
"]",
"=",
"blob_id",
"in",
"self",
".",
"blobs",
"return",
"result"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | FileFinderOSFromClient | This function expands paths from the args and returns related stat entries.
Args:
args: An `rdf_file_finder.FileFinderArgs` object.
Yields:
`rdf_paths.PathSpec` instances. | grr/client/grr_response_client/client_actions/file_finder.py | def FileFinderOSFromClient(args):
"""This function expands paths from the args and returns related stat entries.
Args:
args: An `rdf_file_finder.FileFinderArgs` object.
Yields:
`rdf_paths.PathSpec` instances.
"""
stat_cache = filesystem.StatCache()
opts = args.action.stat
for path in GetExpand... | def FileFinderOSFromClient(args):
"""This function expands paths from the args and returns related stat entries.
Args:
args: An `rdf_file_finder.FileFinderArgs` object.
Yields:
`rdf_paths.PathSpec` instances.
"""
stat_cache = filesystem.StatCache()
opts = args.action.stat
for path in GetExpand... | [
"This",
"function",
"expands",
"paths",
"from",
"the",
"args",
"and",
"returns",
"related",
"stat",
"entries",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L28-L55 | [
"def",
"FileFinderOSFromClient",
"(",
"args",
")",
":",
"stat_cache",
"=",
"filesystem",
".",
"StatCache",
"(",
")",
"opts",
"=",
"args",
".",
"action",
".",
"stat",
"for",
"path",
"in",
"GetExpandedPaths",
"(",
"args",
")",
":",
"try",
":",
"content_condi... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | GetExpandedPaths | Expands given path patterns.
Args:
args: A `FileFinderArgs` instance that dictates the behaviour of the path
expansion.
Yields:
Absolute paths (as string objects) derived from input patterns.
Raises:
ValueError: For unsupported path types. | grr/client/grr_response_client/client_actions/file_finder.py | def GetExpandedPaths(
args):
"""Expands given path patterns.
Args:
args: A `FileFinderArgs` instance that dictates the behaviour of the path
expansion.
Yields:
Absolute paths (as string objects) derived from input patterns.
Raises:
ValueError: For unsupported path types.
"""
if args... | def GetExpandedPaths(
args):
"""Expands given path patterns.
Args:
args: A `FileFinderArgs` instance that dictates the behaviour of the path
expansion.
Yields:
Absolute paths (as string objects) derived from input patterns.
Raises:
ValueError: For unsupported path types.
"""
if args... | [
"Expands",
"given",
"path",
"patterns",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L140-L166 | [
"def",
"GetExpandedPaths",
"(",
"args",
")",
":",
"if",
"args",
".",
"pathtype",
"==",
"rdf_paths",
".",
"PathSpec",
".",
"PathType",
".",
"OS",
":",
"pathtype",
"=",
"rdf_paths",
".",
"PathSpec",
".",
"PathType",
".",
"OS",
"else",
":",
"raise",
"ValueE... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | _GetMountpoints | Fetches a list of mountpoints.
Args:
only_physical: Determines whether only mountpoints for physical devices
(e.g. hard disks) should be listed. If false, mountpoints for things such
as memory partitions or `/dev/shm` will be returned as well.
Returns:
A set of mountpoints. | grr/client/grr_response_client/client_actions/file_finder.py | def _GetMountpoints(only_physical=True):
"""Fetches a list of mountpoints.
Args:
only_physical: Determines whether only mountpoints for physical devices
(e.g. hard disks) should be listed. If false, mountpoints for things such
as memory partitions or `/dev/shm` will be returned as well.
Returns:... | def _GetMountpoints(only_physical=True):
"""Fetches a list of mountpoints.
Args:
only_physical: Determines whether only mountpoints for physical devices
(e.g. hard disks) should be listed. If false, mountpoints for things such
as memory partitions or `/dev/shm` will be returned as well.
Returns:... | [
"Fetches",
"a",
"list",
"of",
"mountpoints",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L169-L181 | [
"def",
"_GetMountpoints",
"(",
"only_physical",
"=",
"True",
")",
":",
"partitions",
"=",
"psutil",
".",
"disk_partitions",
"(",
"all",
"=",
"not",
"only_physical",
")",
"return",
"set",
"(",
"partition",
".",
"mountpoint",
"for",
"partition",
"in",
"partition... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | _GetMountpointBlacklist | Builds a list of mountpoints to ignore during recursive searches.
Args:
xdev: A `XDev` value that determines policy for crossing device boundaries.
Returns:
A set of mountpoints to ignore.
Raises:
ValueError: If `xdev` value is invalid. | grr/client/grr_response_client/client_actions/file_finder.py | def _GetMountpointBlacklist(xdev):
"""Builds a list of mountpoints to ignore during recursive searches.
Args:
xdev: A `XDev` value that determines policy for crossing device boundaries.
Returns:
A set of mountpoints to ignore.
Raises:
ValueError: If `xdev` value is invalid.
"""
if xdev == rdf... | def _GetMountpointBlacklist(xdev):
"""Builds a list of mountpoints to ignore during recursive searches.
Args:
xdev: A `XDev` value that determines policy for crossing device boundaries.
Returns:
A set of mountpoints to ignore.
Raises:
ValueError: If `xdev` value is invalid.
"""
if xdev == rdf... | [
"Builds",
"a",
"list",
"of",
"mountpoints",
"to",
"ignore",
"during",
"recursive",
"searches",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L184-L209 | [
"def",
"_GetMountpointBlacklist",
"(",
"xdev",
")",
":",
"if",
"xdev",
"==",
"rdf_file_finder",
".",
"FileFinderArgs",
".",
"XDev",
".",
"NEVER",
":",
"# Never cross device boundaries, stop at all mount points.",
"return",
"_GetMountpoints",
"(",
"only_physical",
"=",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.WriteHuntObject | Writes a hunt object to the database. | grr/server/grr_response_server/databases/mem_hunts.py | def WriteHuntObject(self, hunt_obj):
"""Writes a hunt object to the database."""
if hunt_obj.hunt_id in self.hunts:
raise db.DuplicatedHuntError(hunt_id=hunt_obj.hunt_id)
clone = self._DeepCopy(hunt_obj)
clone.create_time = rdfvalue.RDFDatetime.Now()
clone.last_update_time = rdfvalue.RDFDatet... | def WriteHuntObject(self, hunt_obj):
"""Writes a hunt object to the database."""
if hunt_obj.hunt_id in self.hunts:
raise db.DuplicatedHuntError(hunt_id=hunt_obj.hunt_id)
clone = self._DeepCopy(hunt_obj)
clone.create_time = rdfvalue.RDFDatetime.Now()
clone.last_update_time = rdfvalue.RDFDatet... | [
"Writes",
"a",
"hunt",
"object",
"to",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L30-L38 | [
"def",
"WriteHuntObject",
"(",
"self",
",",
"hunt_obj",
")",
":",
"if",
"hunt_obj",
".",
"hunt_id",
"in",
"self",
".",
"hunts",
":",
"raise",
"db",
".",
"DuplicatedHuntError",
"(",
"hunt_id",
"=",
"hunt_obj",
".",
"hunt_id",
")",
"clone",
"=",
"self",
".... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.UpdateHuntObject | Updates the hunt object by applying the update function. | grr/server/grr_response_server/databases/mem_hunts.py | def UpdateHuntObject(self, hunt_id, start_time=None, **kwargs):
"""Updates the hunt object by applying the update function."""
hunt_obj = self.ReadHuntObject(hunt_id)
delta_suffix = "_delta"
for k, v in kwargs.items():
if v is None:
continue
if k.endswith(delta_suffix):
ke... | def UpdateHuntObject(self, hunt_id, start_time=None, **kwargs):
"""Updates the hunt object by applying the update function."""
hunt_obj = self.ReadHuntObject(hunt_id)
delta_suffix = "_delta"
for k, v in kwargs.items():
if v is None:
continue
if k.endswith(delta_suffix):
ke... | [
"Updates",
"the",
"hunt",
"object",
"by",
"applying",
"the",
"update",
"function",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L41-L63 | [
"def",
"UpdateHuntObject",
"(",
"self",
",",
"hunt_id",
",",
"start_time",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"hunt_obj",
"=",
"self",
".",
"ReadHuntObject",
"(",
"hunt_id",
")",
"delta_suffix",
"=",
"\"_delta\"",
"for",
"k",
",",
"v",
"in",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.UpdateHuntOutputPluginState | Updates hunt output plugin state for a given output plugin. | grr/server/grr_response_server/databases/mem_hunts.py | def UpdateHuntOutputPluginState(self, hunt_id, state_index, update_fn):
"""Updates hunt output plugin state for a given output plugin."""
if hunt_id not in self.hunts:
raise db.UnknownHuntError(hunt_id)
try:
state = rdf_flow_runner.OutputPluginState.FromSerializedString(
self.hunt_ou... | def UpdateHuntOutputPluginState(self, hunt_id, state_index, update_fn):
"""Updates hunt output plugin state for a given output plugin."""
if hunt_id not in self.hunts:
raise db.UnknownHuntError(hunt_id)
try:
state = rdf_flow_runner.OutputPluginState.FromSerializedString(
self.hunt_ou... | [
"Updates",
"hunt",
"output",
"plugin",
"state",
"for",
"a",
"given",
"output",
"plugin",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L87-L104 | [
"def",
"UpdateHuntOutputPluginState",
"(",
"self",
",",
"hunt_id",
",",
"state_index",
",",
"update_fn",
")",
":",
"if",
"hunt_id",
"not",
"in",
"self",
".",
"hunts",
":",
"raise",
"db",
".",
"UnknownHuntError",
"(",
"hunt_id",
")",
"try",
":",
"state",
"=... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntObject | Reads a hunt object from the database. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntObject(self, hunt_id):
"""Reads a hunt object from the database."""
try:
return self._DeepCopy(self.hunts[hunt_id])
except KeyError:
raise db.UnknownHuntError(hunt_id) | def ReadHuntObject(self, hunt_id):
"""Reads a hunt object from the database."""
try:
return self._DeepCopy(self.hunts[hunt_id])
except KeyError:
raise db.UnknownHuntError(hunt_id) | [
"Reads",
"a",
"hunt",
"object",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L114-L119 | [
"def",
"ReadHuntObject",
"(",
"self",
",",
"hunt_id",
")",
":",
"try",
":",
"return",
"self",
".",
"_DeepCopy",
"(",
"self",
".",
"hunts",
"[",
"hunt_id",
"]",
")",
"except",
"KeyError",
":",
"raise",
"db",
".",
"UnknownHuntError",
"(",
"hunt_id",
")"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntObjects | Reads all hunt objects from the database. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntObjects(self,
offset,
count,
with_creator=None,
created_after=None,
with_description_match=None):
"""Reads all hunt objects from the database."""
filter_fns = []
if with_creator is not N... | def ReadHuntObjects(self,
offset,
count,
with_creator=None,
created_after=None,
with_description_match=None):
"""Reads all hunt objects from the database."""
filter_fns = []
if with_creator is not N... | [
"Reads",
"all",
"hunt",
"objects",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L122-L141 | [
"def",
"ReadHuntObjects",
"(",
"self",
",",
"offset",
",",
"count",
",",
"with_creator",
"=",
"None",
",",
"created_after",
"=",
"None",
",",
"with_description_match",
"=",
"None",
")",
":",
"filter_fns",
"=",
"[",
"]",
"if",
"with_creator",
"is",
"not",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntLogEntries | Reads hunt log entries of a given hunt using given query options. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntLogEntries(self, hunt_id, offset, count, with_substring=None):
"""Reads hunt log entries of a given hunt using given query options."""
all_entries = []
for flow_obj in self._GetHuntFlows(hunt_id):
for entry in self.ReadFlowLogEntries(
flow_obj.client_id,
flow_obj.flow_i... | def ReadHuntLogEntries(self, hunt_id, offset, count, with_substring=None):
"""Reads hunt log entries of a given hunt using given query options."""
all_entries = []
for flow_obj in self._GetHuntFlows(hunt_id):
for entry in self.ReadFlowLogEntries(
flow_obj.client_id,
flow_obj.flow_i... | [
"Reads",
"hunt",
"log",
"entries",
"of",
"a",
"given",
"hunt",
"using",
"given",
"query",
"options",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L144-L163 | [
"def",
"ReadHuntLogEntries",
"(",
"self",
",",
"hunt_id",
",",
"offset",
",",
"count",
",",
"with_substring",
"=",
"None",
")",
":",
"all_entries",
"=",
"[",
"]",
"for",
"flow_obj",
"in",
"self",
".",
"_GetHuntFlows",
"(",
"hunt_id",
")",
":",
"for",
"en... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntResults | Reads hunt results of a given hunt using given query options. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntResults(self,
hunt_id,
offset,
count,
with_tag=None,
with_type=None,
with_substring=None,
with_timestamp=None):
"""Reads hunt results of a given hunt ... | def ReadHuntResults(self,
hunt_id,
offset,
count,
with_tag=None,
with_type=None,
with_substring=None,
with_timestamp=None):
"""Reads hunt results of a given hunt ... | [
"Reads",
"hunt",
"results",
"of",
"a",
"given",
"hunt",
"using",
"given",
"query",
"options",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L171-L202 | [
"def",
"ReadHuntResults",
"(",
"self",
",",
"hunt_id",
",",
"offset",
",",
"count",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
",",
"with_substring",
"=",
"None",
",",
"with_timestamp",
"=",
"None",
")",
":",
"all_results",
"=",
"[",
"]... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.CountHuntResults | Counts hunt results of a given hunt using given query options. | grr/server/grr_response_server/databases/mem_hunts.py | def CountHuntResults(self, hunt_id, with_tag=None, with_type=None):
"""Counts hunt results of a given hunt using given query options."""
return len(
self.ReadHuntResults(
hunt_id, 0, sys.maxsize, with_tag=with_tag, with_type=with_type)) | def CountHuntResults(self, hunt_id, with_tag=None, with_type=None):
"""Counts hunt results of a given hunt using given query options."""
return len(
self.ReadHuntResults(
hunt_id, 0, sys.maxsize, with_tag=with_tag, with_type=with_type)) | [
"Counts",
"hunt",
"results",
"of",
"a",
"given",
"hunt",
"using",
"given",
"query",
"options",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L205-L209 | [
"def",
"CountHuntResults",
"(",
"self",
",",
"hunt_id",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadHuntResults",
"(",
"hunt_id",
",",
"0",
",",
"sys",
".",
"maxsize",
",",
"with_tag",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntFlows | Reads hunt flows matching given conditins. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntFlows(self,
hunt_id,
offset,
count,
filter_condition=db.HuntFlowsCondition.UNSET):
"""Reads hunt flows matching given conditins."""
if filter_condition == db.HuntFlowsCondition.UNSET:
filter_fn = lambda _: True
... | def ReadHuntFlows(self,
hunt_id,
offset,
count,
filter_condition=db.HuntFlowsCondition.UNSET):
"""Reads hunt flows matching given conditins."""
if filter_condition == db.HuntFlowsCondition.UNSET:
filter_fn = lambda _: True
... | [
"Reads",
"hunt",
"flows",
"matching",
"given",
"conditins",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L221-L248 | [
"def",
"ReadHuntFlows",
"(",
"self",
",",
"hunt_id",
",",
"offset",
",",
"count",
",",
"filter_condition",
"=",
"db",
".",
"HuntFlowsCondition",
".",
"UNSET",
")",
":",
"if",
"filter_condition",
"==",
"db",
".",
"HuntFlowsCondition",
".",
"UNSET",
":",
"filt... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.CountHuntFlows | Counts hunt flows matching given conditions. | grr/server/grr_response_server/databases/mem_hunts.py | def CountHuntFlows(self,
hunt_id,
filter_condition=db.HuntFlowsCondition.UNSET):
"""Counts hunt flows matching given conditions."""
return len(
self.ReadHuntFlows(
hunt_id, 0, sys.maxsize, filter_condition=filter_condition)) | def CountHuntFlows(self,
hunt_id,
filter_condition=db.HuntFlowsCondition.UNSET):
"""Counts hunt flows matching given conditions."""
return len(
self.ReadHuntFlows(
hunt_id, 0, sys.maxsize, filter_condition=filter_condition)) | [
"Counts",
"hunt",
"flows",
"matching",
"given",
"conditions",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L251-L258 | [
"def",
"CountHuntFlows",
"(",
"self",
",",
"hunt_id",
",",
"filter_condition",
"=",
"db",
".",
"HuntFlowsCondition",
".",
"UNSET",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadHuntFlows",
"(",
"hunt_id",
",",
"0",
",",
"sys",
".",
"maxsize",
",",
"f... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntCounters | Reads hunt counters. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntCounters(self, hunt_id):
"""Reads hunt counters."""
num_clients = self.CountHuntFlows(hunt_id)
num_successful_clients = self.CountHuntFlows(
hunt_id, filter_condition=db.HuntFlowsCondition.SUCCEEDED_FLOWS_ONLY)
num_failed_clients = self.CountHuntFlows(
hunt_id, filter_conditi... | def ReadHuntCounters(self, hunt_id):
"""Reads hunt counters."""
num_clients = self.CountHuntFlows(hunt_id)
num_successful_clients = self.CountHuntFlows(
hunt_id, filter_condition=db.HuntFlowsCondition.SUCCEEDED_FLOWS_ONLY)
num_failed_clients = self.CountHuntFlows(
hunt_id, filter_conditi... | [
"Reads",
"hunt",
"counters",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L261-L291 | [
"def",
"ReadHuntCounters",
"(",
"self",
",",
"hunt_id",
")",
":",
"num_clients",
"=",
"self",
".",
"CountHuntFlows",
"(",
"hunt_id",
")",
"num_successful_clients",
"=",
"self",
".",
"CountHuntFlows",
"(",
"hunt_id",
",",
"filter_condition",
"=",
"db",
".",
"Hu... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntClientResourcesStats | Read/calculate hunt client resources stats. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntClientResourcesStats(self, hunt_id):
"""Read/calculate hunt client resources stats."""
result = rdf_stats.ClientResourcesStats()
for f in self._GetHuntFlows(hunt_id):
cr = rdf_client_stats.ClientResources(
session_id="%s/%s" % (f.client_id, f.flow_id),
client_id=f.clie... | def ReadHuntClientResourcesStats(self, hunt_id):
"""Read/calculate hunt client resources stats."""
result = rdf_stats.ClientResourcesStats()
for f in self._GetHuntFlows(hunt_id):
cr = rdf_client_stats.ClientResources(
session_id="%s/%s" % (f.client_id, f.flow_id),
client_id=f.clie... | [
"Read",
"/",
"calculate",
"hunt",
"client",
"resources",
"stats",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L294-L309 | [
"def",
"ReadHuntClientResourcesStats",
"(",
"self",
",",
"hunt_id",
")",
":",
"result",
"=",
"rdf_stats",
".",
"ClientResourcesStats",
"(",
")",
"for",
"f",
"in",
"self",
".",
"_GetHuntFlows",
"(",
"hunt_id",
")",
":",
"cr",
"=",
"rdf_client_stats",
".",
"Cl... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntFlowsStatesAndTimestamps | Reads hunt flows states and timestamps. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntFlowsStatesAndTimestamps(self, hunt_id):
"""Reads hunt flows states and timestamps."""
result = []
for f in self._GetHuntFlows(hunt_id):
result.append(
db.FlowStateAndTimestamps(
flow_state=f.flow_state,
create_time=f.create_time,
last_u... | def ReadHuntFlowsStatesAndTimestamps(self, hunt_id):
"""Reads hunt flows states and timestamps."""
result = []
for f in self._GetHuntFlows(hunt_id):
result.append(
db.FlowStateAndTimestamps(
flow_state=f.flow_state,
create_time=f.create_time,
last_u... | [
"Reads",
"hunt",
"flows",
"states",
"and",
"timestamps",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L312-L323 | [
"def",
"ReadHuntFlowsStatesAndTimestamps",
"(",
"self",
",",
"hunt_id",
")",
":",
"result",
"=",
"[",
"]",
"for",
"f",
"in",
"self",
".",
"_GetHuntFlows",
"(",
"hunt_id",
")",
":",
"result",
".",
"append",
"(",
"db",
".",
"FlowStateAndTimestamps",
"(",
"fl... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.ReadHuntOutputPluginLogEntries | Reads hunt output plugin log entries. | grr/server/grr_response_server/databases/mem_hunts.py | def ReadHuntOutputPluginLogEntries(self,
hunt_id,
output_plugin_id,
offset,
count,
with_type=None):
"""Reads hunt output plugin log... | def ReadHuntOutputPluginLogEntries(self,
hunt_id,
output_plugin_id,
offset,
count,
with_type=None):
"""Reads hunt output plugin log... | [
"Reads",
"hunt",
"output",
"plugin",
"log",
"entries",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L326-L353 | [
"def",
"ReadHuntOutputPluginLogEntries",
"(",
"self",
",",
"hunt_id",
",",
"output_plugin_id",
",",
"offset",
",",
"count",
",",
"with_type",
"=",
"None",
")",
":",
"all_entries",
"=",
"[",
"]",
"for",
"flow_obj",
"in",
"self",
".",
"_GetHuntFlows",
"(",
"hu... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBHuntMixin.CountHuntOutputPluginLogEntries | Counts hunt output plugin log entries. | grr/server/grr_response_server/databases/mem_hunts.py | def CountHuntOutputPluginLogEntries(self,
hunt_id,
output_plugin_id,
with_type=None):
"""Counts hunt output plugin log entries."""
return len(
self.ReadHuntOutputPluginLogEntries(
... | def CountHuntOutputPluginLogEntries(self,
hunt_id,
output_plugin_id,
with_type=None):
"""Counts hunt output plugin log entries."""
return len(
self.ReadHuntOutputPluginLogEntries(
... | [
"Counts",
"hunt",
"output",
"plugin",
"log",
"entries",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L356-L364 | [
"def",
"CountHuntOutputPluginLogEntries",
"(",
"self",
",",
"hunt_id",
",",
"output_plugin_id",
",",
"with_type",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadHuntOutputPluginLogEntries",
"(",
"hunt_id",
",",
"output_plugin_id",
",",
"0",
",",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | MySQLDBForemanRulesMixin.WriteForemanRule | Writes a foreman rule to the database. | grr/server/grr_response_server/databases/mysql_foreman_rules.py | def WriteForemanRule(self, rule, cursor=None):
"""Writes a foreman rule to the database."""
query = ("INSERT INTO foreman_rules "
" (hunt_id, expiration_time, rule) "
"VALUES (%s, FROM_UNIXTIME(%s), %s) "
"ON DUPLICATE KEY UPDATE "
" expiration_time=FROM_UNI... | def WriteForemanRule(self, rule, cursor=None):
"""Writes a foreman rule to the database."""
query = ("INSERT INTO foreman_rules "
" (hunt_id, expiration_time, rule) "
"VALUES (%s, FROM_UNIXTIME(%s), %s) "
"ON DUPLICATE KEY UPDATE "
" expiration_time=FROM_UNI... | [
"Writes",
"a",
"foreman",
"rule",
"to",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_foreman_rules.py#L16-L26 | [
"def",
"WriteForemanRule",
"(",
"self",
",",
"rule",
",",
"cursor",
"=",
"None",
")",
":",
"query",
"=",
"(",
"\"INSERT INTO foreman_rules \"",
"\" (hunt_id, expiration_time, rule) \"",
"\"VALUES (%s, FROM_UNIXTIME(%s), %s) \"",
"\"ON DUPLICATE KEY UPDATE \"",
"\" expiration_... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | main | Run the main test harness. | grr/server/grr_response_server/gui/admin_ui.py | def main(_):
"""Run the main test harness."""
if flags.FLAGS.version:
print("GRR Admin UI {}".format(config_server.VERSION["packageversion"]))
return
config.CONFIG.AddContext(
contexts.ADMIN_UI_CONTEXT,
"Context applied when running the admin user interface GUI.")
server_startup.Init()
... | def main(_):
"""Run the main test harness."""
if flags.FLAGS.version:
print("GRR Admin UI {}".format(config_server.VERSION["packageversion"]))
return
config.CONFIG.AddContext(
contexts.ADMIN_UI_CONTEXT,
"Context applied when running the admin user interface GUI.")
server_startup.Init()
... | [
"Run",
"the",
"main",
"test",
"harness",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/admin_ui.py#L44-L111 | [
"def",
"main",
"(",
"_",
")",
":",
"if",
"flags",
".",
"FLAGS",
".",
"version",
":",
"print",
"(",
"\"GRR Admin UI {}\"",
".",
"format",
"(",
"config_server",
".",
"VERSION",
"[",
"\"packageversion\"",
"]",
")",
")",
"return",
"config",
".",
"CONFIG",
".... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | WriteAllCrashDetails | Updates the last crash attribute of the client. | grr/server/grr_response_server/flows/general/administrative.py | def WriteAllCrashDetails(client_id,
crash_details,
flow_session_id=None,
hunt_session_id=None,
token=None):
"""Updates the last crash attribute of the client."""
# AFF4.
if data_store.AFF4Enabled():
with aff4.F... | def WriteAllCrashDetails(client_id,
crash_details,
flow_session_id=None,
hunt_session_id=None,
token=None):
"""Updates the last crash attribute of the client."""
# AFF4.
if data_store.AFF4Enabled():
with aff4.F... | [
"Updates",
"the",
"last",
"crash",
"attribute",
"of",
"the",
"client",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L56-L114 | [
"def",
"WriteAllCrashDetails",
"(",
"client_id",
",",
"crash_details",
",",
"flow_session_id",
"=",
"None",
",",
"hunt_session_id",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"# AFF4.",
"if",
"data_store",
".",
"AFF4Enabled",
"(",
")",
":",
"with",
"a... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ClientCrashHandler.ProcessMessages | Processes this event. | grr/server/grr_response_server/flows/general/administrative.py | def ProcessMessages(self, msgs=None, token=None):
"""Processes this event."""
nanny_msg = ""
for crash_details in msgs:
client_urn = crash_details.client_id
client_id = client_urn.Basename()
# The session id of the flow that crashed.
session_id = crash_details.session_id
# L... | def ProcessMessages(self, msgs=None, token=None):
"""Processes this event."""
nanny_msg = ""
for crash_details in msgs:
client_urn = crash_details.client_id
client_id = client_urn.Basename()
# The session id of the flow that crashed.
session_id = crash_details.session_id
# L... | [
"Processes",
"this",
"event",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L137-L232 | [
"def",
"ProcessMessages",
"(",
"self",
",",
"msgs",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"nanny_msg",
"=",
"\"\"",
"for",
"crash_details",
"in",
"msgs",
":",
"client_urn",
"=",
"crash_details",
".",
"client_id",
"client_id",
"=",
"client_urn",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | GetClientStatsProcessResponseMixin.ProcessResponse | Actually processes the contents of the response. | grr/server/grr_response_server/flows/general/administrative.py | def ProcessResponse(self, client_id, response):
"""Actually processes the contents of the response."""
precondition.AssertType(client_id, Text)
downsampled = rdf_client_stats.ClientStats.Downsampled(response)
if data_store.AFF4Enabled():
urn = rdf_client.ClientURN(client_id).Add("stats")
w... | def ProcessResponse(self, client_id, response):
"""Actually processes the contents of the response."""
precondition.AssertType(client_id, Text)
downsampled = rdf_client_stats.ClientStats.Downsampled(response)
if data_store.AFF4Enabled():
urn = rdf_client.ClientURN(client_id).Add("stats")
w... | [
"Actually",
"processes",
"the",
"contents",
"of",
"the",
"response",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L238-L254 | [
"def",
"ProcessResponse",
"(",
"self",
",",
"client_id",
",",
"response",
")",
":",
"precondition",
".",
"AssertType",
"(",
"client_id",
",",
"Text",
")",
"downsampled",
"=",
"rdf_client_stats",
".",
"ClientStats",
".",
"Downsampled",
"(",
"response",
")",
"if... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | GetClientStatsAuto.ProcessMessage | Processes a stats response from the client. | grr/server/grr_response_server/flows/general/administrative.py | def ProcessMessage(self, message):
"""Processes a stats response from the client."""
self.ProcessResponse(message.source.Basename(), message.payload) | def ProcessMessage(self, message):
"""Processes a stats response from the client."""
self.ProcessResponse(message.source.Basename(), message.payload) | [
"Processes",
"a",
"stats",
"response",
"from",
"the",
"client",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L287-L289 | [
"def",
"ProcessMessage",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"ProcessResponse",
"(",
"message",
".",
"source",
".",
"Basename",
"(",
")",
",",
"message",
".",
"payload",
")"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | Foreman.ProcessMessage | Run the foreman on the client. | grr/server/grr_response_server/flows/general/administrative.py | def ProcessMessage(self, message):
"""Run the foreman on the client."""
# Only accept authenticated messages
if (message.auth_state !=
rdf_flows.GrrMessage.AuthorizationState.AUTHENTICATED):
return
now = time.time()
# Maintain a cache of the foreman
with self.lock:
if (self... | def ProcessMessage(self, message):
"""Run the foreman on the client."""
# Only accept authenticated messages
if (message.auth_state !=
rdf_flows.GrrMessage.AuthorizationState.AUTHENTICATED):
return
now = time.time()
# Maintain a cache of the foreman
with self.lock:
if (self... | [
"Run",
"the",
"foreman",
"on",
"the",
"client",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L530-L548 | [
"def",
"ProcessMessage",
"(",
"self",
",",
"message",
")",
":",
"# Only accept authenticated messages",
"if",
"(",
"message",
".",
"auth_state",
"!=",
"rdf_flows",
".",
"GrrMessage",
".",
"AuthorizationState",
".",
"AUTHENTICATED",
")",
":",
"return",
"now",
"=",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | NannyMessageHandlerMixin.SendEmail | Processes this event. | grr/server/grr_response_server/flows/general/administrative.py | def SendEmail(self, client_id, message):
"""Processes this event."""
logging.info(self.logline, client_id, message)
client_info = None
hostname = None
# Write crash data.
if data_store.RelationalDBEnabled():
client = data_store.REL_DB.ReadClientSnapshot(client_id)
if client is not ... | def SendEmail(self, client_id, message):
"""Processes this event."""
logging.info(self.logline, client_id, message)
client_info = None
hostname = None
# Write crash data.
if data_store.RelationalDBEnabled():
client = data_store.REL_DB.ReadClientSnapshot(client_id)
if client is not ... | [
"Processes",
"this",
"event",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L795-L837 | [
"def",
"SendEmail",
"(",
"self",
",",
"client_id",
",",
"message",
")",
":",
"logging",
".",
"info",
"(",
"self",
".",
"logline",
",",
"client_id",
",",
"message",
")",
"client_info",
"=",
"None",
"hostname",
"=",
"None",
"# Write crash data.",
"if",
"data... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ClientStartupHandlerMixin.WriteClientStartupInfo | Handle a startup event. | grr/server/grr_response_server/flows/general/administrative.py | def WriteClientStartupInfo(self, client_id, new_si):
"""Handle a startup event."""
drift = rdfvalue.Duration("5m")
if data_store.RelationalDBEnabled():
current_si = data_store.REL_DB.ReadClientStartupInfo(client_id)
# We write the updated record if the client_info has any changes
# or th... | def WriteClientStartupInfo(self, client_id, new_si):
"""Handle a startup event."""
drift = rdfvalue.Duration("5m")
if data_store.RelationalDBEnabled():
current_si = data_store.REL_DB.ReadClientStartupInfo(client_id)
# We write the updated record if the client_info has any changes
# or th... | [
"Handle",
"a",
"startup",
"event",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/administrative.py#L903-L947 | [
"def",
"WriteClientStartupInfo",
"(",
"self",
",",
"client_id",
",",
"new_si",
")",
":",
"drift",
"=",
"rdfvalue",
".",
"Duration",
"(",
"\"5m\"",
")",
"if",
"data_store",
".",
"RelationalDBEnabled",
"(",
")",
":",
"current_si",
"=",
"data_store",
".",
"REL_... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WriteMessageHandlerRequests | Writes a list of message handler requests to the database. | grr/server/grr_response_server/databases/mem_flows.py | def WriteMessageHandlerRequests(self, requests):
"""Writes a list of message handler requests to the database."""
now = rdfvalue.RDFDatetime.Now()
for r in requests:
flow_dict = self.message_handler_requests.setdefault(r.handler_name, {})
cloned_request = r.Copy()
cloned_request.timestamp ... | def WriteMessageHandlerRequests(self, requests):
"""Writes a list of message handler requests to the database."""
now = rdfvalue.RDFDatetime.Now()
for r in requests:
flow_dict = self.message_handler_requests.setdefault(r.handler_name, {})
cloned_request = r.Copy()
cloned_request.timestamp ... | [
"Writes",
"a",
"list",
"of",
"message",
"handler",
"requests",
"to",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L40-L47 | [
"def",
"WriteMessageHandlerRequests",
"(",
"self",
",",
"requests",
")",
":",
"now",
"=",
"rdfvalue",
".",
"RDFDatetime",
".",
"Now",
"(",
")",
"for",
"r",
"in",
"requests",
":",
"flow_dict",
"=",
"self",
".",
"message_handler_requests",
".",
"setdefault",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadMessageHandlerRequests | Reads all message handler requests from the database. | grr/server/grr_response_server/databases/mem_flows.py | def ReadMessageHandlerRequests(self):
"""Reads all message handler requests from the database."""
res = []
leases = self.message_handler_leases
for requests in itervalues(self.message_handler_requests):
for r in itervalues(requests):
res.append(r.Copy())
existing_lease = leases.get... | def ReadMessageHandlerRequests(self):
"""Reads all message handler requests from the database."""
res = []
leases = self.message_handler_leases
for requests in itervalues(self.message_handler_requests):
for r in itervalues(requests):
res.append(r.Copy())
existing_lease = leases.get... | [
"Reads",
"all",
"message",
"handler",
"requests",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L50-L60 | [
"def",
"ReadMessageHandlerRequests",
"(",
"self",
")",
":",
"res",
"=",
"[",
"]",
"leases",
"=",
"self",
".",
"message_handler_leases",
"for",
"requests",
"in",
"itervalues",
"(",
"self",
".",
"message_handler_requests",
")",
":",
"for",
"r",
"in",
"itervalues... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.DeleteMessageHandlerRequests | Deletes a list of message handler requests from the database. | grr/server/grr_response_server/databases/mem_flows.py | def DeleteMessageHandlerRequests(self, requests):
"""Deletes a list of message handler requests from the database."""
for r in requests:
flow_dict = self.message_handler_requests.get(r.handler_name, {})
if r.request_id in flow_dict:
del flow_dict[r.request_id]
flow_dict = self.message... | def DeleteMessageHandlerRequests(self, requests):
"""Deletes a list of message handler requests from the database."""
for r in requests:
flow_dict = self.message_handler_requests.get(r.handler_name, {})
if r.request_id in flow_dict:
del flow_dict[r.request_id]
flow_dict = self.message... | [
"Deletes",
"a",
"list",
"of",
"message",
"handler",
"requests",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L63-L72 | [
"def",
"DeleteMessageHandlerRequests",
"(",
"self",
",",
"requests",
")",
":",
"for",
"r",
"in",
"requests",
":",
"flow_dict",
"=",
"self",
".",
"message_handler_requests",
".",
"get",
"(",
"r",
".",
"handler_name",
",",
"{",
"}",
")",
"if",
"r",
".",
"r... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.RegisterMessageHandler | Leases a number of message handler requests up to the indicated limit. | grr/server/grr_response_server/databases/mem_flows.py | def RegisterMessageHandler(self, handler, lease_time, limit=1000):
"""Leases a number of message handler requests up to the indicated limit."""
self.UnregisterMessageHandler()
self.handler_stop = False
self.handler_thread = threading.Thread(
name="message_handler",
target=self._MessageH... | def RegisterMessageHandler(self, handler, lease_time, limit=1000):
"""Leases a number of message handler requests up to the indicated limit."""
self.UnregisterMessageHandler()
self.handler_stop = False
self.handler_thread = threading.Thread(
name="message_handler",
target=self._MessageH... | [
"Leases",
"a",
"number",
"of",
"message",
"handler",
"requests",
"up",
"to",
"the",
"indicated",
"limit",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L74-L84 | [
"def",
"RegisterMessageHandler",
"(",
"self",
",",
"handler",
",",
"lease_time",
",",
"limit",
"=",
"1000",
")",
":",
"self",
".",
"UnregisterMessageHandler",
"(",
")",
"self",
".",
"handler_stop",
"=",
"False",
"self",
".",
"handler_thread",
"=",
"threading",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.UnregisterMessageHandler | Unregisters any registered message handler. | grr/server/grr_response_server/databases/mem_flows.py | def UnregisterMessageHandler(self, timeout=None):
"""Unregisters any registered message handler."""
if self.handler_thread:
self.handler_stop = True
self.handler_thread.join(timeout)
if self.handler_thread.isAlive():
raise RuntimeError("Message handler thread did not join in time.")
... | def UnregisterMessageHandler(self, timeout=None):
"""Unregisters any registered message handler."""
if self.handler_thread:
self.handler_stop = True
self.handler_thread.join(timeout)
if self.handler_thread.isAlive():
raise RuntimeError("Message handler thread did not join in time.")
... | [
"Unregisters",
"any",
"registered",
"message",
"handler",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L86-L93 | [
"def",
"UnregisterMessageHandler",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"self",
".",
"handler_thread",
":",
"self",
".",
"handler_stop",
"=",
"True",
"self",
".",
"handler_thread",
".",
"join",
"(",
"timeout",
")",
"if",
"self",
".",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin._LeaseMessageHandlerRequests | Read and lease some outstanding message handler requests. | grr/server/grr_response_server/databases/mem_flows.py | def _LeaseMessageHandlerRequests(self, lease_time, limit):
"""Read and lease some outstanding message handler requests."""
leased_requests = []
now = rdfvalue.RDFDatetime.Now()
zero = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(0)
expiration_time = now + lease_time
leases = self.message_handler... | def _LeaseMessageHandlerRequests(self, lease_time, limit):
"""Read and lease some outstanding message handler requests."""
leased_requests = []
now = rdfvalue.RDFDatetime.Now()
zero = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(0)
expiration_time = now + lease_time
leases = self.message_handler... | [
"Read",
"and",
"lease",
"some",
"outstanding",
"message",
"handler",
"requests",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L107-L127 | [
"def",
"_LeaseMessageHandlerRequests",
"(",
"self",
",",
"lease_time",
",",
"limit",
")",
":",
"leased_requests",
"=",
"[",
"]",
"now",
"=",
"rdfvalue",
".",
"RDFDatetime",
".",
"Now",
"(",
")",
"zero",
"=",
"rdfvalue",
".",
"RDFDatetime",
".",
"FromSecondsS... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadAllClientActionRequests | Reads all client action requests available for a given client_id. | grr/server/grr_response_server/databases/mem_flows.py | def ReadAllClientActionRequests(self, client_id):
"""Reads all client action requests available for a given client_id."""
res = []
for key, orig_request in iteritems(self.client_action_requests):
request_client_id, _, _ = key
if request_client_id != client_id:
continue
request = o... | def ReadAllClientActionRequests(self, client_id):
"""Reads all client action requests available for a given client_id."""
res = []
for key, orig_request in iteritems(self.client_action_requests):
request_client_id, _, _ = key
if request_client_id != client_id:
continue
request = o... | [
"Reads",
"all",
"client",
"action",
"requests",
"available",
"for",
"a",
"given",
"client_id",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L130-L149 | [
"def",
"ReadAllClientActionRequests",
"(",
"self",
",",
"client_id",
")",
":",
"res",
"=",
"[",
"]",
"for",
"key",
",",
"orig_request",
"in",
"iteritems",
"(",
"self",
".",
"client_action_requests",
")",
":",
"request_client_id",
",",
"_",
",",
"_",
"=",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.LeaseClientActionRequests | Leases available client action requests for a client. | grr/server/grr_response_server/databases/mem_flows.py | def LeaseClientActionRequests(self,
client_id,
lease_time=None,
limit=sys.maxsize):
"""Leases available client action requests for a client."""
leased_requests = []
now = rdfvalue.RDFDatetime.Now()
expirati... | def LeaseClientActionRequests(self,
client_id,
lease_time=None,
limit=sys.maxsize):
"""Leases available client action requests for a client."""
leased_requests = []
now = rdfvalue.RDFDatetime.Now()
expirati... | [
"Leases",
"available",
"client",
"action",
"requests",
"for",
"a",
"client",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L171-L208 | [
"def",
"LeaseClientActionRequests",
"(",
"self",
",",
"client_id",
",",
"lease_time",
"=",
"None",
",",
"limit",
"=",
"sys",
".",
"maxsize",
")",
":",
"leased_requests",
"=",
"[",
"]",
"now",
"=",
"rdfvalue",
".",
"RDFDatetime",
".",
"Now",
"(",
")",
"ex... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WriteClientActionRequests | Writes messages that should go to the client to the db. | grr/server/grr_response_server/databases/mem_flows.py | def WriteClientActionRequests(self, requests):
"""Writes messages that should go to the client to the db."""
for r in requests:
req_dict = self.flow_requests.get((r.client_id, r.flow_id), {})
if r.request_id not in req_dict:
request_keys = [(r.client_id, r.flow_id, r.request_id) for r in req... | def WriteClientActionRequests(self, requests):
"""Writes messages that should go to the client to the db."""
for r in requests:
req_dict = self.flow_requests.get((r.client_id, r.flow_id), {})
if r.request_id not in req_dict:
request_keys = [(r.client_id, r.flow_id, r.request_id) for r in req... | [
"Writes",
"messages",
"that",
"should",
"go",
"to",
"the",
"client",
"to",
"the",
"db",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L211-L222 | [
"def",
"WriteClientActionRequests",
"(",
"self",
",",
"requests",
")",
":",
"for",
"r",
"in",
"requests",
":",
"req_dict",
"=",
"self",
".",
"flow_requests",
".",
"get",
"(",
"(",
"r",
".",
"client_id",
",",
"r",
".",
"flow_id",
")",
",",
"{",
"}",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WriteFlowObject | Writes a flow object to the database. | grr/server/grr_response_server/databases/mem_flows.py | def WriteFlowObject(self, flow_obj):
"""Writes a flow object to the database."""
if flow_obj.client_id not in self.metadatas:
raise db.UnknownClientError(flow_obj.client_id)
clone = flow_obj.Copy()
clone.last_update_time = rdfvalue.RDFDatetime.Now()
self.flows[(flow_obj.client_id, flow_obj.fl... | def WriteFlowObject(self, flow_obj):
"""Writes a flow object to the database."""
if flow_obj.client_id not in self.metadatas:
raise db.UnknownClientError(flow_obj.client_id)
clone = flow_obj.Copy()
clone.last_update_time = rdfvalue.RDFDatetime.Now()
self.flows[(flow_obj.client_id, flow_obj.fl... | [
"Writes",
"a",
"flow",
"object",
"to",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L225-L232 | [
"def",
"WriteFlowObject",
"(",
"self",
",",
"flow_obj",
")",
":",
"if",
"flow_obj",
".",
"client_id",
"not",
"in",
"self",
".",
"metadatas",
":",
"raise",
"db",
".",
"UnknownClientError",
"(",
"flow_obj",
".",
"client_id",
")",
"clone",
"=",
"flow_obj",
".... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadFlowObject | Reads a flow object from the database. | grr/server/grr_response_server/databases/mem_flows.py | def ReadFlowObject(self, client_id, flow_id):
"""Reads a flow object from the database."""
try:
return self.flows[(client_id, flow_id)].Copy()
except KeyError:
raise db.UnknownFlowError(client_id, flow_id) | def ReadFlowObject(self, client_id, flow_id):
"""Reads a flow object from the database."""
try:
return self.flows[(client_id, flow_id)].Copy()
except KeyError:
raise db.UnknownFlowError(client_id, flow_id) | [
"Reads",
"a",
"flow",
"object",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L235-L240 | [
"def",
"ReadFlowObject",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"try",
":",
"return",
"self",
".",
"flows",
"[",
"(",
"client_id",
",",
"flow_id",
")",
"]",
".",
"Copy",
"(",
")",
"except",
"KeyError",
":",
"raise",
"db",
".",
"Unkn... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadAllFlowObjects | Returns all flow objects. | grr/server/grr_response_server/databases/mem_flows.py | def ReadAllFlowObjects(
self,
client_id = None,
min_create_time = None,
max_create_time = None,
include_child_flows = True,
):
"""Returns all flow objects."""
res = []
for flow in itervalues(self.flows):
if ((client_id is None or flow.client_id == client_id) and
... | def ReadAllFlowObjects(
self,
client_id = None,
min_create_time = None,
max_create_time = None,
include_child_flows = True,
):
"""Returns all flow objects."""
res = []
for flow in itervalues(self.flows):
if ((client_id is None or flow.client_id == client_id) and
... | [
"Returns",
"all",
"flow",
"objects",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L242-L257 | [
"def",
"ReadAllFlowObjects",
"(",
"self",
",",
"client_id",
"=",
"None",
",",
"min_create_time",
"=",
"None",
",",
"max_create_time",
"=",
"None",
",",
"include_child_flows",
"=",
"True",
",",
")",
":",
"res",
"=",
"[",
"]",
"for",
"flow",
"in",
"itervalue... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadChildFlowObjects | Reads flows that were started by a given flow from the database. | grr/server/grr_response_server/databases/mem_flows.py | def ReadChildFlowObjects(self, client_id, flow_id):
"""Reads flows that were started by a given flow from the database."""
res = []
for flow in itervalues(self.flows):
if flow.client_id == client_id and flow.parent_flow_id == flow_id:
res.append(flow)
return res | def ReadChildFlowObjects(self, client_id, flow_id):
"""Reads flows that were started by a given flow from the database."""
res = []
for flow in itervalues(self.flows):
if flow.client_id == client_id and flow.parent_flow_id == flow_id:
res.append(flow)
return res | [
"Reads",
"flows",
"that",
"were",
"started",
"by",
"a",
"given",
"flow",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L260-L266 | [
"def",
"ReadChildFlowObjects",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"res",
"=",
"[",
"]",
"for",
"flow",
"in",
"itervalues",
"(",
"self",
".",
"flows",
")",
":",
"if",
"flow",
".",
"client_id",
"==",
"client_id",
"and",
"flow",
".",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.LeaseFlowForProcessing | Marks a flow as being processed on this worker and returns it. | grr/server/grr_response_server/databases/mem_flows.py | def LeaseFlowForProcessing(self, client_id, flow_id, processing_time):
"""Marks a flow as being processed on this worker and returns it."""
rdf_flow = self.ReadFlowObject(client_id, flow_id)
# TODO(user): remove the check for a legacy hunt prefix as soon as
# AFF4 is gone.
if rdf_flow.parent_hunt_id... | def LeaseFlowForProcessing(self, client_id, flow_id, processing_time):
"""Marks a flow as being processed on this worker and returns it."""
rdf_flow = self.ReadFlowObject(client_id, flow_id)
# TODO(user): remove the check for a legacy hunt prefix as soon as
# AFF4 is gone.
if rdf_flow.parent_hunt_id... | [
"Marks",
"a",
"flow",
"as",
"being",
"processed",
"on",
"this",
"worker",
"and",
"returns",
"it",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L269-L297 | [
"def",
"LeaseFlowForProcessing",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"processing_time",
")",
":",
"rdf_flow",
"=",
"self",
".",
"ReadFlowObject",
"(",
"client_id",
",",
"flow_id",
")",
"# TODO(user): remove the check for a legacy hunt prefix as soon as",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.UpdateFlow | Updates flow objects in the database. | grr/server/grr_response_server/databases/mem_flows.py | def UpdateFlow(self,
client_id,
flow_id,
flow_obj=db.Database.unchanged,
flow_state=db.Database.unchanged,
client_crash_info=db.Database.unchanged,
pending_termination=db.Database.unchanged,
processing... | def UpdateFlow(self,
client_id,
flow_id,
flow_obj=db.Database.unchanged,
flow_state=db.Database.unchanged,
client_crash_info=db.Database.unchanged,
pending_termination=db.Database.unchanged,
processing... | [
"Updates",
"flow",
"objects",
"in",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L300-L333 | [
"def",
"UpdateFlow",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"flow_obj",
"=",
"db",
".",
"Database",
".",
"unchanged",
",",
"flow_state",
"=",
"db",
".",
"Database",
".",
"unchanged",
",",
"client_crash_info",
"=",
"db",
".",
"Database",
".",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.UpdateFlows | Updates flow objects in the database. | grr/server/grr_response_server/databases/mem_flows.py | def UpdateFlows(self,
client_id_flow_id_pairs,
pending_termination=db.Database.unchanged):
"""Updates flow objects in the database."""
for client_id, flow_id in client_id_flow_id_pairs:
try:
self.UpdateFlow(
client_id, flow_id, pending_termination=pe... | def UpdateFlows(self,
client_id_flow_id_pairs,
pending_termination=db.Database.unchanged):
"""Updates flow objects in the database."""
for client_id, flow_id in client_id_flow_id_pairs:
try:
self.UpdateFlow(
client_id, flow_id, pending_termination=pe... | [
"Updates",
"flow",
"objects",
"in",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L336-L345 | [
"def",
"UpdateFlows",
"(",
"self",
",",
"client_id_flow_id_pairs",
",",
"pending_termination",
"=",
"db",
".",
"Database",
".",
"unchanged",
")",
":",
"for",
"client_id",
",",
"flow_id",
"in",
"client_id_flow_id_pairs",
":",
"try",
":",
"self",
".",
"UpdateFlow"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WriteFlowRequests | Writes a list of flow requests to the database. | grr/server/grr_response_server/databases/mem_flows.py | def WriteFlowRequests(self, requests):
"""Writes a list of flow requests to the database."""
flow_processing_requests = []
for request in requests:
if (request.client_id, request.flow_id) not in self.flows:
raise db.AtLeastOneUnknownFlowError([(request.client_id,
... | def WriteFlowRequests(self, requests):
"""Writes a list of flow requests to the database."""
flow_processing_requests = []
for request in requests:
if (request.client_id, request.flow_id) not in self.flows:
raise db.AtLeastOneUnknownFlowError([(request.client_id,
... | [
"Writes",
"a",
"list",
"of",
"flow",
"requests",
"to",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L348-L373 | [
"def",
"WriteFlowRequests",
"(",
"self",
",",
"requests",
")",
":",
"flow_processing_requests",
"=",
"[",
"]",
"for",
"request",
"in",
"requests",
":",
"if",
"(",
"request",
".",
"client_id",
",",
"request",
".",
"flow_id",
")",
"not",
"in",
"self",
".",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.DeleteFlowRequests | Deletes a list of flow requests from the database. | grr/server/grr_response_server/databases/mem_flows.py | def DeleteFlowRequests(self, requests):
"""Deletes a list of flow requests from the database."""
for request in requests:
if (request.client_id, request.flow_id) not in self.flows:
raise db.UnknownFlowError(request.client_id, request.flow_id)
for request in requests:
key = (request.clie... | def DeleteFlowRequests(self, requests):
"""Deletes a list of flow requests from the database."""
for request in requests:
if (request.client_id, request.flow_id) not in self.flows:
raise db.UnknownFlowError(request.client_id, request.flow_id)
for request in requests:
key = (request.clie... | [
"Deletes",
"a",
"list",
"of",
"flow",
"requests",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L376-L395 | [
"def",
"DeleteFlowRequests",
"(",
"self",
",",
"requests",
")",
":",
"for",
"request",
"in",
"requests",
":",
"if",
"(",
"request",
".",
"client_id",
",",
"request",
".",
"flow_id",
")",
"not",
"in",
"self",
".",
"flows",
":",
"raise",
"db",
".",
"Unkn... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WriteFlowResponses | Writes FlowMessages and updates corresponding requests. | grr/server/grr_response_server/databases/mem_flows.py | def WriteFlowResponses(self, responses):
"""Writes FlowMessages and updates corresponding requests."""
status_available = set()
requests_updated = set()
task_ids_by_request = {}
for response in responses:
flow_key = (response.client_id, response.flow_id)
if flow_key not in self.flows:
... | def WriteFlowResponses(self, responses):
"""Writes FlowMessages and updates corresponding requests."""
status_available = set()
requests_updated = set()
task_ids_by_request = {}
for response in responses:
flow_key = (response.client_id, response.flow_id)
if flow_key not in self.flows:
... | [
"Writes",
"FlowMessages",
"and",
"updates",
"corresponding",
"requests",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L398-L461 | [
"def",
"WriteFlowResponses",
"(",
"self",
",",
"responses",
")",
":",
"status_available",
"=",
"set",
"(",
")",
"requests_updated",
"=",
"set",
"(",
")",
"task_ids_by_request",
"=",
"{",
"}",
"for",
"response",
"in",
"responses",
":",
"flow_key",
"=",
"(",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadAllFlowRequestsAndResponses | Reads all requests and responses for a given flow from the database. | grr/server/grr_response_server/databases/mem_flows.py | def ReadAllFlowRequestsAndResponses(self, client_id, flow_id):
"""Reads all requests and responses for a given flow from the database."""
flow_key = (client_id, flow_id)
try:
self.flows[flow_key]
except KeyError:
return []
request_dict = self.flow_requests.get(flow_key, {})
response... | def ReadAllFlowRequestsAndResponses(self, client_id, flow_id):
"""Reads all requests and responses for a given flow from the database."""
flow_key = (client_id, flow_id)
try:
self.flows[flow_key]
except KeyError:
return []
request_dict = self.flow_requests.get(flow_key, {})
response... | [
"Reads",
"all",
"requests",
"and",
"responses",
"for",
"a",
"given",
"flow",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L464-L479 | [
"def",
"ReadAllFlowRequestsAndResponses",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"flow_key",
"=",
"(",
"client_id",
",",
"flow_id",
")",
"try",
":",
"self",
".",
"flows",
"[",
"flow_key",
"]",
"except",
"KeyError",
":",
"return",
"[",
"]"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.DeleteAllFlowRequestsAndResponses | Deletes all requests and responses for a given flow from the database. | grr/server/grr_response_server/databases/mem_flows.py | def DeleteAllFlowRequestsAndResponses(self, client_id, flow_id):
"""Deletes all requests and responses for a given flow from the database."""
flow_key = (client_id, flow_id)
try:
self.flows[flow_key]
except KeyError:
raise db.UnknownFlowError(client_id, flow_id)
try:
del self.flow... | def DeleteAllFlowRequestsAndResponses(self, client_id, flow_id):
"""Deletes all requests and responses for a given flow from the database."""
flow_key = (client_id, flow_id)
try:
self.flows[flow_key]
except KeyError:
raise db.UnknownFlowError(client_id, flow_id)
try:
del self.flow... | [
"Deletes",
"all",
"requests",
"and",
"responses",
"for",
"a",
"given",
"flow",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L482-L498 | [
"def",
"DeleteAllFlowRequestsAndResponses",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"flow_key",
"=",
"(",
"client_id",
",",
"flow_id",
")",
"try",
":",
"self",
".",
"flows",
"[",
"flow_key",
"]",
"except",
"KeyError",
":",
"raise",
"db",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadFlowRequestsReadyForProcessing | Reads all requests for a flow that can be processed by the worker. | grr/server/grr_response_server/databases/mem_flows.py | def ReadFlowRequestsReadyForProcessing(self,
client_id,
flow_id,
next_needed_request=None):
"""Reads all requests for a flow that can be processed by the worker."""
request_dict = self.flow... | def ReadFlowRequestsReadyForProcessing(self,
client_id,
flow_id,
next_needed_request=None):
"""Reads all requests for a flow that can be processed by the worker."""
request_dict = self.flow... | [
"Reads",
"all",
"requests",
"for",
"a",
"flow",
"that",
"can",
"be",
"processed",
"by",
"the",
"worker",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L501-L536 | [
"def",
"ReadFlowRequestsReadyForProcessing",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"next_needed_request",
"=",
"None",
")",
":",
"request_dict",
"=",
"self",
".",
"flow_requests",
".",
"get",
"(",
"(",
"client_id",
",",
"flow_id",
")",
",",
"{",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReleaseProcessedFlow | Releases a flow that the worker was processing to the database. | grr/server/grr_response_server/databases/mem_flows.py | def ReleaseProcessedFlow(self, flow_obj):
"""Releases a flow that the worker was processing to the database."""
key = (flow_obj.client_id, flow_obj.flow_id)
next_id_to_process = flow_obj.next_request_to_process
request_dict = self.flow_requests.get(key, {})
if (next_id_to_process in request_dict and... | def ReleaseProcessedFlow(self, flow_obj):
"""Releases a flow that the worker was processing to the database."""
key = (flow_obj.client_id, flow_obj.flow_id)
next_id_to_process = flow_obj.next_request_to_process
request_dict = self.flow_requests.get(key, {})
if (next_id_to_process in request_dict and... | [
"Releases",
"a",
"flow",
"that",
"the",
"worker",
"was",
"processing",
"to",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L539-L555 | [
"def",
"ReleaseProcessedFlow",
"(",
"self",
",",
"flow_obj",
")",
":",
"key",
"=",
"(",
"flow_obj",
".",
"client_id",
",",
"flow_obj",
".",
"flow_id",
")",
"next_id_to_process",
"=",
"flow_obj",
".",
"next_request_to_process",
"request_dict",
"=",
"self",
".",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WriteFlowProcessingRequests | Writes a list of flow processing requests to the database. | grr/server/grr_response_server/databases/mem_flows.py | def WriteFlowProcessingRequests(self, requests):
"""Writes a list of flow processing requests to the database."""
# If we don't have a handler thread running, we might be able to process the
# requests inline. If we are not, we start the handler thread for real and
# queue the requests normally.
if ... | def WriteFlowProcessingRequests(self, requests):
"""Writes a list of flow processing requests to the database."""
# If we don't have a handler thread running, we might be able to process the
# requests inline. If we are not, we start the handler thread for real and
# queue the requests normally.
if ... | [
"Writes",
"a",
"list",
"of",
"flow",
"processing",
"requests",
"to",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L564-L583 | [
"def",
"WriteFlowProcessingRequests",
"(",
"self",
",",
"requests",
")",
":",
"# If we don't have a handler thread running, we might be able to process the",
"# requests inline. If we are not, we start the handler thread for real and",
"# queue the requests normally.",
"if",
"not",
"self",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.AckFlowProcessingRequests | Deletes a list of flow processing requests from the database. | grr/server/grr_response_server/databases/mem_flows.py | def AckFlowProcessingRequests(self, requests):
"""Deletes a list of flow processing requests from the database."""
for r in requests:
key = (r.client_id, r.flow_id)
if key in self.flow_processing_requests:
del self.flow_processing_requests[key] | def AckFlowProcessingRequests(self, requests):
"""Deletes a list of flow processing requests from the database."""
for r in requests:
key = (r.client_id, r.flow_id)
if key in self.flow_processing_requests:
del self.flow_processing_requests[key] | [
"Deletes",
"a",
"list",
"of",
"flow",
"processing",
"requests",
"from",
"the",
"database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L591-L596 | [
"def",
"AckFlowProcessingRequests",
"(",
"self",
",",
"requests",
")",
":",
"for",
"r",
"in",
"requests",
":",
"key",
"=",
"(",
"r",
".",
"client_id",
",",
"r",
".",
"flow_id",
")",
"if",
"key",
"in",
"self",
".",
"flow_processing_requests",
":",
"del",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin._RegisterFlowProcessingHandler | Registers a handler to receive flow processing messages. | grr/server/grr_response_server/databases/mem_flows.py | def _RegisterFlowProcessingHandler(self, handler):
"""Registers a handler to receive flow processing messages."""
self.flow_handler_stop = False
self.flow_handler_thread = threading.Thread(
name="flow_processing_handler",
target=self._HandleFlowProcessingRequestLoop,
args=(handler,))... | def _RegisterFlowProcessingHandler(self, handler):
"""Registers a handler to receive flow processing messages."""
self.flow_handler_stop = False
self.flow_handler_thread = threading.Thread(
name="flow_processing_handler",
target=self._HandleFlowProcessingRequestLoop,
args=(handler,))... | [
"Registers",
"a",
"handler",
"to",
"receive",
"flow",
"processing",
"messages",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L610-L618 | [
"def",
"_RegisterFlowProcessingHandler",
"(",
"self",
",",
"handler",
")",
":",
"self",
".",
"flow_handler_stop",
"=",
"False",
"self",
".",
"flow_handler_thread",
"=",
"threading",
".",
"Thread",
"(",
"name",
"=",
"\"flow_processing_handler\"",
",",
"target",
"="... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.UnregisterFlowProcessingHandler | Unregisters any registered flow processing handler. | grr/server/grr_response_server/databases/mem_flows.py | def UnregisterFlowProcessingHandler(self, timeout=None):
"""Unregisters any registered flow processing handler."""
self.flow_handler_target = None
if self.flow_handler_thread:
self.flow_handler_stop = True
self.flow_handler_thread.join(timeout)
if self.flow_handler_thread.isAlive():
... | def UnregisterFlowProcessingHandler(self, timeout=None):
"""Unregisters any registered flow processing handler."""
self.flow_handler_target = None
if self.flow_handler_thread:
self.flow_handler_stop = True
self.flow_handler_thread.join(timeout)
if self.flow_handler_thread.isAlive():
... | [
"Unregisters",
"any",
"registered",
"flow",
"processing",
"handler",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L620-L629 | [
"def",
"UnregisterFlowProcessingHandler",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"flow_handler_target",
"=",
"None",
"if",
"self",
".",
"flow_handler_thread",
":",
"self",
".",
"flow_handler_stop",
"=",
"True",
"self",
".",
"flow_handle... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WaitUntilNoFlowsToProcess | Waits until flow processing thread is done processing flows.
Args:
timeout: If specified, is a max number of seconds to spend waiting.
Raises:
TimeOutWhileWaitingForFlowsToBeProcessedError: if timeout is reached. | grr/server/grr_response_server/databases/mem_flows.py | def WaitUntilNoFlowsToProcess(self, timeout=None):
"""Waits until flow processing thread is done processing flows.
Args:
timeout: If specified, is a max number of seconds to spend waiting.
Raises:
TimeOutWhileWaitingForFlowsToBeProcessedError: if timeout is reached.
"""
t = self.flow_h... | def WaitUntilNoFlowsToProcess(self, timeout=None):
"""Waits until flow processing thread is done processing flows.
Args:
timeout: If specified, is a max number of seconds to spend waiting.
Raises:
TimeOutWhileWaitingForFlowsToBeProcessedError: if timeout is reached.
"""
t = self.flow_h... | [
"Waits",
"until",
"flow",
"processing",
"thread",
"is",
"done",
"processing",
"flows",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L641-L669 | [
"def",
"WaitUntilNoFlowsToProcess",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"t",
"=",
"self",
".",
"flow_handler_thread",
"if",
"not",
"t",
":",
"return",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"while",
"True",
":",
"with",
"self",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin._HandleFlowProcessingRequestLoop | Handler thread for the FlowProcessingRequest queue. | grr/server/grr_response_server/databases/mem_flows.py | def _HandleFlowProcessingRequestLoop(self, handler):
"""Handler thread for the FlowProcessingRequest queue."""
while not self.flow_handler_stop:
with self.lock:
todo = self._GetFlowRequestsReadyForProcessing()
for request in todo:
self.flow_handler_num_being_processed += 1
... | def _HandleFlowProcessingRequestLoop(self, handler):
"""Handler thread for the FlowProcessingRequest queue."""
while not self.flow_handler_stop:
with self.lock:
todo = self._GetFlowRequestsReadyForProcessing()
for request in todo:
self.flow_handler_num_being_processed += 1
... | [
"Handler",
"thread",
"for",
"the",
"FlowProcessingRequest",
"queue",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L671-L686 | [
"def",
"_HandleFlowProcessingRequestLoop",
"(",
"self",
",",
"handler",
")",
":",
"while",
"not",
"self",
".",
"flow_handler_stop",
":",
"with",
"self",
".",
"lock",
":",
"todo",
"=",
"self",
".",
"_GetFlowRequestsReadyForProcessing",
"(",
")",
"for",
"request",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WriteFlowResults | Writes flow results for a given flow. | grr/server/grr_response_server/databases/mem_flows.py | def WriteFlowResults(self, results):
"""Writes flow results for a given flow."""
for r in results:
dest = self.flow_results.setdefault((r.client_id, r.flow_id), [])
to_write = r.Copy()
to_write.timestamp = rdfvalue.RDFDatetime.Now()
dest.append(to_write) | def WriteFlowResults(self, results):
"""Writes flow results for a given flow."""
for r in results:
dest = self.flow_results.setdefault((r.client_id, r.flow_id), [])
to_write = r.Copy()
to_write.timestamp = rdfvalue.RDFDatetime.Now()
dest.append(to_write) | [
"Writes",
"flow",
"results",
"for",
"a",
"given",
"flow",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L689-L695 | [
"def",
"WriteFlowResults",
"(",
"self",
",",
"results",
")",
":",
"for",
"r",
"in",
"results",
":",
"dest",
"=",
"self",
".",
"flow_results",
".",
"setdefault",
"(",
"(",
"r",
".",
"client_id",
",",
"r",
".",
"flow_id",
")",
",",
"[",
"]",
")",
"to... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadFlowResults | Reads flow results of a given flow using given query options. | grr/server/grr_response_server/databases/mem_flows.py | def ReadFlowResults(self,
client_id,
flow_id,
offset,
count,
with_tag=None,
with_type=None,
with_substring=None):
"""Reads flow results of a given flow using give... | def ReadFlowResults(self,
client_id,
flow_id,
offset,
count,
with_tag=None,
with_type=None,
with_substring=None):
"""Reads flow results of a given flow using give... | [
"Reads",
"flow",
"results",
"of",
"a",
"given",
"flow",
"using",
"given",
"query",
"options",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L698-L735 | [
"def",
"ReadFlowResults",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"offset",
",",
"count",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
",",
"with_substring",
"=",
"None",
")",
":",
"results",
"=",
"sorted",
"(",
"[",
"x",
".... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.CountFlowResults | Counts flow results of a given flow using given query options. | grr/server/grr_response_server/databases/mem_flows.py | def CountFlowResults(self, client_id, flow_id, with_tag=None, with_type=None):
"""Counts flow results of a given flow using given query options."""
return len(
self.ReadFlowResults(
client_id,
flow_id,
0,
sys.maxsize,
with_tag=with_tag,
... | def CountFlowResults(self, client_id, flow_id, with_tag=None, with_type=None):
"""Counts flow results of a given flow using given query options."""
return len(
self.ReadFlowResults(
client_id,
flow_id,
0,
sys.maxsize,
with_tag=with_tag,
... | [
"Counts",
"flow",
"results",
"of",
"a",
"given",
"flow",
"using",
"given",
"query",
"options",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L738-L747 | [
"def",
"CountFlowResults",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadFlowResults",
"(",
"client_id",
",",
"flow_id",
",",
"0",
",",
"sys",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.CountFlowResultsByType | Returns counts of flow results grouped by result type. | grr/server/grr_response_server/databases/mem_flows.py | def CountFlowResultsByType(self, client_id, flow_id):
"""Returns counts of flow results grouped by result type."""
result = collections.Counter()
for hr in self.ReadFlowResults(client_id, flow_id, 0, sys.maxsize):
key = compatibility.GetName(hr.payload.__class__)
result[key] += 1
return res... | def CountFlowResultsByType(self, client_id, flow_id):
"""Returns counts of flow results grouped by result type."""
result = collections.Counter()
for hr in self.ReadFlowResults(client_id, flow_id, 0, sys.maxsize):
key = compatibility.GetName(hr.payload.__class__)
result[key] += 1
return res... | [
"Returns",
"counts",
"of",
"flow",
"results",
"grouped",
"by",
"result",
"type",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L750-L757 | [
"def",
"CountFlowResultsByType",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"result",
"=",
"collections",
".",
"Counter",
"(",
")",
"for",
"hr",
"in",
"self",
".",
"ReadFlowResults",
"(",
"client_id",
",",
"flow_id",
",",
"0",
",",
"sys",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.WriteFlowLogEntries | Writes flow output plugin log entries for a given flow. | grr/server/grr_response_server/databases/mem_flows.py | def WriteFlowLogEntries(self, entries):
"""Writes flow output plugin log entries for a given flow."""
flow_ids = [(e.client_id, e.flow_id) for e in entries]
for f in flow_ids:
if f not in self.flows:
raise db.AtLeastOneUnknownFlowError(flow_ids)
for e in entries:
dest = self.flow_lo... | def WriteFlowLogEntries(self, entries):
"""Writes flow output plugin log entries for a given flow."""
flow_ids = [(e.client_id, e.flow_id) for e in entries]
for f in flow_ids:
if f not in self.flows:
raise db.AtLeastOneUnknownFlowError(flow_ids)
for e in entries:
dest = self.flow_lo... | [
"Writes",
"flow",
"output",
"plugin",
"log",
"entries",
"for",
"a",
"given",
"flow",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L760-L771 | [
"def",
"WriteFlowLogEntries",
"(",
"self",
",",
"entries",
")",
":",
"flow_ids",
"=",
"[",
"(",
"e",
".",
"client_id",
",",
"e",
".",
"flow_id",
")",
"for",
"e",
"in",
"entries",
"]",
"for",
"f",
"in",
"flow_ids",
":",
"if",
"f",
"not",
"in",
"self... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadFlowLogEntries | Reads flow log entries of a given flow using given query options. | grr/server/grr_response_server/databases/mem_flows.py | def ReadFlowLogEntries(self,
client_id,
flow_id,
offset,
count,
with_substring=None):
"""Reads flow log entries of a given flow using given query options."""
entries = sorted(
sel... | def ReadFlowLogEntries(self,
client_id,
flow_id,
offset,
count,
with_substring=None):
"""Reads flow log entries of a given flow using given query options."""
entries = sorted(
sel... | [
"Reads",
"flow",
"log",
"entries",
"of",
"a",
"given",
"flow",
"using",
"given",
"query",
"options",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L774-L788 | [
"def",
"ReadFlowLogEntries",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"offset",
",",
"count",
",",
"with_substring",
"=",
"None",
")",
":",
"entries",
"=",
"sorted",
"(",
"self",
".",
"flow_log_entries",
".",
"get",
"(",
"(",
"client_id",
",",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.CountFlowLogEntries | Returns number of flow log entries of a given flow. | grr/server/grr_response_server/databases/mem_flows.py | def CountFlowLogEntries(self, client_id, flow_id):
"""Returns number of flow log entries of a given flow."""
return len(self.ReadFlowLogEntries(client_id, flow_id, 0, sys.maxsize)) | def CountFlowLogEntries(self, client_id, flow_id):
"""Returns number of flow log entries of a given flow."""
return len(self.ReadFlowLogEntries(client_id, flow_id, 0, sys.maxsize)) | [
"Returns",
"number",
"of",
"flow",
"log",
"entries",
"of",
"a",
"given",
"flow",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L791-L793 | [
"def",
"CountFlowLogEntries",
"(",
"self",
",",
"client_id",
",",
"flow_id",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadFlowLogEntries",
"(",
"client_id",
",",
"flow_id",
",",
"0",
",",
"sys",
".",
"maxsize",
")",
")"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.ReadFlowOutputPluginLogEntries | Reads flow output plugin log entries. | grr/server/grr_response_server/databases/mem_flows.py | def ReadFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
offset,
count,
with... | def ReadFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
offset,
count,
with... | [
"Reads",
"flow",
"output",
"plugin",
"log",
"entries",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L811-L828 | [
"def",
"ReadFlowOutputPluginLogEntries",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"output_plugin_id",
",",
"offset",
",",
"count",
",",
"with_type",
"=",
"None",
")",
":",
"entries",
"=",
"sorted",
"(",
"self",
".",
"flow_output_plugin_log_entries",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBFlowMixin.CountFlowOutputPluginLogEntries | Returns number of flow output plugin log entries of a given flow. | grr/server/grr_response_server/databases/mem_flows.py | def CountFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
with_type=None):
"""Returns number of flow output plugin log entries of a given flow... | def CountFlowOutputPluginLogEntries(self,
client_id,
flow_id,
output_plugin_id,
with_type=None):
"""Returns number of flow output plugin log entries of a given flow... | [
"Returns",
"number",
"of",
"flow",
"output",
"plugin",
"log",
"entries",
"of",
"a",
"given",
"flow",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L831-L845 | [
"def",
"CountFlowOutputPluginLogEntries",
"(",
"self",
",",
"client_id",
",",
"flow_id",
",",
"output_plugin_id",
",",
"with_type",
"=",
"None",
")",
":",
"return",
"len",
"(",
"self",
".",
"ReadFlowOutputPluginLogEntries",
"(",
"client_id",
",",
"flow_id",
",",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBSignedBinariesMixin.WriteSignedBinaryReferences | See db.Database. | grr/server/grr_response_server/databases/mem_signed_binaries.py | def WriteSignedBinaryReferences(self, binary_id,
references):
"""See db.Database."""
self.signed_binary_references[_SignedBinaryKeyFromID(binary_id)] = (
references.Copy(), rdfvalue.RDFDatetime.Now()) | def WriteSignedBinaryReferences(self, binary_id,
references):
"""See db.Database."""
self.signed_binary_references[_SignedBinaryKeyFromID(binary_id)] = (
references.Copy(), rdfvalue.RDFDatetime.Now()) | [
"See",
"db",
".",
"Database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_signed_binaries.py#L45-L49 | [
"def",
"WriteSignedBinaryReferences",
"(",
"self",
",",
"binary_id",
",",
"references",
")",
":",
"self",
".",
"signed_binary_references",
"[",
"_SignedBinaryKeyFromID",
"(",
"binary_id",
")",
"]",
"=",
"(",
"references",
".",
"Copy",
"(",
")",
",",
"rdfvalue",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | InMemoryDBSignedBinariesMixin.ReadSignedBinaryReferences | See db.Database. | grr/server/grr_response_server/databases/mem_signed_binaries.py | def ReadSignedBinaryReferences(
self, binary_id
):
"""See db.Database."""
binary_key = _SignedBinaryKeyFromID(binary_id)
try:
references, timestamp = self.signed_binary_references[binary_key]
except KeyError:
raise db.UnknownSignedBinaryError(binary_id)
return references.Copy(), ... | def ReadSignedBinaryReferences(
self, binary_id
):
"""See db.Database."""
binary_key = _SignedBinaryKeyFromID(binary_id)
try:
references, timestamp = self.signed_binary_references[binary_key]
except KeyError:
raise db.UnknownSignedBinaryError(binary_id)
return references.Copy(), ... | [
"See",
"db",
".",
"Database",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_signed_binaries.py#L52-L61 | [
"def",
"ReadSignedBinaryReferences",
"(",
"self",
",",
"binary_id",
")",
":",
"binary_key",
"=",
"_SignedBinaryKeyFromID",
"(",
"binary_id",
")",
"try",
":",
"references",
",",
"timestamp",
"=",
"self",
".",
"signed_binary_references",
"[",
"binary_key",
"]",
"exc... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | SqliteInstantOutputPlugin._GetSqliteSchema | Returns a mapping of SQLite column names to Converter objects. | grr/server/grr_response_server/output_plugins/sqlite_plugin.py | def _GetSqliteSchema(self, proto_struct_class, prefix=""):
"""Returns a mapping of SQLite column names to Converter objects."""
schema = collections.OrderedDict()
for type_info in proto_struct_class.type_infos:
if type_info.__class__ is rdf_structs.ProtoEmbedded:
schema.update(
sel... | def _GetSqliteSchema(self, proto_struct_class, prefix=""):
"""Returns a mapping of SQLite column names to Converter objects."""
schema = collections.OrderedDict()
for type_info in proto_struct_class.type_infos:
if type_info.__class__ is rdf_structs.ProtoEmbedded:
schema.update(
sel... | [
"Returns",
"a",
"mapping",
"of",
"SQLite",
"column",
"names",
"to",
"Converter",
"objects",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/output_plugins/sqlite_plugin.py#L160-L171 | [
"def",
"_GetSqliteSchema",
"(",
"self",
",",
"proto_struct_class",
",",
"prefix",
"=",
"\"\"",
")",
":",
"schema",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"for",
"type_info",
"in",
"proto_struct_class",
".",
"type_infos",
":",
"if",
"type_info",
".",... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | SqliteInstantOutputPlugin._ConvertToCanonicalSqlDict | Converts a dict of RDF values into a SQL-ready form. | grr/server/grr_response_server/output_plugins/sqlite_plugin.py | def _ConvertToCanonicalSqlDict(self, schema, raw_dict, prefix=""):
"""Converts a dict of RDF values into a SQL-ready form."""
flattened_dict = {}
for k, v in iteritems(raw_dict):
if isinstance(v, dict):
flattened_dict.update(
self._ConvertToCanonicalSqlDict(
schema,... | def _ConvertToCanonicalSqlDict(self, schema, raw_dict, prefix=""):
"""Converts a dict of RDF values into a SQL-ready form."""
flattened_dict = {}
for k, v in iteritems(raw_dict):
if isinstance(v, dict):
flattened_dict.update(
self._ConvertToCanonicalSqlDict(
schema,... | [
"Converts",
"a",
"dict",
"of",
"RDF",
"values",
"into",
"a",
"SQL",
"-",
"ready",
"form",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/output_plugins/sqlite_plugin.py#L182-L193 | [
"def",
"_ConvertToCanonicalSqlDict",
"(",
"self",
",",
"schema",
",",
"raw_dict",
",",
"prefix",
"=",
"\"\"",
")",
":",
"flattened_dict",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
"raw_dict",
")",
":",
"if",
"isinstance",
"(",
"v",
"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | SqliteInstantOutputPlugin._FlushAllRows | Copies rows from the given db into the output file then deletes them. | grr/server/grr_response_server/output_plugins/sqlite_plugin.py | def _FlushAllRows(self, db_connection, table_name):
"""Copies rows from the given db into the output file then deletes them."""
for sql in db_connection.iterdump():
if (sql.startswith("CREATE TABLE") or
sql.startswith("BEGIN TRANSACTION") or sql.startswith("COMMIT")):
# These statements ... | def _FlushAllRows(self, db_connection, table_name):
"""Copies rows from the given db into the output file then deletes them."""
for sql in db_connection.iterdump():
if (sql.startswith("CREATE TABLE") or
sql.startswith("BEGIN TRANSACTION") or sql.startswith("COMMIT")):
# These statements ... | [
"Copies",
"rows",
"from",
"the",
"given",
"db",
"into",
"the",
"output",
"file",
"then",
"deletes",
"them",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/output_plugins/sqlite_plugin.py#L195-L206 | [
"def",
"_FlushAllRows",
"(",
"self",
",",
"db_connection",
",",
"table_name",
")",
":",
"for",
"sql",
"in",
"db_connection",
".",
"iterdump",
"(",
")",
":",
"if",
"(",
"sql",
".",
"startswith",
"(",
"\"CREATE TABLE\"",
")",
"or",
"sql",
".",
"startswith",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | YamlDumper | Dumps the given aff4object into a yaml representation. | grr/server/grr_response_server/serialize.py | def YamlDumper(aff4object):
"""Dumps the given aff4object into a yaml representation."""
aff4object.Flush()
result = {}
for attribute, values in iteritems(aff4object.synced_attributes):
result[attribute.predicate] = []
for value in values:
# This value is really a LazyDecoder() instance. We need ... | def YamlDumper(aff4object):
"""Dumps the given aff4object into a yaml representation."""
aff4object.Flush()
result = {}
for attribute, values in iteritems(aff4object.synced_attributes):
result[attribute.predicate] = []
for value in values:
# This value is really a LazyDecoder() instance. We need ... | [
"Dumps",
"the",
"given",
"aff4object",
"into",
"a",
"yaml",
"representation",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/serialize.py#L16-L38 | [
"def",
"YamlDumper",
"(",
"aff4object",
")",
":",
"aff4object",
".",
"Flush",
"(",
")",
"result",
"=",
"{",
"}",
"for",
"attribute",
",",
"values",
"in",
"iteritems",
"(",
"aff4object",
".",
"synced_attributes",
")",
":",
"result",
"[",
"attribute",
".",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | YamlLoader | Load an AFF4 object from a serialized YAML representation. | grr/server/grr_response_server/serialize.py | def YamlLoader(string):
"""Load an AFF4 object from a serialized YAML representation."""
representation = yaml.Parse(string)
result_cls = aff4.FACTORY.AFF4Object(representation["aff4_class"])
aff4_attributes = {}
for predicate, values in iteritems(representation["attributes"]):
attribute = aff4.Attribute.... | def YamlLoader(string):
"""Load an AFF4 object from a serialized YAML representation."""
representation = yaml.Parse(string)
result_cls = aff4.FACTORY.AFF4Object(representation["aff4_class"])
aff4_attributes = {}
for predicate, values in iteritems(representation["attributes"]):
attribute = aff4.Attribute.... | [
"Load",
"an",
"AFF4",
"object",
"from",
"a",
"serialized",
"YAML",
"representation",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/serialize.py#L41-L67 | [
"def",
"YamlLoader",
"(",
"string",
")",
":",
"representation",
"=",
"yaml",
".",
"Parse",
"(",
"string",
")",
"result_cls",
"=",
"aff4",
".",
"FACTORY",
".",
"AFF4Object",
"(",
"representation",
"[",
"\"aff4_class\"",
"]",
")",
"aff4_attributes",
"=",
"{",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | GetMetadata | Builds ExportedMetadata object for a given client id and ClientFullInfo. | grr/server/grr_response_server/export.py | def GetMetadata(client_id, client_full_info):
"""Builds ExportedMetadata object for a given client id and ClientFullInfo."""
metadata = ExportedMetadata()
last_snapshot = None
if client_full_info.HasField("last_snapshot"):
last_snapshot = client_full_info.last_snapshot
metadata.client_urn = client_id
... | def GetMetadata(client_id, client_full_info):
"""Builds ExportedMetadata object for a given client id and ClientFullInfo."""
metadata = ExportedMetadata()
last_snapshot = None
if client_full_info.HasField("last_snapshot"):
last_snapshot = client_full_info.last_snapshot
metadata.client_urn = client_id
... | [
"Builds",
"ExportedMetadata",
"object",
"for",
"a",
"given",
"client",
"id",
"and",
"ClientFullInfo",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L1610-L1659 | [
"def",
"GetMetadata",
"(",
"client_id",
",",
"client_full_info",
")",
":",
"metadata",
"=",
"ExportedMetadata",
"(",
")",
"last_snapshot",
"=",
"None",
"if",
"client_full_info",
".",
"HasField",
"(",
"\"last_snapshot\"",
")",
":",
"last_snapshot",
"=",
"client_ful... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | GetMetadataLegacy | Builds ExportedMetadata object for a given client id.
Note: This is a legacy aff4-only implementation.
TODO(user): deprecate as soon as REL_DB migration is done.
Args:
client: RDFURN of a client or VFSGRRClient object itself.
token: Security token.
Returns:
ExportedMetadata object with metadata o... | grr/server/grr_response_server/export.py | def GetMetadataLegacy(client, token=None):
"""Builds ExportedMetadata object for a given client id.
Note: This is a legacy aff4-only implementation.
TODO(user): deprecate as soon as REL_DB migration is done.
Args:
client: RDFURN of a client or VFSGRRClient object itself.
token: Security token.
Retu... | def GetMetadataLegacy(client, token=None):
"""Builds ExportedMetadata object for a given client id.
Note: This is a legacy aff4-only implementation.
TODO(user): deprecate as soon as REL_DB migration is done.
Args:
client: RDFURN of a client or VFSGRRClient object itself.
token: Security token.
Retu... | [
"Builds",
"ExportedMetadata",
"object",
"for",
"a",
"given",
"client",
"id",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L1662-L1725 | [
"def",
"GetMetadataLegacy",
"(",
"client",
",",
"token",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"client",
",",
"rdfvalue",
".",
"RDFURN",
")",
":",
"client_fd",
"=",
"aff4",
".",
"FACTORY",
".",
"Open",
"(",
"client",
",",
"mode",
"=",
"\"r\""... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ConvertValuesWithMetadata | Converts a set of RDFValues into a set of export-friendly RDFValues.
Args:
metadata_value_pairs: Tuples of (metadata, rdf_value), where metadata is an
instance of ExportedMetadata and rdf_value is an RDFValue subclass
instance to be exported.
token: Security token.
options: rdfvalue.ExportOpt... | grr/server/grr_response_server/export.py | def ConvertValuesWithMetadata(metadata_value_pairs, token=None, options=None):
"""Converts a set of RDFValues into a set of export-friendly RDFValues.
Args:
metadata_value_pairs: Tuples of (metadata, rdf_value), where metadata is an
instance of ExportedMetadata and rdf_value is an RDFValue subclass
... | def ConvertValuesWithMetadata(metadata_value_pairs, token=None, options=None):
"""Converts a set of RDFValues into a set of export-friendly RDFValues.
Args:
metadata_value_pairs: Tuples of (metadata, rdf_value), where metadata is an
instance of ExportedMetadata and rdf_value is an RDFValue subclass
... | [
"Converts",
"a",
"set",
"of",
"RDFValues",
"into",
"a",
"set",
"of",
"export",
"-",
"friendly",
"RDFValues",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L1728-L1769 | [
"def",
"ConvertValuesWithMetadata",
"(",
"metadata_value_pairs",
",",
"token",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"no_converter_found_error",
"=",
"None",
"for",
"metadata_values_group",
"in",
"itervalues",
"(",
"collection",
".",
"Group",
"(",
"m... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ConvertValues | Converts a set of RDFValues into a set of export-friendly RDFValues.
Args:
default_metadata: export.ExportedMetadata instance with basic information
about where the values come from. This metadata will be passed to
exporters.
values: Values to convert. They should be of the same type.
token: ... | grr/server/grr_response_server/export.py | def ConvertValues(default_metadata, values, token=None, options=None):
"""Converts a set of RDFValues into a set of export-friendly RDFValues.
Args:
default_metadata: export.ExportedMetadata instance with basic information
about where the values come from. This metadata will be passed to
exporters.... | def ConvertValues(default_metadata, values, token=None, options=None):
"""Converts a set of RDFValues into a set of export-friendly RDFValues.
Args:
default_metadata: export.ExportedMetadata instance with basic information
about where the values come from. This metadata will be passed to
exporters.... | [
"Converts",
"a",
"set",
"of",
"RDFValues",
"into",
"a",
"set",
"of",
"export",
"-",
"friendly",
"RDFValues",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L1772-L1794 | [
"def",
"ConvertValues",
"(",
"default_metadata",
",",
"values",
",",
"token",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"batch_data",
"=",
"[",
"(",
"default_metadata",
",",
"obj",
")",
"for",
"obj",
"in",
"values",
"]",
"return",
"ConvertValuesW... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | ExportConverter.GetConvertersByClass | Returns all converters that take given value as an input value. | grr/server/grr_response_server/export.py | def GetConvertersByClass(value_cls):
"""Returns all converters that take given value as an input value."""
try:
return ExportConverter.converters_cache[value_cls]
except KeyError:
results = [
cls for cls in itervalues(ExportConverter.classes)
if cls.input_rdf_type == value_cl... | def GetConvertersByClass(value_cls):
"""Returns all converters that take given value as an input value."""
try:
return ExportConverter.converters_cache[value_cls]
except KeyError:
results = [
cls for cls in itervalues(ExportConverter.classes)
if cls.input_rdf_type == value_cl... | [
"Returns",
"all",
"converters",
"that",
"take",
"given",
"value",
"as",
"an",
"input",
"value",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L316-L329 | [
"def",
"GetConvertersByClass",
"(",
"value_cls",
")",
":",
"try",
":",
"return",
"ExportConverter",
".",
"converters_cache",
"[",
"value_cls",
"]",
"except",
"KeyError",
":",
"results",
"=",
"[",
"cls",
"for",
"cls",
"in",
"itervalues",
"(",
"ExportConverter",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | DataAgnosticExportConverter.MakeFlatRDFClass | Generates flattened RDFValue class definition for the given value. | grr/server/grr_response_server/export.py | def MakeFlatRDFClass(self, value):
"""Generates flattened RDFValue class definition for the given value."""
def Flatten(self, metadata, value_to_flatten):
if metadata:
self.metadata = metadata
for desc in value_to_flatten.type_infos:
if desc.name == "metadata":
continue
... | def MakeFlatRDFClass(self, value):
"""Generates flattened RDFValue class definition for the given value."""
def Flatten(self, metadata, value_to_flatten):
if metadata:
self.metadata = metadata
for desc in value_to_flatten.type_infos:
if desc.name == "metadata":
continue
... | [
"Generates",
"flattened",
"RDFValue",
"class",
"definition",
"for",
"the",
"given",
"value",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L355-L408 | [
"def",
"MakeFlatRDFClass",
"(",
"self",
",",
"value",
")",
":",
"def",
"Flatten",
"(",
"self",
",",
"metadata",
",",
"value_to_flatten",
")",
":",
"if",
"metadata",
":",
"self",
".",
"metadata",
"=",
"metadata",
"for",
"desc",
"in",
"value_to_flatten",
"."... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | StatEntryToExportedFileConverter.ParseSignedData | Parses signed certificate data and updates result rdfvalue. | grr/server/grr_response_server/export.py | def ParseSignedData(signed_data, result):
"""Parses signed certificate data and updates result rdfvalue."""
try:
auth_data
except NameError:
# Verify_sigs is not available so we can't parse signatures. If you want
# this functionality, please install the verify-sigs package:
# https:... | def ParseSignedData(signed_data, result):
"""Parses signed certificate data and updates result rdfvalue."""
try:
auth_data
except NameError:
# Verify_sigs is not available so we can't parse signatures. If you want
# this functionality, please install the verify-sigs package:
# https:... | [
"Parses",
"signed",
"certificate",
"data",
"and",
"updates",
"result",
"rdfvalue",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L436-L496 | [
"def",
"ParseSignedData",
"(",
"signed_data",
",",
"result",
")",
":",
"try",
":",
"auth_data",
"except",
"NameError",
":",
"# Verify_sigs is not available so we can't parse signatures. If you want",
"# this functionality, please install the verify-sigs package:",
"# https://github.c... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | StatEntryToExportedFileConverter.ParseFileHash | Parses Hash rdfvalue into ExportedFile's fields. | grr/server/grr_response_server/export.py | def ParseFileHash(hash_obj, result):
"""Parses Hash rdfvalue into ExportedFile's fields."""
if hash_obj.HasField("md5"):
result.hash_md5 = str(hash_obj.md5)
if hash_obj.HasField("sha1"):
result.hash_sha1 = str(hash_obj.sha1)
if hash_obj.HasField("sha256"):
result.hash_sha256 = str(ha... | def ParseFileHash(hash_obj, result):
"""Parses Hash rdfvalue into ExportedFile's fields."""
if hash_obj.HasField("md5"):
result.hash_md5 = str(hash_obj.md5)
if hash_obj.HasField("sha1"):
result.hash_sha1 = str(hash_obj.sha1)
if hash_obj.HasField("sha256"):
result.hash_sha256 = str(ha... | [
"Parses",
"Hash",
"rdfvalue",
"into",
"ExportedFile",
"s",
"fields",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L499-L518 | [
"def",
"ParseFileHash",
"(",
"hash_obj",
",",
"result",
")",
":",
"if",
"hash_obj",
".",
"HasField",
"(",
"\"md5\"",
")",
":",
"result",
".",
"hash_md5",
"=",
"str",
"(",
"hash_obj",
".",
"md5",
")",
"if",
"hash_obj",
".",
"HasField",
"(",
"\"sha1\"",
... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | StatEntryToExportedFileConverter.Convert | Converts StatEntry to ExportedFile.
Does nothing if StatEntry corresponds to a registry entry and not to a file.
Args:
metadata: ExportedMetadata to be used for conversion.
stat_entry: StatEntry to be converted.
token: Security token.
Returns:
List or generator with resulting RDFV... | grr/server/grr_response_server/export.py | def Convert(self, metadata, stat_entry, token=None):
"""Converts StatEntry to ExportedFile.
Does nothing if StatEntry corresponds to a registry entry and not to a file.
Args:
metadata: ExportedMetadata to be used for conversion.
stat_entry: StatEntry to be converted.
token: Security toke... | def Convert(self, metadata, stat_entry, token=None):
"""Converts StatEntry to ExportedFile.
Does nothing if StatEntry corresponds to a registry entry and not to a file.
Args:
metadata: ExportedMetadata to be used for conversion.
stat_entry: StatEntry to be converted.
token: Security toke... | [
"Converts",
"StatEntry",
"to",
"ExportedFile",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L520-L534 | [
"def",
"Convert",
"(",
"self",
",",
"metadata",
",",
"stat_entry",
",",
"token",
"=",
"None",
")",
":",
"return",
"self",
".",
"BatchConvert",
"(",
"[",
"(",
"metadata",
",",
"stat_entry",
")",
"]",
",",
"token",
"=",
"token",
")"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | StatEntryToExportedFileConverter._RemoveRegistryKeys | Filter out registry keys to operate on files. | grr/server/grr_response_server/export.py | def _RemoveRegistryKeys(self, metadata_value_pairs):
"""Filter out registry keys to operate on files."""
filtered_pairs = []
for metadata, stat_entry in metadata_value_pairs:
# Ignore registry keys.
if stat_entry.pathspec.pathtype != rdf_paths.PathSpec.PathType.REGISTRY:
filtered_pairs.a... | def _RemoveRegistryKeys(self, metadata_value_pairs):
"""Filter out registry keys to operate on files."""
filtered_pairs = []
for metadata, stat_entry in metadata_value_pairs:
# Ignore registry keys.
if stat_entry.pathspec.pathtype != rdf_paths.PathSpec.PathType.REGISTRY:
filtered_pairs.a... | [
"Filter",
"out",
"registry",
"keys",
"to",
"operate",
"on",
"files",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L536-L544 | [
"def",
"_RemoveRegistryKeys",
"(",
"self",
",",
"metadata_value_pairs",
")",
":",
"filtered_pairs",
"=",
"[",
"]",
"for",
"metadata",
",",
"stat_entry",
"in",
"metadata_value_pairs",
":",
"# Ignore registry keys.",
"if",
"stat_entry",
".",
"pathspec",
".",
"pathtype... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | StatEntryToExportedFileConverter._OpenFilesForRead | Open files all at once if necessary. | grr/server/grr_response_server/export.py | def _OpenFilesForRead(self, metadata_value_pairs, token):
"""Open files all at once if necessary."""
aff4_paths = [
result.AFF4Path(metadata.client_urn)
for metadata, result in metadata_value_pairs
]
fds = aff4.FACTORY.MultiOpen(aff4_paths, mode="r", token=token)
fds_dict = dict([(fd... | def _OpenFilesForRead(self, metadata_value_pairs, token):
"""Open files all at once if necessary."""
aff4_paths = [
result.AFF4Path(metadata.client_urn)
for metadata, result in metadata_value_pairs
]
fds = aff4.FACTORY.MultiOpen(aff4_paths, mode="r", token=token)
fds_dict = dict([(fd... | [
"Open",
"files",
"all",
"at",
"once",
"if",
"necessary",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L546-L554 | [
"def",
"_OpenFilesForRead",
"(",
"self",
",",
"metadata_value_pairs",
",",
"token",
")",
":",
"aff4_paths",
"=",
"[",
"result",
".",
"AFF4Path",
"(",
"metadata",
".",
"client_urn",
")",
"for",
"metadata",
",",
"result",
"in",
"metadata_value_pairs",
"]",
"fds"... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
train | StatEntryToExportedFileConverter._ExportFileContent | Add file content from aff4_object to result. | grr/server/grr_response_server/export.py | def _ExportFileContent(self, aff4_object, result):
"""Add file content from aff4_object to result."""
if self.options.export_files_contents:
try:
result.content = aff4_object.Read(self.MAX_CONTENT_SIZE)
result.content_sha256 = hashlib.sha256(result.content).hexdigest()
except (IOErro... | def _ExportFileContent(self, aff4_object, result):
"""Add file content from aff4_object to result."""
if self.options.export_files_contents:
try:
result.content = aff4_object.Read(self.MAX_CONTENT_SIZE)
result.content_sha256 = hashlib.sha256(result.content).hexdigest()
except (IOErro... | [
"Add",
"file",
"content",
"from",
"aff4_object",
"to",
"result",
"."
] | google/grr | python | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L556-L563 | [
"def",
"_ExportFileContent",
"(",
"self",
",",
"aff4_object",
",",
"result",
")",
":",
"if",
"self",
".",
"options",
".",
"export_files_contents",
":",
"try",
":",
"result",
".",
"content",
"=",
"aff4_object",
".",
"Read",
"(",
"self",
".",
"MAX_CONTENT_SIZE... | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.