repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
google/grr | grr/server/grr_response_server/rdfvalues/objects.py | PathInfo.GetAncestors | def GetAncestors(self):
"""Yields all ancestors of a path.
The ancestors are returned in order from closest to the farthest one.
Yields:
Instances of `rdf_objects.PathInfo`.
"""
current = self
while True:
current = current.GetParent()
if current is None:
return
... | python | def GetAncestors(self):
"""Yields all ancestors of a path.
The ancestors are returned in order from closest to the farthest one.
Yields:
Instances of `rdf_objects.PathInfo`.
"""
current = self
while True:
current = current.GetParent()
if current is None:
return
... | [
"def",
"GetAncestors",
"(",
"self",
")",
":",
"current",
"=",
"self",
"while",
"True",
":",
"current",
"=",
"current",
".",
"GetParent",
"(",
")",
"if",
"current",
"is",
"None",
":",
"return",
"yield",
"current"
] | Yields all ancestors of a path.
The ancestors are returned in order from closest to the farthest one.
Yields:
Instances of `rdf_objects.PathInfo`. | [
"Yields",
"all",
"ancestors",
"of",
"a",
"path",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/objects.py#L445-L458 | train | Yields all ancestors of a path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/rdfvalues/objects.py | PathInfo.UpdateFrom | def UpdateFrom(self, src):
"""Merge path info records.
Merges src into self.
Args:
src: An rdfvalues.objects.PathInfo record, will be merged into self.
Raises:
ValueError: If src does not represent the same path.
"""
if not isinstance(src, PathInfo):
raise TypeError("expected... | python | def UpdateFrom(self, src):
"""Merge path info records.
Merges src into self.
Args:
src: An rdfvalues.objects.PathInfo record, will be merged into self.
Raises:
ValueError: If src does not represent the same path.
"""
if not isinstance(src, PathInfo):
raise TypeError("expected... | [
"def",
"UpdateFrom",
"(",
"self",
",",
"src",
")",
":",
"if",
"not",
"isinstance",
"(",
"src",
",",
"PathInfo",
")",
":",
"raise",
"TypeError",
"(",
"\"expected `%s` but got `%s`\"",
"%",
"(",
"PathInfo",
",",
"type",
"(",
"src",
")",
")",
")",
"if",
"... | Merge path info records.
Merges src into self.
Args:
src: An rdfvalues.objects.PathInfo record, will be merged into self.
Raises:
ValueError: If src does not represent the same path. | [
"Merge",
"path",
"info",
"records",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/objects.py#L460-L485 | train | Updates the internal state of this object from src. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/rdfvalues/objects.py | VfsFileReference.ToURN | def ToURN(self):
"""Converts a reference into an URN."""
if self.path_type in [PathInfo.PathType.OS, PathInfo.PathType.TSK]:
return rdfvalue.RDFURN(self.client_id).Add("fs").Add(
self.path_type.name.lower()).Add("/".join(self.path_components))
elif self.path_type == PathInfo.PathType.REGIST... | python | def ToURN(self):
"""Converts a reference into an URN."""
if self.path_type in [PathInfo.PathType.OS, PathInfo.PathType.TSK]:
return rdfvalue.RDFURN(self.client_id).Add("fs").Add(
self.path_type.name.lower()).Add("/".join(self.path_components))
elif self.path_type == PathInfo.PathType.REGIST... | [
"def",
"ToURN",
"(",
"self",
")",
":",
"if",
"self",
".",
"path_type",
"in",
"[",
"PathInfo",
".",
"PathType",
".",
"OS",
",",
"PathInfo",
".",
"PathType",
".",
"TSK",
"]",
":",
"return",
"rdfvalue",
".",
"RDFURN",
"(",
"self",
".",
"client_id",
")",... | Converts a reference into an URN. | [
"Converts",
"a",
"reference",
"into",
"an",
"URN",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/objects.py#L573-L586 | train | Converts a reference into an URN. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/rdfvalues/objects.py | VfsFileReference.ToPath | def ToPath(self):
"""Converts a reference into a VFS file path."""
if self.path_type == PathInfo.PathType.OS:
return os.path.join("fs", "os", *self.path_components)
elif self.path_type == PathInfo.PathType.TSK:
return os.path.join("fs", "tsk", *self.path_components)
elif self.path_type == P... | python | def ToPath(self):
"""Converts a reference into a VFS file path."""
if self.path_type == PathInfo.PathType.OS:
return os.path.join("fs", "os", *self.path_components)
elif self.path_type == PathInfo.PathType.TSK:
return os.path.join("fs", "tsk", *self.path_components)
elif self.path_type == P... | [
"def",
"ToPath",
"(",
"self",
")",
":",
"if",
"self",
".",
"path_type",
"==",
"PathInfo",
".",
"PathType",
".",
"OS",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"\"fs\"",
",",
"\"os\"",
",",
"*",
"self",
".",
"path_components",
")",
"elif",
... | Converts a reference into a VFS file path. | [
"Converts",
"a",
"reference",
"into",
"a",
"VFS",
"file",
"path",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/objects.py#L588-L600 | train | Converts a reference into a VFS file path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/client/grr_response_client/client_logging.py | LogInit | def LogInit():
"""Configure the logging subsystem."""
logging.debug("Initializing client logging subsystem.")
# The root logger.
logger = logging.getLogger()
memory_handlers = [
m for m in logger.handlers
if m.__class__.__name__ == "PreLoggingMemoryHandler"
]
# Clear all handers.
logger.ha... | python | def LogInit():
"""Configure the logging subsystem."""
logging.debug("Initializing client logging subsystem.")
# The root logger.
logger = logging.getLogger()
memory_handlers = [
m for m in logger.handlers
if m.__class__.__name__ == "PreLoggingMemoryHandler"
]
# Clear all handers.
logger.ha... | [
"def",
"LogInit",
"(",
")",
":",
"logging",
".",
"debug",
"(",
"\"Initializing client logging subsystem.\"",
")",
"# The root logger.",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"memory_handlers",
"=",
"[",
"m",
"for",
"m",
"in",
"logger",
".",
"ha... | Configure the logging subsystem. | [
"Configure",
"the",
"logging",
"subsystem",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_logging.py#L132-L150 | train | Configure the logging subsystem. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/gui/api_plugins/client.py | UpdateClientsFromFleetspeak | def UpdateClientsFromFleetspeak(clients):
"""Updates ApiClient records to include info from Fleetspeak."""
if not fleetspeak_connector.CONN or not fleetspeak_connector.CONN.outgoing:
# FS not configured, or an outgoing connection is otherwise unavailable.
return
id_map = {}
for client in clients:
if... | python | def UpdateClientsFromFleetspeak(clients):
"""Updates ApiClient records to include info from Fleetspeak."""
if not fleetspeak_connector.CONN or not fleetspeak_connector.CONN.outgoing:
# FS not configured, or an outgoing connection is otherwise unavailable.
return
id_map = {}
for client in clients:
if... | [
"def",
"UpdateClientsFromFleetspeak",
"(",
"clients",
")",
":",
"if",
"not",
"fleetspeak_connector",
".",
"CONN",
"or",
"not",
"fleetspeak_connector",
".",
"CONN",
".",
"outgoing",
":",
"# FS not configured, or an outgoing connection is otherwise unavailable.",
"return",
"i... | Updates ApiClient records to include info from Fleetspeak. | [
"Updates",
"ApiClient",
"records",
"to",
"include",
"info",
"from",
"Fleetspeak",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/client.py#L53-L70 | train | Updates ApiClient records to include info from Fleetspeak. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/gui/api_plugins/client.py | ApiRemoveClientsLabelsHandler.RemoveClientLabels | def RemoveClientLabels(self, client, labels_names):
"""Removes labels with given names from a given client object."""
affected_owners = set()
for label in client.GetLabels():
if label.name in labels_names and label.owner != "GRR":
affected_owners.add(label.owner)
for owner in affected_ow... | python | def RemoveClientLabels(self, client, labels_names):
"""Removes labels with given names from a given client object."""
affected_owners = set()
for label in client.GetLabels():
if label.name in labels_names and label.owner != "GRR":
affected_owners.add(label.owner)
for owner in affected_ow... | [
"def",
"RemoveClientLabels",
"(",
"self",
",",
"client",
",",
"labels_names",
")",
":",
"affected_owners",
"=",
"set",
"(",
")",
"for",
"label",
"in",
"client",
".",
"GetLabels",
"(",
")",
":",
"if",
"label",
".",
"name",
"in",
"labels_names",
"and",
"la... | Removes labels with given names from a given client object. | [
"Removes",
"labels",
"with",
"given",
"names",
"from",
"a",
"given",
"client",
"object",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/client.py#L825-L834 | train | Removes labels with given names from a given client object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries._NormalizeTime | def _NormalizeTime(self, time):
"""Normalize a time to be an int measured in microseconds."""
if isinstance(time, rdfvalue.RDFDatetime):
return time.AsMicrosecondsSinceEpoch()
if isinstance(time, rdfvalue.Duration):
return time.microseconds
return int(time) | python | def _NormalizeTime(self, time):
"""Normalize a time to be an int measured in microseconds."""
if isinstance(time, rdfvalue.RDFDatetime):
return time.AsMicrosecondsSinceEpoch()
if isinstance(time, rdfvalue.Duration):
return time.microseconds
return int(time) | [
"def",
"_NormalizeTime",
"(",
"self",
",",
"time",
")",
":",
"if",
"isinstance",
"(",
"time",
",",
"rdfvalue",
".",
"RDFDatetime",
")",
":",
"return",
"time",
".",
"AsMicrosecondsSinceEpoch",
"(",
")",
"if",
"isinstance",
"(",
"time",
",",
"rdfvalue",
".",... | Normalize a time to be an int measured in microseconds. | [
"Normalize",
"a",
"time",
"to",
"be",
"an",
"int",
"measured",
"in",
"microseconds",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L38-L44 | train | Normalize a time to be an int measured in microseconds. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries.Append | def Append(self, value, timestamp):
"""Adds value at timestamp.
Values must be added in order of increasing timestamp.
Args:
value: An observed value.
timestamp: The timestamp at which value was observed.
Raises:
RuntimeError: If timestamp is smaller than the previous timstamp.
... | python | def Append(self, value, timestamp):
"""Adds value at timestamp.
Values must be added in order of increasing timestamp.
Args:
value: An observed value.
timestamp: The timestamp at which value was observed.
Raises:
RuntimeError: If timestamp is smaller than the previous timstamp.
... | [
"def",
"Append",
"(",
"self",
",",
"value",
",",
"timestamp",
")",
":",
"timestamp",
"=",
"self",
".",
"_NormalizeTime",
"(",
"timestamp",
")",
"if",
"self",
".",
"data",
"and",
"timestamp",
"<",
"self",
".",
"data",
"[",
"-",
"1",
"]",
"[",
"1",
"... | Adds value at timestamp.
Values must be added in order of increasing timestamp.
Args:
value: An observed value.
timestamp: The timestamp at which value was observed.
Raises:
RuntimeError: If timestamp is smaller than the previous timstamp. | [
"Adds",
"value",
"at",
"timestamp",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L46-L62 | train | Adds value at timestamp. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries.MultiAppend | def MultiAppend(self, value_timestamp_pairs):
"""Adds multiple value<->timestamp pairs.
Args:
value_timestamp_pairs: Tuples of (value, timestamp).
"""
for value, timestamp in value_timestamp_pairs:
self.Append(value, timestamp) | python | def MultiAppend(self, value_timestamp_pairs):
"""Adds multiple value<->timestamp pairs.
Args:
value_timestamp_pairs: Tuples of (value, timestamp).
"""
for value, timestamp in value_timestamp_pairs:
self.Append(value, timestamp) | [
"def",
"MultiAppend",
"(",
"self",
",",
"value_timestamp_pairs",
")",
":",
"for",
"value",
",",
"timestamp",
"in",
"value_timestamp_pairs",
":",
"self",
".",
"Append",
"(",
"value",
",",
"timestamp",
")"
] | Adds multiple value<->timestamp pairs.
Args:
value_timestamp_pairs: Tuples of (value, timestamp). | [
"Adds",
"multiple",
"value<",
"-",
">",
"timestamp",
"pairs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L64-L71 | train | Adds multiple value< = timestamp pairs to the end of the sequence. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries.FilterRange | def FilterRange(self, start_time=None, stop_time=None):
"""Filter the series to lie between start_time and stop_time.
Removes all values of the series which are outside of some time range.
Args:
start_time: If set, timestamps before start_time will be dropped.
stop_time: If set, timestamps at ... | python | def FilterRange(self, start_time=None, stop_time=None):
"""Filter the series to lie between start_time and stop_time.
Removes all values of the series which are outside of some time range.
Args:
start_time: If set, timestamps before start_time will be dropped.
stop_time: If set, timestamps at ... | [
"def",
"FilterRange",
"(",
"self",
",",
"start_time",
"=",
"None",
",",
"stop_time",
"=",
"None",
")",
":",
"start_time",
"=",
"self",
".",
"_NormalizeTime",
"(",
"start_time",
")",
"stop_time",
"=",
"self",
".",
"_NormalizeTime",
"(",
"stop_time",
")",
"s... | Filter the series to lie between start_time and stop_time.
Removes all values of the series which are outside of some time range.
Args:
start_time: If set, timestamps before start_time will be dropped.
stop_time: If set, timestamps at or past stop_time will be dropped. | [
"Filter",
"the",
"series",
"to",
"lie",
"between",
"start_time",
"and",
"stop_time",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L73-L89 | train | Filter the series to lie between start_time and stop_time. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries.Normalize | def Normalize(self, period, start_time, stop_time, mode=NORMALIZE_MODE_GAUGE):
"""Normalize the series to have a fixed period over a fixed time range.
Supports two modes, depending on the type of data:
NORMALIZE_MODE_GAUGE: support gauge values. If multiple original data
points lie within an out... | python | def Normalize(self, period, start_time, stop_time, mode=NORMALIZE_MODE_GAUGE):
"""Normalize the series to have a fixed period over a fixed time range.
Supports two modes, depending on the type of data:
NORMALIZE_MODE_GAUGE: support gauge values. If multiple original data
points lie within an out... | [
"def",
"Normalize",
"(",
"self",
",",
"period",
",",
"start_time",
",",
"stop_time",
",",
"mode",
"=",
"NORMALIZE_MODE_GAUGE",
")",
":",
"period",
"=",
"self",
".",
"_NormalizeTime",
"(",
"period",
")",
"start_time",
"=",
"self",
".",
"_NormalizeTime",
"(",
... | Normalize the series to have a fixed period over a fixed time range.
Supports two modes, depending on the type of data:
NORMALIZE_MODE_GAUGE: support gauge values. If multiple original data
points lie within an output interval, the output value is an average of
the original data point. if n... | [
"Normalize",
"the",
"series",
"to",
"have",
"a",
"fixed",
"period",
"over",
"a",
"fixed",
"time",
"range",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L91-L153 | train | Normalizes the series to have a fixed period over a fixed time range. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries.MakeIncreasing | def MakeIncreasing(self):
"""Makes the time series increasing.
Assumes that series is based on a counter which is occasionally reset, and
using this assumption converts the sequence to estimate the total number of
counts which occurred.
NOTE: Could give inacurate numbers in either of the following... | python | def MakeIncreasing(self):
"""Makes the time series increasing.
Assumes that series is based on a counter which is occasionally reset, and
using this assumption converts the sequence to estimate the total number of
counts which occurred.
NOTE: Could give inacurate numbers in either of the following... | [
"def",
"MakeIncreasing",
"(",
"self",
")",
":",
"offset",
"=",
"0",
"last_value",
"=",
"None",
"for",
"p",
"in",
"self",
".",
"data",
":",
"if",
"last_value",
"and",
"last_value",
">",
"p",
"[",
"0",
"]",
":",
"# Assume that it was only reset once.",
"offs... | Makes the time series increasing.
Assumes that series is based on a counter which is occasionally reset, and
using this assumption converts the sequence to estimate the total number of
counts which occurred.
NOTE: Could give inacurate numbers in either of the following cases: 1)
Multiple resets oc... | [
"Makes",
"the",
"time",
"series",
"increasing",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L155-L175 | train | Makes the time series increasing. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries.ToDeltas | def ToDeltas(self):
"""Convert the sequence to the sequence of differences between points.
The value of each point v[i] is replaced by v[i+1] - v[i], except for the
last point which is dropped.
"""
if len(self.data) < 2:
self.data = []
return
for i in range(0, len(self.data) - 1):
... | python | def ToDeltas(self):
"""Convert the sequence to the sequence of differences between points.
The value of each point v[i] is replaced by v[i+1] - v[i], except for the
last point which is dropped.
"""
if len(self.data) < 2:
self.data = []
return
for i in range(0, len(self.data) - 1):
... | [
"def",
"ToDeltas",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"data",
")",
"<",
"2",
":",
"self",
".",
"data",
"=",
"[",
"]",
"return",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"self",
".",
"data",
")",
"-",
"1",
")"... | Convert the sequence to the sequence of differences between points.
The value of each point v[i] is replaced by v[i+1] - v[i], except for the
last point which is dropped. | [
"Convert",
"the",
"sequence",
"to",
"the",
"sequence",
"of",
"differences",
"between",
"points",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L177-L191 | train | Convert the sequence of differences between points. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries.Add | def Add(self, other):
"""Add other to self pointwise.
Requires that both self and other are of the same length, and contain
identical timestamps. Typically this means that Normalize has been called
on both with identical time parameters.
Args:
other: The sequence to add to self.
Raises:... | python | def Add(self, other):
"""Add other to self pointwise.
Requires that both self and other are of the same length, and contain
identical timestamps. Typically this means that Normalize has been called
on both with identical time parameters.
Args:
other: The sequence to add to self.
Raises:... | [
"def",
"Add",
"(",
"self",
",",
"other",
")",
":",
"if",
"len",
"(",
"self",
".",
"data",
")",
"!=",
"len",
"(",
"other",
".",
"data",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Can only add series of identical lengths.\"",
")",
"for",
"i",
"in",
"range"... | Add other to self pointwise.
Requires that both self and other are of the same length, and contain
identical timestamps. Typically this means that Normalize has been called
on both with identical time parameters.
Args:
other: The sequence to add to self.
Raises:
RuntimeError: other do... | [
"Add",
"other",
"to",
"self",
"pointwise",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L193-L213 | train | Adds other to self pointwise. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/timeseries.py | Timeseries.Mean | def Mean(self):
"""Return the arithmatic mean of all values."""
values = [v for v, _ in self.data if v is not None]
if not values:
return None
# TODO(hanuszczak): Why do we return a floored division result instead of
# the exact value?
return sum(values) // len(values) | python | def Mean(self):
"""Return the arithmatic mean of all values."""
values = [v for v, _ in self.data if v is not None]
if not values:
return None
# TODO(hanuszczak): Why do we return a floored division result instead of
# the exact value?
return sum(values) // len(values) | [
"def",
"Mean",
"(",
"self",
")",
":",
"values",
"=",
"[",
"v",
"for",
"v",
",",
"_",
"in",
"self",
".",
"data",
"if",
"v",
"is",
"not",
"None",
"]",
"if",
"not",
"values",
":",
"return",
"None",
"# TODO(hanuszczak): Why do we return a floored division resu... | Return the arithmatic mean of all values. | [
"Return",
"the",
"arithmatic",
"mean",
"of",
"all",
"values",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/timeseries.py#L221-L229 | train | Return the arithmatic mean of all values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/rdfvalues/artifacts.py | ArtifactSource.Validate | def Validate(self):
"""Check the source is well constructed."""
self._ValidateReturnedTypes()
self._ValidatePaths()
self._ValidateType()
self._ValidateRequiredAttributes()
self._ValidateCommandArgs() | python | def Validate(self):
"""Check the source is well constructed."""
self._ValidateReturnedTypes()
self._ValidatePaths()
self._ValidateType()
self._ValidateRequiredAttributes()
self._ValidateCommandArgs() | [
"def",
"Validate",
"(",
"self",
")",
":",
"self",
".",
"_ValidateReturnedTypes",
"(",
")",
"self",
".",
"_ValidatePaths",
"(",
")",
"self",
".",
"_ValidateType",
"(",
")",
"self",
".",
"_ValidateRequiredAttributes",
"(",
")",
"self",
".",
"_ValidateCommandArgs... | Check the source is well constructed. | [
"Check",
"the",
"source",
"is",
"well",
"constructed",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/artifacts.py#L173-L179 | train | Check the source is well constructed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/rdfvalues/artifacts.py | Artifact.ToPrimitiveDict | def ToPrimitiveDict(self):
"""Handle dict generation specifically for Artifacts."""
artifact_dict = super(Artifact, self).ToPrimitiveDict()
# ArtifactName is not JSON-serializable, so convert name to string.
artifact_dict["name"] = utils.SmartStr(self.name)
# Convert proto enum to simple strings s... | python | def ToPrimitiveDict(self):
"""Handle dict generation specifically for Artifacts."""
artifact_dict = super(Artifact, self).ToPrimitiveDict()
# ArtifactName is not JSON-serializable, so convert name to string.
artifact_dict["name"] = utils.SmartStr(self.name)
# Convert proto enum to simple strings s... | [
"def",
"ToPrimitiveDict",
"(",
"self",
")",
":",
"artifact_dict",
"=",
"super",
"(",
"Artifact",
",",
"self",
")",
".",
"ToPrimitiveDict",
"(",
")",
"# ArtifactName is not JSON-serializable, so convert name to string.",
"artifact_dict",
"[",
"\"name\"",
"]",
"=",
"uti... | Handle dict generation specifically for Artifacts. | [
"Handle",
"dict",
"generation",
"specifically",
"for",
"Artifacts",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/artifacts.py#L306-L328 | train | Handle dict generation specifically for Artifacts. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | BaseHandler.Validate | def Validate(self):
"""Verifies this filter set can process the result data."""
# All filters can handle the input type.
bad_filters = []
for f in self.filters:
try:
f.Validate()
except DefinitionError as e:
bad_filters.append("%s: %s" % (f.expression, e))
if bad_filters:... | python | def Validate(self):
"""Verifies this filter set can process the result data."""
# All filters can handle the input type.
bad_filters = []
for f in self.filters:
try:
f.Validate()
except DefinitionError as e:
bad_filters.append("%s: %s" % (f.expression, e))
if bad_filters:... | [
"def",
"Validate",
"(",
"self",
")",
":",
"# All filters can handle the input type.",
"bad_filters",
"=",
"[",
"]",
"for",
"f",
"in",
"self",
".",
"filters",
":",
"try",
":",
"f",
".",
"Validate",
"(",
")",
"except",
"DefinitionError",
"as",
"e",
":",
"bad... | Verifies this filter set can process the result data. | [
"Verifies",
"this",
"filter",
"set",
"can",
"process",
"the",
"result",
"data",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L60-L71 | train | Verifies this filter set can process the result data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | ParallelHandler.Parse | def Parse(self, raw_data):
"""Take the data and yield results that passed through the filters.
The output of each filter is added to a result set. So long as the filter
selects, but does not modify, raw data, the result count will remain
accurate.
Args:
raw_data: An iterable series of rdf va... | python | def Parse(self, raw_data):
"""Take the data and yield results that passed through the filters.
The output of each filter is added to a result set. So long as the filter
selects, but does not modify, raw data, the result count will remain
accurate.
Args:
raw_data: An iterable series of rdf va... | [
"def",
"Parse",
"(",
"self",
",",
"raw_data",
")",
":",
"self",
".",
"results",
"=",
"set",
"(",
")",
"if",
"not",
"self",
".",
"filters",
":",
"self",
".",
"results",
".",
"update",
"(",
"raw_data",
")",
"else",
":",
"for",
"f",
"in",
"self",
".... | Take the data and yield results that passed through the filters.
The output of each filter is added to a result set. So long as the filter
selects, but does not modify, raw data, the result count will remain
accurate.
Args:
raw_data: An iterable series of rdf values.
Returns:
A list o... | [
"Take",
"the",
"data",
"and",
"yield",
"results",
"that",
"passed",
"through",
"the",
"filters",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L89-L108 | train | Take the data and yield results that passed through the filters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | SerialHandler.Parse | def Parse(self, raw_data):
"""Take the results and yield results that passed through the filters.
The output of each filter is used as the input for successive filters.
Args:
raw_data: An iterable series of rdf values.
Returns:
A list of rdf values that matched all filters.
"""
se... | python | def Parse(self, raw_data):
"""Take the results and yield results that passed through the filters.
The output of each filter is used as the input for successive filters.
Args:
raw_data: An iterable series of rdf values.
Returns:
A list of rdf values that matched all filters.
"""
se... | [
"def",
"Parse",
"(",
"self",
",",
"raw_data",
")",
":",
"self",
".",
"results",
"=",
"raw_data",
"for",
"f",
"in",
"self",
".",
"filters",
":",
"self",
".",
"results",
"=",
"f",
".",
"Parse",
"(",
"self",
".",
"results",
")",
"return",
"self",
".",... | Take the results and yield results that passed through the filters.
The output of each filter is used as the input for successive filters.
Args:
raw_data: An iterable series of rdf values.
Returns:
A list of rdf values that matched all filters. | [
"Take",
"the",
"results",
"and",
"yield",
"results",
"that",
"passed",
"through",
"the",
"filters",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L114-L128 | train | Take the results and yield results that passed through the filters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | Filter.GetFilter | def GetFilter(cls, filter_name):
"""Return an initialized filter. Only initialize filters once.
Args:
filter_name: The name of the filter, as a string.
Returns:
an initialized instance of the filter.
Raises:
DefinitionError if the type of filter has not been defined.
"""
# C... | python | def GetFilter(cls, filter_name):
"""Return an initialized filter. Only initialize filters once.
Args:
filter_name: The name of the filter, as a string.
Returns:
an initialized instance of the filter.
Raises:
DefinitionError if the type of filter has not been defined.
"""
# C... | [
"def",
"GetFilter",
"(",
"cls",
",",
"filter_name",
")",
":",
"# Check if the filter is defined in the registry.",
"try",
":",
"filt_cls",
"=",
"cls",
".",
"GetPlugin",
"(",
"filter_name",
")",
"except",
"KeyError",
":",
"raise",
"DefinitionError",
"(",
"\"Filter %s... | Return an initialized filter. Only initialize filters once.
Args:
filter_name: The name of the filter, as a string.
Returns:
an initialized instance of the filter.
Raises:
DefinitionError if the type of filter has not been defined. | [
"Return",
"an",
"initialized",
"filter",
".",
"Only",
"initialize",
"filters",
"once",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L141-L159 | train | Returns an initialized filter. Only initialize filters once. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | AttrFilter._GetVal | def _GetVal(self, obj, key):
"""Recurse down an attribute chain to the actual result data."""
if "." in key:
lhs, rhs = key.split(".", 1)
obj2 = getattr(obj, lhs, None)
if obj2 is None:
return None
return self._GetVal(obj2, rhs)
else:
return getattr(obj, key, None) | python | def _GetVal(self, obj, key):
"""Recurse down an attribute chain to the actual result data."""
if "." in key:
lhs, rhs = key.split(".", 1)
obj2 = getattr(obj, lhs, None)
if obj2 is None:
return None
return self._GetVal(obj2, rhs)
else:
return getattr(obj, key, None) | [
"def",
"_GetVal",
"(",
"self",
",",
"obj",
",",
"key",
")",
":",
"if",
"\".\"",
"in",
"key",
":",
"lhs",
",",
"rhs",
"=",
"key",
".",
"split",
"(",
"\".\"",
",",
"1",
")",
"obj2",
"=",
"getattr",
"(",
"obj",
",",
"lhs",
",",
"None",
")",
"if"... | Recurse down an attribute chain to the actual result data. | [
"Recurse",
"down",
"an",
"attribute",
"chain",
"to",
"the",
"actual",
"result",
"data",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L199-L208 | train | Recursively walks down an attribute chain to the actual result data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | ObjectFilter.ParseObjs | def ParseObjs(self, objs, expression):
"""Parse one or more objects using an objectfilter expression."""
filt = self._Compile(expression)
for result in filt.Filter(objs):
yield result | python | def ParseObjs(self, objs, expression):
"""Parse one or more objects using an objectfilter expression."""
filt = self._Compile(expression)
for result in filt.Filter(objs):
yield result | [
"def",
"ParseObjs",
"(",
"self",
",",
"objs",
",",
"expression",
")",
":",
"filt",
"=",
"self",
".",
"_Compile",
"(",
"expression",
")",
"for",
"result",
"in",
"filt",
".",
"Filter",
"(",
"objs",
")",
":",
"yield",
"result"
] | Parse one or more objects using an objectfilter expression. | [
"Parse",
"one",
"or",
"more",
"objects",
"using",
"an",
"objectfilter",
"expression",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L236-L240 | train | Parse one or more objects using an objectfilter expression. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | StatFilter._Comparator | def _Comparator(self, operator):
"""Generate lambdas for uid and gid comparison."""
if operator == "=":
return lambda x, y: x == y
elif operator == ">=":
return lambda x, y: x >= y
elif operator == ">":
return lambda x, y: x > y
elif operator == "<=":
return lambda x, y: x <=... | python | def _Comparator(self, operator):
"""Generate lambdas for uid and gid comparison."""
if operator == "=":
return lambda x, y: x == y
elif operator == ">=":
return lambda x, y: x >= y
elif operator == ">":
return lambda x, y: x > y
elif operator == "<=":
return lambda x, y: x <=... | [
"def",
"_Comparator",
"(",
"self",
",",
"operator",
")",
":",
"if",
"operator",
"==",
"\"=\"",
":",
"return",
"lambda",
"x",
",",
"y",
":",
"x",
"==",
"y",
"elif",
"operator",
"==",
"\">=\"",
":",
"return",
"lambda",
"x",
",",
"y",
":",
"x",
">=",
... | Generate lambdas for uid and gid comparison. | [
"Generate",
"lambdas",
"for",
"uid",
"and",
"gid",
"comparison",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L360-L374 | train | Generate lambdas for uid and gid comparison. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | StatFilter._Initialize | def _Initialize(self):
"""Initialize the filter configuration from a validated configuration.
The configuration is read. Active filters are added to the matcher list,
which is used to process the Stat values.
"""
if self.cfg.mask:
self.mask = int(self.cfg.mask[0], 8)
else:
self.mas... | python | def _Initialize(self):
"""Initialize the filter configuration from a validated configuration.
The configuration is read. Active filters are added to the matcher list,
which is used to process the Stat values.
"""
if self.cfg.mask:
self.mask = int(self.cfg.mask[0], 8)
else:
self.mas... | [
"def",
"_Initialize",
"(",
"self",
")",
":",
"if",
"self",
".",
"cfg",
".",
"mask",
":",
"self",
".",
"mask",
"=",
"int",
"(",
"self",
".",
"cfg",
".",
"mask",
"[",
"0",
"]",
",",
"8",
")",
"else",
":",
"self",
".",
"mask",
"=",
"0o7777",
"if... | Initialize the filter configuration from a validated configuration.
The configuration is read. Active filters are added to the matcher list,
which is used to process the Stat values. | [
"Initialize",
"the",
"filter",
"configuration",
"from",
"a",
"validated",
"configuration",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L397-L438 | train | Initialize the filter configuration from a validated configuration. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | StatFilter.ParseObjs | def ParseObjs(self, objs, expression):
"""Parse one or more objects by testing if it has matching stat results.
Args:
objs: An iterable of objects that should be checked.
expression: A StatFilter expression, e.g.:
"uid:>0 gid:=0 file_type:link"
Yields:
matching objects.
"""
... | python | def ParseObjs(self, objs, expression):
"""Parse one or more objects by testing if it has matching stat results.
Args:
objs: An iterable of objects that should be checked.
expression: A StatFilter expression, e.g.:
"uid:>0 gid:=0 file_type:link"
Yields:
matching objects.
"""
... | [
"def",
"ParseObjs",
"(",
"self",
",",
"objs",
",",
"expression",
")",
":",
"self",
".",
"Validate",
"(",
"expression",
")",
"for",
"obj",
"in",
"objs",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"rdf_client_fs",
".",
"StatEntry",
")",
":",
"conti... | Parse one or more objects by testing if it has matching stat results.
Args:
objs: An iterable of objects that should be checked.
expression: A StatFilter expression, e.g.:
"uid:>0 gid:=0 file_type:link"
Yields:
matching objects. | [
"Parse",
"one",
"or",
"more",
"objects",
"by",
"testing",
"if",
"it",
"has",
"matching",
"stat",
"results",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L440-L460 | train | Parse one or more objects by testing if they match the given expression. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | StatFilter.Validate | def Validate(self, expression):
"""Validates that a parsed rule entry is valid for fschecker.
Args:
expression: A rule expression.
Raises:
DefinitionError: If the filter definition could not be validated.
Returns:
True if the expression validated OK.
"""
parsed = self._Load(... | python | def Validate(self, expression):
"""Validates that a parsed rule entry is valid for fschecker.
Args:
expression: A rule expression.
Raises:
DefinitionError: If the filter definition could not be validated.
Returns:
True if the expression validated OK.
"""
parsed = self._Load(... | [
"def",
"Validate",
"(",
"self",
",",
"expression",
")",
":",
"parsed",
"=",
"self",
".",
"_Load",
"(",
"expression",
")",
"if",
"not",
"parsed",
":",
"raise",
"DefinitionError",
"(",
"\"Empty StatFilter expression.\"",
")",
"bad_keys",
"=",
"set",
"(",
"pars... | Validates that a parsed rule entry is valid for fschecker.
Args:
expression: A rule expression.
Raises:
DefinitionError: If the filter definition could not be validated.
Returns:
True if the expression validated OK. | [
"Validates",
"that",
"a",
"parsed",
"rule",
"entry",
"is",
"valid",
"for",
"fschecker",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L462-L539 | train | Validates that a parsed rule entry is valid for fschecker. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | RDFFilter.ParseObjs | def ParseObjs(self, objs, type_names):
"""Parse one or more objects by testing if it is a known RDF class."""
for obj in objs:
for type_name in self._RDFTypes(type_names):
if isinstance(obj, self._GetClass(type_name)):
yield obj | python | def ParseObjs(self, objs, type_names):
"""Parse one or more objects by testing if it is a known RDF class."""
for obj in objs:
for type_name in self._RDFTypes(type_names):
if isinstance(obj, self._GetClass(type_name)):
yield obj | [
"def",
"ParseObjs",
"(",
"self",
",",
"objs",
",",
"type_names",
")",
":",
"for",
"obj",
"in",
"objs",
":",
"for",
"type_name",
"in",
"self",
".",
"_RDFTypes",
"(",
"type_names",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"self",
".",
"_GetClass",
... | Parse one or more objects by testing if it is a known RDF class. | [
"Parse",
"one",
"or",
"more",
"objects",
"by",
"testing",
"if",
"it",
"is",
"a",
"known",
"RDF",
"class",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L552-L557 | train | Parse one or more objects by testing if they are a known RDF class. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/check_lib/filters.py | RDFFilter.Validate | def Validate(self, type_names):
"""Filtered types need to be RDFValues."""
errs = [n for n in self._RDFTypes(type_names) if not self._GetClass(n)]
if errs:
raise DefinitionError("Undefined RDF Types: %s" % ",".join(errs)) | python | def Validate(self, type_names):
"""Filtered types need to be RDFValues."""
errs = [n for n in self._RDFTypes(type_names) if not self._GetClass(n)]
if errs:
raise DefinitionError("Undefined RDF Types: %s" % ",".join(errs)) | [
"def",
"Validate",
"(",
"self",
",",
"type_names",
")",
":",
"errs",
"=",
"[",
"n",
"for",
"n",
"in",
"self",
".",
"_RDFTypes",
"(",
"type_names",
")",
"if",
"not",
"self",
".",
"_GetClass",
"(",
"n",
")",
"]",
"if",
"errs",
":",
"raise",
"Definiti... | Filtered types need to be RDFValues. | [
"Filtered",
"types",
"need",
"to",
"be",
"RDFValues",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/filters.py#L559-L563 | train | Validates that the given types are RDFValues. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/bin/worker.py | main | def main(argv):
"""Main."""
del argv # Unused.
if flags.FLAGS.version:
print("GRR worker {}".format(config_server.VERSION["packageversion"]))
return
config.CONFIG.AddContext(contexts.WORKER_CONTEXT,
"Context applied when running a worker.")
# Initialise flows and config_... | python | def main(argv):
"""Main."""
del argv # Unused.
if flags.FLAGS.version:
print("GRR worker {}".format(config_server.VERSION["packageversion"]))
return
config.CONFIG.AddContext(contexts.WORKER_CONTEXT,
"Context applied when running a worker.")
# Initialise flows and config_... | [
"def",
"main",
"(",
"argv",
")",
":",
"del",
"argv",
"# Unused.",
"if",
"flags",
".",
"FLAGS",
".",
"version",
":",
"print",
"(",
"\"GRR worker {}\"",
".",
"format",
"(",
"config_server",
".",
"VERSION",
"[",
"\"packageversion\"",
"]",
")",
")",
"return",
... | Main. | [
"Main",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/bin/worker.py#L37-L56 | train | Main function for GRR worker. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/compatibility.py | GetName | def GetName(obj):
"""A compatibility wrapper for getting object's name.
In Python 2 class names are returned as `bytes` (since class names can contain
only ASCII characters) whereas in Python 3 they are `unicode` (since class
names can contain arbitrary unicode characters).
This function makes this behaviou... | python | def GetName(obj):
"""A compatibility wrapper for getting object's name.
In Python 2 class names are returned as `bytes` (since class names can contain
only ASCII characters) whereas in Python 3 they are `unicode` (since class
names can contain arbitrary unicode characters).
This function makes this behaviou... | [
"def",
"GetName",
"(",
"obj",
")",
":",
"precondition",
".",
"AssertType",
"(",
"obj",
",",
"(",
"type",
",",
"types",
".",
"FunctionType",
")",
")",
"if",
"PY2",
":",
"return",
"obj",
".",
"__name__",
".",
"decode",
"(",
"\"ascii\"",
")",
"else",
":... | A compatibility wrapper for getting object's name.
In Python 2 class names are returned as `bytes` (since class names can contain
only ASCII characters) whereas in Python 3 they are `unicode` (since class
names can contain arbitrary unicode characters).
This function makes this behaviour consistent and always... | [
"A",
"compatibility",
"wrapper",
"for",
"getting",
"object",
"s",
"name",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compatibility.py#L80-L104 | train | A compatibility wrapper for getting object s name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/compatibility.py | SetName | def SetName(obj, name):
"""A compatibility wrapper for setting object's name.
See documentation for `GetName` for more information.
Args:
obj: A type or function object to set the name for.
name: A name to set.
"""
# Not doing type assertion on obj, since it may be a mock object used
# in tests.
... | python | def SetName(obj, name):
"""A compatibility wrapper for setting object's name.
See documentation for `GetName` for more information.
Args:
obj: A type or function object to set the name for.
name: A name to set.
"""
# Not doing type assertion on obj, since it may be a mock object used
# in tests.
... | [
"def",
"SetName",
"(",
"obj",
",",
"name",
")",
":",
"# Not doing type assertion on obj, since it may be a mock object used",
"# in tests.",
"precondition",
".",
"AssertType",
"(",
"name",
",",
"str",
")",
"if",
"PY2",
":",
"obj",
".",
"__name__",
"=",
"name",
"."... | A compatibility wrapper for setting object's name.
See documentation for `GetName` for more information.
Args:
obj: A type or function object to set the name for.
name: A name to set. | [
"A",
"compatibility",
"wrapper",
"for",
"setting",
"object",
"s",
"name",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compatibility.py#L107-L123 | train | A compatibility wrapper for setting object s name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/compatibility.py | ListAttrs | def ListAttrs(cls):
"""A compatibility wrapper for listing class attributes.
This method solves similar Python 2 compatibility issues for `dir` function as
`GetName` does for `__name__` invocations. See documentation for `GetName` for
more details.
Once support for Python 2 is dropped all invocations of thi... | python | def ListAttrs(cls):
"""A compatibility wrapper for listing class attributes.
This method solves similar Python 2 compatibility issues for `dir` function as
`GetName` does for `__name__` invocations. See documentation for `GetName` for
more details.
Once support for Python 2 is dropped all invocations of thi... | [
"def",
"ListAttrs",
"(",
"cls",
")",
":",
"precondition",
".",
"AssertType",
"(",
"cls",
",",
"type",
")",
"if",
"PY2",
":",
"# TODO(user): once https://github.com/google/pytype/issues/127 is fixed,",
"# pytype should be able to tell that this line is unreachable in py3.",
"ret... | A compatibility wrapper for listing class attributes.
This method solves similar Python 2 compatibility issues for `dir` function as
`GetName` does for `__name__` invocations. See documentation for `GetName` for
more details.
Once support for Python 2 is dropped all invocations of this function should
be re... | [
"A",
"compatibility",
"wrapper",
"for",
"listing",
"class",
"attributes",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compatibility.py#L126-L149 | train | A compatibility wrapper for listing class attributes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/compatibility.py | MakeType | def MakeType(name, base_classes,
namespace):
"""A compatibility wrapper for the `type` built-in function.
In Python 2 `type` (used as a type constructor) requires the name argument to
be a `bytes` object whereas in Python 3 it is required to be an `unicode`
object. Since class name is human readab... | python | def MakeType(name, base_classes,
namespace):
"""A compatibility wrapper for the `type` built-in function.
In Python 2 `type` (used as a type constructor) requires the name argument to
be a `bytes` object whereas in Python 3 it is required to be an `unicode`
object. Since class name is human readab... | [
"def",
"MakeType",
"(",
"name",
",",
"base_classes",
",",
"namespace",
")",
":",
"precondition",
".",
"AssertType",
"(",
"name",
",",
"str",
")",
"if",
"PY2",
":",
"name",
"=",
"name",
".",
"encode",
"(",
"\"ascii\"",
")",
"return",
"type",
"(",
"name"... | A compatibility wrapper for the `type` built-in function.
In Python 2 `type` (used as a type constructor) requires the name argument to
be a `bytes` object whereas in Python 3 it is required to be an `unicode`
object. Since class name is human readable text rather than arbitrary stream
of bytes, the Python 3 b... | [
"A",
"compatibility",
"wrapper",
"for",
"the",
"type",
"built",
"-",
"in",
"function",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compatibility.py#L152-L179 | train | A compatibility wrapper for the type function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/compatibility.py | FormatTime | def FormatTime(fmt, stime = None):
"""A compatibility wrapper for the `strftime` function.
It is guaranteed to always take unicode string as an argument and return an
unicode string as a result.
Args:
fmt: A format string specifying formatting of the output.
stime: A time representation as returned by... | python | def FormatTime(fmt, stime = None):
"""A compatibility wrapper for the `strftime` function.
It is guaranteed to always take unicode string as an argument and return an
unicode string as a result.
Args:
fmt: A format string specifying formatting of the output.
stime: A time representation as returned by... | [
"def",
"FormatTime",
"(",
"fmt",
",",
"stime",
"=",
"None",
")",
":",
"precondition",
".",
"AssertType",
"(",
"fmt",
",",
"str",
")",
"precondition",
".",
"AssertOptionalType",
"(",
"stime",
",",
"time",
".",
"struct_time",
")",
"# TODO(hanuszczak): https://gi... | A compatibility wrapper for the `strftime` function.
It is guaranteed to always take unicode string as an argument and return an
unicode string as a result.
Args:
fmt: A format string specifying formatting of the output.
stime: A time representation as returned by `gmtime` or `localtime`.
Returns:
... | [
"A",
"compatibility",
"wrapper",
"for",
"the",
"strftime",
"function",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compatibility.py#L182-L210 | train | A compatibility wrapper for the strftime function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/compatibility.py | ShlexSplit | def ShlexSplit(string):
"""A wrapper for `shlex.split` that works with unicode objects.
Args:
string: A unicode string to split.
Returns:
A list of unicode strings representing parts of the input string.
"""
precondition.AssertType(string, Text)
if PY2:
string = string.encode("utf-8")
part... | python | def ShlexSplit(string):
"""A wrapper for `shlex.split` that works with unicode objects.
Args:
string: A unicode string to split.
Returns:
A list of unicode strings representing parts of the input string.
"""
precondition.AssertType(string, Text)
if PY2:
string = string.encode("utf-8")
part... | [
"def",
"ShlexSplit",
"(",
"string",
")",
":",
"precondition",
".",
"AssertType",
"(",
"string",
",",
"Text",
")",
"if",
"PY2",
":",
"string",
"=",
"string",
".",
"encode",
"(",
"\"utf-8\"",
")",
"parts",
"=",
"shlex",
".",
"split",
"(",
"string",
")",
... | A wrapper for `shlex.split` that works with unicode objects.
Args:
string: A unicode string to split.
Returns:
A list of unicode strings representing parts of the input string. | [
"A",
"wrapper",
"for",
"shlex",
".",
"split",
"that",
"works",
"with",
"unicode",
"objects",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compatibility.py#L214-L236 | train | A wrapper for shlex. split that works with unicode objects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/compatibility.py | Environ | def Environ(variable, default):
"""A wrapper for `os.environ.get` that works the same way in both Pythons.
Args:
variable: A name of the variable to get the value of.
default: A default value to return in case no value for the given variable
is set.
Returns:
An environment value of the given v... | python | def Environ(variable, default):
"""A wrapper for `os.environ.get` that works the same way in both Pythons.
Args:
variable: A name of the variable to get the value of.
default: A default value to return in case no value for the given variable
is set.
Returns:
An environment value of the given v... | [
"def",
"Environ",
"(",
"variable",
",",
"default",
")",
":",
"precondition",
".",
"AssertType",
"(",
"variable",
",",
"Text",
")",
"value",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"variable",
",",
"default",
")",
"if",
"value",
"is",
"None",
":",
... | A wrapper for `os.environ.get` that works the same way in both Pythons.
Args:
variable: A name of the variable to get the value of.
default: A default value to return in case no value for the given variable
is set.
Returns:
An environment value of the given variable. | [
"A",
"wrapper",
"for",
"os",
".",
"environ",
".",
"get",
"that",
"works",
"the",
"same",
"way",
"in",
"both",
"Pythons",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compatibility.py#L252-L271 | train | A wrapper for os. environ. get that works the same way in both Pythons and Pythons. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/compat/json.py | Dump | def Dump(obj,
sort_keys = False,
encoder = None):
"""Stringifies a Python object into its JSON representation.
Args:
obj: A Python object to convert to JSON.
sort_keys: If True, output dictionaries keys in sorted (ascending) order.
encoder: An (optional) encoder class to use.
Retur... | python | def Dump(obj,
sort_keys = False,
encoder = None):
"""Stringifies a Python object into its JSON representation.
Args:
obj: A Python object to convert to JSON.
sort_keys: If True, output dictionaries keys in sorted (ascending) order.
encoder: An (optional) encoder class to use.
Retur... | [
"def",
"Dump",
"(",
"obj",
",",
"sort_keys",
"=",
"False",
",",
"encoder",
"=",
"None",
")",
":",
"# Python 2 json.dumps expects separators as a tuple of bytes, while",
"# Python 3 expects them to be a tuple of unicode strings. Pytype",
"# is too dumb to infer the result of the if st... | Stringifies a Python object into its JSON representation.
Args:
obj: A Python object to convert to JSON.
sort_keys: If True, output dictionaries keys in sorted (ascending) order.
encoder: An (optional) encoder class to use.
Returns:
A JSON representation of the given object. | [
"Stringifies",
"a",
"Python",
"object",
"into",
"its",
"JSON",
"representation",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/json.py#L69-L101 | train | Stringifies a Python object into its JSON representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/server_startup.py | DropPrivileges | def DropPrivileges():
"""Attempt to drop privileges if required."""
if config.CONFIG["Server.username"]:
try:
os.setuid(pwd.getpwnam(config.CONFIG["Server.username"]).pw_uid)
except (KeyError, OSError):
logging.exception("Unable to switch to user %s",
config.CONFIG["Serve... | python | def DropPrivileges():
"""Attempt to drop privileges if required."""
if config.CONFIG["Server.username"]:
try:
os.setuid(pwd.getpwnam(config.CONFIG["Server.username"]).pw_uid)
except (KeyError, OSError):
logging.exception("Unable to switch to user %s",
config.CONFIG["Serve... | [
"def",
"DropPrivileges",
"(",
")",
":",
"if",
"config",
".",
"CONFIG",
"[",
"\"Server.username\"",
"]",
":",
"try",
":",
"os",
".",
"setuid",
"(",
"pwd",
".",
"getpwnam",
"(",
"config",
".",
"CONFIG",
"[",
"\"Server.username\"",
"]",
")",
".",
"pw_uid",
... | Attempt to drop privileges if required. | [
"Attempt",
"to",
"drop",
"privileges",
"if",
"required",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/server_startup.py#L41-L49 | train | Attempt to drop privileges if required. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/server_startup.py | Init | def Init():
"""Run all required startup routines and initialization hooks."""
global INIT_RAN
if INIT_RAN:
return
# Set up a temporary syslog handler so we have somewhere to log problems
# with ConfigInit() which needs to happen before we can start our create our
# proper logging setup.
syslog_logger... | python | def Init():
"""Run all required startup routines and initialization hooks."""
global INIT_RAN
if INIT_RAN:
return
# Set up a temporary syslog handler so we have somewhere to log problems
# with ConfigInit() which needs to happen before we can start our create our
# proper logging setup.
syslog_logger... | [
"def",
"Init",
"(",
")",
":",
"global",
"INIT_RAN",
"if",
"INIT_RAN",
":",
"return",
"# Set up a temporary syslog handler so we have somewhere to log problems",
"# with ConfigInit() which needs to happen before we can start our create our",
"# proper logging setup.",
"syslog_logger",
"... | Run all required startup routines and initialization hooks. | [
"Run",
"all",
"required",
"startup",
"routines",
"and",
"initialization",
"hooks",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/server_startup.py#L56-L101 | train | Initialize the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/version.py | VersionPath | def VersionPath():
"""Returns a path to version.ini."""
# Try to get a version.ini. It should be in the resources if the code
# was packed with "pip sdist". It will be 2 levels up from grr_response_core
# if the code was installed via "pip install -e".
version_ini = (
package.ResourcePath("grr-response... | python | def VersionPath():
"""Returns a path to version.ini."""
# Try to get a version.ini. It should be in the resources if the code
# was packed with "pip sdist". It will be 2 levels up from grr_response_core
# if the code was installed via "pip install -e".
version_ini = (
package.ResourcePath("grr-response... | [
"def",
"VersionPath",
"(",
")",
":",
"# Try to get a version.ini. It should be in the resources if the code",
"# was packed with \"pip sdist\". It will be 2 levels up from grr_response_core",
"# if the code was installed via \"pip install -e\".",
"version_ini",
"=",
"(",
"package",
".",
"R... | Returns a path to version.ini. | [
"Returns",
"a",
"path",
"to",
"version",
".",
"ini",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/version.py#L15-L28 | train | Returns a path to version. ini. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/version.py | Version | def Version():
"""Return a dict with GRR version information."""
version_ini = VersionPath()
config = configparser.SafeConfigParser()
config.read(version_ini)
return dict(
packageversion=config.get("Version", "packageversion"),
major=config.getint("Version", "major"),
minor=config.getint("... | python | def Version():
"""Return a dict with GRR version information."""
version_ini = VersionPath()
config = configparser.SafeConfigParser()
config.read(version_ini)
return dict(
packageversion=config.get("Version", "packageversion"),
major=config.getint("Version", "major"),
minor=config.getint("... | [
"def",
"Version",
"(",
")",
":",
"version_ini",
"=",
"VersionPath",
"(",
")",
"config",
"=",
"configparser",
".",
"SafeConfigParser",
"(",
")",
"config",
".",
"read",
"(",
"version_ini",
")",
"return",
"dict",
"(",
"packageversion",
"=",
"config",
".",
"ge... | Return a dict with GRR version information. | [
"Return",
"a",
"dict",
"with",
"GRR",
"version",
"information",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/version.py#L31-L43 | train | Return a dict with GRR version information. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/client/grr_response_client/osx/process.py | Process.Regions | def Regions(self,
skip_executable_regions=False,
skip_shared_regions=False,
skip_readonly_regions=False):
"""Iterates over the readable regions for this process.
We use mach_vm_region_recurse here to get a fine grained view of
the process' memory space. The algorit... | python | def Regions(self,
skip_executable_regions=False,
skip_shared_regions=False,
skip_readonly_regions=False):
"""Iterates over the readable regions for this process.
We use mach_vm_region_recurse here to get a fine grained view of
the process' memory space. The algorit... | [
"def",
"Regions",
"(",
"self",
",",
"skip_executable_regions",
"=",
"False",
",",
"skip_shared_regions",
"=",
"False",
",",
"skip_readonly_regions",
"=",
"False",
")",
":",
"address",
"=",
"ctypes",
".",
"c_ulong",
"(",
"0",
")",
"mapsize",
"=",
"ctypes",
".... | Iterates over the readable regions for this process.
We use mach_vm_region_recurse here to get a fine grained view of
the process' memory space. The algorithm is that for some regions,
the function returns is_submap=True which means that there are
actually subregions that we need to examine by increasi... | [
"Iterates",
"over",
"the",
"readable",
"regions",
"for",
"this",
"process",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/osx/process.py#L96-L183 | train | Iterates over the readable regions of this process. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/client/grr_response_client/osx/process.py | Process.ReadBytes | def ReadBytes(self, address, num_bytes):
"""Reads at most num_bytes starting from offset <address>."""
pdata = ctypes.c_void_p(0)
data_cnt = ctypes.c_uint32(0)
ret = libc.mach_vm_read(self.task, ctypes.c_ulonglong(address),
ctypes.c_longlong(num_bytes), ctypes.pointer(pdata)... | python | def ReadBytes(self, address, num_bytes):
"""Reads at most num_bytes starting from offset <address>."""
pdata = ctypes.c_void_p(0)
data_cnt = ctypes.c_uint32(0)
ret = libc.mach_vm_read(self.task, ctypes.c_ulonglong(address),
ctypes.c_longlong(num_bytes), ctypes.pointer(pdata)... | [
"def",
"ReadBytes",
"(",
"self",
",",
"address",
",",
"num_bytes",
")",
":",
"pdata",
"=",
"ctypes",
".",
"c_void_p",
"(",
"0",
")",
"data_cnt",
"=",
"ctypes",
".",
"c_uint32",
"(",
"0",
")",
"ret",
"=",
"libc",
".",
"mach_vm_read",
"(",
"self",
".",... | Reads at most num_bytes starting from offset <address>. | [
"Reads",
"at",
"most",
"num_bytes",
"starting",
"from",
"offset",
"<address",
">",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/osx/process.py#L185-L197 | train | Reads at most num_bytes starting from offset <address >. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | BinarySIDtoStringSID | def BinarySIDtoStringSID(sid):
"""Converts a binary SID to its string representation.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379597.aspx
The byte representation of an SID is as follows:
Offset Length Description
00 01 revision
01 01 sub-authority count
0... | python | def BinarySIDtoStringSID(sid):
"""Converts a binary SID to its string representation.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379597.aspx
The byte representation of an SID is as follows:
Offset Length Description
00 01 revision
01 01 sub-authority count
0... | [
"def",
"BinarySIDtoStringSID",
"(",
"sid",
")",
":",
"precondition",
".",
"AssertType",
"(",
"sid",
",",
"bytes",
")",
"# TODO: This seemingly no-op is actually not a no-op. The reason",
"# is that `sid` might be either `bytes` from the future package or `str` (e.g.",
"# a bytes lite... | Converts a binary SID to its string representation.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379597.aspx
The byte representation of an SID is as follows:
Offset Length Description
00 01 revision
01 01 sub-authority count
02 06 authority (big endian... | [
"Converts",
"a",
"binary",
"SID",
"to",
"its",
"string",
"representation",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L30-L91 | train | Converts a binary SID to its string representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMIEventConsumerParser.ParseMultiple | def ParseMultiple(self, result_dicts):
"""Parse WMI Event Consumers."""
for result_dict in result_dicts:
wmi_dict = result_dict.ToDict()
try:
creator_sid_bytes = bytes(wmi_dict["CreatorSID"])
wmi_dict["CreatorSID"] = BinarySIDtoStringSID(creator_sid_bytes)
except ValueError:
... | python | def ParseMultiple(self, result_dicts):
"""Parse WMI Event Consumers."""
for result_dict in result_dicts:
wmi_dict = result_dict.ToDict()
try:
creator_sid_bytes = bytes(wmi_dict["CreatorSID"])
wmi_dict["CreatorSID"] = BinarySIDtoStringSID(creator_sid_bytes)
except ValueError:
... | [
"def",
"ParseMultiple",
"(",
"self",
",",
"result_dicts",
")",
":",
"for",
"result_dict",
"in",
"result_dicts",
":",
"wmi_dict",
"=",
"result_dict",
".",
"ToDict",
"(",
")",
"try",
":",
"creator_sid_bytes",
"=",
"bytes",
"(",
"wmi_dict",
"[",
"\"CreatorSID\"",... | Parse WMI Event Consumers. | [
"Parse",
"WMI",
"Event",
"Consumers",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L99-L138 | train | Parse WMI Event Consumers. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMIInstalledSoftwareParser.ParseMultiple | def ParseMultiple(self, result_dicts):
"""Parse the WMI packages output."""
status = rdf_client.SoftwarePackage.InstallState.INSTALLED
packages = []
for result_dict in result_dicts:
packages.append(
rdf_client.SoftwarePackage(
name=result_dict["Name"],
descrip... | python | def ParseMultiple(self, result_dicts):
"""Parse the WMI packages output."""
status = rdf_client.SoftwarePackage.InstallState.INSTALLED
packages = []
for result_dict in result_dicts:
packages.append(
rdf_client.SoftwarePackage(
name=result_dict["Name"],
descrip... | [
"def",
"ParseMultiple",
"(",
"self",
",",
"result_dicts",
")",
":",
"status",
"=",
"rdf_client",
".",
"SoftwarePackage",
".",
"InstallState",
".",
"INSTALLED",
"packages",
"=",
"[",
"]",
"for",
"result_dict",
"in",
"result_dicts",
":",
"packages",
".",
"append... | Parse the WMI packages output. | [
"Parse",
"the",
"WMI",
"packages",
"output",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L167-L180 | train | Parse the WMI packages output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMIHotfixesSoftwareParser.AmericanDateToEpoch | def AmericanDateToEpoch(self, date_str):
"""Take a US format date and return epoch."""
try:
epoch = time.strptime(date_str, "%m/%d/%Y")
return int(calendar.timegm(epoch)) * 1000000
except ValueError:
return 0 | python | def AmericanDateToEpoch(self, date_str):
"""Take a US format date and return epoch."""
try:
epoch = time.strptime(date_str, "%m/%d/%Y")
return int(calendar.timegm(epoch)) * 1000000
except ValueError:
return 0 | [
"def",
"AmericanDateToEpoch",
"(",
"self",
",",
"date_str",
")",
":",
"try",
":",
"epoch",
"=",
"time",
".",
"strptime",
"(",
"date_str",
",",
"\"%m/%d/%Y\"",
")",
"return",
"int",
"(",
"calendar",
".",
"timegm",
"(",
"epoch",
")",
")",
"*",
"1000000",
... | Take a US format date and return epoch. | [
"Take",
"a",
"US",
"format",
"date",
"and",
"return",
"epoch",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L189-L195 | train | Take a US format date and return epoch. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMIHotfixesSoftwareParser.ParseMultiple | def ParseMultiple(self, result_dicts):
"""Parse the WMI packages output."""
status = rdf_client.SoftwarePackage.InstallState.INSTALLED
packages = []
for result_dict in result_dicts:
result = result_dict.ToDict()
# InstalledOn comes back in a godawful format such as '7/10/2013'.
insta... | python | def ParseMultiple(self, result_dicts):
"""Parse the WMI packages output."""
status = rdf_client.SoftwarePackage.InstallState.INSTALLED
packages = []
for result_dict in result_dicts:
result = result_dict.ToDict()
# InstalledOn comes back in a godawful format such as '7/10/2013'.
insta... | [
"def",
"ParseMultiple",
"(",
"self",
",",
"result_dicts",
")",
":",
"status",
"=",
"rdf_client",
".",
"SoftwarePackage",
".",
"InstallState",
".",
"INSTALLED",
"packages",
"=",
"[",
"]",
"for",
"result_dict",
"in",
"result_dicts",
":",
"result",
"=",
"result_d... | Parse the WMI packages output. | [
"Parse",
"the",
"WMI",
"packages",
"output",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L197-L216 | train | Parse the WMI packages output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMIUserParser.ParseMultiple | def ParseMultiple(self, result_dicts):
"""Parse the WMI Win32_UserAccount output."""
for result_dict in result_dicts:
kb_user = rdf_client.User()
for wmi_key, kb_key in iteritems(self.account_mapping):
try:
kb_user.Set(kb_key, result_dict[wmi_key])
except KeyError:
... | python | def ParseMultiple(self, result_dicts):
"""Parse the WMI Win32_UserAccount output."""
for result_dict in result_dicts:
kb_user = rdf_client.User()
for wmi_key, kb_key in iteritems(self.account_mapping):
try:
kb_user.Set(kb_key, result_dict[wmi_key])
except KeyError:
... | [
"def",
"ParseMultiple",
"(",
"self",
",",
"result_dicts",
")",
":",
"for",
"result_dict",
"in",
"result_dicts",
":",
"kb_user",
"=",
"rdf_client",
".",
"User",
"(",
")",
"for",
"wmi_key",
",",
"kb_key",
"in",
"iteritems",
"(",
"self",
".",
"account_mapping",... | Parse the WMI Win32_UserAccount output. | [
"Parse",
"the",
"WMI",
"Win32_UserAccount",
"output",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L236-L250 | train | Parse the WMI Win32_UserAccount output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMILogicalDisksParser.ParseMultiple | def ParseMultiple(self, result_dicts):
"""Parse the WMI packages output."""
for result_dict in result_dicts:
result = result_dict.ToDict()
winvolume = rdf_client_fs.WindowsVolume(
drive_letter=result.get("DeviceID"),
drive_type=result.get("DriveType"))
try:
size = ... | python | def ParseMultiple(self, result_dicts):
"""Parse the WMI packages output."""
for result_dict in result_dicts:
result = result_dict.ToDict()
winvolume = rdf_client_fs.WindowsVolume(
drive_letter=result.get("DeviceID"),
drive_type=result.get("DriveType"))
try:
size = ... | [
"def",
"ParseMultiple",
"(",
"self",
",",
"result_dicts",
")",
":",
"for",
"result_dict",
"in",
"result_dicts",
":",
"result",
"=",
"result_dict",
".",
"ToDict",
"(",
")",
"winvolume",
"=",
"rdf_client_fs",
".",
"WindowsVolume",
"(",
"drive_letter",
"=",
"resu... | Parse the WMI packages output. | [
"Parse",
"the",
"WMI",
"packages",
"output",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L259-L286 | train | Parse the WMI packages output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMIComputerSystemProductParser.ParseMultiple | def ParseMultiple(self, result_dicts):
"""Parse the WMI output to get Identifying Number."""
for result_dict in result_dicts:
# Currently we are only grabbing the Identifying Number
# as the serial number (catches the unique number for VMs).
# This could be changed to include more information ... | python | def ParseMultiple(self, result_dicts):
"""Parse the WMI output to get Identifying Number."""
for result_dict in result_dicts:
# Currently we are only grabbing the Identifying Number
# as the serial number (catches the unique number for VMs).
# This could be changed to include more information ... | [
"def",
"ParseMultiple",
"(",
"self",
",",
"result_dicts",
")",
":",
"for",
"result_dict",
"in",
"result_dicts",
":",
"# Currently we are only grabbing the Identifying Number",
"# as the serial number (catches the unique number for VMs).",
"# This could be changed to include more inform... | Parse the WMI output to get Identifying Number. | [
"Parse",
"the",
"WMI",
"output",
"to",
"get",
"Identifying",
"Number",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L295-L305 | train | Parse the WMI output to get Identifying Number. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMIInterfacesParser.WMITimeStrToRDFDatetime | def WMITimeStrToRDFDatetime(self, timestr):
"""Return RDFDatetime from string like 20140825162259.000000-420.
Args:
timestr: WMI time string
Returns:
rdfvalue.RDFDatetime
We have some timezone manipulation work to do here because the UTC offset is
in minutes rather than +-HHMM
"""... | python | def WMITimeStrToRDFDatetime(self, timestr):
"""Return RDFDatetime from string like 20140825162259.000000-420.
Args:
timestr: WMI time string
Returns:
rdfvalue.RDFDatetime
We have some timezone manipulation work to do here because the UTC offset is
in minutes rather than +-HHMM
"""... | [
"def",
"WMITimeStrToRDFDatetime",
"(",
"self",
",",
"timestr",
")",
":",
"# We use manual parsing here because the time functions provided (datetime,",
"# dateutil) do not properly deal with timezone information.",
"offset_minutes",
"=",
"timestr",
"[",
"21",
":",
"]",
"year",
"=... | Return RDFDatetime from string like 20140825162259.000000-420.
Args:
timestr: WMI time string
Returns:
rdfvalue.RDFDatetime
We have some timezone manipulation work to do here because the UTC offset is
in minutes rather than +-HHMM | [
"Return",
"RDFDatetime",
"from",
"string",
"like",
"20140825162259",
".",
"000000",
"-",
"420",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L317-L343 | train | Converts a WMI time string to an RDFDatetime object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/wmi_parser.py | WMIInterfacesParser.ParseMultiple | def ParseMultiple(self, result_dicts):
"""Parse the WMI packages output."""
for result_dict in result_dicts:
args = {"ifname": result_dict["Description"]}
args["mac_address"] = binascii.unhexlify(
result_dict["MACAddress"].replace(":", ""))
self._ConvertIPs([("IPAddress", "addresses... | python | def ParseMultiple(self, result_dicts):
"""Parse the WMI packages output."""
for result_dict in result_dicts:
args = {"ifname": result_dict["Description"]}
args["mac_address"] = binascii.unhexlify(
result_dict["MACAddress"].replace(":", ""))
self._ConvertIPs([("IPAddress", "addresses... | [
"def",
"ParseMultiple",
"(",
"self",
",",
"result_dicts",
")",
":",
"for",
"result_dict",
"in",
"result_dicts",
":",
"args",
"=",
"{",
"\"ifname\"",
":",
"result_dict",
"[",
"\"Description\"",
"]",
"}",
"args",
"[",
"\"mac_address\"",
"]",
"=",
"binascii",
"... | Parse the WMI packages output. | [
"Parse",
"the",
"WMI",
"packages",
"output",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/wmi_parser.py#L360-L383 | train | Parse the WMI packages output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/rdfvalues/flow_objects.py | _ClientIDFromSessionID | def _ClientIDFromSessionID(session_id):
"""Extracts the client id from a session id."""
parts = session_id.Split(4)
client_id = parts[0]
if re.match(r"C\.[0-9a-f]{16}", client_id):
return client_id
# Maybe it's a legacy hunt id (aff4:/hunts/<hunt_id>/<client_id>/...
client_id = parts[2]
if re.match(... | python | def _ClientIDFromSessionID(session_id):
"""Extracts the client id from a session id."""
parts = session_id.Split(4)
client_id = parts[0]
if re.match(r"C\.[0-9a-f]{16}", client_id):
return client_id
# Maybe it's a legacy hunt id (aff4:/hunts/<hunt_id>/<client_id>/...
client_id = parts[2]
if re.match(... | [
"def",
"_ClientIDFromSessionID",
"(",
"session_id",
")",
":",
"parts",
"=",
"session_id",
".",
"Split",
"(",
"4",
")",
"client_id",
"=",
"parts",
"[",
"0",
"]",
"if",
"re",
".",
"match",
"(",
"r\"C\\.[0-9a-f]{16}\"",
",",
"client_id",
")",
":",
"return",
... | Extracts the client id from a session id. | [
"Extracts",
"the",
"client",
"id",
"from",
"a",
"session",
"id",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/flow_objects.py#L165-L178 | train | Extracts the client id from a session id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/rdfvalues/flow_objects.py | FlowResponseForLegacyResponse | def FlowResponseForLegacyResponse(legacy_msg):
"""Helper function to convert legacy client replies to flow responses."""
if legacy_msg.type == legacy_msg.Type.MESSAGE:
response = FlowResponse(
client_id=_ClientIDFromSessionID(legacy_msg.session_id),
flow_id=legacy_msg.session_id.Basename(),
... | python | def FlowResponseForLegacyResponse(legacy_msg):
"""Helper function to convert legacy client replies to flow responses."""
if legacy_msg.type == legacy_msg.Type.MESSAGE:
response = FlowResponse(
client_id=_ClientIDFromSessionID(legacy_msg.session_id),
flow_id=legacy_msg.session_id.Basename(),
... | [
"def",
"FlowResponseForLegacyResponse",
"(",
"legacy_msg",
")",
":",
"if",
"legacy_msg",
".",
"type",
"==",
"legacy_msg",
".",
"Type",
".",
"MESSAGE",
":",
"response",
"=",
"FlowResponse",
"(",
"client_id",
"=",
"_ClientIDFromSessionID",
"(",
"legacy_msg",
".",
... | Helper function to convert legacy client replies to flow responses. | [
"Helper",
"function",
"to",
"convert",
"legacy",
"client",
"replies",
"to",
"flow",
"responses",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/flow_objects.py#L197-L230 | train | Helper function to convert legacy client replies to flow responses. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/osx_quarantine.py | OSXQuarantineEvents.Parse | def Parse(self):
"""Iterator returning dict for each entry in history."""
for data in self.Query(self.EVENTS_QUERY):
(timestamp, agent_bundle_identifier, agent_name, url, sender,
sender_address, type_number, title, referrer, referrer_alias) = data
yield [
timestamp, "OSX_QUARANTINE"... | python | def Parse(self):
"""Iterator returning dict for each entry in history."""
for data in self.Query(self.EVENTS_QUERY):
(timestamp, agent_bundle_identifier, agent_name, url, sender,
sender_address, type_number, title, referrer, referrer_alias) = data
yield [
timestamp, "OSX_QUARANTINE"... | [
"def",
"Parse",
"(",
"self",
")",
":",
"for",
"data",
"in",
"self",
".",
"Query",
"(",
"self",
".",
"EVENTS_QUERY",
")",
":",
"(",
"timestamp",
",",
"agent_bundle_identifier",
",",
"agent_name",
",",
"url",
",",
"sender",
",",
"sender_address",
",",
"typ... | Iterator returning dict for each entry in history. | [
"Iterator",
"returning",
"dict",
"for",
"each",
"entry",
"in",
"history",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/osx_quarantine.py#L30-L39 | train | Yields a list of events from the history. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/ip_resolver.py | IPResolver.RetrieveIP4Info | def RetrieveIP4Info(self, ip):
"""Retrieves information for an IP4 address."""
if ip.is_private:
return (IPInfo.INTERNAL, "Internal IP address.")
try:
# It's an external IP, let's try to do a reverse lookup.
res = socket.getnameinfo((str(ip), 0), socket.NI_NAMEREQD)
return (IPInfo.EX... | python | def RetrieveIP4Info(self, ip):
"""Retrieves information for an IP4 address."""
if ip.is_private:
return (IPInfo.INTERNAL, "Internal IP address.")
try:
# It's an external IP, let's try to do a reverse lookup.
res = socket.getnameinfo((str(ip), 0), socket.NI_NAMEREQD)
return (IPInfo.EX... | [
"def",
"RetrieveIP4Info",
"(",
"self",
",",
"ip",
")",
":",
"if",
"ip",
".",
"is_private",
":",
"return",
"(",
"IPInfo",
".",
"INTERNAL",
",",
"\"Internal IP address.\"",
")",
"try",
":",
"# It's an external IP, let's try to do a reverse lookup.",
"res",
"=",
"soc... | Retrieves information for an IP4 address. | [
"Retrieves",
"information",
"for",
"an",
"IP4",
"address",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/ip_resolver.py#L61-L70 | train | Retrieves information for an IP4 address. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mysql_pool.py | Pool.get | def get(self, blocking=True):
"""Gets a connection.
Args:
blocking: Whether to block when max_size connections are already in use.
If false, may return None.
Returns:
A connection to the database.
Raises:
PoolAlreadyClosedError: if close() method was already called on
... | python | def get(self, blocking=True):
"""Gets a connection.
Args:
blocking: Whether to block when max_size connections are already in use.
If false, may return None.
Returns:
A connection to the database.
Raises:
PoolAlreadyClosedError: if close() method was already called on
... | [
"def",
"get",
"(",
"self",
",",
"blocking",
"=",
"True",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"PoolAlreadyClosedError",
"(",
"\"Connection pool is already closed.\"",
")",
"# NOTE: Once we acquire capacity from the semaphore, it is essential that we",
"# ret... | Gets a connection.
Args:
blocking: Whether to block when max_size connections are already in use.
If false, may return None.
Returns:
A connection to the database.
Raises:
PoolAlreadyClosedError: if close() method was already called on
this pool. | [
"Gets",
"a",
"connection",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_pool.py#L47-L81 | train | Gets a connection from the pool. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/config/grr_response_templates/setup.py | Sdist.CheckTemplates | def CheckTemplates(self, base_dir, version):
"""Verify we have at least one template that matches maj.minor version."""
major_minor = ".".join(version.split(".")[0:2])
templates = glob.glob(
os.path.join(base_dir, "templates/*%s*.zip" % major_minor))
required_templates = set(
[x.replace(... | python | def CheckTemplates(self, base_dir, version):
"""Verify we have at least one template that matches maj.minor version."""
major_minor = ".".join(version.split(".")[0:2])
templates = glob.glob(
os.path.join(base_dir, "templates/*%s*.zip" % major_minor))
required_templates = set(
[x.replace(... | [
"def",
"CheckTemplates",
"(",
"self",
",",
"base_dir",
",",
"version",
")",
":",
"major_minor",
"=",
"\".\"",
".",
"join",
"(",
"version",
".",
"split",
"(",
"\".\"",
")",
"[",
"0",
":",
"2",
"]",
")",
"templates",
"=",
"glob",
".",
"glob",
"(",
"o... | Verify we have at least one template that matches maj.minor version. | [
"Verify",
"we",
"have",
"at",
"least",
"one",
"template",
"that",
"matches",
"maj",
".",
"minor",
"version",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/config/grr_response_templates/setup.py#L53-L69 | train | Verify that we have at least one template that matches maj. minor version. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | _TerminateFlow | def _TerminateFlow(rdf_flow,
reason=None,
flow_state=rdf_flow_objects.Flow.FlowState.ERROR):
"""Does the actual termination."""
flow_cls = registry.FlowRegistry.FlowClassByName(rdf_flow.flow_class_name)
flow_obj = flow_cls(rdf_flow)
if not flow_obj.IsRunning():
# Nothi... | python | def _TerminateFlow(rdf_flow,
reason=None,
flow_state=rdf_flow_objects.Flow.FlowState.ERROR):
"""Does the actual termination."""
flow_cls = registry.FlowRegistry.FlowClassByName(rdf_flow.flow_class_name)
flow_obj = flow_cls(rdf_flow)
if not flow_obj.IsRunning():
# Nothi... | [
"def",
"_TerminateFlow",
"(",
"rdf_flow",
",",
"reason",
"=",
"None",
",",
"flow_state",
"=",
"rdf_flow_objects",
".",
"Flow",
".",
"FlowState",
".",
"ERROR",
")",
":",
"flow_cls",
"=",
"registry",
".",
"FlowRegistry",
".",
"FlowClassByName",
"(",
"rdf_flow",
... | Does the actual termination. | [
"Does",
"the",
"actual",
"termination",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L35-L61 | train | Does the actual termination. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | TerminateFlow | def TerminateFlow(client_id,
flow_id,
reason=None,
flow_state=rdf_flow_objects.Flow.FlowState.ERROR):
"""Terminates a flow and all of its children.
Args:
client_id: Client ID of a flow to terminate.
flow_id: Flow ID of a flow to terminate.
reason: S... | python | def TerminateFlow(client_id,
flow_id,
reason=None,
flow_state=rdf_flow_objects.Flow.FlowState.ERROR):
"""Terminates a flow and all of its children.
Args:
client_id: Client ID of a flow to terminate.
flow_id: Flow ID of a flow to terminate.
reason: S... | [
"def",
"TerminateFlow",
"(",
"client_id",
",",
"flow_id",
",",
"reason",
"=",
"None",
",",
"flow_state",
"=",
"rdf_flow_objects",
".",
"Flow",
".",
"FlowState",
".",
"ERROR",
")",
":",
"to_terminate",
"=",
"[",
"data_store",
".",
"REL_DB",
".",
"ReadFlowObje... | Terminates a flow and all of its children.
Args:
client_id: Client ID of a flow to terminate.
flow_id: Flow ID of a flow to terminate.
reason: String with a termination reason.
flow_state: Flow state to be assigned to a flow after termination. Defaults
to FlowState.ERROR. | [
"Terminates",
"a",
"flow",
"and",
"all",
"of",
"its",
"children",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L64-L87 | train | Terminates a flow and all of its children. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | DualDBFlow | def DualDBFlow(cls):
"""Decorator that creates AFF4 and RELDB flows from a given mixin."""
if issubclass(cls, flow.GRRFlow):
raise ValueError("Mixin class shouldn't inherit from GRRFlow.")
if cls.__name__[-5:] != "Mixin":
raise ValueError("Flow mixin should have a name that ends in 'Mixin'.")
flow_na... | python | def DualDBFlow(cls):
"""Decorator that creates AFF4 and RELDB flows from a given mixin."""
if issubclass(cls, flow.GRRFlow):
raise ValueError("Mixin class shouldn't inherit from GRRFlow.")
if cls.__name__[-5:] != "Mixin":
raise ValueError("Flow mixin should have a name that ends in 'Mixin'.")
flow_na... | [
"def",
"DualDBFlow",
"(",
"cls",
")",
":",
"if",
"issubclass",
"(",
"cls",
",",
"flow",
".",
"GRRFlow",
")",
":",
"raise",
"ValueError",
"(",
"\"Mixin class shouldn't inherit from GRRFlow.\"",
")",
"if",
"cls",
".",
"__name__",
"[",
"-",
"5",
":",
"]",
"!=... | Decorator that creates AFF4 and RELDB flows from a given mixin. | [
"Decorator",
"that",
"creates",
"AFF4",
"and",
"RELDB",
"flows",
"from",
"a",
"given",
"mixin",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L850-L868 | train | Decorator that creates AFF4 and RELDB flows from a given mixin. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.CallState | def CallState(self, next_state="", start_time=None):
"""This method is used to schedule a new state on a different worker.
This is basically the same as CallFlow() except we are calling
ourselves. The state will be invoked at a later time.
Args:
next_state: The state in this flow to be invoked.... | python | def CallState(self, next_state="", start_time=None):
"""This method is used to schedule a new state on a different worker.
This is basically the same as CallFlow() except we are calling
ourselves. The state will be invoked at a later time.
Args:
next_state: The state in this flow to be invoked.... | [
"def",
"CallState",
"(",
"self",
",",
"next_state",
"=",
"\"\"",
",",
"start_time",
"=",
"None",
")",
":",
"if",
"not",
"getattr",
"(",
"self",
",",
"next_state",
")",
":",
"raise",
"ValueError",
"(",
"\"Next state %s is invalid.\"",
"%",
"next_state",
")",
... | This method is used to schedule a new state on a different worker.
This is basically the same as CallFlow() except we are calling
ourselves. The state will be invoked at a later time.
Args:
next_state: The state in this flow to be invoked.
start_time: Start the flow at this time. This delays... | [
"This",
"method",
"is",
"used",
"to",
"schedule",
"a",
"new",
"state",
"on",
"a",
"different",
"worker",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L139-L165 | train | This method is used to schedule a new state in a different worker. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.CallClient | def CallClient(self,
action_cls,
request=None,
next_state=None,
request_data=None,
**kwargs):
"""Calls the client asynchronously.
This sends a message to the client to invoke an Action. The run action may
send back many re... | python | def CallClient(self,
action_cls,
request=None,
next_state=None,
request_data=None,
**kwargs):
"""Calls the client asynchronously.
This sends a message to the client to invoke an Action. The run action may
send back many re... | [
"def",
"CallClient",
"(",
"self",
",",
"action_cls",
",",
"request",
"=",
"None",
",",
"next_state",
"=",
"None",
",",
"request_data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"action_identifier",
"=",
"action_registry",
".",
"ID_BY_ACTI... | Calls the client asynchronously.
This sends a message to the client to invoke an Action. The run action may
send back many responses that will be queued by the framework until a status
message is sent by the client. The status message will cause the entire
transaction to be committed to the specified s... | [
"Calls",
"the",
"client",
"asynchronously",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L177-L268 | train | Calls the client asynchronously. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.CallFlow | def CallFlow(self,
flow_name=None,
next_state=None,
request_data=None,
client_id=None,
base_session_id=None,
**kwargs):
"""Creates a new flow and send its responses to a state.
This creates a new flow. The flow may send b... | python | def CallFlow(self,
flow_name=None,
next_state=None,
request_data=None,
client_id=None,
base_session_id=None,
**kwargs):
"""Creates a new flow and send its responses to a state.
This creates a new flow. The flow may send b... | [
"def",
"CallFlow",
"(",
"self",
",",
"flow_name",
"=",
"None",
",",
"next_state",
"=",
"None",
",",
"request_data",
"=",
"None",
",",
"client_id",
"=",
"None",
",",
"base_session_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"getatt... | Creates a new flow and send its responses to a state.
This creates a new flow. The flow may send back many responses which will be
queued by the framework until the flow terminates. The final status message
will cause the entire transaction to be committed to the specified state.
Args:
flow_nam... | [
"Creates",
"a",
"new",
"flow",
"and",
"send",
"its",
"responses",
"to",
"a",
"state",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L270-L322 | train | Calls a flow and returns the id of the new flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.SendReply | def SendReply(self, response, tag=None):
"""Allows this flow to send a message to its parent flow.
If this flow does not have a parent, the message is ignored.
Args:
response: An RDFValue() instance to be sent to the parent.
tag: If specified, tag the result with this tag.
Raises:
V... | python | def SendReply(self, response, tag=None):
"""Allows this flow to send a message to its parent flow.
If this flow does not have a parent, the message is ignored.
Args:
response: An RDFValue() instance to be sent to the parent.
tag: If specified, tag the result with this tag.
Raises:
V... | [
"def",
"SendReply",
"(",
"self",
",",
"response",
",",
"tag",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"response",
",",
"rdfvalue",
".",
"RDFValue",
")",
":",
"raise",
"ValueError",
"(",
"\"SendReply can only send RDFValues\"",
")",
"if",
"self... | Allows this flow to send a message to its parent flow.
If this flow does not have a parent, the message is ignored.
Args:
response: An RDFValue() instance to be sent to the parent.
tag: If specified, tag the result with this tag.
Raises:
ValueError: If responses is not of the correct ty... | [
"Allows",
"this",
"flow",
"to",
"send",
"a",
"message",
"to",
"its",
"parent",
"flow",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L324-L359 | train | Allows this flow to send a message to its parent flow. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.SaveResourceUsage | def SaveResourceUsage(self, status):
"""Method to tally resources."""
user_cpu = status.cpu_time_used.user_cpu_time
system_cpu = status.cpu_time_used.system_cpu_time
self.rdf_flow.cpu_time_used.user_cpu_time += user_cpu
self.rdf_flow.cpu_time_used.system_cpu_time += system_cpu
self.rdf_flow.net... | python | def SaveResourceUsage(self, status):
"""Method to tally resources."""
user_cpu = status.cpu_time_used.user_cpu_time
system_cpu = status.cpu_time_used.system_cpu_time
self.rdf_flow.cpu_time_used.user_cpu_time += user_cpu
self.rdf_flow.cpu_time_used.system_cpu_time += system_cpu
self.rdf_flow.net... | [
"def",
"SaveResourceUsage",
"(",
"self",
",",
"status",
")",
":",
"user_cpu",
"=",
"status",
".",
"cpu_time_used",
".",
"user_cpu_time",
"system_cpu",
"=",
"status",
".",
"cpu_time_used",
".",
"system_cpu_time",
"self",
".",
"rdf_flow",
".",
"cpu_time_used",
"."... | Method to tally resources. | [
"Method",
"to",
"tally",
"resources",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L361-L382 | train | Method to tally resources. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.Error | def Error(self, error_message=None, backtrace=None, status=None):
"""Terminates this flow with an error."""
stats_collector_instance.Get().IncrementCounter(
"flow_errors", fields=[compatibility.GetName(self.__class__)])
client_id = self.rdf_flow.client_id
flow_id = self.rdf_flow.flow_id
lo... | python | def Error(self, error_message=None, backtrace=None, status=None):
"""Terminates this flow with an error."""
stats_collector_instance.Get().IncrementCounter(
"flow_errors", fields=[compatibility.GetName(self.__class__)])
client_id = self.rdf_flow.client_id
flow_id = self.rdf_flow.flow_id
lo... | [
"def",
"Error",
"(",
"self",
",",
"error_message",
"=",
"None",
",",
"backtrace",
"=",
"None",
",",
"status",
"=",
"None",
")",
":",
"stats_collector_instance",
".",
"Get",
"(",
")",
".",
"IncrementCounter",
"(",
"\"flow_errors\"",
",",
"fields",
"=",
"[",... | Terminates this flow with an error. | [
"Terminates",
"this",
"flow",
"with",
"an",
"error",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L384-L426 | train | Terminates this flow with an error. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.MarkDone | def MarkDone(self, status=None):
"""Marks this flow as done."""
stats_collector_instance.Get().IncrementCounter(
"flow_completions", fields=[compatibility.GetName(self.__class__)])
# Notify our parent flow or hunt that we are done (if there's a parent flow
# or hunt).
if self.rdf_flow.paren... | python | def MarkDone(self, status=None):
"""Marks this flow as done."""
stats_collector_instance.Get().IncrementCounter(
"flow_completions", fields=[compatibility.GetName(self.__class__)])
# Notify our parent flow or hunt that we are done (if there's a parent flow
# or hunt).
if self.rdf_flow.paren... | [
"def",
"MarkDone",
"(",
"self",
",",
"status",
"=",
"None",
")",
":",
"stats_collector_instance",
".",
"Get",
"(",
")",
".",
"IncrementCounter",
"(",
"\"flow_completions\"",
",",
"fields",
"=",
"[",
"compatibility",
".",
"GetName",
"(",
"self",
".",
"__class... | Marks this flow as done. | [
"Marks",
"this",
"flow",
"as",
"done",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L470-L494 | train | Marks this flow as done. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.Log | def Log(self, format_str, *args):
"""Logs the message using the flow's standard logging.
Args:
format_str: Format string
*args: arguments to the format string
"""
log_entry = rdf_flow_objects.FlowLogEntry(
client_id=self.rdf_flow.client_id,
flow_id=self.rdf_flow.flow_id,
... | python | def Log(self, format_str, *args):
"""Logs the message using the flow's standard logging.
Args:
format_str: Format string
*args: arguments to the format string
"""
log_entry = rdf_flow_objects.FlowLogEntry(
client_id=self.rdf_flow.client_id,
flow_id=self.rdf_flow.flow_id,
... | [
"def",
"Log",
"(",
"self",
",",
"format_str",
",",
"*",
"args",
")",
":",
"log_entry",
"=",
"rdf_flow_objects",
".",
"FlowLogEntry",
"(",
"client_id",
"=",
"self",
".",
"rdf_flow",
".",
"client_id",
",",
"flow_id",
"=",
"self",
".",
"rdf_flow",
".",
"flo... | Logs the message using the flow's standard logging.
Args:
format_str: Format string
*args: arguments to the format string | [
"Logs",
"the",
"message",
"using",
"the",
"flow",
"s",
"standard",
"logging",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L496-L510 | train | Logs the message using the standard logging. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.RunStateMethod | def RunStateMethod(self, method_name, request=None, responses=None):
"""Completes the request by calling the state method.
Args:
method_name: The name of the state method to call.
request: A RequestState protobuf.
responses: A list of FlowMessages responding to the request.
"""
if sel... | python | def RunStateMethod(self, method_name, request=None, responses=None):
"""Completes the request by calling the state method.
Args:
method_name: The name of the state method to call.
request: A RequestState protobuf.
responses: A list of FlowMessages responding to the request.
"""
if sel... | [
"def",
"RunStateMethod",
"(",
"self",
",",
"method_name",
",",
"request",
"=",
"None",
",",
"responses",
"=",
"None",
")",
":",
"if",
"self",
".",
"rdf_flow",
".",
"pending_termination",
":",
"self",
".",
"Error",
"(",
"error_message",
"=",
"self",
".",
... | Completes the request by calling the state method.
Args:
method_name: The name of the state method to call.
request: A RequestState protobuf.
responses: A list of FlowMessages responding to the request. | [
"Completes",
"the",
"request",
"by",
"calling",
"the",
"state",
"method",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L512-L580 | train | Runs the given method on the current state. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase.ProcessAllReadyRequests | def ProcessAllReadyRequests(self):
"""Processes all requests that are due to run.
Returns:
The number of processed requests.
"""
request_dict = data_store.REL_DB.ReadFlowRequestsReadyForProcessing(
self.rdf_flow.client_id,
self.rdf_flow.flow_id,
next_needed_request=self.rd... | python | def ProcessAllReadyRequests(self):
"""Processes all requests that are due to run.
Returns:
The number of processed requests.
"""
request_dict = data_store.REL_DB.ReadFlowRequestsReadyForProcessing(
self.rdf_flow.client_id,
self.rdf_flow.flow_id,
next_needed_request=self.rd... | [
"def",
"ProcessAllReadyRequests",
"(",
"self",
")",
":",
"request_dict",
"=",
"data_store",
".",
"REL_DB",
".",
"ReadFlowRequestsReadyForProcessing",
"(",
"self",
".",
"rdf_flow",
".",
"client_id",
",",
"self",
".",
"rdf_flow",
".",
"flow_id",
",",
"next_needed_re... | Processes all requests that are due to run.
Returns:
The number of processed requests. | [
"Processes",
"all",
"requests",
"that",
"are",
"due",
"to",
"run",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L582-L615 | train | Processes all requests that are due to run. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/flow_base.py | FlowBase._ProcessRepliesWithFlowOutputPlugins | def _ProcessRepliesWithFlowOutputPlugins(self, replies):
"""Processes replies with output plugins."""
created_output_plugins = []
for index, output_plugin_state in enumerate(
self.rdf_flow.output_plugins_states):
plugin_descriptor = output_plugin_state.plugin_descriptor
output_plugin_cls... | python | def _ProcessRepliesWithFlowOutputPlugins(self, replies):
"""Processes replies with output plugins."""
created_output_plugins = []
for index, output_plugin_state in enumerate(
self.rdf_flow.output_plugins_states):
plugin_descriptor = output_plugin_state.plugin_descriptor
output_plugin_cls... | [
"def",
"_ProcessRepliesWithFlowOutputPlugins",
"(",
"self",
",",
"replies",
")",
":",
"created_output_plugins",
"=",
"[",
"]",
"for",
"index",
",",
"output_plugin_state",
"in",
"enumerate",
"(",
"self",
".",
"rdf_flow",
".",
"output_plugins_states",
")",
":",
"plu... | Processes replies with output plugins. | [
"Processes",
"replies",
"with",
"output",
"plugins",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L718-L775 | train | Processes replies with output plugins. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | _SignedBinaryIDFromURN | def _SignedBinaryIDFromURN(binary_urn
):
"""Converts an AFF4 URN for a signed binary to a SignedBinaryID."""
if binary_urn.RelativeName(GetAFF4PythonHackRoot()):
return rdf_objects.SignedBinaryID(
binary_type=rdf_objects.SignedBinaryID.BinaryType.PYTHON_HACK,
path=binar... | python | def _SignedBinaryIDFromURN(binary_urn
):
"""Converts an AFF4 URN for a signed binary to a SignedBinaryID."""
if binary_urn.RelativeName(GetAFF4PythonHackRoot()):
return rdf_objects.SignedBinaryID(
binary_type=rdf_objects.SignedBinaryID.BinaryType.PYTHON_HACK,
path=binar... | [
"def",
"_SignedBinaryIDFromURN",
"(",
"binary_urn",
")",
":",
"if",
"binary_urn",
".",
"RelativeName",
"(",
"GetAFF4PythonHackRoot",
"(",
")",
")",
":",
"return",
"rdf_objects",
".",
"SignedBinaryID",
"(",
"binary_type",
"=",
"rdf_objects",
".",
"SignedBinaryID",
... | Converts an AFF4 URN for a signed binary to a SignedBinaryID. | [
"Converts",
"an",
"AFF4",
"URN",
"for",
"a",
"signed",
"binary",
"to",
"a",
"SignedBinaryID",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L32-L45 | train | Converts an AFF4 URN for a signed binary to a SignedBinaryID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | _SignedBinaryURNFromID | def _SignedBinaryURNFromID(binary_id
):
"""Converts a SignedBinaryID to the equivalent AFF4 URN."""
binary_type = binary_id.binary_type
if binary_type == rdf_objects.SignedBinaryID.BinaryType.PYTHON_HACK:
return GetAFF4PythonHackRoot().Add(binary_id.path)
elif binary_type == rdf_ob... | python | def _SignedBinaryURNFromID(binary_id
):
"""Converts a SignedBinaryID to the equivalent AFF4 URN."""
binary_type = binary_id.binary_type
if binary_type == rdf_objects.SignedBinaryID.BinaryType.PYTHON_HACK:
return GetAFF4PythonHackRoot().Add(binary_id.path)
elif binary_type == rdf_ob... | [
"def",
"_SignedBinaryURNFromID",
"(",
"binary_id",
")",
":",
"binary_type",
"=",
"binary_id",
".",
"binary_type",
"if",
"binary_type",
"==",
"rdf_objects",
".",
"SignedBinaryID",
".",
"BinaryType",
".",
"PYTHON_HACK",
":",
"return",
"GetAFF4PythonHackRoot",
"(",
")"... | Converts a SignedBinaryID to the equivalent AFF4 URN. | [
"Converts",
"a",
"SignedBinaryID",
"to",
"the",
"equivalent",
"AFF4",
"URN",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L48-L57 | train | Converts a SignedBinaryID to the equivalent AFF4 URN. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | WriteSignedBinary | def WriteSignedBinary(binary_urn,
binary_content,
private_key,
public_key,
chunk_size = 1024,
token = None):
"""Signs a binary and saves it to the datastore.
If a signed binary with the given URN already e... | python | def WriteSignedBinary(binary_urn,
binary_content,
private_key,
public_key,
chunk_size = 1024,
token = None):
"""Signs a binary and saves it to the datastore.
If a signed binary with the given URN already e... | [
"def",
"WriteSignedBinary",
"(",
"binary_urn",
",",
"binary_content",
",",
"private_key",
",",
"public_key",
",",
"chunk_size",
"=",
"1024",
",",
"token",
"=",
"None",
")",
":",
"if",
"_ShouldUseLegacyDatastore",
"(",
")",
":",
"collects",
".",
"GRRSignedBlob",
... | Signs a binary and saves it to the datastore.
If a signed binary with the given URN already exists, its contents will get
overwritten.
Args:
binary_urn: URN that should serve as a unique identifier for the binary.
binary_content: Contents of the binary, as raw bytes.
private_key: Key that should be ... | [
"Signs",
"a",
"binary",
"and",
"saves",
"it",
"to",
"the",
"datastore",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L68-L110 | train | Signs a binary and saves it to the datastore. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | WriteSignedBinaryBlobs | def WriteSignedBinaryBlobs(binary_urn,
blobs,
token = None):
"""Saves signed blobs to the datastore.
If a signed binary with the given URN already exists, its contents will get
overwritten.
Args:
binary_urn: RDFURN that should serve as a unique identif... | python | def WriteSignedBinaryBlobs(binary_urn,
blobs,
token = None):
"""Saves signed blobs to the datastore.
If a signed binary with the given URN already exists, its contents will get
overwritten.
Args:
binary_urn: RDFURN that should serve as a unique identif... | [
"def",
"WriteSignedBinaryBlobs",
"(",
"binary_urn",
",",
"blobs",
",",
"token",
"=",
"None",
")",
":",
"if",
"_ShouldUseLegacyDatastore",
"(",
")",
":",
"aff4",
".",
"FACTORY",
".",
"Delete",
"(",
"binary_urn",
",",
"token",
"=",
"token",
")",
"with",
"dat... | Saves signed blobs to the datastore.
If a signed binary with the given URN already exists, its contents will get
overwritten.
Args:
binary_urn: RDFURN that should serve as a unique identifier for the binary.
blobs: An Iterable of signed blobs to write to the datastore.
token: ACL token to use with t... | [
"Saves",
"signed",
"blobs",
"to",
"the",
"datastore",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L113-L149 | train | Writes signed blobs to the datastore. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | DeleteSignedBinary | def DeleteSignedBinary(binary_urn,
token = None):
"""Deletes the binary with the given urn from the datastore.
Args:
binary_urn: RDFURN that serves as a unique identifier for the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Raises:
SignedBinaryNo... | python | def DeleteSignedBinary(binary_urn,
token = None):
"""Deletes the binary with the given urn from the datastore.
Args:
binary_urn: RDFURN that serves as a unique identifier for the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Raises:
SignedBinaryNo... | [
"def",
"DeleteSignedBinary",
"(",
"binary_urn",
",",
"token",
"=",
"None",
")",
":",
"if",
"_ShouldUseLegacyDatastore",
"(",
")",
":",
"try",
":",
"aff4",
".",
"FACTORY",
".",
"Open",
"(",
"binary_urn",
",",
"aff4_type",
"=",
"aff4",
".",
"AFF4Stream",
","... | Deletes the binary with the given urn from the datastore.
Args:
binary_urn: RDFURN that serves as a unique identifier for the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Raises:
SignedBinaryNotFoundError: If the signed binary does not exist. | [
"Deletes",
"the",
"binary",
"with",
"the",
"given",
"urn",
"from",
"the",
"datastore",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L152-L183 | train | Deletes the signed binary with the given urn from the datastore. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | FetchURNsForAllSignedBinaries | def FetchURNsForAllSignedBinaries(token
):
"""Returns URNs for all signed binaries in the datastore.
Args:
token: ACL token to use with the legacy (non-relational) datastore.
"""
if _ShouldUseLegacyDatastore():
urns = []
aff4_roots = [GetAFF4PythonHackRoot(), GetAFF... | python | def FetchURNsForAllSignedBinaries(token
):
"""Returns URNs for all signed binaries in the datastore.
Args:
token: ACL token to use with the legacy (non-relational) datastore.
"""
if _ShouldUseLegacyDatastore():
urns = []
aff4_roots = [GetAFF4PythonHackRoot(), GetAFF... | [
"def",
"FetchURNsForAllSignedBinaries",
"(",
"token",
")",
":",
"if",
"_ShouldUseLegacyDatastore",
"(",
")",
":",
"urns",
"=",
"[",
"]",
"aff4_roots",
"=",
"[",
"GetAFF4PythonHackRoot",
"(",
")",
",",
"GetAFF4ExecutablesRoot",
"(",
")",
"]",
"for",
"_",
",",
... | Returns URNs for all signed binaries in the datastore.
Args:
token: ACL token to use with the legacy (non-relational) datastore. | [
"Returns",
"URNs",
"for",
"all",
"signed",
"binaries",
"in",
"the",
"datastore",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L186-L206 | train | Returns the URNs for all signed binaries in the datastore. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | FetchBlobsForSignedBinary | def FetchBlobsForSignedBinary(
binary_urn,
token = None
):
"""Retrieves blobs for the given binary from the datastore.
Args:
binary_urn: RDFURN that uniquely identifies the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Returns:
A tuple containing an iterator for... | python | def FetchBlobsForSignedBinary(
binary_urn,
token = None
):
"""Retrieves blobs for the given binary from the datastore.
Args:
binary_urn: RDFURN that uniquely identifies the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Returns:
A tuple containing an iterator for... | [
"def",
"FetchBlobsForSignedBinary",
"(",
"binary_urn",
",",
"token",
"=",
"None",
")",
":",
"if",
"_ShouldUseLegacyDatastore",
"(",
")",
":",
"try",
":",
"aff4_stream",
"=",
"aff4",
".",
"FACTORY",
".",
"Open",
"(",
"binary_urn",
",",
"aff4_type",
"=",
"coll... | Retrieves blobs for the given binary from the datastore.
Args:
binary_urn: RDFURN that uniquely identifies the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Returns:
A tuple containing an iterator for all the binary's blobs and an
RDFDatetime representing when the bin... | [
"Retrieves",
"blobs",
"for",
"the",
"given",
"binary",
"from",
"the",
"datastore",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L209-L246 | train | Retrieves blobs for the given signed binary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | FetchSizeOfSignedBinary | def FetchSizeOfSignedBinary(binary_urn,
token = None
):
"""Returns the size of the given binary (in bytes).
Args:
binary_urn: RDFURN that uniquely identifies the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Raises:
... | python | def FetchSizeOfSignedBinary(binary_urn,
token = None
):
"""Returns the size of the given binary (in bytes).
Args:
binary_urn: RDFURN that uniquely identifies the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Raises:
... | [
"def",
"FetchSizeOfSignedBinary",
"(",
"binary_urn",
",",
"token",
"=",
"None",
")",
":",
"if",
"_ShouldUseLegacyDatastore",
"(",
")",
":",
"try",
":",
"aff4_stream",
"=",
"aff4",
".",
"FACTORY",
".",
"Open",
"(",
"binary_urn",
",",
"aff4_type",
"=",
"collec... | Returns the size of the given binary (in bytes).
Args:
binary_urn: RDFURN that uniquely identifies the binary.
token: ACL token to use with the legacy (non-relational) datastore.
Raises:
SignedBinaryNotFoundError: If no signed binary with the given URN exists. | [
"Returns",
"the",
"size",
"of",
"the",
"given",
"binary",
"(",
"in",
"bytes",
")",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L249-L275 | train | Fetches the size of the given signed binary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/signed_binary_utils.py | StreamSignedBinaryContents | def StreamSignedBinaryContents(blob_iterator,
chunk_size = 1024
):
"""Yields the contents of the given binary in chunks of the given size.
Args:
blob_iterator: An Iterator over all the binary's blobs.
chunk_size: Size, in bytes, of the chunks to ... | python | def StreamSignedBinaryContents(blob_iterator,
chunk_size = 1024
):
"""Yields the contents of the given binary in chunks of the given size.
Args:
blob_iterator: An Iterator over all the binary's blobs.
chunk_size: Size, in bytes, of the chunks to ... | [
"def",
"StreamSignedBinaryContents",
"(",
"blob_iterator",
",",
"chunk_size",
"=",
"1024",
")",
":",
"all_blobs_read",
"=",
"False",
"byte_buffer",
"=",
"io",
".",
"BytesIO",
"(",
")",
"while",
"not",
"all_blobs_read",
"or",
"byte_buffer",
".",
"getvalue",
"(",
... | Yields the contents of the given binary in chunks of the given size.
Args:
blob_iterator: An Iterator over all the binary's blobs.
chunk_size: Size, in bytes, of the chunks to yield. | [
"Yields",
"the",
"contents",
"of",
"the",
"given",
"binary",
"in",
"chunks",
"of",
"the",
"given",
"size",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/signed_binary_utils.py#L278-L303 | train | Returns an iterator over all the blobs in the given binary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/blob_stores/memory_stream_bs.py | MemoryStreamBlobStore.WriteBlobs | def WriteBlobs(self, blob_id_data_map):
"""Creates or overwrites blobs."""
urns = {self._BlobUrn(blob_id): blob_id for blob_id in blob_id_data_map}
mutation_pool = data_store.DB.GetMutationPool()
existing = aff4.FACTORY.MultiOpen(
urns, aff4_type=aff4.AFF4MemoryStreamBase, mode="r")
for ... | python | def WriteBlobs(self, blob_id_data_map):
"""Creates or overwrites blobs."""
urns = {self._BlobUrn(blob_id): blob_id for blob_id in blob_id_data_map}
mutation_pool = data_store.DB.GetMutationPool()
existing = aff4.FACTORY.MultiOpen(
urns, aff4_type=aff4.AFF4MemoryStreamBase, mode="r")
for ... | [
"def",
"WriteBlobs",
"(",
"self",
",",
"blob_id_data_map",
")",
":",
"urns",
"=",
"{",
"self",
".",
"_BlobUrn",
"(",
"blob_id",
")",
":",
"blob_id",
"for",
"blob_id",
"in",
"blob_id_data_map",
"}",
"mutation_pool",
"=",
"data_store",
".",
"DB",
".",
"GetMu... | Creates or overwrites blobs. | [
"Creates",
"or",
"overwrites",
"blobs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/blob_stores/memory_stream_bs.py#L24-L50 | train | Creates or overwrites blobs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/blob_stores/memory_stream_bs.py | MemoryStreamBlobStore.CheckBlobsExist | def CheckBlobsExist(self, blob_ids):
"""Check if blobs for the given digests already exist."""
res = {blob_id: False for blob_id in blob_ids}
urns = {self._BlobUrn(blob_id): blob_id for blob_id in blob_ids}
existing = aff4.FACTORY.MultiOpen(
urns, aff4_type=aff4.AFF4MemoryStreamBase, mode="r")... | python | def CheckBlobsExist(self, blob_ids):
"""Check if blobs for the given digests already exist."""
res = {blob_id: False for blob_id in blob_ids}
urns = {self._BlobUrn(blob_id): blob_id for blob_id in blob_ids}
existing = aff4.FACTORY.MultiOpen(
urns, aff4_type=aff4.AFF4MemoryStreamBase, mode="r")... | [
"def",
"CheckBlobsExist",
"(",
"self",
",",
"blob_ids",
")",
":",
"res",
"=",
"{",
"blob_id",
":",
"False",
"for",
"blob_id",
"in",
"blob_ids",
"}",
"urns",
"=",
"{",
"self",
".",
"_BlobUrn",
"(",
"blob_id",
")",
":",
"blob_id",
"for",
"blob_id",
"in",... | Check if blobs for the given digests already exist. | [
"Check",
"if",
"blobs",
"for",
"the",
"given",
"digests",
"already",
"exist",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/blob_stores/memory_stream_bs.py#L63-L75 | train | Checks if blobs for the given digests already exist. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mysql_utils.py | NamedPlaceholders | def NamedPlaceholders(iterable):
"""Returns named placeholders from all elements of the given iterable.
Use this function for VALUES of MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6),
this function sorts column names.
Examples:
>>> NamedPlaceholders({"password": ... | python | def NamedPlaceholders(iterable):
"""Returns named placeholders from all elements of the given iterable.
Use this function for VALUES of MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6),
this function sorts column names.
Examples:
>>> NamedPlaceholders({"password": ... | [
"def",
"NamedPlaceholders",
"(",
"iterable",
")",
":",
"placeholders",
"=",
"\", \"",
".",
"join",
"(",
"\"%({})s\"",
".",
"format",
"(",
"key",
")",
"for",
"key",
"in",
"sorted",
"(",
"iterable",
")",
")",
"return",
"\"({})\"",
".",
"format",
"(",
"plac... | Returns named placeholders from all elements of the given iterable.
Use this function for VALUES of MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6),
this function sorts column names.
Examples:
>>> NamedPlaceholders({"password": "foo", "name": "bar"})
u'(%(name)s... | [
"Returns",
"named",
"placeholders",
"from",
"all",
"elements",
"of",
"the",
"given",
"iterable",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_utils.py#L66-L85 | train | Returns a string containing named placeholders from all elements of the given iterable. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mysql_utils.py | Columns | def Columns(iterable):
"""Returns a string of column names for MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6),
this function sorts column names.
Examples:
>>> Columns({"password": "foo", "name": "bar"})
u'(`name`, `password`)'
Args:
iterable: The iterable... | python | def Columns(iterable):
"""Returns a string of column names for MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6),
this function sorts column names.
Examples:
>>> Columns({"password": "foo", "name": "bar"})
u'(`name`, `password`)'
Args:
iterable: The iterable... | [
"def",
"Columns",
"(",
"iterable",
")",
":",
"columns",
"=",
"sorted",
"(",
"iterable",
")",
"return",
"\"({})\"",
".",
"format",
"(",
"\", \"",
".",
"join",
"(",
"\"`{}`\"",
".",
"format",
"(",
"col",
")",
"for",
"col",
"in",
"columns",
")",
")"
] | Returns a string of column names for MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6),
this function sorts column names.
Examples:
>>> Columns({"password": "foo", "name": "bar"})
u'(`name`, `password`)'
Args:
iterable: The iterable of strings to be used as co... | [
"Returns",
"a",
"string",
"of",
"column",
"names",
"for",
"MySQL",
"INSERTs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_utils.py#L88-L103 | train | Returns a string containing a tuple of column names for MySQL INSERTs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mysql_utils.py | TimestampToRDFDatetime | def TimestampToRDFDatetime(timestamp):
"""Converts MySQL `TIMESTAMP(6)` columns to datetime objects."""
# TODO(hanuszczak): `timestamp` should be of MySQL type `Decimal`. However,
# it is unclear where this type is actually defined and how to import it in
# order to have a type assertion.
if timestamp is None... | python | def TimestampToRDFDatetime(timestamp):
"""Converts MySQL `TIMESTAMP(6)` columns to datetime objects."""
# TODO(hanuszczak): `timestamp` should be of MySQL type `Decimal`. However,
# it is unclear where this type is actually defined and how to import it in
# order to have a type assertion.
if timestamp is None... | [
"def",
"TimestampToRDFDatetime",
"(",
"timestamp",
")",
":",
"# TODO(hanuszczak): `timestamp` should be of MySQL type `Decimal`. However,",
"# it is unclear where this type is actually defined and how to import it in",
"# order to have a type assertion.",
"if",
"timestamp",
"is",
"None",
"... | Converts MySQL `TIMESTAMP(6)` columns to datetime objects. | [
"Converts",
"MySQL",
"TIMESTAMP",
"(",
"6",
")",
"columns",
"to",
"datetime",
"objects",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_utils.py#L120-L129 | train | Converts MySQL TIMESTAMP columns to RDFDatetime objects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mysql_utils.py | ComponentsToPath | def ComponentsToPath(components):
"""Converts a list of path components to a canonical path representation.
Args:
components: A sequence of path components.
Returns:
A canonical MySQL path representation.
"""
precondition.AssertIterableType(components, Text)
for component in components:
if not... | python | def ComponentsToPath(components):
"""Converts a list of path components to a canonical path representation.
Args:
components: A sequence of path components.
Returns:
A canonical MySQL path representation.
"""
precondition.AssertIterableType(components, Text)
for component in components:
if not... | [
"def",
"ComponentsToPath",
"(",
"components",
")",
":",
"precondition",
".",
"AssertIterableType",
"(",
"components",
",",
"Text",
")",
"for",
"component",
"in",
"components",
":",
"if",
"not",
"component",
":",
"raise",
"ValueError",
"(",
"\"Empty path component ... | Converts a list of path components to a canonical path representation.
Args:
components: A sequence of path components.
Returns:
A canonical MySQL path representation. | [
"Converts",
"a",
"list",
"of",
"path",
"components",
"to",
"a",
"canonical",
"path",
"representation",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_utils.py#L141-L161 | train | Converts a list of path components to a canonical MySQL path representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/databases/mysql_utils.py | PathToComponents | def PathToComponents(path):
"""Converts a canonical path representation to a list of components.
Args:
path: A canonical MySQL path representation.
Returns:
A sequence of path components.
"""
precondition.AssertType(path, Text)
if path and not path.startswith("/"):
raise ValueError("Path '{}' ... | python | def PathToComponents(path):
"""Converts a canonical path representation to a list of components.
Args:
path: A canonical MySQL path representation.
Returns:
A sequence of path components.
"""
precondition.AssertType(path, Text)
if path and not path.startswith("/"):
raise ValueError("Path '{}' ... | [
"def",
"PathToComponents",
"(",
"path",
")",
":",
"precondition",
".",
"AssertType",
"(",
"path",
",",
"Text",
")",
"if",
"path",
"and",
"not",
"path",
".",
"startswith",
"(",
"\"/\"",
")",
":",
"raise",
"ValueError",
"(",
"\"Path '{}' is not absolute\"",
".... | Converts a canonical path representation to a list of components.
Args:
path: A canonical MySQL path representation.
Returns:
A sequence of path components. | [
"Converts",
"a",
"canonical",
"path",
"representation",
"to",
"a",
"list",
"of",
"components",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_utils.py#L164-L180 | train | Converts a MySQL path representation to a list of components. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_service_parser.py | _LogInvalidRunLevels | def _LogInvalidRunLevels(states, valid):
"""Log any invalid run states found."""
invalid = set()
for state in states:
if state not in valid:
invalid.add(state)
if invalid:
logging.warning("Invalid init runlevel(s) encountered: %s",
", ".join(invalid)) | python | def _LogInvalidRunLevels(states, valid):
"""Log any invalid run states found."""
invalid = set()
for state in states:
if state not in valid:
invalid.add(state)
if invalid:
logging.warning("Invalid init runlevel(s) encountered: %s",
", ".join(invalid)) | [
"def",
"_LogInvalidRunLevels",
"(",
"states",
",",
"valid",
")",
":",
"invalid",
"=",
"set",
"(",
")",
"for",
"state",
"in",
"states",
":",
"if",
"state",
"not",
"in",
"valid",
":",
"invalid",
".",
"add",
"(",
"state",
")",
"if",
"invalid",
":",
"log... | Log any invalid run states found. | [
"Log",
"any",
"invalid",
"run",
"states",
"found",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_service_parser.py#L77-L85 | train | Log any invalid run states found. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_service_parser.py | GetRunlevelsLSB | def GetRunlevelsLSB(states):
"""Accepts a string and returns a list of strings of numeric LSB runlevels."""
if not states:
return set()
valid = set(["0", "1", "2", "3", "4", "5", "6"])
_LogInvalidRunLevels(states, valid)
return valid.intersection(set(states.split())) | python | def GetRunlevelsLSB(states):
"""Accepts a string and returns a list of strings of numeric LSB runlevels."""
if not states:
return set()
valid = set(["0", "1", "2", "3", "4", "5", "6"])
_LogInvalidRunLevels(states, valid)
return valid.intersection(set(states.split())) | [
"def",
"GetRunlevelsLSB",
"(",
"states",
")",
":",
"if",
"not",
"states",
":",
"return",
"set",
"(",
")",
"valid",
"=",
"set",
"(",
"[",
"\"0\"",
",",
"\"1\"",
",",
"\"2\"",
",",
"\"3\"",
",",
"\"4\"",
",",
"\"5\"",
",",
"\"6\"",
"]",
")",
"_LogInv... | Accepts a string and returns a list of strings of numeric LSB runlevels. | [
"Accepts",
"a",
"string",
"and",
"returns",
"a",
"list",
"of",
"strings",
"of",
"numeric",
"LSB",
"runlevels",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_service_parser.py#L88-L94 | train | Accepts a string and returns a list of strings of numeric LSB runlevels. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_service_parser.py | GetRunlevelsNonLSB | def GetRunlevelsNonLSB(states):
"""Accepts a string and returns a list of strings of numeric LSB runlevels."""
if not states:
return set()
convert_table = {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
# SysV, Gentoo, Solaris, HP-UX all ... | python | def GetRunlevelsNonLSB(states):
"""Accepts a string and returns a list of strings of numeric LSB runlevels."""
if not states:
return set()
convert_table = {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
# SysV, Gentoo, Solaris, HP-UX all ... | [
"def",
"GetRunlevelsNonLSB",
"(",
"states",
")",
":",
"if",
"not",
"states",
":",
"return",
"set",
"(",
")",
"convert_table",
"=",
"{",
"\"0\"",
":",
"\"0\"",
",",
"\"1\"",
":",
"\"1\"",
",",
"\"2\"",
":",
"\"2\"",
",",
"\"3\"",
":",
"\"3\"",
",",
"\... | Accepts a string and returns a list of strings of numeric LSB runlevels. | [
"Accepts",
"a",
"string",
"and",
"returns",
"a",
"list",
"of",
"strings",
"of",
"numeric",
"LSB",
"runlevels",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_service_parser.py#L97-L115 | train | Accepts a string and returns a list of strings of numeric LSB runlevels. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_service_parser.py | LinuxLSBInitParser._InsservExpander | def _InsservExpander(self, facilities, val):
"""Expand insserv variables."""
expanded = []
if val.startswith("$"):
vals = facilities.get(val, [])
for v in vals:
expanded.extend(self._InsservExpander(facilities, v))
elif val.startswith("+"):
expanded.append(val[1:])
else:
... | python | def _InsservExpander(self, facilities, val):
"""Expand insserv variables."""
expanded = []
if val.startswith("$"):
vals = facilities.get(val, [])
for v in vals:
expanded.extend(self._InsservExpander(facilities, v))
elif val.startswith("+"):
expanded.append(val[1:])
else:
... | [
"def",
"_InsservExpander",
"(",
"self",
",",
"facilities",
",",
"val",
")",
":",
"expanded",
"=",
"[",
"]",
"if",
"val",
".",
"startswith",
"(",
"\"$\"",
")",
":",
"vals",
"=",
"facilities",
".",
"get",
"(",
"val",
",",
"[",
"]",
")",
"for",
"v",
... | Expand insserv variables. | [
"Expand",
"insserv",
"variables",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_service_parser.py#L151-L162 | train | Expand insserv variables. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_service_parser.py | LinuxLSBInitParser._ParseInsserv | def _ParseInsserv(self, data):
"""/etc/insserv.conf* entries define system facilities.
Full format details are in man 8 insserv, but the basic structure is:
$variable facility1 facility2
$second_variable facility3 $variable
Any init script that specifies Required-Start: $second_vari... | python | def _ParseInsserv(self, data):
"""/etc/insserv.conf* entries define system facilities.
Full format details are in man 8 insserv, but the basic structure is:
$variable facility1 facility2
$second_variable facility3 $variable
Any init script that specifies Required-Start: $second_vari... | [
"def",
"_ParseInsserv",
"(",
"self",
",",
"data",
")",
":",
"p",
"=",
"config_file",
".",
"FieldParser",
"(",
")",
"entries",
"=",
"p",
".",
"ParseEntries",
"(",
"data",
")",
"raw",
"=",
"{",
"e",
"[",
"0",
"]",
":",
"e",
"[",
"1",
":",
"]",
"f... | /etc/insserv.conf* entries define system facilities.
Full format details are in man 8 insserv, but the basic structure is:
$variable facility1 facility2
$second_variable facility3 $variable
Any init script that specifies Required-Start: $second_variable needs to be
expanded to facil... | [
"/",
"etc",
"/",
"insserv",
".",
"conf",
"*",
"entries",
"define",
"system",
"facilities",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_service_parser.py#L164-L189 | train | Parses the INSserv file and returns a list of services and facilities. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_service_parser.py | LinuxXinetdParser._ProcessEntries | def _ProcessEntries(self, fd):
"""Extract entries from the xinetd config files."""
p = config_file.KeyValueParser(kv_sep="{", term="}", sep=None)
data = utils.ReadFileBytesAsUnicode(fd)
entries = p.ParseEntries(data)
for entry in entries:
for section, cfg in iteritems(entry):
# The par... | python | def _ProcessEntries(self, fd):
"""Extract entries from the xinetd config files."""
p = config_file.KeyValueParser(kv_sep="{", term="}", sep=None)
data = utils.ReadFileBytesAsUnicode(fd)
entries = p.ParseEntries(data)
for entry in entries:
for section, cfg in iteritems(entry):
# The par... | [
"def",
"_ProcessEntries",
"(",
"self",
",",
"fd",
")",
":",
"p",
"=",
"config_file",
".",
"KeyValueParser",
"(",
"kv_sep",
"=",
"\"{\"",
",",
"term",
"=",
"\"}\"",
",",
"sep",
"=",
"None",
")",
"data",
"=",
"utils",
".",
"ReadFileBytesAsUnicode",
"(",
... | Extract entries from the xinetd config files. | [
"Extract",
"entries",
"from",
"the",
"xinetd",
"config",
"files",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_service_parser.py#L229-L241 | train | Extract entries from the xinetd config files. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_service_parser.py | LinuxXinetdParser._GenConfig | def _GenConfig(self, cfg):
"""Interpolate configurations with defaults to generate actual configs."""
# Some setting names may have a + or - suffix. These indicate that the
# settings modify the default values.
merged = self.default.copy()
for setting, vals in iteritems(cfg):
option, operator ... | python | def _GenConfig(self, cfg):
"""Interpolate configurations with defaults to generate actual configs."""
# Some setting names may have a + or - suffix. These indicate that the
# settings modify the default values.
merged = self.default.copy()
for setting, vals in iteritems(cfg):
option, operator ... | [
"def",
"_GenConfig",
"(",
"self",
",",
"cfg",
")",
":",
"# Some setting names may have a + or - suffix. These indicate that the",
"# settings modify the default values.",
"merged",
"=",
"self",
".",
"default",
".",
"copy",
"(",
")",
"for",
"setting",
",",
"vals",
"in",
... | Interpolate configurations with defaults to generate actual configs. | [
"Interpolate",
"configurations",
"with",
"defaults",
"to",
"generate",
"actual",
"configs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_service_parser.py#L243-L258 | train | Interpolate configurations with defaults to generate actual configs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_service_parser.py | LinuxSysVInitParser.ParseMultiple | def ParseMultiple(self, stats, unused_file_obj, unused_kb):
"""Identify the init scripts and the start/stop scripts at each runlevel.
Evaluate all the stat entries collected from the system.
If the path name matches a runlevel spec, and if the filename matches a
sysv init symlink process the link as a ... | python | def ParseMultiple(self, stats, unused_file_obj, unused_kb):
"""Identify the init scripts and the start/stop scripts at each runlevel.
Evaluate all the stat entries collected from the system.
If the path name matches a runlevel spec, and if the filename matches a
sysv init symlink process the link as a ... | [
"def",
"ParseMultiple",
"(",
"self",
",",
"stats",
",",
"unused_file_obj",
",",
"unused_kb",
")",
":",
"services",
"=",
"{",
"}",
"for",
"stat_entry",
"in",
"stats",
":",
"path",
"=",
"stat_entry",
".",
"pathspec",
".",
"path",
"runlevel",
"=",
"self",
"... | Identify the init scripts and the start/stop scripts at each runlevel.
Evaluate all the stat entries collected from the system.
If the path name matches a runlevel spec, and if the filename matches a
sysv init symlink process the link as a service.
Args:
stats: An iterator of StatEntry rdfs.
... | [
"Identify",
"the",
"init",
"scripts",
"and",
"the",
"start",
"/",
"stop",
"scripts",
"at",
"each",
"runlevel",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_service_parser.py#L298-L338 | train | Parse a single file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/gui/api_labels_restricted_call_router.py | CheckClientLabels | def CheckClientLabels(client_id,
labels_whitelist=None,
labels_owners_whitelist=None,
token=None):
"""Checks a given client against labels/owners whitelists."""
labels_whitelist = labels_whitelist or []
labels_owners_whitelist = labels_owners_whit... | python | def CheckClientLabels(client_id,
labels_whitelist=None,
labels_owners_whitelist=None,
token=None):
"""Checks a given client against labels/owners whitelists."""
labels_whitelist = labels_whitelist or []
labels_owners_whitelist = labels_owners_whit... | [
"def",
"CheckClientLabels",
"(",
"client_id",
",",
"labels_whitelist",
"=",
"None",
",",
"labels_owners_whitelist",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"labels_whitelist",
"=",
"labels_whitelist",
"or",
"[",
"]",
"labels_owners_whitelist",
"=",
"labe... | Checks a given client against labels/owners whitelists. | [
"Checks",
"a",
"given",
"client",
"against",
"labels",
"/",
"owners",
"whitelists",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_labels_restricted_call_router.py#L29-L52 | train | Checks a given client against labels and owners whitelists. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.