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/core/grr_response_core/lib/parsers/linux_file_parser.py | LinuxSystemPasswdParser.AddPassword | def AddPassword(self, fileset):
"""Add the passwd entries to the shadow store."""
passwd = fileset.get("/etc/passwd")
if passwd:
self._ParseFile(passwd, self.ParsePasswdEntry)
else:
logging.debug("No /etc/passwd file.") | python | def AddPassword(self, fileset):
"""Add the passwd entries to the shadow store."""
passwd = fileset.get("/etc/passwd")
if passwd:
self._ParseFile(passwd, self.ParsePasswdEntry)
else:
logging.debug("No /etc/passwd file.") | [
"def",
"AddPassword",
"(",
"self",
",",
"fileset",
")",
":",
"passwd",
"=",
"fileset",
".",
"get",
"(",
"\"/etc/passwd\"",
")",
"if",
"passwd",
":",
"self",
".",
"_ParseFile",
"(",
"passwd",
",",
"self",
".",
"ParsePasswdEntry",
")",
"else",
":",
"loggin... | Add the passwd entries to the shadow store. | [
"Add",
"the",
"passwd",
"entries",
"to",
"the",
"shadow",
"store",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_file_parser.py#L663-L669 | train | Add the passwd entries to the shadow store. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_file_parser.py | LinuxSystemPasswdParser.AddShadow | def AddShadow(self, fileset):
"""Add the shadow entries to the shadow store."""
shadow = fileset.get("/etc/shadow")
if shadow:
self._ParseFile(shadow, self.ParseShadowEntry)
else:
logging.debug("No /etc/shadow file.") | python | def AddShadow(self, fileset):
"""Add the shadow entries to the shadow store."""
shadow = fileset.get("/etc/shadow")
if shadow:
self._ParseFile(shadow, self.ParseShadowEntry)
else:
logging.debug("No /etc/shadow file.") | [
"def",
"AddShadow",
"(",
"self",
",",
"fileset",
")",
":",
"shadow",
"=",
"fileset",
".",
"get",
"(",
"\"/etc/shadow\"",
")",
"if",
"shadow",
":",
"self",
".",
"_ParseFile",
"(",
"shadow",
",",
"self",
".",
"ParseShadowEntry",
")",
"else",
":",
"logging"... | Add the shadow entries to the shadow store. | [
"Add",
"the",
"shadow",
"entries",
"to",
"the",
"shadow",
"store",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_file_parser.py#L671-L677 | train | Add the shadow entries to the shadow store. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/linux_file_parser.py | LinuxSystemPasswdParser.ParseFileset | def ParseFileset(self, fileset=None):
"""Process linux system login files.
Orchestrates collection of account entries from /etc/passwd and
/etc/shadow. The passwd and shadow entries are reconciled and group
memberships are mapped to the account.
Args:
fileset: A dict of files mapped from pa... | python | def ParseFileset(self, fileset=None):
"""Process linux system login files.
Orchestrates collection of account entries from /etc/passwd and
/etc/shadow. The passwd and shadow entries are reconciled and group
memberships are mapped to the account.
Args:
fileset: A dict of files mapped from pa... | [
"def",
"ParseFileset",
"(",
"self",
",",
"fileset",
"=",
"None",
")",
":",
"self",
".",
"AddPassword",
"(",
"fileset",
")",
"self",
".",
"AddShadow",
"(",
"fileset",
")",
"self",
".",
"ReconcileShadow",
"(",
"self",
".",
"shadow_store",
")",
"# Get group m... | Process linux system login files.
Orchestrates collection of account entries from /etc/passwd and
/etc/shadow. The passwd and shadow entries are reconciled and group
memberships are mapped to the account.
Args:
fileset: A dict of files mapped from path to an open file.
Yields:
- A se... | [
"Process",
"linux",
"system",
"login",
"files",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_file_parser.py#L679-L711 | train | Parse a linux system login fileset and populate the user and group memberships. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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_file_parser.py | PathParser._ExpandPath | def _ExpandPath(self, target, vals, paths):
"""Extract path information, interpolating current path values as needed."""
if target not in self._TARGETS:
return
expanded = []
for val in vals:
# Null entries specify the current directory, so :a::b:c: is equivalent
# to .:a:.:b:c:.
... | python | def _ExpandPath(self, target, vals, paths):
"""Extract path information, interpolating current path values as needed."""
if target not in self._TARGETS:
return
expanded = []
for val in vals:
# Null entries specify the current directory, so :a::b:c: is equivalent
# to .:a:.:b:c:.
... | [
"def",
"_ExpandPath",
"(",
"self",
",",
"target",
",",
"vals",
",",
"paths",
")",
":",
"if",
"target",
"not",
"in",
"self",
".",
"_TARGETS",
":",
"return",
"expanded",
"=",
"[",
"]",
"for",
"val",
"in",
"vals",
":",
"# Null entries specify the current dire... | Extract path information, interpolating current path values as needed. | [
"Extract",
"path",
"information",
"interpolating",
"current",
"path",
"values",
"as",
"needed",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_file_parser.py#L749-L770 | train | Extract path information interpolating current path values as needed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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_file_parser.py | PathParser._ParseShVariables | def _ParseShVariables(self, lines):
"""Extract env_var and path values from sh derivative shells.
Iterates over each line, word by word searching for statements that set the
path. These are either variables, or conditions that would allow a variable
to be set later in the line (e.g. export).
Args:... | python | def _ParseShVariables(self, lines):
"""Extract env_var and path values from sh derivative shells.
Iterates over each line, word by word searching for statements that set the
path. These are either variables, or conditions that would allow a variable
to be set later in the line (e.g. export).
Args:... | [
"def",
"_ParseShVariables",
"(",
"self",
",",
"lines",
")",
":",
"paths",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"for",
"entry",
"in",
"line",
":",
"if",
"\"=\"",
"in",
"entry",
":",
"# Pad out the list so that it's always 2 elements, even if the spli... | Extract env_var and path values from sh derivative shells.
Iterates over each line, word by word searching for statements that set the
path. These are either variables, or conditions that would allow a variable
to be set later in the line (e.g. export).
Args:
lines: A list of lines, each of whic... | [
"Extract",
"env_var",
"and",
"path",
"values",
"from",
"sh",
"derivative",
"shells",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_file_parser.py#L772-L803 | train | Parses the environment variables and paths from the line. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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_file_parser.py | PathParser._ParseCshVariables | def _ParseCshVariables(self, lines):
"""Extract env_var and path values from csh derivative shells.
Path attributes can be set several ways:
- setenv takes the form "setenv PATH_NAME COLON:SEPARATED:LIST"
- set takes the form "set path_name=(space separated list)" and is
automatically exported fo... | python | def _ParseCshVariables(self, lines):
"""Extract env_var and path values from csh derivative shells.
Path attributes can be set several ways:
- setenv takes the form "setenv PATH_NAME COLON:SEPARATED:LIST"
- set takes the form "set path_name=(space separated list)" and is
automatically exported fo... | [
"def",
"_ParseCshVariables",
"(",
"self",
",",
"lines",
")",
":",
"paths",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"if",
"len",
"(",
"line",
")",
"<",
"2",
":",
"continue",
"action",
"=",
"line",
"[",
"0",
"]",
"if",
"action",
"==",
"\"... | Extract env_var and path values from csh derivative shells.
Path attributes can be set several ways:
- setenv takes the form "setenv PATH_NAME COLON:SEPARATED:LIST"
- set takes the form "set path_name=(space separated list)" and is
automatically exported for several types of files.
The first ent... | [
"Extract",
"env_var",
"and",
"path",
"values",
"from",
"csh",
"derivative",
"shells",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_file_parser.py#L805-L842 | train | Parses the environment variables and path values from a list of lines. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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_file_parser.py | PathParser.Parse | def Parse(self, stat, file_obj, knowledge_base):
"""Identifies the paths set within a file.
Expands paths within the context of the file, but does not infer fully
expanded paths from external states. There are plenty of cases where path
attributes are unresolved, e.g. sourcing other files.
Lines a... | python | def Parse(self, stat, file_obj, knowledge_base):
"""Identifies the paths set within a file.
Expands paths within the context of the file, but does not infer fully
expanded paths from external states. There are plenty of cases where path
attributes are unresolved, e.g. sourcing other files.
Lines a... | [
"def",
"Parse",
"(",
"self",
",",
"stat",
",",
"file_obj",
",",
"knowledge_base",
")",
":",
"_",
"=",
"knowledge_base",
"lines",
"=",
"self",
".",
"parser",
".",
"ParseEntries",
"(",
"utils",
".",
"ReadFileBytesAsUnicode",
"(",
"file_obj",
")",
")",
"if",
... | Identifies the paths set within a file.
Expands paths within the context of the file, but does not infer fully
expanded paths from external states. There are plenty of cases where path
attributes are unresolved, e.g. sourcing other files.
Lines are not handled literally. A field parser is used to:
... | [
"Identifies",
"the",
"paths",
"set",
"within",
"a",
"file",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_file_parser.py#L844-L875 | train | Parses the file and returns a set of attributed 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/client/grr_response_client/vfs_handlers/base.py | VFSHandler.Seek | def Seek(self, offset, whence=os.SEEK_SET):
"""Seek to an offset in the file."""
if whence == os.SEEK_SET:
self.offset = offset
elif whence == os.SEEK_CUR:
self.offset += offset
elif whence == os.SEEK_END:
self.offset = self.size + offset
else:
raise ValueError("Illegal whenc... | python | def Seek(self, offset, whence=os.SEEK_SET):
"""Seek to an offset in the file."""
if whence == os.SEEK_SET:
self.offset = offset
elif whence == os.SEEK_CUR:
self.offset += offset
elif whence == os.SEEK_END:
self.offset = self.size + offset
else:
raise ValueError("Illegal whenc... | [
"def",
"Seek",
"(",
"self",
",",
"offset",
",",
"whence",
"=",
"os",
".",
"SEEK_SET",
")",
":",
"if",
"whence",
"==",
"os",
".",
"SEEK_SET",
":",
"self",
".",
"offset",
"=",
"offset",
"elif",
"whence",
"==",
"os",
".",
"SEEK_CUR",
":",
"self",
".",... | Seek to an offset in the file. | [
"Seek",
"to",
"an",
"offset",
"in",
"the",
"file",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/vfs_handlers/base.py#L89-L98 | train | Seek to an offset in the file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/client/grr_response_client/vfs_handlers/base.py | VFSHandler.OpenAsContainer | def OpenAsContainer(self):
"""Guesses a container from the current object."""
if self.IsDirectory():
return self
# TODO(user): Add support for more containers here (e.g. registries, zip
# files etc).
else: # For now just guess TSK.
tsk_handler = self._handlers[rdf_paths.PathSpec.PathTy... | python | def OpenAsContainer(self):
"""Guesses a container from the current object."""
if self.IsDirectory():
return self
# TODO(user): Add support for more containers here (e.g. registries, zip
# files etc).
else: # For now just guess TSK.
tsk_handler = self._handlers[rdf_paths.PathSpec.PathTy... | [
"def",
"OpenAsContainer",
"(",
"self",
")",
":",
"if",
"self",
".",
"IsDirectory",
"(",
")",
":",
"return",
"self",
"# TODO(user): Add support for more containers here (e.g. registries, zip",
"# files etc).",
"else",
":",
"# For now just guess TSK.",
"tsk_handler",
"=",
"... | Guesses a container from the current object. | [
"Guesses",
"a",
"container",
"from",
"the",
"current",
"object",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/vfs_handlers/base.py#L121-L136 | train | Guesses a container from the current 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/client/grr_response_client/vfs_handlers/base.py | VFSHandler.MatchBestComponentName | def MatchBestComponentName(self, component):
"""Returns the name of the component which matches best our base listing.
In order to do the best case insensitive matching we list the files in the
base handler and return the base match for this component.
Args:
component: A component name which sho... | python | def MatchBestComponentName(self, component):
"""Returns the name of the component which matches best our base listing.
In order to do the best case insensitive matching we list the files in the
base handler and return the base match for this component.
Args:
component: A component name which sho... | [
"def",
"MatchBestComponentName",
"(",
"self",
",",
"component",
")",
":",
"fd",
"=",
"self",
".",
"OpenAsContainer",
"(",
")",
"# Adjust the component casing",
"file_listing",
"=",
"set",
"(",
"fd",
".",
"ListNames",
"(",
")",
")",
"# First try an exact match",
... | Returns the name of the component which matches best our base listing.
In order to do the best case insensitive matching we list the files in the
base handler and return the base match for this component.
Args:
component: A component name which should be present in this directory.
Returns:
... | [
"Returns",
"the",
"name",
"of",
"the",
"component",
"which",
"matches",
"best",
"our",
"base",
"listing",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/vfs_handlers/base.py#L138-L171 | train | Returns the name of the component which matches the best our base listing. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/vfs_handlers/base.py | VFSHandler.Open | def Open(cls, fd, component, handlers, pathspec=None, progress_callback=None):
"""Try to correct the casing of component.
This method is called when we failed to open the component directly. We try
to transform the component into something which is likely to work.
In this implementation, we correct th... | python | def Open(cls, fd, component, handlers, pathspec=None, progress_callback=None):
"""Try to correct the casing of component.
This method is called when we failed to open the component directly. We try
to transform the component into something which is likely to work.
In this implementation, we correct th... | [
"def",
"Open",
"(",
"cls",
",",
"fd",
",",
"component",
",",
"handlers",
",",
"pathspec",
"=",
"None",
",",
"progress_callback",
"=",
"None",
")",
":",
"# The handler for this component",
"try",
":",
"handler",
"=",
"handlers",
"[",
"component",
".",
"pathty... | Try to correct the casing of component.
This method is called when we failed to open the component directly. We try
to transform the component into something which is likely to work.
In this implementation, we correct the case of the component until we can
not open the path any more.
Args:
... | [
"Try",
"to",
"correct",
"the",
"casing",
"of",
"component",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/vfs_handlers/base.py#L199-L272 | train | Opens a file object for the given component. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/multi_type_collection.py | MultiTypeCollection.StaticAdd | def StaticAdd(cls,
collection_urn,
rdf_value,
timestamp=None,
suffix=None,
mutation_pool=None):
"""Adds an rdf value to a collection.
Adds an rdf value to a collection. Does not require that the collection be
open. NOTE: The ca... | python | def StaticAdd(cls,
collection_urn,
rdf_value,
timestamp=None,
suffix=None,
mutation_pool=None):
"""Adds an rdf value to a collection.
Adds an rdf value to a collection. Does not require that the collection be
open. NOTE: The ca... | [
"def",
"StaticAdd",
"(",
"cls",
",",
"collection_urn",
",",
"rdf_value",
",",
"timestamp",
"=",
"None",
",",
"suffix",
"=",
"None",
",",
"mutation_pool",
"=",
"None",
")",
":",
"if",
"rdf_value",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Can't add ... | Adds an rdf value to a collection.
Adds an rdf value to a collection. Does not require that the collection be
open. NOTE: The caller is responsible for ensuring that the collection
exists and is of the correct type.
Args:
collection_urn: The urn of the collection to add to.
rdf_value: The ... | [
"Adds",
"an",
"rdf",
"value",
"to",
"a",
"collection",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/multi_type_collection.py#L26-L79 | train | Adds an rdf value to a multi - type collection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/multi_type_collection.py | MultiTypeCollection.ScanByType | def ScanByType(self,
type_name,
after_timestamp=None,
include_suffix=False,
max_records=None):
"""Scans for stored records.
Scans through the collection, returning stored values ordered by timestamp.
Args:
type_name: Type of the rec... | python | def ScanByType(self,
type_name,
after_timestamp=None,
include_suffix=False,
max_records=None):
"""Scans for stored records.
Scans through the collection, returning stored values ordered by timestamp.
Args:
type_name: Type of the rec... | [
"def",
"ScanByType",
"(",
"self",
",",
"type_name",
",",
"after_timestamp",
"=",
"None",
",",
"include_suffix",
"=",
"False",
",",
"max_records",
"=",
"None",
")",
":",
"sub_collection_urn",
"=",
"self",
".",
"collection_id",
".",
"Add",
"(",
"type_name",
")... | Scans for stored records.
Scans through the collection, returning stored values ordered by timestamp.
Args:
type_name: Type of the records to scan.
after_timestamp: If set, only returns values recorded after timestamp.
include_suffix: If true, the timestamps returned are pairs of the form
... | [
"Scans",
"for",
"stored",
"records",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/multi_type_collection.py#L85-L115 | train | Scans for stored records of a certain type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | StartHunt | def StartHunt(args=None, runner_args=None, token=None, **kwargs):
"""This class method creates new hunts."""
# If no token is specified, raise.
if not token:
raise access_control.UnauthorizedAccess("A token must be specified.")
# Build the runner args from the keywords.
if runner_args is None:
runne... | python | def StartHunt(args=None, runner_args=None, token=None, **kwargs):
"""This class method creates new hunts."""
# If no token is specified, raise.
if not token:
raise access_control.UnauthorizedAccess("A token must be specified.")
# Build the runner args from the keywords.
if runner_args is None:
runne... | [
"def",
"StartHunt",
"(",
"args",
"=",
"None",
",",
"runner_args",
"=",
"None",
",",
"token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# If no token is specified, raise.",
"if",
"not",
"token",
":",
"raise",
"access_control",
".",
"UnauthorizedAccess",
... | This class method creates new hunts. | [
"This",
"class",
"method",
"creates",
"new",
"hunts",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L52-L112 | train | This class method creates new hunts. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | HuntRunner.ProcessCompletedRequests | def ProcessCompletedRequests(self, notification, thread_pool):
"""Go through the list of requests and process the completed ones.
We take a snapshot in time of all requests and responses for this hunt. We
then process as many completed requests as possible. If responses are not
quite here we leave it f... | python | def ProcessCompletedRequests(self, notification, thread_pool):
"""Go through the list of requests and process the completed ones.
We take a snapshot in time of all requests and responses for this hunt. We
then process as many completed requests as possible. If responses are not
quite here we leave it f... | [
"def",
"ProcessCompletedRequests",
"(",
"self",
",",
"notification",
",",
"thread_pool",
")",
":",
"# First ensure that client messages are all removed. NOTE: We make a new",
"# queue manager here because we want only the client messages to be removed",
"# ASAP. This must happen before we ac... | Go through the list of requests and process the completed ones.
We take a snapshot in time of all requests and responses for this hunt. We
then process as many completed requests as possible. If responses are not
quite here we leave it for next time.
Args:
notification: The notification object t... | [
"Go",
"through",
"the",
"list",
"of",
"requests",
"and",
"process",
"the",
"completed",
"ones",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L187-L261 | train | Processes the completed requests and responses for this hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner.RunStateMethod | def RunStateMethod(self,
method_name,
request=None,
responses=None,
event=None,
direct_response=None):
"""Completes the request by calling the state method.
Args:
method_name: The name of the state me... | python | def RunStateMethod(self,
method_name,
request=None,
responses=None,
event=None,
direct_response=None):
"""Completes the request by calling the state method.
Args:
method_name: The name of the state me... | [
"def",
"RunStateMethod",
"(",
"self",
",",
"method_name",
",",
"request",
"=",
"None",
",",
"responses",
"=",
"None",
",",
"event",
"=",
"None",
",",
"direct_response",
"=",
"None",
")",
":",
"client_id",
"=",
"None",
"try",
":",
"self",
".",
"context",
... | 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 GrrMessages responding to the request.
event: A threading.Event() instance to signal completion of this request.
direct_re... | [
"Completes",
"the",
"request",
"by",
"calling",
"the",
"state",
"method",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L263-L331 | train | Runs the state method specified by method_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/server/grr_response_server/hunts/implementation.py | HuntRunner.Publish | def Publish(self, event_name, msg, delay=0):
"""Sends the message to event listeners."""
events_lib.Events.PublishEvent(event_name, msg, delay=delay) | python | def Publish(self, event_name, msg, delay=0):
"""Sends the message to event listeners."""
events_lib.Events.PublishEvent(event_name, msg, delay=delay) | [
"def",
"Publish",
"(",
"self",
",",
"event_name",
",",
"msg",
",",
"delay",
"=",
"0",
")",
":",
"events_lib",
".",
"Events",
".",
"PublishEvent",
"(",
"event_name",
",",
"msg",
",",
"delay",
"=",
"delay",
")"
] | Sends the message to event listeners. | [
"Sends",
"the",
"message",
"to",
"event",
"listeners",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L339-L341 | train | Sends the message to the event listeners. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | HuntRunner._GetSubFlowCPULimit | def _GetSubFlowCPULimit(self):
"""Get current CPU limit for subflows."""
subflow_cpu_limit = None
if self.runner_args.per_client_cpu_limit:
subflow_cpu_limit = self.runner_args.per_client_cpu_limit
if self.runner_args.cpu_limit:
cpu_usage_data = self.context.client_resources.cpu_usage
... | python | def _GetSubFlowCPULimit(self):
"""Get current CPU limit for subflows."""
subflow_cpu_limit = None
if self.runner_args.per_client_cpu_limit:
subflow_cpu_limit = self.runner_args.per_client_cpu_limit
if self.runner_args.cpu_limit:
cpu_usage_data = self.context.client_resources.cpu_usage
... | [
"def",
"_GetSubFlowCPULimit",
"(",
"self",
")",
":",
"subflow_cpu_limit",
"=",
"None",
"if",
"self",
".",
"runner_args",
".",
"per_client_cpu_limit",
":",
"subflow_cpu_limit",
"=",
"self",
".",
"runner_args",
".",
"per_client_cpu_limit",
"if",
"self",
".",
"runner... | Get current CPU limit for subflows. | [
"Get",
"current",
"CPU",
"limit",
"for",
"subflows",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L343-L364 | train | Get current CPU limit for subflows. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | HuntRunner._GetSubFlowNetworkLimit | def _GetSubFlowNetworkLimit(self):
"""Get current network limit for subflows."""
subflow_network_limit = None
if self.runner_args.per_client_network_limit_bytes:
subflow_network_limit = self.runner_args.per_client_network_limit_bytes
if self.runner_args.network_bytes_limit:
remaining_netw... | python | def _GetSubFlowNetworkLimit(self):
"""Get current network limit for subflows."""
subflow_network_limit = None
if self.runner_args.per_client_network_limit_bytes:
subflow_network_limit = self.runner_args.per_client_network_limit_bytes
if self.runner_args.network_bytes_limit:
remaining_netw... | [
"def",
"_GetSubFlowNetworkLimit",
"(",
"self",
")",
":",
"subflow_network_limit",
"=",
"None",
"if",
"self",
".",
"runner_args",
".",
"per_client_network_limit_bytes",
":",
"subflow_network_limit",
"=",
"self",
".",
"runner_args",
".",
"per_client_network_limit_bytes",
... | Get current network limit for subflows. | [
"Get",
"current",
"network",
"limit",
"for",
"subflows",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L366-L384 | train | Get current network limit for subflows. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | HuntRunner._CallFlowLegacy | def _CallFlowLegacy(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.
... | python | def _CallFlowLegacy(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.
... | [
"def",
"_CallFlowLegacy",
"(",
"self",
",",
"flow_name",
"=",
"None",
",",
"next_state",
"=",
"None",
",",
"request_data",
"=",
"None",
",",
"client_id",
"=",
"None",
",",
"base_session_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client_id",
"=... | 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/hunts/implementation.py#L386-L463 | train | A legacy method for handling flow calls. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | HuntRunner._CallFlowRelational | def _CallFlowRelational(self,
flow_name=None,
args=None,
runner_args=None,
client_id=None,
**kwargs):
"""Creates a new flow and send its responses to a state.
This creates a new flo... | python | def _CallFlowRelational(self,
flow_name=None,
args=None,
runner_args=None,
client_id=None,
**kwargs):
"""Creates a new flow and send its responses to a state.
This creates a new flo... | [
"def",
"_CallFlowRelational",
"(",
"self",
",",
"flow_name",
"=",
"None",
",",
"args",
"=",
"None",
",",
"runner_args",
"=",
"None",
",",
"client_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"client_id",
",",
"rdfvalue",
... | 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/hunts/implementation.py#L465-L508 | train | Creates a new flow and sends its responses to a 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/hunts/implementation.py | HuntRunner.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",
"data_store",
... | 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/hunts/implementation.py#L510-L556 | train | This method creates a new flow and sends its responses to a 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/hunts/implementation.py | HuntRunner._Process | def _Process(self, request, responses, thread_pool=None, events=None):
"""Hunts process all responses concurrently in a threadpool."""
# This function is called and runs within the main processing thread. We do
# not need to lock the hunt object while running in this method.
if request.next_state == "Ad... | python | def _Process(self, request, responses, thread_pool=None, events=None):
"""Hunts process all responses concurrently in a threadpool."""
# This function is called and runs within the main processing thread. We do
# not need to lock the hunt object while running in this method.
if request.next_state == "Ad... | [
"def",
"_Process",
"(",
"self",
",",
"request",
",",
"responses",
",",
"thread_pool",
"=",
"None",
",",
"events",
"=",
"None",
")",
":",
"# This function is called and runs within the main processing thread. We do",
"# not need to lock the hunt object while running in this meth... | Hunts process all responses concurrently in a threadpool. | [
"Hunts",
"process",
"all",
"responses",
"concurrently",
"in",
"a",
"threadpool",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L672-L729 | train | Processes the given request and 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/server/grr_response_server/hunts/implementation.py | HuntRunner.Log | def Log(self, format_str, *args):
"""Logs the message using the hunt's standard logging.
Args:
format_str: Format string
*args: arguments to the format string
Raises:
RuntimeError: on parent missing logs_collection
"""
format_str = utils.SmartUnicode(format_str)
status = for... | python | def Log(self, format_str, *args):
"""Logs the message using the hunt's standard logging.
Args:
format_str: Format string
*args: arguments to the format string
Raises:
RuntimeError: on parent missing logs_collection
"""
format_str = utils.SmartUnicode(format_str)
status = for... | [
"def",
"Log",
"(",
"self",
",",
"format_str",
",",
"*",
"args",
")",
":",
"format_str",
"=",
"utils",
".",
"SmartUnicode",
"(",
"format_str",
")",
"status",
"=",
"format_str",
"if",
"args",
":",
"try",
":",
"# The status message is always in unicode",
"status"... | Logs the message using the hunt's standard logging.
Args:
format_str: Format string
*args: arguments to the format string
Raises:
RuntimeError: on parent missing logs_collection | [
"Logs",
"the",
"message",
"using",
"the",
"hunt",
"s",
"standard",
"logging",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L731-L765 | train | Logs the message using the hunt s 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/hunts/implementation.py | HuntRunner.Error | def Error(self, backtrace, client_id=None):
"""Logs an error for a client but does not terminate the hunt."""
logging.error("Hunt Error: %s", backtrace)
self.hunt_obj.LogClientError(client_id, backtrace=backtrace) | python | def Error(self, backtrace, client_id=None):
"""Logs an error for a client but does not terminate the hunt."""
logging.error("Hunt Error: %s", backtrace)
self.hunt_obj.LogClientError(client_id, backtrace=backtrace) | [
"def",
"Error",
"(",
"self",
",",
"backtrace",
",",
"client_id",
"=",
"None",
")",
":",
"logging",
".",
"error",
"(",
"\"Hunt Error: %s\"",
",",
"backtrace",
")",
"self",
".",
"hunt_obj",
".",
"LogClientError",
"(",
"client_id",
",",
"backtrace",
"=",
"bac... | Logs an error for a client but does not terminate the hunt. | [
"Logs",
"an",
"error",
"for",
"a",
"client",
"but",
"does",
"not",
"terminate",
"the",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L767-L770 | train | Logs an error for a client but does not terminate the hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner.SaveResourceUsage | def SaveResourceUsage(self, client_id, status):
"""Update the resource usage of the hunt."""
# Per client stats.
self.hunt_obj.ProcessClientResourcesStats(client_id, status)
# Overall hunt resource usage.
self.UpdateProtoResources(status) | python | def SaveResourceUsage(self, client_id, status):
"""Update the resource usage of the hunt."""
# Per client stats.
self.hunt_obj.ProcessClientResourcesStats(client_id, status)
# Overall hunt resource usage.
self.UpdateProtoResources(status) | [
"def",
"SaveResourceUsage",
"(",
"self",
",",
"client_id",
",",
"status",
")",
":",
"# Per client stats.",
"self",
".",
"hunt_obj",
".",
"ProcessClientResourcesStats",
"(",
"client_id",
",",
"status",
")",
"# Overall hunt resource usage.",
"self",
".",
"UpdateProtoRes... | Update the resource usage of the hunt. | [
"Update",
"the",
"resource",
"usage",
"of",
"the",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L772-L777 | train | Update the resource usage of the hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner.InitializeContext | def InitializeContext(self, args):
"""Initializes the context of this hunt."""
if args is None:
args = rdf_hunts.HuntRunnerArgs()
context = rdf_hunts.HuntContext(
create_time=rdfvalue.RDFDatetime.Now(),
creator=self.token.username,
duration=args.expiry_time,
start_time... | python | def InitializeContext(self, args):
"""Initializes the context of this hunt."""
if args is None:
args = rdf_hunts.HuntRunnerArgs()
context = rdf_hunts.HuntContext(
create_time=rdfvalue.RDFDatetime.Now(),
creator=self.token.username,
duration=args.expiry_time,
start_time... | [
"def",
"InitializeContext",
"(",
"self",
",",
"args",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"rdf_hunts",
".",
"HuntRunnerArgs",
"(",
")",
"context",
"=",
"rdf_hunts",
".",
"HuntContext",
"(",
"create_time",
"=",
"rdfvalue",
".",
"RDFDatet... | Initializes the context of this hunt. | [
"Initializes",
"the",
"context",
"of",
"this",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L779-L791 | train | Initializes the hunt context. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | HuntRunner.GetNewSessionID | def GetNewSessionID(self, **_):
"""Returns a random integer session ID for this hunt.
All hunts are created under the aff4:/hunts namespace.
Returns:
a formatted session id string.
"""
return rdfvalue.SessionID(base="aff4:/hunts", queue=self.runner_args.queue) | python | def GetNewSessionID(self, **_):
"""Returns a random integer session ID for this hunt.
All hunts are created under the aff4:/hunts namespace.
Returns:
a formatted session id string.
"""
return rdfvalue.SessionID(base="aff4:/hunts", queue=self.runner_args.queue) | [
"def",
"GetNewSessionID",
"(",
"self",
",",
"*",
"*",
"_",
")",
":",
"return",
"rdfvalue",
".",
"SessionID",
"(",
"base",
"=",
"\"aff4:/hunts\"",
",",
"queue",
"=",
"self",
".",
"runner_args",
".",
"queue",
")"
] | Returns a random integer session ID for this hunt.
All hunts are created under the aff4:/hunts namespace.
Returns:
a formatted session id string. | [
"Returns",
"a",
"random",
"integer",
"session",
"ID",
"for",
"this",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L793-L801 | train | Returns a random integer session id for this hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner.Start | def Start(self):
"""This uploads the rules to the foreman and, thus, starts the hunt."""
# We are already running.
if self.hunt_obj.Get(self.hunt_obj.Schema.STATE) == "STARTED":
return
# Determine when this hunt will expire.
self.context.duration = self.runner_args.expiry_time
# When the... | python | def Start(self):
"""This uploads the rules to the foreman and, thus, starts the hunt."""
# We are already running.
if self.hunt_obj.Get(self.hunt_obj.Schema.STATE) == "STARTED":
return
# Determine when this hunt will expire.
self.context.duration = self.runner_args.expiry_time
# When the... | [
"def",
"Start",
"(",
"self",
")",
":",
"# We are already running.",
"if",
"self",
".",
"hunt_obj",
".",
"Get",
"(",
"self",
".",
"hunt_obj",
".",
"Schema",
".",
"STATE",
")",
"==",
"\"STARTED\"",
":",
"return",
"# Determine when this hunt will expire.",
"self",
... | This uploads the rules to the foreman and, thus, starts the hunt. | [
"This",
"uploads",
"the",
"rules",
"to",
"the",
"foreman",
"and",
"thus",
"starts",
"the",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L811-L831 | train | Starts the hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner._AddForemanRule | def _AddForemanRule(self):
"""Adds a foreman rule for this hunt."""
if data_store.RelationalDBEnabled():
# Relational DB uses ForemanCondition objects.
foreman_condition = foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.Now(),
expiration_time=self.context.init_... | python | def _AddForemanRule(self):
"""Adds a foreman rule for this hunt."""
if data_store.RelationalDBEnabled():
# Relational DB uses ForemanCondition objects.
foreman_condition = foreman_rules.ForemanCondition(
creation_time=rdfvalue.RDFDatetime.Now(),
expiration_time=self.context.init_... | [
"def",
"_AddForemanRule",
"(",
"self",
")",
":",
"if",
"data_store",
".",
"RelationalDBEnabled",
"(",
")",
":",
"# Relational DB uses ForemanCondition objects.",
"foreman_condition",
"=",
"foreman_rules",
".",
"ForemanCondition",
"(",
"creation_time",
"=",
"rdfvalue",
"... | Adds a foreman rule for this hunt. | [
"Adds",
"a",
"foreman",
"rule",
"for",
"this",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L833-L876 | train | Adds a foreman rule for this hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner._RemoveForemanRule | def _RemoveForemanRule(self):
"""Removes the foreman rule corresponding to this hunt."""
if data_store.RelationalDBEnabled():
data_store.REL_DB.RemoveForemanRule(hunt_id=self.session_id.Basename())
return
with aff4.FACTORY.Open(
"aff4:/foreman", mode="rw", token=self.token) as foreman:
... | python | def _RemoveForemanRule(self):
"""Removes the foreman rule corresponding to this hunt."""
if data_store.RelationalDBEnabled():
data_store.REL_DB.RemoveForemanRule(hunt_id=self.session_id.Basename())
return
with aff4.FACTORY.Open(
"aff4:/foreman", mode="rw", token=self.token) as foreman:
... | [
"def",
"_RemoveForemanRule",
"(",
"self",
")",
":",
"if",
"data_store",
".",
"RelationalDBEnabled",
"(",
")",
":",
"data_store",
".",
"REL_DB",
".",
"RemoveForemanRule",
"(",
"hunt_id",
"=",
"self",
".",
"session_id",
".",
"Basename",
"(",
")",
")",
"return"... | Removes the foreman rule corresponding to this hunt. | [
"Removes",
"the",
"foreman",
"rule",
"corresponding",
"to",
"this",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L878-L890 | train | Removes the foreman rule corresponding to this hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner._Complete | def _Complete(self):
"""Marks the hunt as completed."""
self._RemoveForemanRule()
if "w" in self.hunt_obj.mode:
self.hunt_obj.Set(self.hunt_obj.Schema.STATE("COMPLETED"))
self.hunt_obj.Flush() | python | def _Complete(self):
"""Marks the hunt as completed."""
self._RemoveForemanRule()
if "w" in self.hunt_obj.mode:
self.hunt_obj.Set(self.hunt_obj.Schema.STATE("COMPLETED"))
self.hunt_obj.Flush() | [
"def",
"_Complete",
"(",
"self",
")",
":",
"self",
".",
"_RemoveForemanRule",
"(",
")",
"if",
"\"w\"",
"in",
"self",
".",
"hunt_obj",
".",
"mode",
":",
"self",
".",
"hunt_obj",
".",
"Set",
"(",
"self",
".",
"hunt_obj",
".",
"Schema",
".",
"STATE",
"(... | Marks the hunt as completed. | [
"Marks",
"the",
"hunt",
"as",
"completed",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L892-L897 | train | Marks the hunt as completed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | HuntRunner.Pause | def Pause(self):
"""Pauses the hunt (removes Foreman rules, does not touch expiry time)."""
if not self.IsHuntStarted():
return
self._RemoveForemanRule()
self.hunt_obj.Set(self.hunt_obj.Schema.STATE("PAUSED"))
self.hunt_obj.Flush()
self._CreateAuditEvent("HUNT_PAUSED") | python | def Pause(self):
"""Pauses the hunt (removes Foreman rules, does not touch expiry time)."""
if not self.IsHuntStarted():
return
self._RemoveForemanRule()
self.hunt_obj.Set(self.hunt_obj.Schema.STATE("PAUSED"))
self.hunt_obj.Flush()
self._CreateAuditEvent("HUNT_PAUSED") | [
"def",
"Pause",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"IsHuntStarted",
"(",
")",
":",
"return",
"self",
".",
"_RemoveForemanRule",
"(",
")",
"self",
".",
"hunt_obj",
".",
"Set",
"(",
"self",
".",
"hunt_obj",
".",
"Schema",
".",
"STATE",
"(... | Pauses the hunt (removes Foreman rules, does not touch expiry time). | [
"Pauses",
"the",
"hunt",
"(",
"removes",
"Foreman",
"rules",
"does",
"not",
"touch",
"expiry",
"time",
")",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L899-L909 | train | Pauses the hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner.Stop | def Stop(self, reason=None):
"""Cancels the hunt (removes Foreman rules, resets expiry time to 0)."""
self._RemoveForemanRule()
self.hunt_obj.Set(self.hunt_obj.Schema.STATE("STOPPED"))
self.hunt_obj.Flush()
self._CreateAuditEvent("HUNT_STOPPED")
if reason:
notification_lib.Notify(
... | python | def Stop(self, reason=None):
"""Cancels the hunt (removes Foreman rules, resets expiry time to 0)."""
self._RemoveForemanRule()
self.hunt_obj.Set(self.hunt_obj.Schema.STATE("STOPPED"))
self.hunt_obj.Flush()
self._CreateAuditEvent("HUNT_STOPPED")
if reason:
notification_lib.Notify(
... | [
"def",
"Stop",
"(",
"self",
",",
"reason",
"=",
"None",
")",
":",
"self",
".",
"_RemoveForemanRule",
"(",
")",
"self",
".",
"hunt_obj",
".",
"Set",
"(",
"self",
".",
"hunt_obj",
".",
"Schema",
".",
"STATE",
"(",
"\"STOPPED\"",
")",
")",
"self",
".",
... | Cancels the hunt (removes Foreman rules, resets expiry time to 0). | [
"Cancels",
"the",
"hunt",
"(",
"removes",
"Foreman",
"rules",
"resets",
"expiry",
"time",
"to",
"0",
")",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L911-L926 | train | Stops the hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | HuntRunner.IsHuntStarted | def IsHuntStarted(self):
"""Is this hunt considered started?
This method is used to check if new clients should be processed by
this hunt. Note that child flow responses are always processed but
new clients are not allowed to be scheduled unless the hunt is
started.
Returns:
If a new cli... | python | def IsHuntStarted(self):
"""Is this hunt considered started?
This method is used to check if new clients should be processed by
this hunt. Note that child flow responses are always processed but
new clients are not allowed to be scheduled unless the hunt is
started.
Returns:
If a new cli... | [
"def",
"IsHuntStarted",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"hunt_obj",
".",
"Get",
"(",
"self",
".",
"hunt_obj",
".",
"Schema",
".",
"STATE",
")",
"if",
"state",
"!=",
"\"STARTED\"",
":",
"return",
"False",
"# Stop the hunt due to expiry.",
... | Is this hunt considered started?
This method is used to check if new clients should be processed by
this hunt. Note that child flow responses are always processed but
new clients are not allowed to be scheduled unless the hunt is
started.
Returns:
If a new client is allowed to be scheduled o... | [
"Is",
"this",
"hunt",
"considered",
"started?"
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L937-L957 | train | Determines if this hunt is started. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | HuntRunner.CallState | def CallState(self,
messages=None,
next_state="",
client_id=None,
request_data=None,
start_time=None):
"""This method is used to asynchronously schedule a new hunt state.
The state will be invoked in a later time and receive all th... | python | def CallState(self,
messages=None,
next_state="",
client_id=None,
request_data=None,
start_time=None):
"""This method is used to asynchronously schedule a new hunt state.
The state will be invoked in a later time and receive all th... | [
"def",
"CallState",
"(",
"self",
",",
"messages",
"=",
"None",
",",
"next_state",
"=",
"\"\"",
",",
"client_id",
"=",
"None",
",",
"request_data",
"=",
"None",
",",
"start_time",
"=",
"None",
")",
":",
"if",
"messages",
"is",
"None",
":",
"messages",
"... | This method is used to asynchronously schedule a new hunt state.
The state will be invoked in a later time and receive all the messages
we send.
Args:
messages: A list of rdfvalues to send. If the last one is not a GrrStatus,
we append an OK Status.
next_state: The state in this hunt t... | [
"This",
"method",
"is",
"used",
"to",
"asynchronously",
"schedule",
"a",
"new",
"hunt",
"state",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L965-L1036 | train | This method is used to schedule a new state in a hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | GRRHunt.CreateRunner | def CreateRunner(self, **kw):
"""Make a new runner."""
self.runner = HuntRunner(self, token=self.token, **kw)
return self.runner | python | def CreateRunner(self, **kw):
"""Make a new runner."""
self.runner = HuntRunner(self, token=self.token, **kw)
return self.runner | [
"def",
"CreateRunner",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"runner",
"=",
"HuntRunner",
"(",
"self",
",",
"token",
"=",
"self",
".",
"token",
",",
"*",
"*",
"kw",
")",
"return",
"self",
".",
"runner"
] | Make a new runner. | [
"Make",
"a",
"new",
"runner",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1120-L1123 | train | Create a new runner. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | GRRHunt.StartClients | def StartClients(cls, hunt_id, client_ids, token=None):
"""This method is called by the foreman for each client it discovers.
Note that this function is performance sensitive since it is called by the
foreman for every client which needs to be scheduled.
Args:
hunt_id: The hunt to schedule.
... | python | def StartClients(cls, hunt_id, client_ids, token=None):
"""This method is called by the foreman for each client it discovers.
Note that this function is performance sensitive since it is called by the
foreman for every client which needs to be scheduled.
Args:
hunt_id: The hunt to schedule.
... | [
"def",
"StartClients",
"(",
"cls",
",",
"hunt_id",
",",
"client_ids",
",",
"token",
"=",
"None",
")",
":",
"token",
"=",
"token",
"or",
"access_control",
".",
"ACLToken",
"(",
"username",
"=",
"\"Hunt\"",
",",
"reason",
"=",
"\"hunting\"",
")",
"with",
"... | This method is called by the foreman for each client it discovers.
Note that this function is performance sensitive since it is called by the
foreman for every client which needs to be scheduled.
Args:
hunt_id: The hunt to schedule.
client_ids: List of clients that should be added to the hunt.... | [
"This",
"method",
"is",
"called",
"by",
"the",
"foreman",
"for",
"each",
"client",
"it",
"discovers",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1331-L1370 | train | Starts a new hunt for each client in the list of clients. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | GRRHunt.CallFlow | def CallFlow(self,
flow_name=None,
next_state=None,
request_data=None,
client_id=None,
**kwargs):
"""Create a new child flow from a hunt."""
base_session_id = None
if client_id:
# The flow is stored in the hunt namespace,
... | python | def CallFlow(self,
flow_name=None,
next_state=None,
request_data=None,
client_id=None,
**kwargs):
"""Create a new child flow from a hunt."""
base_session_id = None
if client_id:
# The flow is stored in the hunt namespace,
... | [
"def",
"CallFlow",
"(",
"self",
",",
"flow_name",
"=",
"None",
",",
"next_state",
"=",
"None",
",",
"request_data",
"=",
"None",
",",
"client_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"base_session_id",
"=",
"None",
"if",
"client_id",
":",
"... | Create a new child flow from a hunt. | [
"Create",
"a",
"new",
"child",
"flow",
"from",
"a",
"hunt",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1468-L1500 | train | Create a new child flow from a hunt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | GRRHunt.Start | def Start(self):
"""Initializes this hunt from arguments."""
with data_store.DB.GetMutationPool() as mutation_pool:
self.CreateCollections(mutation_pool)
if not self.runner_args.description:
self.SetDescription() | python | def Start(self):
"""Initializes this hunt from arguments."""
with data_store.DB.GetMutationPool() as mutation_pool:
self.CreateCollections(mutation_pool)
if not self.runner_args.description:
self.SetDescription() | [
"def",
"Start",
"(",
"self",
")",
":",
"with",
"data_store",
".",
"DB",
".",
"GetMutationPool",
"(",
")",
"as",
"mutation_pool",
":",
"self",
".",
"CreateCollections",
"(",
"mutation_pool",
")",
"if",
"not",
"self",
".",
"runner_args",
".",
"description",
... | Initializes this hunt from arguments. | [
"Initializes",
"this",
"hunt",
"from",
"arguments",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1517-L1523 | train | Initializes this hunt from arguments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | GRRHunt.LogClientError | def LogClientError(self, client_id, log_message=None, backtrace=None):
"""Logs an error for a client."""
self.RegisterClientError(
client_id, log_message=log_message, backtrace=backtrace) | python | def LogClientError(self, client_id, log_message=None, backtrace=None):
"""Logs an error for a client."""
self.RegisterClientError(
client_id, log_message=log_message, backtrace=backtrace) | [
"def",
"LogClientError",
"(",
"self",
",",
"client_id",
",",
"log_message",
"=",
"None",
",",
"backtrace",
"=",
"None",
")",
":",
"self",
".",
"RegisterClientError",
"(",
"client_id",
",",
"log_message",
"=",
"log_message",
",",
"backtrace",
"=",
"backtrace",
... | Logs an error for a client. | [
"Logs",
"an",
"error",
"for",
"a",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1565-L1568 | train | Logs an error for a client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | GRRHunt.ProcessClientResourcesStats | def ProcessClientResourcesStats(self, client_id, status):
"""Process status message from a client and update the stats.
Args:
client_id: Client id.
status: The status object returned from the client.
"""
if hasattr(status, "child_session_id"):
flow_path = status.child_session_id
e... | python | def ProcessClientResourcesStats(self, client_id, status):
"""Process status message from a client and update the stats.
Args:
client_id: Client id.
status: The status object returned from the client.
"""
if hasattr(status, "child_session_id"):
flow_path = status.child_session_id
e... | [
"def",
"ProcessClientResourcesStats",
"(",
"self",
",",
"client_id",
",",
"status",
")",
":",
"if",
"hasattr",
"(",
"status",
",",
"\"child_session_id\"",
")",
":",
"flow_path",
"=",
"status",
".",
"child_session_id",
"else",
":",
"flow_path",
"=",
"\"aff4:/%s/f... | Process status message from a client and update the stats.
Args:
client_id: Client id.
status: The status object returned from the client. | [
"Process",
"status",
"message",
"from",
"a",
"client",
"and",
"update",
"the",
"stats",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1570-L1588 | train | Process a status message from a client and update the stats. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/hunts/implementation.py | GRRHunt.GetClientsByStatus | def GetClientsByStatus(self):
"""Get all the clients in a dict of {status: [client_list]}."""
started = self.GetClients()
completed = self.GetCompletedClients()
outstanding = started - completed
return {
"STARTED": started,
"COMPLETED": completed,
"OUTSTANDING": outstanding
... | python | def GetClientsByStatus(self):
"""Get all the clients in a dict of {status: [client_list]}."""
started = self.GetClients()
completed = self.GetCompletedClients()
outstanding = started - completed
return {
"STARTED": started,
"COMPLETED": completed,
"OUTSTANDING": outstanding
... | [
"def",
"GetClientsByStatus",
"(",
"self",
")",
":",
"started",
"=",
"self",
".",
"GetClients",
"(",
")",
"completed",
"=",
"self",
".",
"GetCompletedClients",
"(",
")",
"outstanding",
"=",
"started",
"-",
"completed",
"return",
"{",
"\"STARTED\"",
":",
"star... | Get all the clients in a dict of {status: [client_list]}. | [
"Get",
"all",
"the",
"clients",
"in",
"a",
"dict",
"of",
"{",
"status",
":",
"[",
"client_list",
"]",
"}",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1631-L1641 | train | Get all the clients in a dict of status. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/hunts/implementation.py | GRRHunt.GetClientStates | def GetClientStates(self, client_list, client_chunk=50):
"""Take in a client list and return dicts with their age and hostname."""
for client_group in collection.Batch(client_list, client_chunk):
for fd in aff4.FACTORY.MultiOpen(
client_group,
mode="r",
aff4_type=aff4_grr.VFS... | python | def GetClientStates(self, client_list, client_chunk=50):
"""Take in a client list and return dicts with their age and hostname."""
for client_group in collection.Batch(client_list, client_chunk):
for fd in aff4.FACTORY.MultiOpen(
client_group,
mode="r",
aff4_type=aff4_grr.VFS... | [
"def",
"GetClientStates",
"(",
"self",
",",
"client_list",
",",
"client_chunk",
"=",
"50",
")",
":",
"for",
"client_group",
"in",
"collection",
".",
"Batch",
"(",
"client_list",
",",
"client_chunk",
")",
":",
"for",
"fd",
"in",
"aff4",
".",
"FACTORY",
".",... | Take in a client list and return dicts with their age and hostname. | [
"Take",
"in",
"a",
"client",
"list",
"and",
"return",
"dicts",
"with",
"their",
"age",
"and",
"hostname",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L1643-L1654 | train | Take in a client list and return dicts with their age and hostname. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | api_client/python/grr_api_client/client.py | SearchClients | def SearchClients(query=None, context=None):
"""List clients conforming to a givent query."""
args = client_pb2.ApiSearchClientsArgs(query=query)
items = context.SendIteratorRequest("SearchClients", args)
return utils.MapItemsIterator(lambda data: Client(data=data, context=context),
... | python | def SearchClients(query=None, context=None):
"""List clients conforming to a givent query."""
args = client_pb2.ApiSearchClientsArgs(query=query)
items = context.SendIteratorRequest("SearchClients", args)
return utils.MapItemsIterator(lambda data: Client(data=data, context=context),
... | [
"def",
"SearchClients",
"(",
"query",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"args",
"=",
"client_pb2",
".",
"ApiSearchClientsArgs",
"(",
"query",
"=",
"query",
")",
"items",
"=",
"context",
".",
"SendIteratorRequest",
"(",
"\"SearchClients\"",
... | List clients conforming to a givent query. | [
"List",
"clients",
"conforming",
"to",
"a",
"givent",
"query",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L264-L271 | train | List clients conforming to a givent query. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | api_client/python/grr_api_client/client.py | ClientApprovalBase.Get | def Get(self):
"""Fetch and return a proper ClientApproval object."""
args = user_pb2.ApiGetClientApprovalArgs(
client_id=self.client_id,
approval_id=self.approval_id,
username=self.username)
result = self._context.SendRequest("GetClientApproval", args)
return ClientApproval(
... | python | def Get(self):
"""Fetch and return a proper ClientApproval object."""
args = user_pb2.ApiGetClientApprovalArgs(
client_id=self.client_id,
approval_id=self.approval_id,
username=self.username)
result = self._context.SendRequest("GetClientApproval", args)
return ClientApproval(
... | [
"def",
"Get",
"(",
"self",
")",
":",
"args",
"=",
"user_pb2",
".",
"ApiGetClientApprovalArgs",
"(",
"client_id",
"=",
"self",
".",
"client_id",
",",
"approval_id",
"=",
"self",
".",
"approval_id",
",",
"username",
"=",
"self",
".",
"username",
")",
"result... | Fetch and return a proper ClientApproval object. | [
"Fetch",
"and",
"return",
"a",
"proper",
"ClientApproval",
"object",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L49-L58 | train | Fetch and return a proper ClientApproval 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 | api_client/python/grr_api_client/client.py | ClientBase.File | def File(self, path):
"""Returns a reference to a file with a given path on client's VFS."""
return vfs.FileRef(
client_id=self.client_id, path=path, context=self._context) | python | def File(self, path):
"""Returns a reference to a file with a given path on client's VFS."""
return vfs.FileRef(
client_id=self.client_id, path=path, context=self._context) | [
"def",
"File",
"(",
"self",
",",
"path",
")",
":",
"return",
"vfs",
".",
"FileRef",
"(",
"client_id",
"=",
"self",
".",
"client_id",
",",
"path",
"=",
"path",
",",
"context",
"=",
"self",
".",
"_context",
")"
] | Returns a reference to a file with a given path on client's VFS. | [
"Returns",
"a",
"reference",
"to",
"a",
"file",
"with",
"a",
"given",
"path",
"on",
"client",
"s",
"VFS",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L130-L134 | train | Returns a reference to a file with a given path on client s VFS. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | api_client/python/grr_api_client/client.py | ClientBase.Flow | def Flow(self, flow_id):
"""Return a reference to a flow with a given id on this client."""
return flow.FlowRef(
client_id=self.client_id, flow_id=flow_id, context=self._context) | python | def Flow(self, flow_id):
"""Return a reference to a flow with a given id on this client."""
return flow.FlowRef(
client_id=self.client_id, flow_id=flow_id, context=self._context) | [
"def",
"Flow",
"(",
"self",
",",
"flow_id",
")",
":",
"return",
"flow",
".",
"FlowRef",
"(",
"client_id",
"=",
"self",
".",
"client_id",
",",
"flow_id",
"=",
"flow_id",
",",
"context",
"=",
"self",
".",
"_context",
")"
] | Return a reference to a flow with a given id on this client. | [
"Return",
"a",
"reference",
"to",
"a",
"flow",
"with",
"a",
"given",
"id",
"on",
"this",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L136-L140 | train | Return a reference to a flow with a given id on this client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | api_client/python/grr_api_client/client.py | ClientBase.CreateFlow | def CreateFlow(self, name=None, args=None, runner_args=None):
"""Create new flow on this client."""
if not name:
raise ValueError("name can't be empty")
request = flow_pb2.ApiCreateFlowArgs(client_id=self.client_id)
request.flow.name = name
if runner_args:
request.flow.runner_args.Cop... | python | def CreateFlow(self, name=None, args=None, runner_args=None):
"""Create new flow on this client."""
if not name:
raise ValueError("name can't be empty")
request = flow_pb2.ApiCreateFlowArgs(client_id=self.client_id)
request.flow.name = name
if runner_args:
request.flow.runner_args.Cop... | [
"def",
"CreateFlow",
"(",
"self",
",",
"name",
"=",
"None",
",",
"args",
"=",
"None",
",",
"runner_args",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"raise",
"ValueError",
"(",
"\"name can't be empty\"",
")",
"request",
"=",
"flow_pb2",
".",
"ApiCr... | Create new flow on this client. | [
"Create",
"new",
"flow",
"on",
"this",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L142-L159 | train | Create a new flow on this client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | api_client/python/grr_api_client/client.py | ClientBase.ListFlows | def ListFlows(self):
"""List flows that ran on this client."""
args = flow_pb2.ApiListFlowsArgs(client_id=self.client_id)
items = self._context.SendIteratorRequest("ListFlows", args)
return utils.MapItemsIterator(
lambda data: flow.Flow(data=data, context=self._context), items) | python | def ListFlows(self):
"""List flows that ran on this client."""
args = flow_pb2.ApiListFlowsArgs(client_id=self.client_id)
items = self._context.SendIteratorRequest("ListFlows", args)
return utils.MapItemsIterator(
lambda data: flow.Flow(data=data, context=self._context), items) | [
"def",
"ListFlows",
"(",
"self",
")",
":",
"args",
"=",
"flow_pb2",
".",
"ApiListFlowsArgs",
"(",
"client_id",
"=",
"self",
".",
"client_id",
")",
"items",
"=",
"self",
".",
"_context",
".",
"SendIteratorRequest",
"(",
"\"ListFlows\"",
",",
"args",
")",
"r... | List flows that ran on this client. | [
"List",
"flows",
"that",
"ran",
"on",
"this",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L161-L168 | train | List flows that ran on this client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | api_client/python/grr_api_client/client.py | ClientBase.Approval | def Approval(self, username, approval_id):
"""Returns a reference to an approval."""
return ClientApprovalRef(
client_id=self.client_id,
username=username,
approval_id=approval_id,
context=self._context) | python | def Approval(self, username, approval_id):
"""Returns a reference to an approval."""
return ClientApprovalRef(
client_id=self.client_id,
username=username,
approval_id=approval_id,
context=self._context) | [
"def",
"Approval",
"(",
"self",
",",
"username",
",",
"approval_id",
")",
":",
"return",
"ClientApprovalRef",
"(",
"client_id",
"=",
"self",
".",
"client_id",
",",
"username",
"=",
"username",
",",
"approval_id",
"=",
"approval_id",
",",
"context",
"=",
"sel... | Returns a reference to an approval. | [
"Returns",
"a",
"reference",
"to",
"an",
"approval",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L170-L177 | train | Returns a reference to an approval. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | api_client/python/grr_api_client/client.py | ClientBase.CreateApproval | def CreateApproval(self,
reason=None,
notified_users=None,
email_cc_addresses=None,
keep_client_alive=False):
"""Create a new approval for the current user to access this client."""
if not reason:
raise ValueError("reason... | python | def CreateApproval(self,
reason=None,
notified_users=None,
email_cc_addresses=None,
keep_client_alive=False):
"""Create a new approval for the current user to access this client."""
if not reason:
raise ValueError("reason... | [
"def",
"CreateApproval",
"(",
"self",
",",
"reason",
"=",
"None",
",",
"notified_users",
"=",
"None",
",",
"email_cc_addresses",
"=",
"None",
",",
"keep_client_alive",
"=",
"False",
")",
":",
"if",
"not",
"reason",
":",
"raise",
"ValueError",
"(",
"\"reason ... | Create a new approval for the current user to access this client. | [
"Create",
"a",
"new",
"approval",
"for",
"the",
"current",
"user",
"to",
"access",
"this",
"client",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L179-L203 | train | Create a new approval for the current user to access this client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | api_client/python/grr_api_client/client.py | ClientRef.Get | def Get(self):
"""Fetch client's data and return a proper Client object."""
args = client_pb2.ApiGetClientArgs(client_id=self.client_id)
result = self._context.SendRequest("GetClient", args)
return Client(data=result, context=self._context) | python | def Get(self):
"""Fetch client's data and return a proper Client object."""
args = client_pb2.ApiGetClientArgs(client_id=self.client_id)
result = self._context.SendRequest("GetClient", args)
return Client(data=result, context=self._context) | [
"def",
"Get",
"(",
"self",
")",
":",
"args",
"=",
"client_pb2",
".",
"ApiGetClientArgs",
"(",
"client_id",
"=",
"self",
".",
"client_id",
")",
"result",
"=",
"self",
".",
"_context",
".",
"SendRequest",
"(",
"\"GetClient\"",
",",
"args",
")",
"return",
"... | Fetch client's data and return a proper Client object. | [
"Fetch",
"client",
"s",
"data",
"and",
"return",
"a",
"proper",
"Client",
"object",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/client.py#L242-L247 | train | Fetch client s data and return a proper 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/core/grr_response_core/lib/communicator.py | GetMetricMetadata | def GetMetricMetadata():
"""Returns a list of MetricMetadata for communicator-related metrics."""
return [
stats_utils.CreateCounterMetadata("grr_client_unknown"),
stats_utils.CreateCounterMetadata("grr_decoding_error"),
stats_utils.CreateCounterMetadata("grr_decryption_error"),
stats_utils.... | python | def GetMetricMetadata():
"""Returns a list of MetricMetadata for communicator-related metrics."""
return [
stats_utils.CreateCounterMetadata("grr_client_unknown"),
stats_utils.CreateCounterMetadata("grr_decoding_error"),
stats_utils.CreateCounterMetadata("grr_decryption_error"),
stats_utils.... | [
"def",
"GetMetricMetadata",
"(",
")",
":",
"return",
"[",
"stats_utils",
".",
"CreateCounterMetadata",
"(",
"\"grr_client_unknown\"",
")",
",",
"stats_utils",
".",
"CreateCounterMetadata",
"(",
"\"grr_decoding_error\"",
")",
",",
"stats_utils",
".",
"CreateCounterMetada... | Returns a list of MetricMetadata for communicator-related metrics. | [
"Returns",
"a",
"list",
"of",
"MetricMetadata",
"for",
"communicator",
"-",
"related",
"metrics",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L27-L38 | train | Returns a list of MetricMetadata for communicator - related metrics. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/communicator.py | Cipher.Encrypt | def Encrypt(self, data, iv=None):
"""Symmetrically encrypt the data using the optional iv."""
if iv is None:
iv = rdf_crypto.EncryptionKey.GenerateKey(length=128)
cipher = rdf_crypto.AES128CBCCipher(self.cipher.key, iv)
return iv, cipher.Encrypt(data) | python | def Encrypt(self, data, iv=None):
"""Symmetrically encrypt the data using the optional iv."""
if iv is None:
iv = rdf_crypto.EncryptionKey.GenerateKey(length=128)
cipher = rdf_crypto.AES128CBCCipher(self.cipher.key, iv)
return iv, cipher.Encrypt(data) | [
"def",
"Encrypt",
"(",
"self",
",",
"data",
",",
"iv",
"=",
"None",
")",
":",
"if",
"iv",
"is",
"None",
":",
"iv",
"=",
"rdf_crypto",
".",
"EncryptionKey",
".",
"GenerateKey",
"(",
"length",
"=",
"128",
")",
"cipher",
"=",
"rdf_crypto",
".",
"AES128C... | Symmetrically encrypt the data using the optional iv. | [
"Symmetrically",
"encrypt",
"the",
"data",
"using",
"the",
"optional",
"iv",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L102-L107 | train | Symmetrically encrypt the data using the optional iv. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/communicator.py | Cipher.Decrypt | def Decrypt(self, data, iv):
"""Symmetrically decrypt the data."""
key = rdf_crypto.EncryptionKey(self.cipher.key)
iv = rdf_crypto.EncryptionKey(iv)
return rdf_crypto.AES128CBCCipher(key, iv).Decrypt(data) | python | def Decrypt(self, data, iv):
"""Symmetrically decrypt the data."""
key = rdf_crypto.EncryptionKey(self.cipher.key)
iv = rdf_crypto.EncryptionKey(iv)
return rdf_crypto.AES128CBCCipher(key, iv).Decrypt(data) | [
"def",
"Decrypt",
"(",
"self",
",",
"data",
",",
"iv",
")",
":",
"key",
"=",
"rdf_crypto",
".",
"EncryptionKey",
"(",
"self",
".",
"cipher",
".",
"key",
")",
"iv",
"=",
"rdf_crypto",
".",
"EncryptionKey",
"(",
"iv",
")",
"return",
"rdf_crypto",
".",
... | Symmetrically decrypt the data. | [
"Symmetrically",
"decrypt",
"the",
"data",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L109-L113 | train | Symmetrically decrypt the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/communicator.py | ReceivedCipher._VerifyHMAC | def _VerifyHMAC(self, comms=None):
"""Verifies the HMAC.
This method raises a DecryptionError if the received HMAC does not
verify. If the HMAC verifies correctly, True is returned.
Args:
comms: The comms RdfValue to verify.
Raises:
DecryptionError: The HMAC did not verify.
Retur... | python | def _VerifyHMAC(self, comms=None):
"""Verifies the HMAC.
This method raises a DecryptionError if the received HMAC does not
verify. If the HMAC verifies correctly, True is returned.
Args:
comms: The comms RdfValue to verify.
Raises:
DecryptionError: The HMAC did not verify.
Retur... | [
"def",
"_VerifyHMAC",
"(",
"self",
",",
"comms",
"=",
"None",
")",
":",
"# Check the encrypted message integrity using HMAC.",
"if",
"self",
".",
"hmac_type",
"==",
"\"SIMPLE_HMAC\"",
":",
"msg",
"=",
"comms",
".",
"encrypted",
"digest",
"=",
"comms",
".",
"hmac... | Verifies the HMAC.
This method raises a DecryptionError if the received HMAC does not
verify. If the HMAC verifies correctly, True is returned.
Args:
comms: The comms RdfValue to verify.
Raises:
DecryptionError: The HMAC did not verify.
Returns:
True | [
"Verifies",
"the",
"HMAC",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L204-L240 | train | Verifies the HMAC. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/communicator.py | ReceivedCipher.VerifyCipherSignature | def VerifyCipherSignature(self, remote_public_key):
"""Verifies the signature on the encrypted cipher block.
This method returns True if the signature verifies correctly with
the key given.
Args:
remote_public_key: The remote public key.
Returns:
None
Raises:
rdf_crypto.Veri... | python | def VerifyCipherSignature(self, remote_public_key):
"""Verifies the signature on the encrypted cipher block.
This method returns True if the signature verifies correctly with
the key given.
Args:
remote_public_key: The remote public key.
Returns:
None
Raises:
rdf_crypto.Veri... | [
"def",
"VerifyCipherSignature",
"(",
"self",
",",
"remote_public_key",
")",
":",
"if",
"self",
".",
"cipher_metadata",
".",
"signature",
"and",
"remote_public_key",
":",
"stats_collector_instance",
".",
"Get",
"(",
")",
".",
"IncrementCounter",
"(",
"\"grr_rsa_opera... | Verifies the signature on the encrypted cipher block.
This method returns True if the signature verifies correctly with
the key given.
Args:
remote_public_key: The remote public key.
Returns:
None
Raises:
rdf_crypto.VerificationError: A signature and a key were both given but
... | [
"Verifies",
"the",
"signature",
"on",
"the",
"encrypted",
"cipher",
"block",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L242-L263 | train | Verifies the signature on the encrypted cipher block. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/communicator.py | Communicator.EncodeMessageList | def EncodeMessageList(cls, message_list, packed_message_list):
"""Encode the MessageList into the packed_message_list rdfvalue."""
# By default uncompress
uncompressed_data = message_list.SerializeToString()
packed_message_list.message_list = uncompressed_data
compressed_data = zlib.compress(uncomp... | python | def EncodeMessageList(cls, message_list, packed_message_list):
"""Encode the MessageList into the packed_message_list rdfvalue."""
# By default uncompress
uncompressed_data = message_list.SerializeToString()
packed_message_list.message_list = uncompressed_data
compressed_data = zlib.compress(uncomp... | [
"def",
"EncodeMessageList",
"(",
"cls",
",",
"message_list",
",",
"packed_message_list",
")",
":",
"# By default uncompress",
"uncompressed_data",
"=",
"message_list",
".",
"SerializeToString",
"(",
")",
"packed_message_list",
".",
"message_list",
"=",
"uncompressed_data"... | Encode the MessageList into the packed_message_list rdfvalue. | [
"Encode",
"the",
"MessageList",
"into",
"the",
"packed_message_list",
"rdfvalue",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L290-L302 | train | Encodes the MessageList into the packed_message_list rdfvalue. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/communicator.py | Communicator._GetServerCipher | def _GetServerCipher(self):
"""Returns the cipher for self.server_name."""
if self.server_cipher is not None:
expiry = self.server_cipher_age + rdfvalue.Duration("1d")
if expiry > rdfvalue.RDFDatetime.Now():
return self.server_cipher
remote_public_key = self._GetRemotePublicKey(self.se... | python | def _GetServerCipher(self):
"""Returns the cipher for self.server_name."""
if self.server_cipher is not None:
expiry = self.server_cipher_age + rdfvalue.Duration("1d")
if expiry > rdfvalue.RDFDatetime.Now():
return self.server_cipher
remote_public_key = self._GetRemotePublicKey(self.se... | [
"def",
"_GetServerCipher",
"(",
"self",
")",
":",
"if",
"self",
".",
"server_cipher",
"is",
"not",
"None",
":",
"expiry",
"=",
"self",
".",
"server_cipher_age",
"+",
"rdfvalue",
".",
"Duration",
"(",
"\"1d\"",
")",
"if",
"expiry",
">",
"rdfvalue",
".",
"... | Returns the cipher for self.server_name. | [
"Returns",
"the",
"cipher",
"for",
"self",
".",
"server_name",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L308-L320 | train | Returns the server cipher for self. server_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/communicator.py | Communicator.EncodeMessages | def EncodeMessages(self,
message_list,
result,
destination=None,
timestamp=None,
api_version=3):
"""Accepts a list of messages and encodes for transmission.
This function signs and then encrypts the payload... | python | def EncodeMessages(self,
message_list,
result,
destination=None,
timestamp=None,
api_version=3):
"""Accepts a list of messages and encodes for transmission.
This function signs and then encrypts the payload... | [
"def",
"EncodeMessages",
"(",
"self",
",",
"message_list",
",",
"result",
",",
"destination",
"=",
"None",
",",
"timestamp",
"=",
"None",
",",
"api_version",
"=",
"3",
")",
":",
"if",
"api_version",
"not",
"in",
"[",
"3",
"]",
":",
"raise",
"RuntimeError... | Accepts a list of messages and encodes for transmission.
This function signs and then encrypts the payload.
Args:
message_list: A MessageList rdfvalue containing a list of GrrMessages.
result: A ClientCommunication rdfvalue which will be filled in.
destination: The CN of the remote system... | [
"Accepts",
"a",
"list",
"of",
"messages",
"and",
"encodes",
"for",
"transmission",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L322-L399 | train | This function signs and encrypts a list of GrrMessages and encrypts the resulting message list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/communicator.py | Communicator.DecryptMessage | def DecryptMessage(self, encrypted_response):
"""Decrypt the serialized, encrypted string.
Args:
encrypted_response: A serialized and encrypted string.
Returns:
a Packed_Message_List rdfvalue
"""
try:
response_comms = rdf_flows.ClientCommunication.FromSerializedString(
... | python | def DecryptMessage(self, encrypted_response):
"""Decrypt the serialized, encrypted string.
Args:
encrypted_response: A serialized and encrypted string.
Returns:
a Packed_Message_List rdfvalue
"""
try:
response_comms = rdf_flows.ClientCommunication.FromSerializedString(
... | [
"def",
"DecryptMessage",
"(",
"self",
",",
"encrypted_response",
")",
":",
"try",
":",
"response_comms",
"=",
"rdf_flows",
".",
"ClientCommunication",
".",
"FromSerializedString",
"(",
"encrypted_response",
")",
"return",
"self",
".",
"DecodeMessages",
"(",
"respons... | Decrypt the serialized, encrypted string.
Args:
encrypted_response: A serialized and encrypted string.
Returns:
a Packed_Message_List rdfvalue | [
"Decrypt",
"the",
"serialized",
"encrypted",
"string",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L401-L416 | train | Decrypt the serialized and encrypted string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/communicator.py | Communicator.DecompressMessageList | def DecompressMessageList(cls, packed_message_list):
"""Decompress the message data from packed_message_list.
Args:
packed_message_list: A PackedMessageList rdfvalue with some data in it.
Returns:
a MessageList rdfvalue.
Raises:
DecodingError: If decompression fails.
"""
com... | python | def DecompressMessageList(cls, packed_message_list):
"""Decompress the message data from packed_message_list.
Args:
packed_message_list: A PackedMessageList rdfvalue with some data in it.
Returns:
a MessageList rdfvalue.
Raises:
DecodingError: If decompression fails.
"""
com... | [
"def",
"DecompressMessageList",
"(",
"cls",
",",
"packed_message_list",
")",
":",
"compression",
"=",
"packed_message_list",
".",
"compression",
"if",
"compression",
"==",
"rdf_flows",
".",
"PackedMessageList",
".",
"CompressionType",
".",
"UNCOMPRESSED",
":",
"data",... | Decompress the message data from packed_message_list.
Args:
packed_message_list: A PackedMessageList rdfvalue with some data in it.
Returns:
a MessageList rdfvalue.
Raises:
DecodingError: If decompression fails. | [
"Decompress",
"the",
"message",
"data",
"from",
"packed_message_list",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L419-L449 | train | Decompress the message data from a PackedMessageList rdfvalue. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/communicator.py | Communicator.DecodeMessages | def DecodeMessages(self, response_comms):
"""Extract and verify server message.
Args:
response_comms: A ClientCommunication rdfvalue
Returns:
list of messages and the CN where they came from.
Raises:
DecryptionError: If the message failed to decrypt properly.
"""
# Have ... | python | def DecodeMessages(self, response_comms):
"""Extract and verify server message.
Args:
response_comms: A ClientCommunication rdfvalue
Returns:
list of messages and the CN where they came from.
Raises:
DecryptionError: If the message failed to decrypt properly.
"""
# Have ... | [
"def",
"DecodeMessages",
"(",
"self",
",",
"response_comms",
")",
":",
"# Have we seen this cipher before?",
"cipher_verified",
"=",
"False",
"try",
":",
"cipher",
"=",
"self",
".",
"encrypted_cipher_cache",
".",
"Get",
"(",
"response_comms",
".",
"encrypted_cipher",
... | Extract and verify server message.
Args:
response_comms: A ClientCommunication rdfvalue
Returns:
list of messages and the CN where they came from.
Raises:
DecryptionError: If the message failed to decrypt properly. | [
"Extract",
"and",
"verify",
"server",
"message",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L451-L524 | train | Extracts and verifies a server message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/communicator.py | Communicator.VerifyMessageSignature | def VerifyMessageSignature(self, unused_response_comms, packed_message_list,
cipher, cipher_verified, api_version,
remote_public_key):
"""Verify the message list signature.
This is the way the messages are verified in the client.
In the client we a... | python | def VerifyMessageSignature(self, unused_response_comms, packed_message_list,
cipher, cipher_verified, api_version,
remote_public_key):
"""Verify the message list signature.
This is the way the messages are verified in the client.
In the client we a... | [
"def",
"VerifyMessageSignature",
"(",
"self",
",",
"unused_response_comms",
",",
"packed_message_list",
",",
"cipher",
",",
"cipher_verified",
",",
"api_version",
",",
"remote_public_key",
")",
":",
"# This is not used atm since we only support a single api version (3).",
"_",
... | Verify the message list signature.
This is the way the messages are verified in the client.
In the client we also check that the nonce returned by the server is correct
(the timestamp doubles as a nonce). If the nonce fails we deem the response
unauthenticated since it might have resulted from a repla... | [
"Verify",
"the",
"message",
"list",
"signature",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/communicator.py#L526-L569 | train | Verify the signature of the message list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/rdfvalue.py | RegisterLateBindingCallback | def RegisterLateBindingCallback(target_name, callback, **kwargs):
"""Registers a callback to be invoked when the RDFValue named is declared."""
_LATE_BINDING_STORE.setdefault(target_name, []).append((callback, kwargs)) | python | def RegisterLateBindingCallback(target_name, callback, **kwargs):
"""Registers a callback to be invoked when the RDFValue named is declared."""
_LATE_BINDING_STORE.setdefault(target_name, []).append((callback, kwargs)) | [
"def",
"RegisterLateBindingCallback",
"(",
"target_name",
",",
"callback",
",",
"*",
"*",
"kwargs",
")",
":",
"_LATE_BINDING_STORE",
".",
"setdefault",
"(",
"target_name",
",",
"[",
"]",
")",
".",
"append",
"(",
"(",
"callback",
",",
"kwargs",
")",
")"
] | Registers a callback to be invoked when the RDFValue named is declared. | [
"Registers",
"a",
"callback",
"to",
"be",
"invoked",
"when",
"the",
"RDFValue",
"named",
"is",
"declared",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalue.py#L55-L57 | train | Registers a callback to be invoked when the RDFValue named is declared. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/rdfvalue.py | ByteSize.ParseFromHumanReadable | def ParseFromHumanReadable(self, string):
"""Parse a human readable string of a byte string.
Args:
string: The string to parse.
Raises:
DecodeError: If the string can not be parsed.
"""
if not string:
return None
match = self.REGEX.match(string.strip().lower())
if not ma... | python | def ParseFromHumanReadable(self, string):
"""Parse a human readable string of a byte string.
Args:
string: The string to parse.
Raises:
DecodeError: If the string can not be parsed.
"""
if not string:
return None
match = self.REGEX.match(string.strip().lower())
if not ma... | [
"def",
"ParseFromHumanReadable",
"(",
"self",
",",
"string",
")",
":",
"if",
"not",
"string",
":",
"return",
"None",
"match",
"=",
"self",
".",
"REGEX",
".",
"match",
"(",
"string",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
")",
"if",
"not",
... | Parse a human readable string of a byte string.
Args:
string: The string to parse.
Raises:
DecodeError: If the string can not be parsed. | [
"Parse",
"a",
"human",
"readable",
"string",
"of",
"a",
"byte",
"string",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalue.py#L1013-L1040 | train | Parses a human readable string of a byte string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/parsers/osx_launchd.py | OSXLaunchdJobDict.FilterItem | def FilterItem(self, launchditem):
"""Should this job be filtered.
Args:
launchditem: job NSCFDictionary
Returns:
True if the item should be filtered (dropped)
"""
for regex in self.blacklist_regex:
if regex.match(launchditem.get("Label", "")):
return True
return False | python | def FilterItem(self, launchditem):
"""Should this job be filtered.
Args:
launchditem: job NSCFDictionary
Returns:
True if the item should be filtered (dropped)
"""
for regex in self.blacklist_regex:
if regex.match(launchditem.get("Label", "")):
return True
return False | [
"def",
"FilterItem",
"(",
"self",
",",
"launchditem",
")",
":",
"for",
"regex",
"in",
"self",
".",
"blacklist_regex",
":",
"if",
"regex",
".",
"match",
"(",
"launchditem",
".",
"get",
"(",
"\"Label\"",
",",
"\"\"",
")",
")",
":",
"return",
"True",
"ret... | Should this job be filtered.
Args:
launchditem: job NSCFDictionary
Returns:
True if the item should be filtered (dropped) | [
"Should",
"this",
"job",
"be",
"filtered",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/osx_launchd.py#L53-L64 | train | Returns True if the item should be dropped. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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_launchd.py | DarwinPersistenceMechanismsParser.Parse | def Parse(self, persistence, knowledge_base, download_pathtype):
"""Convert persistence collector output to downloadable rdfvalues."""
pathspecs = []
if isinstance(persistence, rdf_client.OSXServiceInformation):
if persistence.program:
pathspecs = rdf_paths.PathSpec(
path=persiste... | python | def Parse(self, persistence, knowledge_base, download_pathtype):
"""Convert persistence collector output to downloadable rdfvalues."""
pathspecs = []
if isinstance(persistence, rdf_client.OSXServiceInformation):
if persistence.program:
pathspecs = rdf_paths.PathSpec(
path=persiste... | [
"def",
"Parse",
"(",
"self",
",",
"persistence",
",",
"knowledge_base",
",",
"download_pathtype",
")",
":",
"pathspecs",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"persistence",
",",
"rdf_client",
".",
"OSXServiceInformation",
")",
":",
"if",
"persistence",
".",... | Convert persistence collector output to downloadable rdfvalues. | [
"Convert",
"persistence",
"collector",
"output",
"to",
"downloadable",
"rdfvalues",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/osx_launchd.py#L72-L85 | train | Parse persistence collector 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/util/collection.py | Trim | def Trim(lst, limit):
"""Trims a given list so that it is not longer than given limit.
Args:
lst: A list to trim.
limit: A maximum number of elements in the list after trimming.
Returns:
A suffix of the input list that was trimmed.
"""
limit = max(0, limit)
clipping = lst[limit:]
del lst[li... | python | def Trim(lst, limit):
"""Trims a given list so that it is not longer than given limit.
Args:
lst: A list to trim.
limit: A maximum number of elements in the list after trimming.
Returns:
A suffix of the input list that was trimmed.
"""
limit = max(0, limit)
clipping = lst[limit:]
del lst[li... | [
"def",
"Trim",
"(",
"lst",
",",
"limit",
")",
":",
"limit",
"=",
"max",
"(",
"0",
",",
"limit",
")",
"clipping",
"=",
"lst",
"[",
"limit",
":",
"]",
"del",
"lst",
"[",
"limit",
":",
"]",
"return",
"clipping"
] | Trims a given list so that it is not longer than given limit.
Args:
lst: A list to trim.
limit: A maximum number of elements in the list after trimming.
Returns:
A suffix of the input list that was trimmed. | [
"Trims",
"a",
"given",
"list",
"so",
"that",
"it",
"is",
"not",
"longer",
"than",
"given",
"limit",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/collection.py#L39-L53 | train | Trims a given list so that it is not longer than given limit. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/util/collection.py | Group | def Group(items, key):
"""Groups items by given key function.
Args:
items: An iterable or an iterator of items.
key: A function which given each item will return the key.
Returns:
A dict with keys being each unique key and values being a list of items of
that key.
"""
result = {}
for item... | python | def Group(items, key):
"""Groups items by given key function.
Args:
items: An iterable or an iterator of items.
key: A function which given each item will return the key.
Returns:
A dict with keys being each unique key and values being a list of items of
that key.
"""
result = {}
for item... | [
"def",
"Group",
"(",
"items",
",",
"key",
")",
":",
"result",
"=",
"{",
"}",
"for",
"item",
"in",
"items",
":",
"result",
".",
"setdefault",
"(",
"key",
"(",
"item",
")",
",",
"[",
"]",
")",
".",
"append",
"(",
"item",
")",
"return",
"result"
] | Groups items by given key function.
Args:
items: An iterable or an iterator of items.
key: A function which given each item will return the key.
Returns:
A dict with keys being each unique key and values being a list of items of
that key. | [
"Groups",
"items",
"by",
"given",
"key",
"function",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/collection.py#L56-L72 | train | Groups items by given key 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/collection.py | Batch | def Batch(items, size):
"""Divide items into batches of specified size.
In case where number of items is not evenly divisible by the batch size, the
last batch is going to be shorter.
Args:
items: An iterable or an iterator of items.
size: A size of the returned batches.
Yields:
Lists of items ... | python | def Batch(items, size):
"""Divide items into batches of specified size.
In case where number of items is not evenly divisible by the batch size, the
last batch is going to be shorter.
Args:
items: An iterable or an iterator of items.
size: A size of the returned batches.
Yields:
Lists of items ... | [
"def",
"Batch",
"(",
"items",
",",
"size",
")",
":",
"batch",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"batch",
".",
"append",
"(",
"item",
")",
"if",
"len",
"(",
"batch",
")",
"==",
"size",
":",
"yield",
"batch",
"batch",
"=",
"[",
"]... | Divide items into batches of specified size.
In case where number of items is not evenly divisible by the batch size, the
last batch is going to be shorter.
Args:
items: An iterable or an iterator of items.
size: A size of the returned batches.
Yields:
Lists of items with specified size. | [
"Divide",
"items",
"into",
"batches",
"of",
"specified",
"size",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/collection.py#L75-L97 | train | Divides items into batches of specified size. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/collection.py | StartsWith | def StartsWith(this, that):
"""Checks whether an items of one iterable are a prefix of another.
Args:
this: An iterable that needs to be checked.
that: An iterable of which items must match the prefix of `this`.
Returns:
`True` if `that` is a prefix of `this`, `False` otherwise.
"""
this_iter = ... | python | def StartsWith(this, that):
"""Checks whether an items of one iterable are a prefix of another.
Args:
this: An iterable that needs to be checked.
that: An iterable of which items must match the prefix of `this`.
Returns:
`True` if `that` is a prefix of `this`, `False` otherwise.
"""
this_iter = ... | [
"def",
"StartsWith",
"(",
"this",
",",
"that",
")",
":",
"this_iter",
"=",
"iter",
"(",
"this",
")",
"that_iter",
"=",
"iter",
"(",
"that",
")",
"while",
"True",
":",
"try",
":",
"this_value",
"=",
"next",
"(",
"that_iter",
")",
"except",
"StopIteratio... | Checks whether an items of one iterable are a prefix of another.
Args:
this: An iterable that needs to be checked.
that: An iterable of which items must match the prefix of `this`.
Returns:
`True` if `that` is a prefix of `this`, `False` otherwise. | [
"Checks",
"whether",
"an",
"items",
"of",
"one",
"iterable",
"are",
"a",
"prefix",
"of",
"another",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/collection.py#L100-L125 | train | Checks whether an iterable of items of one iterable are a prefix of another. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/collection.py | Unzip | def Unzip(iterable):
"""Unzips specified iterable of pairs to pair of two iterables.
This function is an inversion of the standard `zip` function and the following
hold:
* ∀ l, r. l, r == unzip(zip(l, r))
* ∀ p. p == zip(unzip(p))
Examples:
>>> Unzip([("foo", 1), ("bar", 2), ("baz", 3)])
(["f... | python | def Unzip(iterable):
"""Unzips specified iterable of pairs to pair of two iterables.
This function is an inversion of the standard `zip` function and the following
hold:
* ∀ l, r. l, r == unzip(zip(l, r))
* ∀ p. p == zip(unzip(p))
Examples:
>>> Unzip([("foo", 1), ("bar", 2), ("baz", 3)])
(["f... | [
"def",
"Unzip",
"(",
"iterable",
")",
":",
"lefts",
"=",
"[",
"]",
"rights",
"=",
"[",
"]",
"for",
"left",
",",
"right",
"in",
"iterable",
":",
"lefts",
".",
"append",
"(",
"left",
")",
"rights",
".",
"append",
"(",
"right",
")",
"return",
"lefts",... | Unzips specified iterable of pairs to pair of two iterables.
This function is an inversion of the standard `zip` function and the following
hold:
* ∀ l, r. l, r == unzip(zip(l, r))
* ∀ p. p == zip(unzip(p))
Examples:
>>> Unzip([("foo", 1), ("bar", 2), ("baz", 3)])
(["foo", "bar", "baz"], [1, 2,... | [
"Unzips",
"specified",
"iterable",
"of",
"pairs",
"to",
"pair",
"of",
"two",
"iterables",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/collection.py#L128-L154 | train | Unzips specified iterable of pairs to pair of two iterables. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/collection.py | DictProduct | def DictProduct(dictionary):
"""Computes a cartesian product of dict with iterable values.
This utility function, accepts a dictionary with iterable values, computes
cartesian products of these values and yields dictionaries of expanded values.
Examples:
>>> list(DictProduct({"a": [1, 2], "b": [3, 4]}))
... | python | def DictProduct(dictionary):
"""Computes a cartesian product of dict with iterable values.
This utility function, accepts a dictionary with iterable values, computes
cartesian products of these values and yields dictionaries of expanded values.
Examples:
>>> list(DictProduct({"a": [1, 2], "b": [3, 4]}))
... | [
"def",
"DictProduct",
"(",
"dictionary",
")",
":",
"keys",
",",
"values",
"=",
"Unzip",
"(",
"iteritems",
"(",
"dictionary",
")",
")",
"for",
"product_values",
"in",
"itertools",
".",
"product",
"(",
"*",
"values",
")",
":",
"yield",
"dict",
"(",
"zip",
... | Computes a cartesian product of dict with iterable values.
This utility function, accepts a dictionary with iterable values, computes
cartesian products of these values and yields dictionaries of expanded values.
Examples:
>>> list(DictProduct({"a": [1, 2], "b": [3, 4]}))
[{"a": 1, "b": 3}, {"a": 1, "b"... | [
"Computes",
"a",
"cartesian",
"product",
"of",
"dict",
"with",
"iterable",
"values",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/collection.py#L157-L176 | train | This utility function accepts a dictionary with iterable values computes a cartesian product of these values and yields dictionaries of expanded values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/server/grr_response_server/bin/console.py | main | def main(argv):
"""Main."""
del argv # Unused.
if flags.FLAGS.version:
print("GRR console {}".format(config_server.VERSION["packageversion"]))
return
banner = ("\nWelcome to the GRR console\n")
config.CONFIG.AddContext(contexts.COMMAND_LINE_CONTEXT)
config.CONFIG.AddContext(contexts.CONSOLE_CONT... | python | def main(argv):
"""Main."""
del argv # Unused.
if flags.FLAGS.version:
print("GRR console {}".format(config_server.VERSION["packageversion"]))
return
banner = ("\nWelcome to the GRR console\n")
config.CONFIG.AddContext(contexts.COMMAND_LINE_CONTEXT)
config.CONFIG.AddContext(contexts.CONSOLE_CONT... | [
"def",
"main",
"(",
"argv",
")",
":",
"del",
"argv",
"# Unused.",
"if",
"flags",
".",
"FLAGS",
".",
"version",
":",
"print",
"(",
"\"GRR console {}\"",
".",
"format",
"(",
"config_server",
".",
"VERSION",
"[",
"\"packageversion\"",
"]",
")",
")",
"return",... | Main. | [
"Main",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/bin/console.py#L100-L153 | train | Main function for the GRR console. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | AsIter | def AsIter(arg):
"""Encapsulates an argument in a tuple, if it's not already iterable."""
if isinstance(arg, string_types):
rslt = [arg]
elif isinstance(arg, collections.Iterable):
rslt = arg
elif not arg:
rslt = []
else:
rslt = [arg]
return tuple(rslt) | python | def AsIter(arg):
"""Encapsulates an argument in a tuple, if it's not already iterable."""
if isinstance(arg, string_types):
rslt = [arg]
elif isinstance(arg, collections.Iterable):
rslt = arg
elif not arg:
rslt = []
else:
rslt = [arg]
return tuple(rslt) | [
"def",
"AsIter",
"(",
"arg",
")",
":",
"if",
"isinstance",
"(",
"arg",
",",
"string_types",
")",
":",
"rslt",
"=",
"[",
"arg",
"]",
"elif",
"isinstance",
"(",
"arg",
",",
"collections",
".",
"Iterable",
")",
":",
"rslt",
"=",
"arg",
"elif",
"not",
... | Encapsulates an argument in a tuple, if it's not already iterable. | [
"Encapsulates",
"an",
"argument",
"in",
"a",
"tuple",
"if",
"it",
"s",
"not",
"already",
"iterable",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L30-L40 | train | Encapsulates an argument in a tuple if it s not already 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/core/grr_response_core/lib/parsers/config_file.py | FieldParser._GenStates | def _GenStates(self):
"""Generate the lexer states."""
self.GenCommentState()
self.GenFwdState()
self.GenQuotedState()
self.GenCatchallState() | python | def _GenStates(self):
"""Generate the lexer states."""
self.GenCommentState()
self.GenFwdState()
self.GenQuotedState()
self.GenCatchallState() | [
"def",
"_GenStates",
"(",
"self",
")",
":",
"self",
".",
"GenCommentState",
"(",
")",
"self",
".",
"GenFwdState",
"(",
")",
"self",
".",
"GenQuotedState",
"(",
")",
"self",
".",
"GenCatchallState",
"(",
")"
] | Generate the lexer states. | [
"Generate",
"the",
"lexer",
"states",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L113-L118 | train | Generate the lexer states. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | FieldParser.GenFwdState | def GenFwdState(self):
"""Generates forwarding state rules.
The lexer will fast forward until there is string content. The
string content will be returned to the string processor.
"""
for c in self.cont:
self._AddToken("FWD", c, None, None)
for s in self.sep:
self._AddToken("FWD", s... | python | def GenFwdState(self):
"""Generates forwarding state rules.
The lexer will fast forward until there is string content. The
string content will be returned to the string processor.
"""
for c in self.cont:
self._AddToken("FWD", c, None, None)
for s in self.sep:
self._AddToken("FWD", s... | [
"def",
"GenFwdState",
"(",
"self",
")",
":",
"for",
"c",
"in",
"self",
".",
"cont",
":",
"self",
".",
"_AddToken",
"(",
"\"FWD\"",
",",
"c",
",",
"None",
",",
"None",
")",
"for",
"s",
"in",
"self",
".",
"sep",
":",
"self",
".",
"_AddToken",
"(",
... | Generates forwarding state rules.
The lexer will fast forward until there is string content. The
string content will be returned to the string processor. | [
"Generates",
"forwarding",
"state",
"rules",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L128-L138 | train | Generates forwarding state rules. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | FieldParser.GenQuotedState | def GenQuotedState(self):
"""Generate string matching state rules."""
for i, q in enumerate(self.quot):
label = "%s_STRING" % i
escaped = re.escape(q)
self._AddToken(label, escaped, "PopState", None)
self._AddToken(label, q, "PopState", None)
if self.ml_quote:
self._AddToke... | python | def GenQuotedState(self):
"""Generate string matching state rules."""
for i, q in enumerate(self.quot):
label = "%s_STRING" % i
escaped = re.escape(q)
self._AddToken(label, escaped, "PopState", None)
self._AddToken(label, q, "PopState", None)
if self.ml_quote:
self._AddToke... | [
"def",
"GenQuotedState",
"(",
"self",
")",
":",
"for",
"i",
",",
"q",
"in",
"enumerate",
"(",
"self",
".",
"quot",
")",
":",
"label",
"=",
"\"%s_STRING\"",
"%",
"i",
"escaped",
"=",
"re",
".",
"escape",
"(",
"q",
")",
"self",
".",
"_AddToken",
"(",... | Generate string matching state rules. | [
"Generate",
"string",
"matching",
"state",
"rules",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L140-L151 | train | Generates the string matching rules for the given quotation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | FieldParser.GenCatchallState | def GenCatchallState(self):
"""Generate string matching state rules.
This sets up initial state handlers that cover both the 'INITIAL' state
and the intermediate content between fields.
The lexer acts on items with precedence:
- continuation characters: use the fast forward state rules.
- ... | python | def GenCatchallState(self):
"""Generate string matching state rules.
This sets up initial state handlers that cover both the 'INITIAL' state
and the intermediate content between fields.
The lexer acts on items with precedence:
- continuation characters: use the fast forward state rules.
- ... | [
"def",
"GenCatchallState",
"(",
"self",
")",
":",
"for",
"c",
"in",
"self",
".",
"comments",
":",
"self",
".",
"_AddToken",
"(",
"\".\"",
",",
"c",
",",
"\"PushState,EndField\"",
",",
"\"COMMENT\"",
")",
"for",
"c",
"in",
"self",
".",
"cont",
":",
"sel... | Generate string matching state rules.
This sets up initial state handlers that cover both the 'INITIAL' state
and the intermediate content between fields.
The lexer acts on items with precedence:
- continuation characters: use the fast forward state rules.
- field separators: finalize processi... | [
"Generate",
"string",
"matching",
"state",
"rules",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L153-L174 | train | Generates the state handlers that cover both the INITIAL and QUOTATION states. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | SshdFieldParser.ParseLine | def ParseLine(self, line):
"""Extracts keyword/value settings from the sshd config.
The keyword is always the first string item.
Values are the remainder of the string. In cases where an sshd config
allows multiple values, these are split according to whatever separator(s)
sshd_config permits for t... | python | def ParseLine(self, line):
"""Extracts keyword/value settings from the sshd config.
The keyword is always the first string item.
Values are the remainder of the string. In cases where an sshd config
allows multiple values, these are split according to whatever separator(s)
sshd_config permits for t... | [
"def",
"ParseLine",
"(",
"self",
",",
"line",
")",
":",
"kv",
"=",
"line",
".",
"split",
"(",
"None",
",",
"1",
")",
"keyword",
"=",
"kv",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"# Safely set the argument string if it wasn't found.",
"values",
"=",
"kv",... | Extracts keyword/value settings from the sshd config.
The keyword is always the first string item.
Values are the remainder of the string. In cases where an sshd config
allows multiple values, these are split according to whatever separator(s)
sshd_config permits for that value.
Keywords and value... | [
"Extracts",
"keyword",
"/",
"value",
"settings",
"from",
"the",
"sshd",
"config",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L445-L490 | train | Parses a line of the sshd config 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/core/grr_response_core/lib/parsers/config_file.py | SshdFieldParser._ParseEntry | def _ParseEntry(self, key, val):
"""Adds an entry for a configuration setting.
Args:
key: The name of the setting.
val: The value of the setting.
"""
if key in self._repeated:
setting = self.section.setdefault(key, [])
setting.extend(val)
else:
self.section.setdefault(... | python | def _ParseEntry(self, key, val):
"""Adds an entry for a configuration setting.
Args:
key: The name of the setting.
val: The value of the setting.
"""
if key in self._repeated:
setting = self.section.setdefault(key, [])
setting.extend(val)
else:
self.section.setdefault(... | [
"def",
"_ParseEntry",
"(",
"self",
",",
"key",
",",
"val",
")",
":",
"if",
"key",
"in",
"self",
".",
"_repeated",
":",
"setting",
"=",
"self",
".",
"section",
".",
"setdefault",
"(",
"key",
",",
"[",
"]",
")",
"setting",
".",
"extend",
"(",
"val",
... | Adds an entry for a configuration setting.
Args:
key: The name of the setting.
val: The value of the setting. | [
"Adds",
"an",
"entry",
"for",
"a",
"configuration",
"setting",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L492-L503 | train | Parses a configuration setting entry. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | SshdFieldParser._ParseMatchGrp | def _ParseMatchGrp(self, key, val):
"""Adds valid match group parameters to the configuration."""
if key in self._match_keywords:
self._ParseEntry(key, val) | python | def _ParseMatchGrp(self, key, val):
"""Adds valid match group parameters to the configuration."""
if key in self._match_keywords:
self._ParseEntry(key, val) | [
"def",
"_ParseMatchGrp",
"(",
"self",
",",
"key",
",",
"val",
")",
":",
"if",
"key",
"in",
"self",
".",
"_match_keywords",
":",
"self",
".",
"_ParseEntry",
"(",
"key",
",",
"val",
")"
] | Adds valid match group parameters to the configuration. | [
"Adds",
"valid",
"match",
"group",
"parameters",
"to",
"the",
"configuration",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L505-L508 | train | Parses a match group parameter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | SshdFieldParser._NewMatchSection | def _NewMatchSection(self, val):
"""Create a new configuration section for each match clause.
Each match clause is added to the main config, and the criterion that will
trigger the match is recorded, as is the configuration.
Args:
val: The value following the 'match' keyword.
"""
section... | python | def _NewMatchSection(self, val):
"""Create a new configuration section for each match clause.
Each match clause is added to the main config, and the criterion that will
trigger the match is recorded, as is the configuration.
Args:
val: The value following the 'match' keyword.
"""
section... | [
"def",
"_NewMatchSection",
"(",
"self",
",",
"val",
")",
":",
"section",
"=",
"{",
"\"criterion\"",
":",
"val",
",",
"\"config\"",
":",
"{",
"}",
"}",
"self",
".",
"matches",
".",
"append",
"(",
"section",
")",
"# Now add configuration items to config section ... | Create a new configuration section for each match clause.
Each match clause is added to the main config, and the criterion that will
trigger the match is recorded, as is the configuration.
Args:
val: The value following the 'match' keyword. | [
"Create",
"a",
"new",
"configuration",
"section",
"for",
"each",
"match",
"clause",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L510-L524 | train | Create a new configuration section for each match clause. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | SshdConfigParser.Parse | def Parse(self, stat, file_object, knowledge_base):
"""Parse the sshd configuration.
Process each of the lines in the configuration file.
Assembes an sshd_config file into a dictionary with the configuration
keyword as the key, and the configuration settings as value(s).
Args:
stat: unused
... | python | def Parse(self, stat, file_object, knowledge_base):
"""Parse the sshd configuration.
Process each of the lines in the configuration file.
Assembes an sshd_config file into a dictionary with the configuration
keyword as the key, and the configuration settings as value(s).
Args:
stat: unused
... | [
"def",
"Parse",
"(",
"self",
",",
"stat",
",",
"file_object",
",",
"knowledge_base",
")",
":",
"_",
",",
"_",
"=",
"stat",
",",
"knowledge_base",
"# Clean out any residual state.",
"self",
".",
"_field_parser",
".",
"Flush",
"(",
")",
"lines",
"=",
"[",
"l... | Parse the sshd configuration.
Process each of the lines in the configuration file.
Assembes an sshd_config file into a dictionary with the configuration
keyword as the key, and the configuration settings as value(s).
Args:
stat: unused
file_object: An open configuration file object.
... | [
"Parse",
"the",
"sshd",
"configuration",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L545-L574 | train | Parse the sshd configuration 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/core/grr_response_core/lib/parsers/config_file.py | MountCmdParser.Parse | def Parse(self, cmd, args, stdout, stderr, return_val, time_taken,
knowledge_base):
"""Parse the mount command output."""
_ = stderr, time_taken, args, knowledge_base # Unused.
self.CheckReturn(cmd, return_val)
result = rdf_protodict.AttributedDict()
for entry in self._field_parser.Pars... | python | def Parse(self, cmd, args, stdout, stderr, return_val, time_taken,
knowledge_base):
"""Parse the mount command output."""
_ = stderr, time_taken, args, knowledge_base # Unused.
self.CheckReturn(cmd, return_val)
result = rdf_protodict.AttributedDict()
for entry in self._field_parser.Pars... | [
"def",
"Parse",
"(",
"self",
",",
"cmd",
",",
"args",
",",
"stdout",
",",
"stderr",
",",
"return_val",
",",
"time_taken",
",",
"knowledge_base",
")",
":",
"_",
"=",
"stderr",
",",
"time_taken",
",",
"args",
",",
"knowledge_base",
"# Unused.",
"self",
"."... | Parse the mount command output. | [
"Parse",
"the",
"mount",
"command",
"output",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L637-L660 | train | Parse the mount command 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/config_file.py | RsyslogFieldParser.ParseAction | def ParseAction(self, action):
"""Extract log configuration data from rsyslog actions.
Actions have the format:
<facility>/<severity> <type_def><destination>;<template>
e.g. *.* @@loghost.example.com.:514;RSYSLOG_ForwardFormat
Actions are selected by a type definition. These include:
"@@... | python | def ParseAction(self, action):
"""Extract log configuration data from rsyslog actions.
Actions have the format:
<facility>/<severity> <type_def><destination>;<template>
e.g. *.* @@loghost.example.com.:514;RSYSLOG_ForwardFormat
Actions are selected by a type definition. These include:
"@@... | [
"def",
"ParseAction",
"(",
"self",
",",
"action",
")",
":",
"rslt",
"=",
"rdf_config_file",
".",
"LogTarget",
"(",
")",
"for",
"dst_str",
",",
"dst_re",
"in",
"iteritems",
"(",
"self",
".",
"destinations",
")",
":",
"dst",
"=",
"dst_re",
".",
"match",
... | Extract log configuration data from rsyslog actions.
Actions have the format:
<facility>/<severity> <type_def><destination>;<template>
e.g. *.* @@loghost.example.com.:514;RSYSLOG_ForwardFormat
Actions are selected by a type definition. These include:
"@@": TCP syslog
"@": UDP syslog
... | [
"Extract",
"log",
"configuration",
"data",
"from",
"rsyslog",
"actions",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L677-L706 | train | Parses the rsyslog action string and returns a LogTarget 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/config_file.py | PackageSourceParser.ParseURIFromKeyValues | def ParseURIFromKeyValues(self, data, separator, uri_key):
"""Parse key/value formatted source listing and return potential URLs.
The fundamental shape of this format is as follows:
key: value # here : = separator
key : value
URI: [URL] # here URI = uri_key
[URL] # this is where it b... | python | def ParseURIFromKeyValues(self, data, separator, uri_key):
"""Parse key/value formatted source listing and return potential URLs.
The fundamental shape of this format is as follows:
key: value # here : = separator
key : value
URI: [URL] # here URI = uri_key
[URL] # this is where it b... | [
"def",
"ParseURIFromKeyValues",
"(",
"self",
",",
"data",
",",
"separator",
",",
"uri_key",
")",
":",
"precondition",
".",
"AssertType",
"(",
"data",
",",
"Text",
")",
"precondition",
".",
"AssertType",
"(",
"separator",
",",
"Text",
")",
"kv_entries",
"=",
... | Parse key/value formatted source listing and return potential URLs.
The fundamental shape of this format is as follows:
key: value # here : = separator
key : value
URI: [URL] # here URI = uri_key
[URL] # this is where it becomes trickey because [URL]
[URL] # can contain 'separ... | [
"Parse",
"key",
"/",
"value",
"formatted",
"source",
"listing",
"and",
"return",
"potential",
"URLs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L763-L808 | train | Parse a key value formatted source listing and return a list of potential URLs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | APTPackageSourceParser.FindPotentialURIs | def FindPotentialURIs(self, file_obj):
"""Given a file, this will return all potenial APT source URIs."""
rfc822_format = "" # will contain all lines not in legacy format
uris_to_parse = []
for line in utils.ReadFileBytesAsUnicode(file_obj).splitlines(True):
# check if legacy style line - if it ... | python | def FindPotentialURIs(self, file_obj):
"""Given a file, this will return all potenial APT source URIs."""
rfc822_format = "" # will contain all lines not in legacy format
uris_to_parse = []
for line in utils.ReadFileBytesAsUnicode(file_obj).splitlines(True):
# check if legacy style line - if it ... | [
"def",
"FindPotentialURIs",
"(",
"self",
",",
"file_obj",
")",
":",
"rfc822_format",
"=",
"\"\"",
"# will contain all lines not in legacy format",
"uris_to_parse",
"=",
"[",
"]",
"for",
"line",
"in",
"utils",
".",
"ReadFileBytesAsUnicode",
"(",
"file_obj",
")",
".",... | Given a file, this will return all potenial APT source URIs. | [
"Given",
"a",
"file",
"this",
"will",
"return",
"all",
"potenial",
"APT",
"source",
"URIs",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L815-L829 | train | Given a file this will return all potenial APT source URIs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | NtpdFieldParser.ParseLine | def ParseLine(self, entries):
"""Extracts keyword/value settings from the ntpd config.
The keyword is always the first entry item.
Values are the remainder of the entries. In cases where an ntpd config
allows multiple values, these are split according to whitespace or
duplicate entries.
Keywor... | python | def ParseLine(self, entries):
"""Extracts keyword/value settings from the ntpd config.
The keyword is always the first entry item.
Values are the remainder of the entries. In cases where an ntpd config
allows multiple values, these are split according to whitespace or
duplicate entries.
Keywor... | [
"def",
"ParseLine",
"(",
"self",
",",
"entries",
")",
":",
"# If no entries were found, short circuit.",
"if",
"not",
"entries",
":",
"return",
"keyword",
"=",
"entries",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"# Set the argument string if it wasn't found.",
"values... | Extracts keyword/value settings from the ntpd config.
The keyword is always the first entry item.
Values are the remainder of the entries. In cases where an ntpd config
allows multiple values, these are split according to whitespace or
duplicate entries.
Keywords and values are normalized. Keyword... | [
"Extracts",
"keyword",
"/",
"value",
"settings",
"from",
"the",
"ntpd",
"config",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L925-L993 | train | Parses a single line of ntpd config 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/core/grr_response_core/lib/parsers/config_file.py | NtpdParser.Parse | def Parse(self, stat, file_object, knowledge_base):
"""Parse a ntp config into rdf."""
_, _ = stat, knowledge_base
# TODO(hanuszczak): This parser only allows single use because it messes
# with its state. This should be fixed.
field_parser = NtpdFieldParser()
for line in field_parser.ParseEntr... | python | def Parse(self, stat, file_object, knowledge_base):
"""Parse a ntp config into rdf."""
_, _ = stat, knowledge_base
# TODO(hanuszczak): This parser only allows single use because it messes
# with its state. This should be fixed.
field_parser = NtpdFieldParser()
for line in field_parser.ParseEntr... | [
"def",
"Parse",
"(",
"self",
",",
"stat",
",",
"file_object",
",",
"knowledge_base",
")",
":",
"_",
",",
"_",
"=",
"stat",
",",
"knowledge_base",
"# TODO(hanuszczak): This parser only allows single use because it messes",
"# with its state. This should be fixed.",
"field_pa... | Parse a ntp config into rdf. | [
"Parse",
"a",
"ntp",
"config",
"into",
"rdf",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L999-L1018 | train | Parse a ntp config into rdf. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | SudoersFieldParser._ExtractList | def _ExtractList(self, fields, ignores=(",",), terminators=()):
"""Extract a list from the given fields."""
extracted = []
i = 0
for i, field in enumerate(fields):
# Space-separated comma; ignore, but this is not a finished list.
# Similar for any other specified ignores (eg, equals sign).
... | python | def _ExtractList(self, fields, ignores=(",",), terminators=()):
"""Extract a list from the given fields."""
extracted = []
i = 0
for i, field in enumerate(fields):
# Space-separated comma; ignore, but this is not a finished list.
# Similar for any other specified ignores (eg, equals sign).
... | [
"def",
"_ExtractList",
"(",
"self",
",",
"fields",
",",
"ignores",
"=",
"(",
"\",\"",
",",
")",
",",
"terminators",
"=",
"(",
")",
")",
":",
"extracted",
"=",
"[",
"]",
"i",
"=",
"0",
"for",
"i",
",",
"field",
"in",
"enumerate",
"(",
"fields",
")... | Extract a list from the given fields. | [
"Extract",
"a",
"list",
"from",
"the",
"given",
"fields",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L1058-L1080 | train | Extracts a list from the given fields. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | SudoersFieldParser.ParseSudoersEntry | def ParseSudoersEntry(self, entry, sudoers_config):
"""Parse an entry and add it to the given SudoersConfig rdfvalue."""
key = entry[0]
if key in SudoersFieldParser.ALIAS_TYPES:
# Alias.
alias_entry = rdf_config_file.SudoersAlias(
type=SudoersFieldParser.ALIAS_TYPES.get(key), name=ent... | python | def ParseSudoersEntry(self, entry, sudoers_config):
"""Parse an entry and add it to the given SudoersConfig rdfvalue."""
key = entry[0]
if key in SudoersFieldParser.ALIAS_TYPES:
# Alias.
alias_entry = rdf_config_file.SudoersAlias(
type=SudoersFieldParser.ALIAS_TYPES.get(key), name=ent... | [
"def",
"ParseSudoersEntry",
"(",
"self",
",",
"entry",
",",
"sudoers_config",
")",
":",
"key",
"=",
"entry",
"[",
"0",
"]",
"if",
"key",
"in",
"SudoersFieldParser",
".",
"ALIAS_TYPES",
":",
"# Alias.",
"alias_entry",
"=",
"rdf_config_file",
".",
"SudoersAlias"... | Parse an entry and add it to the given SudoersConfig rdfvalue. | [
"Parse",
"an",
"entry",
"and",
"add",
"it",
"to",
"the",
"given",
"SudoersConfig",
"rdfvalue",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L1082-L1137 | train | Parses an entry and adds it to the given SudoersConfig rdfvalue. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/config_file.py | SudoersFieldParser.Preprocess | def Preprocess(self, data):
"""Preprocess the given data, ready for parsing."""
# Add whitespace to line continuations.
data = data.replace(":\\", ": \\")
# Strip comments manually because sudoers has multiple meanings for '#'.
data = SudoersFieldParser.COMMENTS_RE.sub("", data)
return data | python | def Preprocess(self, data):
"""Preprocess the given data, ready for parsing."""
# Add whitespace to line continuations.
data = data.replace(":\\", ": \\")
# Strip comments manually because sudoers has multiple meanings for '#'.
data = SudoersFieldParser.COMMENTS_RE.sub("", data)
return data | [
"def",
"Preprocess",
"(",
"self",
",",
"data",
")",
":",
"# Add whitespace to line continuations.",
"data",
"=",
"data",
".",
"replace",
"(",
"\":\\\\\"",
",",
"\": \\\\\"",
")",
"# Strip comments manually because sudoers has multiple meanings for '#'.",
"data",
"=",
"Sud... | Preprocess the given data, ready for parsing. | [
"Preprocess",
"the",
"given",
"data",
"ready",
"for",
"parsing",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/config_file.py#L1139-L1146 | train | Preprocess the given data ready for parsing. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/type_info.py | RDFValueType.Validate | def Validate(self, value):
"""Validate an RDFValue instance.
Args:
value: An RDFValue instance or something which may be used to instantiate
the correct instance.
Raises:
TypeValueError: If the value is not a valid RDFValue instance or the
required type.
Returns:
A V... | python | def Validate(self, value):
"""Validate an RDFValue instance.
Args:
value: An RDFValue instance or something which may be used to instantiate
the correct instance.
Raises:
TypeValueError: If the value is not a valid RDFValue instance or the
required type.
Returns:
A V... | [
"def",
"Validate",
"(",
"self",
",",
"value",
")",
":",
"# Allow None as a default.",
"if",
"value",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"value",
",",
"self",
".",
"rdfclass",
")",
":",
"# Try to coerce the type to the correct rdf_class.",... | Validate an RDFValue instance.
Args:
value: An RDFValue instance or something which may be used to instantiate
the correct instance.
Raises:
TypeValueError: If the value is not a valid RDFValue instance or the
required type.
Returns:
A Valid RDFValue instance. | [
"Validate",
"an",
"RDFValue",
"instance",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/type_info.py#L130-L156 | train | Validate an RDFValue instance. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/type_info.py | RDFStructDictType.Validate | def Validate(self, value):
"""Validate the value.
Args:
value: Value is expected to be a dict-like object that a given RDFStruct
can be initialized from.
Raises:
TypeValueError: If the value is not a valid dict-like object that a given
RDFStruct can be initialized from.
Re... | python | def Validate(self, value):
"""Validate the value.
Args:
value: Value is expected to be a dict-like object that a given RDFStruct
can be initialized from.
Raises:
TypeValueError: If the value is not a valid dict-like object that a given
RDFStruct can be initialized from.
Re... | [
"def",
"Validate",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"not",
"isinstance",
"(",
"value",
",",
"self",
".",
"rdfclass",
")",
":",
"# Try to coerce the type to the correct rdf_class.",
"try",
":",
"r"... | Validate the value.
Args:
value: Value is expected to be a dict-like object that a given RDFStruct
can be initialized from.
Raises:
TypeValueError: If the value is not a valid dict-like object that a given
RDFStruct can be initialized from.
Returns:
A valid instance of s... | [
"Validate",
"the",
"value",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/type_info.py#L177-L207 | train | Validate the value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/type_info.py | TypeDescriptorSet.Add | def Add(self, other):
"""Returns a copy of this set with a new element added."""
new_descriptors = []
for desc in self.descriptors + other.descriptors:
if desc not in new_descriptors:
new_descriptors.append(desc)
return TypeDescriptorSet(*new_descriptors) | python | def Add(self, other):
"""Returns a copy of this set with a new element added."""
new_descriptors = []
for desc in self.descriptors + other.descriptors:
if desc not in new_descriptors:
new_descriptors.append(desc)
return TypeDescriptorSet(*new_descriptors) | [
"def",
"Add",
"(",
"self",
",",
"other",
")",
":",
"new_descriptors",
"=",
"[",
"]",
"for",
"desc",
"in",
"self",
".",
"descriptors",
"+",
"other",
".",
"descriptors",
":",
"if",
"desc",
"not",
"in",
"new_descriptors",
":",
"new_descriptors",
".",
"appen... | Returns a copy of this set with a new element added. | [
"Returns",
"a",
"copy",
"of",
"this",
"set",
"with",
"a",
"new",
"element",
"added",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/type_info.py#L253-L260 | train | Returns a copy of this set with a new element added. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/type_info.py | TypeDescriptorSet.Append | def Append(self, desc):
"""Append the descriptor to this set."""
if desc not in self.descriptors:
self.descriptors.append(desc)
self.descriptor_map[desc.name] = desc
self.descriptor_names.append(desc.name) | python | def Append(self, desc):
"""Append the descriptor to this set."""
if desc not in self.descriptors:
self.descriptors.append(desc)
self.descriptor_map[desc.name] = desc
self.descriptor_names.append(desc.name) | [
"def",
"Append",
"(",
"self",
",",
"desc",
")",
":",
"if",
"desc",
"not",
"in",
"self",
".",
"descriptors",
":",
"self",
".",
"descriptors",
".",
"append",
"(",
"desc",
")",
"self",
".",
"descriptor_map",
"[",
"desc",
".",
"name",
"]",
"=",
"desc",
... | Append the descriptor to this set. | [
"Append",
"the",
"descriptor",
"to",
"this",
"set",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/type_info.py#L262-L267 | train | Append the descriptor to this set. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
google/grr | grr/core/grr_response_core/lib/type_info.py | TypeDescriptorSet.Remove | def Remove(self, *descriptor_names):
"""Returns a copy of this set without elements with given names."""
new_descriptor_map = self.descriptor_map.copy()
for name in descriptor_names:
new_descriptor_map.pop(name, None)
new_descriptors = [
desc for desc in self.descriptors
if desc i... | python | def Remove(self, *descriptor_names):
"""Returns a copy of this set without elements with given names."""
new_descriptor_map = self.descriptor_map.copy()
for name in descriptor_names:
new_descriptor_map.pop(name, None)
new_descriptors = [
desc for desc in self.descriptors
if desc i... | [
"def",
"Remove",
"(",
"self",
",",
"*",
"descriptor_names",
")",
":",
"new_descriptor_map",
"=",
"self",
".",
"descriptor_map",
".",
"copy",
"(",
")",
"for",
"name",
"in",
"descriptor_names",
":",
"new_descriptor_map",
".",
"pop",
"(",
"name",
",",
"None",
... | Returns a copy of this set without elements with given names. | [
"Returns",
"a",
"copy",
"of",
"this",
"set",
"without",
"elements",
"with",
"given",
"names",
"."
] | 5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74 | https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/type_info.py#L273-L283 | train | Returns a copy of this set without elements with given names. | Pu7Z6IJCgH3a,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.