partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
MySQLDBFlowMixin.DeleteClientActionRequests
Deletes a list of client messages from the db.
grr/server/grr_response_server/databases/mysql_flows.py
def DeleteClientActionRequests(self, requests): """Deletes a list of client messages from the db.""" if not requests: return to_delete = [] for r in requests: to_delete.append((r.client_id, r.flow_id, r.request_id)) if len(set(to_delete)) != len(to_delete): raise ValueError( ...
def DeleteClientActionRequests(self, requests): """Deletes a list of client messages from the db.""" if not requests: return to_delete = [] for r in requests: to_delete.append((r.client_id, r.flow_id, r.request_id)) if len(set(to_delete)) != len(to_delete): raise ValueError( ...
[ "Deletes", "a", "list", "of", "client", "messages", "from", "the", "db", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L174-L187
[ "def", "DeleteClientActionRequests", "(", "self", ",", "requests", ")", ":", "if", "not", "requests", ":", "return", "to_delete", "=", "[", "]", "for", "r", "in", "requests", ":", "to_delete", ".", "append", "(", "(", "r", ".", "client_id", ",", "r", "...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.LeaseClientActionRequests
Leases available client messages for the client with the given id.
grr/server/grr_response_server/databases/mysql_flows.py
def LeaseClientActionRequests(self, client_id, lease_time=None, limit=None, cursor=None): """Leases available client messages for the client with the given id.""" now = rdfvalue.RDFDa...
def LeaseClientActionRequests(self, client_id, lease_time=None, limit=None, cursor=None): """Leases available client messages for the client with the given id.""" now = rdfvalue.RDFDa...
[ "Leases", "available", "client", "messages", "for", "the", "client", "with", "the", "given", "id", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L190-L238
[ "def", "LeaseClientActionRequests", "(", "self", ",", "client_id", ",", "lease_time", "=", "None", ",", "limit", "=", "None", ",", "cursor", "=", "None", ")", ":", "now", "=", "rdfvalue", ".", "RDFDatetime", ".", "Now", "(", ")", "now_str", "=", "mysql_u...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.WriteClientActionRequests
Writes messages that should go to the client to the db.
grr/server/grr_response_server/databases/mysql_flows.py
def WriteClientActionRequests(self, requests, cursor=None): """Writes messages that should go to the client to the db.""" query = ("INSERT IGNORE INTO client_action_requests " "(client_id, flow_id, request_id, timestamp, request) " "VALUES %s ON DUPLICATE KEY UPDATE " "ti...
def WriteClientActionRequests(self, requests, cursor=None): """Writes messages that should go to the client to the db.""" query = ("INSERT IGNORE INTO client_action_requests " "(client_id, flow_id, request_id, timestamp, request) " "VALUES %s ON DUPLICATE KEY UPDATE " "ti...
[ "Writes", "messages", "that", "should", "go", "to", "the", "client", "to", "the", "db", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L241-L265
[ "def", "WriteClientActionRequests", "(", "self", ",", "requests", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"INSERT IGNORE INTO client_action_requests \"", "\"(client_id, flow_id, request_id, timestamp, request) \"", "\"VALUES %s ON DUPLICATE KEY UPDATE \"", "\"t...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.WriteFlowObject
Writes a flow object to the database.
grr/server/grr_response_server/databases/mysql_flows.py
def WriteFlowObject(self, flow_obj, cursor=None): """Writes a flow object to the database.""" query = """ INSERT INTO flows (client_id, flow_id, long_flow_id, parent_flow_id, parent_hunt_id, flow, flow_state, next_request_to_process, pending_termination, timest...
def WriteFlowObject(self, flow_obj, cursor=None): """Writes a flow object to the database.""" query = """ INSERT INTO flows (client_id, flow_id, long_flow_id, parent_flow_id, parent_hunt_id, flow, flow_state, next_request_to_process, pending_termination, timest...
[ "Writes", "a", "flow", "object", "to", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L268-L328
[ "def", "WriteFlowObject", "(", "self", ",", "flow_obj", ",", "cursor", "=", "None", ")", ":", "query", "=", "\"\"\"\n INSERT INTO flows (client_id, flow_id, long_flow_id, parent_flow_id,\n parent_hunt_id, flow, flow_state,\n next_request_to_...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._FlowObjectFromRow
Generates a flow object from a database row.
grr/server/grr_response_server/databases/mysql_flows.py
def _FlowObjectFromRow(self, row): """Generates a flow object from a database row.""" flow, fs, cci, pt, nr, pd, po, ps, uct, sct, nbs, nrs, ts, lut = row flow_obj = rdf_flow_objects.Flow.FromSerializedString(flow) if fs not in [None, rdf_flow_objects.Flow.FlowState.UNSET]: flow_obj.flow_state =...
def _FlowObjectFromRow(self, row): """Generates a flow object from a database row.""" flow, fs, cci, pt, nr, pd, po, ps, uct, sct, nbs, nrs, ts, lut = row flow_obj = rdf_flow_objects.Flow.FromSerializedString(flow) if fs not in [None, rdf_flow_objects.Flow.FlowState.UNSET]: flow_obj.flow_state =...
[ "Generates", "a", "flow", "object", "from", "a", "database", "row", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L330-L360
[ "def", "_FlowObjectFromRow", "(", "self", ",", "row", ")", ":", "flow", ",", "fs", ",", "cci", ",", "pt", ",", "nr", ",", "pd", ",", "po", ",", "ps", ",", "uct", ",", "sct", ",", "nbs", ",", "nrs", ",", "ts", ",", "lut", "=", "row", "flow_obj...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReadFlowObject
Reads a flow object from the database.
grr/server/grr_response_server/databases/mysql_flows.py
def ReadFlowObject(self, client_id, flow_id, cursor=None): """Reads a flow object from the database.""" query = ("SELECT " + self.FLOW_DB_FIELDS + "FROM flows WHERE client_id=%s AND flow_id=%s") cursor.execute( query, [db_utils.ClientIDToInt(client_id), db_utils.FlowIDT...
def ReadFlowObject(self, client_id, flow_id, cursor=None): """Reads a flow object from the database.""" query = ("SELECT " + self.FLOW_DB_FIELDS + "FROM flows WHERE client_id=%s AND flow_id=%s") cursor.execute( query, [db_utils.ClientIDToInt(client_id), db_utils.FlowIDT...
[ "Reads", "a", "flow", "object", "from", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L378-L390
[ "def", "ReadFlowObject", "(", "self", ",", "client_id", ",", "flow_id", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT \"", "+", "self", ".", "FLOW_DB_FIELDS", "+", "\"FROM flows WHERE client_id=%s AND flow_id=%s\"", ")", "cursor", ".", "exec...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReadAllFlowObjects
Returns all flow objects.
grr/server/grr_response_server/databases/mysql_flows.py
def ReadAllFlowObjects(self, client_id = None, min_create_time = None, max_create_time = None, include_child_flows = True, cursor=None): """Returns all flow objects.""" conditions = [] ...
def ReadAllFlowObjects(self, client_id = None, min_create_time = None, max_create_time = None, include_child_flows = True, cursor=None): """Returns all flow objects.""" conditions = [] ...
[ "Returns", "all", "flow", "objects", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L393-L423
[ "def", "ReadAllFlowObjects", "(", "self", ",", "client_id", "=", "None", ",", "min_create_time", "=", "None", ",", "max_create_time", "=", "None", ",", "include_child_flows", "=", "True", ",", "cursor", "=", "None", ")", ":", "conditions", "=", "[", "]", "...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReadChildFlowObjects
Reads flows that were started by a given flow from the database.
grr/server/grr_response_server/databases/mysql_flows.py
def ReadChildFlowObjects(self, client_id, flow_id, cursor=None): """Reads flows that were started by a given flow from the database.""" query = ("SELECT " + self.FLOW_DB_FIELDS + "FROM flows WHERE client_id=%s AND parent_flow_id=%s") cursor.execute( query, [db_utils.ClientIDToIn...
def ReadChildFlowObjects(self, client_id, flow_id, cursor=None): """Reads flows that were started by a given flow from the database.""" query = ("SELECT " + self.FLOW_DB_FIELDS + "FROM flows WHERE client_id=%s AND parent_flow_id=%s") cursor.execute( query, [db_utils.ClientIDToIn...
[ "Reads", "flows", "that", "were", "started", "by", "a", "given", "flow", "from", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L426-L434
[ "def", "ReadChildFlowObjects", "(", "self", ",", "client_id", ",", "flow_id", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT \"", "+", "self", ".", "FLOW_DB_FIELDS", "+", "\"FROM flows WHERE client_id=%s AND parent_flow_id=%s\"", ")", "cursor", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.LeaseFlowForProcessing
Marks a flow as being processed on this worker and returns it.
grr/server/grr_response_server/databases/mysql_flows.py
def LeaseFlowForProcessing(self, client_id, flow_id, processing_time, cursor=None): """Marks a flow as being processed on this worker and returns it.""" query = ("SELECT " + self.FLOW_DB_FIELDS + ...
def LeaseFlowForProcessing(self, client_id, flow_id, processing_time, cursor=None): """Marks a flow as being processed on this worker and returns it.""" query = ("SELECT " + self.FLOW_DB_FIELDS + ...
[ "Marks", "a", "flow", "as", "being", "processed", "on", "this", "worker", "and", "returns", "it", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L437-L498
[ "def", "LeaseFlowForProcessing", "(", "self", ",", "client_id", ",", "flow_id", ",", "processing_time", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT \"", "+", "self", ".", "FLOW_DB_FIELDS", "+", "\"FROM flows WHERE client_id=%s AND flow_id=%s\"...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.UpdateFlow
Updates flow objects in the database.
grr/server/grr_response_server/databases/mysql_flows.py
def UpdateFlow(self, client_id, flow_id, flow_obj=db.Database.unchanged, flow_state=db.Database.unchanged, client_crash_info=db.Database.unchanged, pending_termination=db.Database.unchanged, processing...
def UpdateFlow(self, client_id, flow_id, flow_obj=db.Database.unchanged, flow_state=db.Database.unchanged, client_crash_info=db.Database.unchanged, pending_termination=db.Database.unchanged, processing...
[ "Updates", "flow", "objects", "in", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L501-L561
[ "def", "UpdateFlow", "(", "self", ",", "client_id", ",", "flow_id", ",", "flow_obj", "=", "db", ".", "Database", ".", "unchanged", ",", "flow_state", "=", "db", ".", "Database", ".", "unchanged", ",", "client_crash_info", "=", "db", ".", "Database", ".", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.UpdateFlows
Updates flow objects in the database.
grr/server/grr_response_server/databases/mysql_flows.py
def UpdateFlows(self, client_id_flow_id_pairs, pending_termination=db.Database.unchanged, cursor=None): """Updates flow objects in the database.""" if pending_termination == db.Database.unchanged: return serialized_termination = pending_terminati...
def UpdateFlows(self, client_id_flow_id_pairs, pending_termination=db.Database.unchanged, cursor=None): """Updates flow objects in the database.""" if pending_termination == db.Database.unchanged: return serialized_termination = pending_terminati...
[ "Updates", "flow", "objects", "in", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L564-L581
[ "def", "UpdateFlows", "(", "self", ",", "client_id_flow_id_pairs", ",", "pending_termination", "=", "db", ".", "Database", ".", "unchanged", ",", "cursor", "=", "None", ")", ":", "if", "pending_termination", "==", "db", ".", "Database", ".", "unchanged", ":", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._WriteFlowProcessingRequests
Returns a (query, args) tuple that inserts the given requests.
grr/server/grr_response_server/databases/mysql_flows.py
def _WriteFlowProcessingRequests(self, requests, cursor): """Returns a (query, args) tuple that inserts the given requests.""" templates = [] args = [] for req in requests: templates.append("(%s, %s, %s, FROM_UNIXTIME(%s))") args.append(db_utils.ClientIDToInt(req.client_id)) args.appen...
def _WriteFlowProcessingRequests(self, requests, cursor): """Returns a (query, args) tuple that inserts the given requests.""" templates = [] args = [] for req in requests: templates.append("(%s, %s, %s, FROM_UNIXTIME(%s))") args.append(db_utils.ClientIDToInt(req.client_id)) args.appen...
[ "Returns", "a", "(", "query", "args", ")", "tuple", "that", "inserts", "the", "given", "requests", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L583-L600
[ "def", "_WriteFlowProcessingRequests", "(", "self", ",", "requests", ",", "cursor", ")", ":", "templates", "=", "[", "]", "args", "=", "[", "]", "for", "req", "in", "requests", ":", "templates", ".", "append", "(", "\"(%s, %s, %s, FROM_UNIXTIME(%s))\"", ")", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.WriteFlowRequests
Writes a list of flow requests to the database.
grr/server/grr_response_server/databases/mysql_flows.py
def WriteFlowRequests(self, requests, cursor=None): """Writes a list of flow requests to the database.""" args = [] templates = [] flow_keys = [] needs_processing = {} for r in requests: if r.needs_processing: needs_processing.setdefault((r.client_id, r.flow_id), []).append(r) ...
def WriteFlowRequests(self, requests, cursor=None): """Writes a list of flow requests to the database.""" args = [] templates = [] flow_keys = [] needs_processing = {} for r in requests: if r.needs_processing: needs_processing.setdefault((r.client_id, r.flow_id), []).append(r) ...
[ "Writes", "a", "list", "of", "flow", "requests", "to", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L603-L660
[ "def", "WriteFlowRequests", "(", "self", ",", "requests", ",", "cursor", "=", "None", ")", ":", "args", "=", "[", "]", "templates", "=", "[", "]", "flow_keys", "=", "[", "]", "needs_processing", "=", "{", "}", "for", "r", "in", "requests", ":", "if",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._WriteResponses
Builds the writes to store the given responses in the db.
grr/server/grr_response_server/databases/mysql_flows.py
def _WriteResponses(self, responses, cursor): """Builds the writes to store the given responses in the db.""" query = ("INSERT IGNORE INTO flow_responses " "(client_id, flow_id, request_id, response_id, " "response, status, iterator, timestamp) VALUES ") templates = [] args =...
def _WriteResponses(self, responses, cursor): """Builds the writes to store the given responses in the db.""" query = ("INSERT IGNORE INTO flow_responses " "(client_id, flow_id, request_id, response_id, " "response, status, iterator, timestamp) VALUES ") templates = [] args =...
[ "Builds", "the", "writes", "to", "store", "the", "given", "responses", "in", "the", "db", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L662-L706
[ "def", "_WriteResponses", "(", "self", ",", "responses", ",", "cursor", ")", ":", "query", "=", "(", "\"INSERT IGNORE INTO flow_responses \"", "\"(client_id, flow_id, request_id, response_id, \"", "\"response, status, iterator, timestamp) VALUES \"", ")", "templates", "=", "[",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._DeleteClientActionRequest
Builds deletes for client messages.
grr/server/grr_response_server/databases/mysql_flows.py
def _DeleteClientActionRequest(self, to_delete, cursor=None): """Builds deletes for client messages.""" query = "DELETE FROM client_action_requests WHERE " conditions = [] args = [] for client_id, flow_id, request_id in to_delete: conditions.append("(client_id=%s AND flow_id=%s AND request_id...
def _DeleteClientActionRequest(self, to_delete, cursor=None): """Builds deletes for client messages.""" query = "DELETE FROM client_action_requests WHERE " conditions = [] args = [] for client_id, flow_id, request_id in to_delete: conditions.append("(client_id=%s AND flow_id=%s AND request_id...
[ "Builds", "deletes", "for", "client", "messages", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L709-L722
[ "def", "_DeleteClientActionRequest", "(", "self", ",", "to_delete", ",", "cursor", "=", "None", ")", ":", "query", "=", "\"DELETE FROM client_action_requests WHERE \"", "conditions", "=", "[", "]", "args", "=", "[", "]", "for", "client_id", ",", "flow_id", ",", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._WriteFlowResponsesAndExpectedUpdates
Writes a flow responses and updates flow requests expected counts.
grr/server/grr_response_server/databases/mysql_flows.py
def _WriteFlowResponsesAndExpectedUpdates(self, responses, cursor=None): """Writes a flow responses and updates flow requests expected counts.""" self._WriteResponses(responses, cursor) query = """ UPDATE flow_requests SET responses_expected=%(responses_expected)s WHERE client_id...
def _WriteFlowResponsesAndExpectedUpdates(self, responses, cursor=None): """Writes a flow responses and updates flow requests expected counts.""" self._WriteResponses(responses, cursor) query = """ UPDATE flow_requests SET responses_expected=%(responses_expected)s WHERE client_id...
[ "Writes", "a", "flow", "responses", "and", "updates", "flow", "requests", "expected", "counts", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L725-L749
[ "def", "_WriteFlowResponsesAndExpectedUpdates", "(", "self", ",", "responses", ",", "cursor", "=", "None", ")", ":", "self", ".", "_WriteResponses", "(", "responses", ",", "cursor", ")", "query", "=", "\"\"\"\n UPDATE flow_requests\n SET responses_expected=%(res...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._ReadFlowResponseCounts
Reads counts of responses for the given requests.
grr/server/grr_response_server/databases/mysql_flows.py
def _ReadFlowResponseCounts(self, request_keys, cursor=None): """Reads counts of responses for the given requests.""" query = """ SELECT flow_requests.client_id, flow_requests.flow_id, flow_requests.request_id, COUNT(*) FROM flow_responses, flow_requests WHERE ({conditions}) A...
def _ReadFlowResponseCounts(self, request_keys, cursor=None): """Reads counts of responses for the given requests.""" query = """ SELECT flow_requests.client_id, flow_requests.flow_id, flow_requests.request_id, COUNT(*) FROM flow_responses, flow_requests WHERE ({conditions}) A...
[ "Reads", "counts", "of", "responses", "for", "the", "given", "requests", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L751-L788
[ "def", "_ReadFlowResponseCounts", "(", "self", ",", "request_keys", ",", "cursor", "=", "None", ")", ":", "query", "=", "\"\"\"\n SELECT\n flow_requests.client_id, flow_requests.flow_id,\n flow_requests.request_id, COUNT(*)\n FROM flow_responses, flow_requests\n ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._ReadAndLockNextRequestsToProcess
Reads and locks the next_request_to_process for a number of flows.
grr/server/grr_response_server/databases/mysql_flows.py
def _ReadAndLockNextRequestsToProcess(self, flow_keys, cursor): """Reads and locks the next_request_to_process for a number of flows.""" query = """ SELECT client_id, flow_id, next_request_to_process FROM flows WHERE {conditions} FOR UPDATE """ condition_template = "(client_id =...
def _ReadAndLockNextRequestsToProcess(self, flow_keys, cursor): """Reads and locks the next_request_to_process for a number of flows.""" query = """ SELECT client_id, flow_id, next_request_to_process FROM flows WHERE {conditions} FOR UPDATE """ condition_template = "(client_id =...
[ "Reads", "and", "locks", "the", "next_request_to_process", "for", "a", "number", "of", "flows", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L790-L813
[ "def", "_ReadAndLockNextRequestsToProcess", "(", "self", ",", "flow_keys", ",", "cursor", ")", ":", "query", "=", "\"\"\"\n SELECT client_id, flow_id, next_request_to_process\n FROM flows\n WHERE {conditions}\n FOR UPDATE\n \"\"\"", "condition_template", "=", "\"...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._ReadLockAndUpdateCompletedRequests
Reads, locks, and updates completed requests.
grr/server/grr_response_server/databases/mysql_flows.py
def _ReadLockAndUpdateCompletedRequests(self, request_keys, response_counts, cursor): """Reads, locks, and updates completed requests.""" condition_template = """ (flow_requests.client_id = %s AND flow_requests.flow_id = %s AND flow_requests.request...
def _ReadLockAndUpdateCompletedRequests(self, request_keys, response_counts, cursor): """Reads, locks, and updates completed requests.""" condition_template = """ (flow_requests.client_id = %s AND flow_requests.flow_id = %s AND flow_requests.request...
[ "Reads", "locks", "and", "updates", "completed", "requests", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L815-L864
[ "def", "_ReadLockAndUpdateCompletedRequests", "(", "self", ",", "request_keys", ",", "response_counts", ",", "cursor", ")", ":", "condition_template", "=", "\"\"\"\n (flow_requests.client_id = %s AND\n flow_requests.flow_id = %s AND\n flow_requests.request_id = %s AND\n ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._UpdateRequestsAndScheduleFPRs
Updates requests and writes FlowProcessingRequests if needed.
grr/server/grr_response_server/databases/mysql_flows.py
def _UpdateRequestsAndScheduleFPRs(self, responses, cursor=None): """Updates requests and writes FlowProcessingRequests if needed.""" request_keys = set( (r.client_id, r.flow_id, r.request_id) for r in responses) flow_keys = set((r.client_id, r.flow_id) for r in responses) response_counts = se...
def _UpdateRequestsAndScheduleFPRs(self, responses, cursor=None): """Updates requests and writes FlowProcessingRequests if needed.""" request_keys = set( (r.client_id, r.flow_id, r.request_id) for r in responses) flow_keys = set((r.client_id, r.flow_id) for r in responses) response_counts = se...
[ "Updates", "requests", "and", "writes", "FlowProcessingRequests", "if", "needed", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L867-L897
[ "def", "_UpdateRequestsAndScheduleFPRs", "(", "self", ",", "responses", ",", "cursor", "=", "None", ")", ":", "request_keys", "=", "set", "(", "(", "r", ".", "client_id", ",", "r", ".", "flow_id", ",", "r", ".", "request_id", ")", "for", "r", "in", "re...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.WriteFlowResponses
Writes FlowMessages and updates corresponding requests.
grr/server/grr_response_server/databases/mysql_flows.py
def WriteFlowResponses(self, responses): """Writes FlowMessages and updates corresponding requests.""" if not responses: return for batch in collection.Batch(responses, self._WRITE_ROWS_BATCH_SIZE): self._WriteFlowResponsesAndExpectedUpdates(batch) completed_requests = self._UpdateRequ...
def WriteFlowResponses(self, responses): """Writes FlowMessages and updates corresponding requests.""" if not responses: return for batch in collection.Batch(responses, self._WRITE_ROWS_BATCH_SIZE): self._WriteFlowResponsesAndExpectedUpdates(batch) completed_requests = self._UpdateRequ...
[ "Writes", "FlowMessages", "and", "updates", "corresponding", "requests", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L900-L913
[ "def", "WriteFlowResponses", "(", "self", ",", "responses", ")", ":", "if", "not", "responses", ":", "return", "for", "batch", "in", "collection", ".", "Batch", "(", "responses", ",", "self", ".", "_WRITE_ROWS_BATCH_SIZE", ")", ":", "self", ".", "_WriteFlowR...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.DeleteFlowRequests
Deletes a list of flow requests from the database.
grr/server/grr_response_server/databases/mysql_flows.py
def DeleteFlowRequests(self, requests, cursor=None): """Deletes a list of flow requests from the database.""" if not requests: return conditions = [] args = [] for r in requests: conditions.append("(client_id=%s AND flow_id=%s AND request_id=%s)") args.append(db_utils.ClientIDToIn...
def DeleteFlowRequests(self, requests, cursor=None): """Deletes a list of flow requests from the database.""" if not requests: return conditions = [] args = [] for r in requests: conditions.append("(client_id=%s AND flow_id=%s AND request_id=%s)") args.append(db_utils.ClientIDToIn...
[ "Deletes", "a", "list", "of", "flow", "requests", "from", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L916-L933
[ "def", "DeleteFlowRequests", "(", "self", ",", "requests", ",", "cursor", "=", "None", ")", ":", "if", "not", "requests", ":", "return", "conditions", "=", "[", "]", "args", "=", "[", "]", "for", "r", "in", "requests", ":", "conditions", ".", "append",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.DeleteAllFlowRequestsAndResponses
Deletes all requests and responses for a given flow from the database.
grr/server/grr_response_server/databases/mysql_flows.py
def DeleteAllFlowRequestsAndResponses(self, client_id, flow_id, cursor=None): """Deletes all requests and responses for a given flow from the database.""" args = [db_utils.ClientIDToInt(client_id), db_utils.FlowIDToInt(flow_id)] res_query = "DELETE FROM flow_responses WHERE client_id=%s AND flow_id=%s" ...
def DeleteAllFlowRequestsAndResponses(self, client_id, flow_id, cursor=None): """Deletes all requests and responses for a given flow from the database.""" args = [db_utils.ClientIDToInt(client_id), db_utils.FlowIDToInt(flow_id)] res_query = "DELETE FROM flow_responses WHERE client_id=%s AND flow_id=%s" ...
[ "Deletes", "all", "requests", "and", "responses", "for", "a", "given", "flow", "from", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L975-L981
[ "def", "DeleteAllFlowRequestsAndResponses", "(", "self", ",", "client_id", ",", "flow_id", ",", "cursor", "=", "None", ")", ":", "args", "=", "[", "db_utils", ".", "ClientIDToInt", "(", "client_id", ")", ",", "db_utils", ".", "FlowIDToInt", "(", "flow_id", "...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReadFlowRequestsReadyForProcessing
Reads all requests for a flow that can be processed by the worker.
grr/server/grr_response_server/databases/mysql_flows.py
def ReadFlowRequestsReadyForProcessing(self, client_id, flow_id, next_needed_request, cursor=None): """Reads all requests for a flow that can be process...
def ReadFlowRequestsReadyForProcessing(self, client_id, flow_id, next_needed_request, cursor=None): """Reads all requests for a flow that can be process...
[ "Reads", "all", "requests", "for", "a", "flow", "that", "can", "be", "processed", "by", "the", "worker", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L984-L1032
[ "def", "ReadFlowRequestsReadyForProcessing", "(", "self", ",", "client_id", ",", "flow_id", ",", "next_needed_request", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT request, needs_processing, responses_expected, \"", "\"UNIX_TIMESTAMP(timestamp) \"", "...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReleaseProcessedFlow
Releases a flow that the worker was processing to the database.
grr/server/grr_response_server/databases/mysql_flows.py
def ReleaseProcessedFlow(self, flow_obj, cursor=None): """Releases a flow that the worker was processing to the database.""" update_query = """ UPDATE flows LEFT OUTER JOIN ( SELECT client_id, flow_id, needs_processing FROM flow_requests WHERE client_id = %(client_id)s AND ...
def ReleaseProcessedFlow(self, flow_obj, cursor=None): """Releases a flow that the worker was processing to the database.""" update_query = """ UPDATE flows LEFT OUTER JOIN ( SELECT client_id, flow_id, needs_processing FROM flow_requests WHERE client_id = %(client_id)s AND ...
[ "Releases", "a", "flow", "that", "the", "worker", "was", "processing", "to", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1035-L1096
[ "def", "ReleaseProcessedFlow", "(", "self", ",", "flow_obj", ",", "cursor", "=", "None", ")", ":", "update_query", "=", "\"\"\"\n UPDATE flows\n LEFT OUTER JOIN (\n SELECT client_id, flow_id, needs_processing\n FROM flow_requests\n WHERE\n client_id = %(client...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReadFlowProcessingRequests
Reads all flow processing requests from the database.
grr/server/grr_response_server/databases/mysql_flows.py
def ReadFlowProcessingRequests(self, cursor=None): """Reads all flow processing requests from the database.""" query = ("SELECT request, UNIX_TIMESTAMP(timestamp) " "FROM flow_processing_requests") cursor.execute(query) res = [] for serialized_request, ts in cursor.fetchall(): re...
def ReadFlowProcessingRequests(self, cursor=None): """Reads all flow processing requests from the database.""" query = ("SELECT request, UNIX_TIMESTAMP(timestamp) " "FROM flow_processing_requests") cursor.execute(query) res = [] for serialized_request, ts in cursor.fetchall(): re...
[ "Reads", "all", "flow", "processing", "requests", "from", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1104-L1116
[ "def", "ReadFlowProcessingRequests", "(", "self", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT request, UNIX_TIMESTAMP(timestamp) \"", "\"FROM flow_processing_requests\"", ")", "cursor", ".", "execute", "(", "query", ")", "res", "=", "[", "]", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.AckFlowProcessingRequests
Deletes a list of flow processing requests from the database.
grr/server/grr_response_server/databases/mysql_flows.py
def AckFlowProcessingRequests(self, requests, cursor=None): """Deletes a list of flow processing requests from the database.""" if not requests: return query = "DELETE FROM flow_processing_requests WHERE " conditions = [] args = [] for r in requests: conditions.append( "(...
def AckFlowProcessingRequests(self, requests, cursor=None): """Deletes a list of flow processing requests from the database.""" if not requests: return query = "DELETE FROM flow_processing_requests WHERE " conditions = [] args = [] for r in requests: conditions.append( "(...
[ "Deletes", "a", "list", "of", "flow", "processing", "requests", "from", "the", "database", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1119-L1136
[ "def", "AckFlowProcessingRequests", "(", "self", ",", "requests", ",", "cursor", "=", "None", ")", ":", "if", "not", "requests", ":", "return", "query", "=", "\"DELETE FROM flow_processing_requests WHERE \"", "conditions", "=", "[", "]", "args", "=", "[", "]", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._LeaseFlowProcessingReqests
Leases a number of flow processing requests.
grr/server/grr_response_server/databases/mysql_flows.py
def _LeaseFlowProcessingReqests(self, cursor=None): """Leases a number of flow processing requests.""" now = rdfvalue.RDFDatetime.Now() expiry = now + rdfvalue.Duration("10m") query = """ UPDATE flow_processing_requests SET leased_until=FROM_UNIXTIME(%(expiry)s), leased_by=%(id)s WHER...
def _LeaseFlowProcessingReqests(self, cursor=None): """Leases a number of flow processing requests.""" now = rdfvalue.RDFDatetime.Now() expiry = now + rdfvalue.Duration("10m") query = """ UPDATE flow_processing_requests SET leased_until=FROM_UNIXTIME(%(expiry)s), leased_by=%(id)s WHER...
[ "Leases", "a", "number", "of", "flow", "processing", "requests", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1145-L1197
[ "def", "_LeaseFlowProcessingReqests", "(", "self", ",", "cursor", "=", "None", ")", ":", "now", "=", "rdfvalue", ".", "RDFDatetime", ".", "Now", "(", ")", "expiry", "=", "now", "+", "rdfvalue", ".", "Duration", "(", "\"10m\"", ")", "query", "=", "\"\"\"\...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin._FlowProcessingRequestHandlerLoop
The main loop for the flow processing request queue.
grr/server/grr_response_server/databases/mysql_flows.py
def _FlowProcessingRequestHandlerLoop(self, handler): """The main loop for the flow processing request queue.""" while not self.flow_processing_request_handler_stop: try: msgs = self._LeaseFlowProcessingReqests() if msgs: for m in msgs: self.flow_processing_request_ha...
def _FlowProcessingRequestHandlerLoop(self, handler): """The main loop for the flow processing request queue.""" while not self.flow_processing_request_handler_stop: try: msgs = self._LeaseFlowProcessingReqests() if msgs: for m in msgs: self.flow_processing_request_ha...
[ "The", "main", "loop", "for", "the", "flow", "processing", "request", "queue", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1201-L1215
[ "def", "_FlowProcessingRequestHandlerLoop", "(", "self", ",", "handler", ")", ":", "while", "not", "self", ".", "flow_processing_request_handler_stop", ":", "try", ":", "msgs", "=", "self", ".", "_LeaseFlowProcessingReqests", "(", ")", "if", "msgs", ":", "for", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.RegisterFlowProcessingHandler
Registers a handler to receive flow processing messages.
grr/server/grr_response_server/databases/mysql_flows.py
def RegisterFlowProcessingHandler(self, handler): """Registers a handler to receive flow processing messages.""" self.UnregisterFlowProcessingHandler() if handler: self.flow_processing_request_handler_stop = False self.flow_processing_request_handler_thread = threading.Thread( name="f...
def RegisterFlowProcessingHandler(self, handler): """Registers a handler to receive flow processing messages.""" self.UnregisterFlowProcessingHandler() if handler: self.flow_processing_request_handler_stop = False self.flow_processing_request_handler_thread = threading.Thread( name="f...
[ "Registers", "a", "handler", "to", "receive", "flow", "processing", "messages", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1217-L1228
[ "def", "RegisterFlowProcessingHandler", "(", "self", ",", "handler", ")", ":", "self", ".", "UnregisterFlowProcessingHandler", "(", ")", "if", "handler", ":", "self", ".", "flow_processing_request_handler_stop", "=", "False", "self", ".", "flow_processing_request_handle...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.UnregisterFlowProcessingHandler
Unregisters any registered flow processing handler.
grr/server/grr_response_server/databases/mysql_flows.py
def UnregisterFlowProcessingHandler(self, timeout=None): """Unregisters any registered flow processing handler.""" if self.flow_processing_request_handler_thread: self.flow_processing_request_handler_stop = True self.flow_processing_request_handler_thread.join(timeout) if self.flow_processing_...
def UnregisterFlowProcessingHandler(self, timeout=None): """Unregisters any registered flow processing handler.""" if self.flow_processing_request_handler_thread: self.flow_processing_request_handler_stop = True self.flow_processing_request_handler_thread.join(timeout) if self.flow_processing_...
[ "Unregisters", "any", "registered", "flow", "processing", "handler", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1230-L1237
[ "def", "UnregisterFlowProcessingHandler", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "flow_processing_request_handler_thread", ":", "self", ".", "flow_processing_request_handler_stop", "=", "True", "self", ".", "flow_processing_request_handler_...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.WriteFlowResults
Writes flow results for a given flow.
grr/server/grr_response_server/databases/mysql_flows.py
def WriteFlowResults(self, results, cursor=None): """Writes flow results for a given flow.""" query = ("INSERT INTO flow_results " "(client_id, flow_id, hunt_id, timestamp, payload, type, tag) " "VALUES ") templates = [] args = [] for r in results: templates.append("...
def WriteFlowResults(self, results, cursor=None): """Writes flow results for a given flow.""" query = ("INSERT INTO flow_results " "(client_id, flow_id, hunt_id, timestamp, payload, type, tag) " "VALUES ") templates = [] args = [] for r in results: templates.append("...
[ "Writes", "flow", "results", "for", "a", "given", "flow", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1240-L1268
[ "def", "WriteFlowResults", "(", "self", ",", "results", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"INSERT INTO flow_results \"", "\"(client_id, flow_id, hunt_id, timestamp, payload, type, tag) \"", "\"VALUES \"", ")", "templates", "=", "[", "]", "args",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReadFlowResults
Reads flow results of a given flow using given query options.
grr/server/grr_response_server/databases/mysql_flows.py
def ReadFlowResults(self, client_id, flow_id, offset, count, with_tag=None, with_type=None, with_substring=None, cursor=None): """Reads flow...
def ReadFlowResults(self, client_id, flow_id, offset, count, with_tag=None, with_type=None, with_substring=None, cursor=None): """Reads flow...
[ "Reads", "flow", "results", "of", "a", "given", "flow", "using", "given", "query", "options", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1271-L1322
[ "def", "ReadFlowResults", "(", "self", ",", "client_id", ",", "flow_id", ",", "offset", ",", "count", ",", "with_tag", "=", "None", ",", "with_type", "=", "None", ",", "with_substring", "=", "None", ",", "cursor", "=", "None", ")", ":", "query", "=", "...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.CountFlowResults
Counts flow results of a given flow using given query options.
grr/server/grr_response_server/databases/mysql_flows.py
def CountFlowResults(self, client_id, flow_id, with_tag=None, with_type=None, cursor=None): """Counts flow results of a given flow using given query options.""" query = ("SELECT COUNT(*) " ...
def CountFlowResults(self, client_id, flow_id, with_tag=None, with_type=None, cursor=None): """Counts flow results of a given flow using given query options.""" query = ("SELECT COUNT(*) " ...
[ "Counts", "flow", "results", "of", "a", "given", "flow", "using", "given", "query", "options", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1325-L1347
[ "def", "CountFlowResults", "(", "self", ",", "client_id", ",", "flow_id", ",", "with_tag", "=", "None", ",", "with_type", "=", "None", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT COUNT(*) \"", "\"FROM flow_results \"", "\"FORCE INDEX (flow...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.CountFlowResultsByType
Returns counts of flow results grouped by result type.
grr/server/grr_response_server/databases/mysql_flows.py
def CountFlowResultsByType(self, client_id, flow_id, cursor=None): """Returns counts of flow results grouped by result type.""" query = ("SELECT type, COUNT(*) FROM flow_results " "FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) " "WHERE client_id = %s AND flow_id = %s " ...
def CountFlowResultsByType(self, client_id, flow_id, cursor=None): """Returns counts of flow results grouped by result type.""" query = ("SELECT type, COUNT(*) FROM flow_results " "FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) " "WHERE client_id = %s AND flow_id = %s " ...
[ "Returns", "counts", "of", "flow", "results", "grouped", "by", "result", "type", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1350-L1360
[ "def", "CountFlowResultsByType", "(", "self", ",", "client_id", ",", "flow_id", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT type, COUNT(*) FROM flow_results \"", "\"FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) \"", "\"WHERE client_id = %s AND...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReadFlowLogEntries
Reads flow log entries of a given flow using given query options.
grr/server/grr_response_server/databases/mysql_flows.py
def ReadFlowLogEntries(self, client_id, flow_id, offset, count, with_substring=None, cursor=None): """Reads flow log entries of a given flow using given query options...
def ReadFlowLogEntries(self, client_id, flow_id, offset, count, with_substring=None, cursor=None): """Reads flow log entries of a given flow using given query options...
[ "Reads", "flow", "log", "entries", "of", "a", "given", "flow", "using", "given", "query", "options", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1389-L1421
[ "def", "ReadFlowLogEntries", "(", "self", ",", "client_id", ",", "flow_id", ",", "offset", ",", "count", ",", "with_substring", "=", "None", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT message, UNIX_TIMESTAMP(timestamp) \"", "\"FROM flow_log...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.CountFlowLogEntries
Returns number of flow log entries of a given flow.
grr/server/grr_response_server/databases/mysql_flows.py
def CountFlowLogEntries(self, client_id, flow_id, cursor=None): """Returns number of flow log entries of a given flow.""" query = ("SELECT COUNT(*) " "FROM flow_log_entries " "FORCE INDEX (flow_log_entries_by_flow) " "WHERE client_id = %s AND flow_id = %s ") args = [d...
def CountFlowLogEntries(self, client_id, flow_id, cursor=None): """Returns number of flow log entries of a given flow.""" query = ("SELECT COUNT(*) " "FROM flow_log_entries " "FORCE INDEX (flow_log_entries_by_flow) " "WHERE client_id = %s AND flow_id = %s ") args = [d...
[ "Returns", "number", "of", "flow", "log", "entries", "of", "a", "given", "flow", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1424-L1434
[ "def", "CountFlowLogEntries", "(", "self", ",", "client_id", ",", "flow_id", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT COUNT(*) \"", "\"FROM flow_log_entries \"", "\"FORCE INDEX (flow_log_entries_by_flow) \"", "\"WHERE client_id = %s AND flow_id = %s ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.WriteFlowOutputPluginLogEntries
Writes flow output plugin log entries for a given flow.
grr/server/grr_response_server/databases/mysql_flows.py
def WriteFlowOutputPluginLogEntries(self, entries, cursor=None): """Writes flow output plugin log entries for a given flow.""" query = ("INSERT INTO flow_output_plugin_log_entries " "(client_id, flow_id, hunt_id, output_plugin_id, " "log_entry_type, message) " "VALUES ") ...
def WriteFlowOutputPluginLogEntries(self, entries, cursor=None): """Writes flow output plugin log entries for a given flow.""" query = ("INSERT INTO flow_output_plugin_log_entries " "(client_id, flow_id, hunt_id, output_plugin_id, " "log_entry_type, message) " "VALUES ") ...
[ "Writes", "flow", "output", "plugin", "log", "entries", "for", "a", "given", "flow", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1437-L1463
[ "def", "WriteFlowOutputPluginLogEntries", "(", "self", ",", "entries", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"INSERT INTO flow_output_plugin_log_entries \"", "\"(client_id, flow_id, hunt_id, output_plugin_id, \"", "\"log_entry_type, message) \"", "\"VALUES \"...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.ReadFlowOutputPluginLogEntries
Reads flow output plugin log entries.
grr/server/grr_response_server/databases/mysql_flows.py
def ReadFlowOutputPluginLogEntries(self, client_id, flow_id, output_plugin_id, offset, count, with...
def ReadFlowOutputPluginLogEntries(self, client_id, flow_id, output_plugin_id, offset, count, with...
[ "Reads", "flow", "output", "plugin", "log", "entries", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1466-L1506
[ "def", "ReadFlowOutputPluginLogEntries", "(", "self", ",", "client_id", ",", "flow_id", ",", "output_plugin_id", ",", "offset", ",", "count", ",", "with_type", "=", "None", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT log_entry_type, messag...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
MySQLDBFlowMixin.CountFlowOutputPluginLogEntries
Returns number of flow output plugin log entries of a given flow.
grr/server/grr_response_server/databases/mysql_flows.py
def CountFlowOutputPluginLogEntries(self, client_id, flow_id, output_plugin_id, with_type=None, cursor=None): """Returns numbe...
def CountFlowOutputPluginLogEntries(self, client_id, flow_id, output_plugin_id, with_type=None, cursor=None): """Returns numbe...
[ "Returns", "number", "of", "flow", "output", "plugin", "log", "entries", "of", "a", "given", "flow", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_flows.py#L1509-L1530
[ "def", "CountFlowOutputPluginLogEntries", "(", "self", ",", "client_id", ",", "flow_id", ",", "output_plugin_id", ",", "with_type", "=", "None", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "\"SELECT COUNT(*) \"", "\"FROM flow_output_plugin_log_entries \""...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ForemanClientRuleSet.Evaluate
Evaluates rules held in the rule set. Args: client_obj: Either an aff4 client object or a client_info dict as returned by ReadFullInfoClient if the relational db is used for reading. Returns: A bool value of the evaluation. Raises: ValueError: The match mode is of unknown value.
grr/server/grr_response_server/foreman_rules.py
def Evaluate(self, client_obj): """Evaluates rules held in the rule set. Args: client_obj: Either an aff4 client object or a client_info dict as returned by ReadFullInfoClient if the relational db is used for reading. Returns: A bool value of the evaluation. Raises: ValueErr...
def Evaluate(self, client_obj): """Evaluates rules held in the rule set. Args: client_obj: Either an aff4 client object or a client_info dict as returned by ReadFullInfoClient if the relational db is used for reading. Returns: A bool value of the evaluation. Raises: ValueErr...
[ "Evaluates", "rules", "held", "in", "the", "rule", "set", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/foreman_rules.py#L304-L324
[ "def", "Evaluate", "(", "self", ",", "client_obj", ")", ":", "if", "self", ".", "match_mode", "==", "ForemanClientRuleSet", ".", "MatchMode", ".", "MATCH_ALL", ":", "quantifier", "=", "all", "elif", "self", ".", "match_mode", "==", "ForemanClientRuleSet", ".",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.WriteGRRUser
Writes user object for a user with a given name.
grr/server/grr_response_server/databases/mem_users.py
def WriteGRRUser(self, username, password=None, ui_mode=None, canary_mode=None, user_type=None): """Writes user object for a user with a given name.""" u = self.users.setdefault(username, rdf_objects.GRRUser(username=...
def WriteGRRUser(self, username, password=None, ui_mode=None, canary_mode=None, user_type=None): """Writes user object for a user with a given name.""" u = self.users.setdefault(username, rdf_objects.GRRUser(username=...
[ "Writes", "user", "object", "for", "a", "user", "with", "a", "given", "name", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L22-L37
[ "def", "WriteGRRUser", "(", "self", ",", "username", ",", "password", "=", "None", ",", "ui_mode", "=", "None", ",", "canary_mode", "=", "None", ",", "user_type", "=", "None", ")", ":", "u", "=", "self", ".", "users", ".", "setdefault", "(", "username"...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.ReadGRRUser
Reads a user object corresponding to a given name.
grr/server/grr_response_server/databases/mem_users.py
def ReadGRRUser(self, username): """Reads a user object corresponding to a given name.""" try: return self.users[username].Copy() except KeyError: raise db.UnknownGRRUserError(username)
def ReadGRRUser(self, username): """Reads a user object corresponding to a given name.""" try: return self.users[username].Copy() except KeyError: raise db.UnknownGRRUserError(username)
[ "Reads", "a", "user", "object", "corresponding", "to", "a", "given", "name", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L40-L45
[ "def", "ReadGRRUser", "(", "self", ",", "username", ")", ":", "try", ":", "return", "self", ".", "users", "[", "username", "]", ".", "Copy", "(", ")", "except", "KeyError", ":", "raise", "db", ".", "UnknownGRRUserError", "(", "username", ")" ]
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.ReadGRRUsers
Reads GRR users with optional pagination, sorted by username.
grr/server/grr_response_server/databases/mem_users.py
def ReadGRRUsers(self, offset=0, count=None): """Reads GRR users with optional pagination, sorted by username.""" if count is None: count = len(self.users) users = sorted(self.users.values(), key=lambda user: user.username) return [user.Copy() for user in users[offset:offset + count]]
def ReadGRRUsers(self, offset=0, count=None): """Reads GRR users with optional pagination, sorted by username.""" if count is None: count = len(self.users) users = sorted(self.users.values(), key=lambda user: user.username) return [user.Copy() for user in users[offset:offset + count]]
[ "Reads", "GRR", "users", "with", "optional", "pagination", "sorted", "by", "username", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L48-L54
[ "def", "ReadGRRUsers", "(", "self", ",", "offset", "=", "0", ",", "count", "=", "None", ")", ":", "if", "count", "is", "None", ":", "count", "=", "len", "(", "self", ".", "users", ")", "users", "=", "sorted", "(", "self", ".", "users", ".", "valu...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.DeleteGRRUser
Deletes the user and all related metadata with the given username.
grr/server/grr_response_server/databases/mem_users.py
def DeleteGRRUser(self, username): """Deletes the user and all related metadata with the given username.""" try: del self.approvals_by_username[username] except KeyError: pass # No approvals to delete for this user. for approvals in itervalues(self.approvals_by_username): for approva...
def DeleteGRRUser(self, username): """Deletes the user and all related metadata with the given username.""" try: del self.approvals_by_username[username] except KeyError: pass # No approvals to delete for this user. for approvals in itervalues(self.approvals_by_username): for approva...
[ "Deletes", "the", "user", "and", "all", "related", "metadata", "with", "the", "given", "username", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L62-L83
[ "def", "DeleteGRRUser", "(", "self", ",", "username", ")", ":", "try", ":", "del", "self", ".", "approvals_by_username", "[", "username", "]", "except", "KeyError", ":", "pass", "# No approvals to delete for this user.", "for", "approvals", "in", "itervalues", "("...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.WriteApprovalRequest
Writes an approval request object.
grr/server/grr_response_server/databases/mem_users.py
def WriteApprovalRequest(self, approval_request): """Writes an approval request object.""" approvals = self.approvals_by_username.setdefault( approval_request.requestor_username, {}) approval_id = str(os.urandom(16).encode("hex")) cloned_request = approval_request.Copy() cloned_request.time...
def WriteApprovalRequest(self, approval_request): """Writes an approval request object.""" approvals = self.approvals_by_username.setdefault( approval_request.requestor_username, {}) approval_id = str(os.urandom(16).encode("hex")) cloned_request = approval_request.Copy() cloned_request.time...
[ "Writes", "an", "approval", "request", "object", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L86-L97
[ "def", "WriteApprovalRequest", "(", "self", ",", "approval_request", ")", ":", "approvals", "=", "self", ".", "approvals_by_username", ".", "setdefault", "(", "approval_request", ".", "requestor_username", ",", "{", "}", ")", "approval_id", "=", "str", "(", "os"...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.ReadApprovalRequest
Reads an approval request object with a given id.
grr/server/grr_response_server/databases/mem_users.py
def ReadApprovalRequest(self, requestor_username, approval_id): """Reads an approval request object with a given id.""" try: return self.approvals_by_username[requestor_username][approval_id] except KeyError: raise db.UnknownApprovalRequestError("Can't find approval with id: %s" % ...
def ReadApprovalRequest(self, requestor_username, approval_id): """Reads an approval request object with a given id.""" try: return self.approvals_by_username[requestor_username][approval_id] except KeyError: raise db.UnknownApprovalRequestError("Can't find approval with id: %s" % ...
[ "Reads", "an", "approval", "request", "object", "with", "a", "given", "id", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L100-L106
[ "def", "ReadApprovalRequest", "(", "self", ",", "requestor_username", ",", "approval_id", ")", ":", "try", ":", "return", "self", ".", "approvals_by_username", "[", "requestor_username", "]", "[", "approval_id", "]", "except", "KeyError", ":", "raise", "db", "."...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.ReadApprovalRequests
Reads approval requests of a given type for a given user.
grr/server/grr_response_server/databases/mem_users.py
def ReadApprovalRequests(self, requestor_username, approval_type, subject_id=None, include_expired=False): """Reads approval requests of a given type for a given user.""" now = rdfvalue.RDFDatetime.Now() ...
def ReadApprovalRequests(self, requestor_username, approval_type, subject_id=None, include_expired=False): """Reads approval requests of a given type for a given user.""" now = rdfvalue.RDFDatetime.Now() ...
[ "Reads", "approval", "requests", "of", "a", "given", "type", "for", "a", "given", "user", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L109-L131
[ "def", "ReadApprovalRequests", "(", "self", ",", "requestor_username", ",", "approval_type", ",", "subject_id", "=", "None", ",", "include_expired", "=", "False", ")", ":", "now", "=", "rdfvalue", ".", "RDFDatetime", ".", "Now", "(", ")", "result", "=", "[",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.GrantApproval
Grants approval for a given request using given username.
grr/server/grr_response_server/databases/mem_users.py
def GrantApproval(self, requestor_username, approval_id, grantor_username): """Grants approval for a given request using given username.""" try: approval = self.approvals_by_username[requestor_username][approval_id] approval.grants.append( rdf_objects.ApprovalGrant( grantor_u...
def GrantApproval(self, requestor_username, approval_id, grantor_username): """Grants approval for a given request using given username.""" try: approval = self.approvals_by_username[requestor_username][approval_id] approval.grants.append( rdf_objects.ApprovalGrant( grantor_u...
[ "Grants", "approval", "for", "a", "given", "request", "using", "given", "username", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L134-L144
[ "def", "GrantApproval", "(", "self", ",", "requestor_username", ",", "approval_id", ",", "grantor_username", ")", ":", "try", ":", "approval", "=", "self", ".", "approvals_by_username", "[", "requestor_username", "]", "[", "approval_id", "]", "approval", ".", "g...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.WriteUserNotification
Writes a notification for a given user.
grr/server/grr_response_server/databases/mem_users.py
def WriteUserNotification(self, notification): """Writes a notification for a given user.""" if notification.username not in self.users: raise db.UnknownGRRUserError(notification.username) cloned_notification = notification.Copy() if not cloned_notification.timestamp: cloned_notification.ti...
def WriteUserNotification(self, notification): """Writes a notification for a given user.""" if notification.username not in self.users: raise db.UnknownGRRUserError(notification.username) cloned_notification = notification.Copy() if not cloned_notification.timestamp: cloned_notification.ti...
[ "Writes", "a", "notification", "for", "a", "given", "user", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L147-L157
[ "def", "WriteUserNotification", "(", "self", ",", "notification", ")", ":", "if", "notification", ".", "username", "not", "in", "self", ".", "users", ":", "raise", "db", ".", "UnknownGRRUserError", "(", "notification", ".", "username", ")", "cloned_notification"...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.ReadUserNotifications
Reads notifications scheduled for a user within a given timerange.
grr/server/grr_response_server/databases/mem_users.py
def ReadUserNotifications(self, username, state=None, timerange=None): """Reads notifications scheduled for a user within a given timerange.""" from_time, to_time = self._ParseTimeRange(timerange) result = [] for n in self.notifications_by_username.get(username, []): if from_time <= n.timestamp <...
def ReadUserNotifications(self, username, state=None, timerange=None): """Reads notifications scheduled for a user within a given timerange.""" from_time, to_time = self._ParseTimeRange(timerange) result = [] for n in self.notifications_by_username.get(username, []): if from_time <= n.timestamp <...
[ "Reads", "notifications", "scheduled", "for", "a", "user", "within", "a", "given", "timerange", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L160-L170
[ "def", "ReadUserNotifications", "(", "self", ",", "username", ",", "state", "=", "None", ",", "timerange", "=", "None", ")", ":", "from_time", ",", "to_time", "=", "self", ".", "_ParseTimeRange", "(", "timerange", ")", "result", "=", "[", "]", "for", "n"...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
InMemoryDBUsersMixin.UpdateUserNotifications
Updates existing user notification objects.
grr/server/grr_response_server/databases/mem_users.py
def UpdateUserNotifications(self, username, timestamps, state=None): """Updates existing user notification objects.""" if not timestamps: return for n in self.notifications_by_username.get(username, []): if n.timestamp in timestamps: n.state = state
def UpdateUserNotifications(self, username, timestamps, state=None): """Updates existing user notification objects.""" if not timestamps: return for n in self.notifications_by_username.get(username, []): if n.timestamp in timestamps: n.state = state
[ "Updates", "existing", "user", "notification", "objects", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_users.py#L173-L180
[ "def", "UpdateUserNotifications", "(", "self", ",", "username", ",", "timestamps", ",", "state", "=", "None", ")", ":", "if", "not", "timestamps", ":", "return", "for", "n", "in", "self", ".", "notifications_by_username", ".", "get", "(", "username", ",", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
_ConditionsToFileFinderConditions
Converts FileFinderSizeConditions to RegistryFinderConditions.
grr/server/grr_response_server/flows/general/registry.py
def _ConditionsToFileFinderConditions(conditions): """Converts FileFinderSizeConditions to RegistryFinderConditions.""" ff_condition_type_cls = rdf_file_finder.FileFinderCondition.Type result = [] for c in conditions: if c.condition_type == RegistryFinderCondition.Type.MODIFICATION_TIME: result.append...
def _ConditionsToFileFinderConditions(conditions): """Converts FileFinderSizeConditions to RegistryFinderConditions.""" ff_condition_type_cls = rdf_file_finder.FileFinderCondition.Type result = [] for c in conditions: if c.condition_type == RegistryFinderCondition.Type.MODIFICATION_TIME: result.append...
[ "Converts", "FileFinderSizeConditions", "to", "RegistryFinderConditions", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/registry.py#L42-L69
[ "def", "_ConditionsToFileFinderConditions", "(", "conditions", ")", ":", "ff_condition_type_cls", "=", "rdf_file_finder", ".", "FileFinderCondition", ".", "Type", "result", "=", "[", "]", "for", "c", "in", "conditions", ":", "if", "c", ".", "condition_type", "==",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
StripTypeInfo
Strips type information from rendered data. Useful for debugging.
grr/server/grr_response_server/gui/api_value_renderers.py
def StripTypeInfo(rendered_data): """Strips type information from rendered data. Useful for debugging.""" if isinstance(rendered_data, (list, tuple)): return [StripTypeInfo(d) for d in rendered_data] elif isinstance(rendered_data, dict): if "value" in rendered_data and "type" in rendered_data: retu...
def StripTypeInfo(rendered_data): """Strips type information from rendered data. Useful for debugging.""" if isinstance(rendered_data, (list, tuple)): return [StripTypeInfo(d) for d in rendered_data] elif isinstance(rendered_data, dict): if "value" in rendered_data and "type" in rendered_data: retu...
[ "Strips", "type", "information", "from", "rendered", "data", ".", "Useful", "for", "debugging", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_value_renderers.py#L65-L79
[ "def", "StripTypeInfo", "(", "rendered_data", ")", ":", "if", "isinstance", "(", "rendered_data", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "StripTypeInfo", "(", "d", ")", "for", "d", "in", "rendered_data", "]", "elif", "isinstance", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
RenderValue
Render given RDFValue as plain old python objects.
grr/server/grr_response_server/gui/api_value_renderers.py
def RenderValue(value, limit_lists=-1): """Render given RDFValue as plain old python objects.""" if value is None: return None renderer = ApiValueRenderer.GetRendererForValueOrClass( value, limit_lists=limit_lists) return renderer.RenderValue(value)
def RenderValue(value, limit_lists=-1): """Render given RDFValue as plain old python objects.""" if value is None: return None renderer = ApiValueRenderer.GetRendererForValueOrClass( value, limit_lists=limit_lists) return renderer.RenderValue(value)
[ "Render", "given", "RDFValue", "as", "plain", "old", "python", "objects", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_value_renderers.py#L570-L578
[ "def", "RenderValue", "(", "value", ",", "limit_lists", "=", "-", "1", ")", ":", "if", "value", "is", "None", ":", "return", "None", "renderer", "=", "ApiValueRenderer", ".", "GetRendererForValueOrClass", "(", "value", ",", "limit_lists", "=", "limit_lists", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiValueRenderer.GetRendererForValueOrClass
Returns renderer corresponding to a given value and rendering args.
grr/server/grr_response_server/gui/api_value_renderers.py
def GetRendererForValueOrClass(cls, value, limit_lists=-1): """Returns renderer corresponding to a given value and rendering args.""" if inspect.isclass(value): value_cls = value else: value_cls = value.__class__ cache_key = "%s_%d" % (value_cls.__name__, limit_lists) try: render...
def GetRendererForValueOrClass(cls, value, limit_lists=-1): """Returns renderer corresponding to a given value and rendering args.""" if inspect.isclass(value): value_cls = value else: value_cls = value.__class__ cache_key = "%s_%d" % (value_cls.__name__, limit_lists) try: render...
[ "Returns", "renderer", "corresponding", "to", "a", "given", "value", "and", "rendering", "args", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_value_renderers.py#L91-L126
[ "def", "GetRendererForValueOrClass", "(", "cls", ",", "value", ",", "limit_lists", "=", "-", "1", ")", ":", "if", "inspect", ".", "isclass", "(", "value", ")", ":", "value_cls", "=", "value", "else", ":", "value_cls", "=", "value", ".", "__class__", "cac...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiValueRenderer.BuildDefaultValue
Renders default value of a given class. Args: value_cls: Default value of this class will be rendered. This class has to be (or to be a subclass of) a self.value_class (i.e. a class that this renderer is capable of rendering). Returns: An initialized default value. Raises: ...
grr/server/grr_response_server/gui/api_value_renderers.py
def BuildDefaultValue(self, value_cls): """Renders default value of a given class. Args: value_cls: Default value of this class will be rendered. This class has to be (or to be a subclass of) a self.value_class (i.e. a class that this renderer is capable of rendering). Returns: ...
def BuildDefaultValue(self, value_cls): """Renders default value of a given class. Args: value_cls: Default value of this class will be rendered. This class has to be (or to be a subclass of) a self.value_class (i.e. a class that this renderer is capable of rendering). Returns: ...
[ "Renders", "default", "value", "of", "a", "given", "class", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_value_renderers.py#L145-L164
[ "def", "BuildDefaultValue", "(", "self", ",", "value_cls", ")", ":", "try", ":", "return", "value_cls", "(", ")", "except", "Exception", "as", "e", ":", "# pylint: disable=broad-except", "logging", ".", "exception", "(", "e", ")", "raise", "DefaultValueError", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiValueRenderer.BuildTypeDescriptor
Renders metadata of a given value class. Args: value_cls: Metadata of this class will be rendered. This class has to be (or to be a subclass of) a self.value_class (i.e. a class that this renderer is capable of rendering). Returns: Dictionary with class metadata.
grr/server/grr_response_server/gui/api_value_renderers.py
def BuildTypeDescriptor(self, value_cls): """Renders metadata of a given value class. Args: value_cls: Metadata of this class will be rendered. This class has to be (or to be a subclass of) a self.value_class (i.e. a class that this renderer is capable of rendering). Returns: D...
def BuildTypeDescriptor(self, value_cls): """Renders metadata of a given value class. Args: value_cls: Metadata of this class will be rendered. This class has to be (or to be a subclass of) a self.value_class (i.e. a class that this renderer is capable of rendering). Returns: D...
[ "Renders", "metadata", "of", "a", "given", "value", "class", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_value_renderers.py#L166-L185
[ "def", "BuildTypeDescriptor", "(", "self", ",", "value_cls", ")", ":", "result", "=", "ApiRDFValueDescriptor", "(", "name", "=", "value_cls", ".", "__name__", ",", "parents", "=", "[", "klass", ".", "__name__", "for", "klass", "in", "value_cls", ".", "__mro_...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiGrrMessageRenderer.RenderPayload
Renders GrrMessage payload and renames args_rdf_name field.
grr/server/grr_response_server/gui/api_value_renderers.py
def RenderPayload(self, result, value): """Renders GrrMessage payload and renames args_rdf_name field.""" if "args_rdf_name" in result: result["payload_type"] = result["args_rdf_name"] del result["args_rdf_name"] if "args" in result: result["payload"] = self._PassThrough(value.payload) ...
def RenderPayload(self, result, value): """Renders GrrMessage payload and renames args_rdf_name field.""" if "args_rdf_name" in result: result["payload_type"] = result["args_rdf_name"] del result["args_rdf_name"] if "args" in result: result["payload"] = self._PassThrough(value.payload) ...
[ "Renders", "GrrMessage", "payload", "and", "renames", "args_rdf_name", "field", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_value_renderers.py#L542-L552
[ "def", "RenderPayload", "(", "self", ",", "result", ",", "value", ")", ":", "if", "\"args_rdf_name\"", "in", "result", ":", "result", "[", "\"payload_type\"", "]", "=", "result", "[", "\"args_rdf_name\"", "]", "del", "result", "[", "\"args_rdf_name\"", "]", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiGrrMessageRenderer.AdjustDescriptor
Payload-aware metadata processor.
grr/server/grr_response_server/gui/api_value_renderers.py
def AdjustDescriptor(self, fields): """Payload-aware metadata processor.""" for f in fields: if f.name == "args_rdf_name": f.name = "payload_type" if f.name == "args": f.name = "payload" return fields
def AdjustDescriptor(self, fields): """Payload-aware metadata processor.""" for f in fields: if f.name == "args_rdf_name": f.name = "payload_type" if f.name == "args": f.name = "payload" return fields
[ "Payload", "-", "aware", "metadata", "processor", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_value_renderers.py#L554-L564
[ "def", "AdjustDescriptor", "(", "self", ",", "fields", ")", ":", "for", "f", "in", "fields", ":", "if", "f", ".", "name", "==", "\"args_rdf_name\"", ":", "f", ".", "name", "=", "\"payload_type\"", "if", "f", ".", "name", "==", "\"args\"", ":", "f", "...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
PlistValueToPlainValue
Takes the plist contents generated by binplist and returns a plain dict. binplist uses rich types to express some of the plist types. We need to convert them to types that RDFValueArray will be able to transport. Args: plist: A plist to convert. Returns: A simple python type.
grr/core/grr_response_core/lib/plist.py
def PlistValueToPlainValue(plist): """Takes the plist contents generated by binplist and returns a plain dict. binplist uses rich types to express some of the plist types. We need to convert them to types that RDFValueArray will be able to transport. Args: plist: A plist to convert. Returns: A simp...
def PlistValueToPlainValue(plist): """Takes the plist contents generated by binplist and returns a plain dict. binplist uses rich types to express some of the plist types. We need to convert them to types that RDFValueArray will be able to transport. Args: plist: A plist to convert. Returns: A simp...
[ "Takes", "the", "plist", "contents", "generated", "by", "binplist", "and", "returns", "a", "plain", "dict", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/plist.py#L124-L146
[ "def", "PlistValueToPlainValue", "(", "plist", ")", ":", "if", "isinstance", "(", "plist", ",", "dict", ")", ":", "ret_value", "=", "dict", "(", ")", "for", "key", ",", "value", "in", "iteritems", "(", "plist", ")", ":", "ret_value", "[", "key", "]", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
PlistFilterParser.StringFinish
StringFinish doesn't act on ATTRIBUTEs here.
grr/core/grr_response_core/lib/plist.py
def StringFinish(self, **_): """StringFinish doesn't act on ATTRIBUTEs here.""" if self.state == "ARG": return self.InsertArg(string=self.string)
def StringFinish(self, **_): """StringFinish doesn't act on ATTRIBUTEs here.""" if self.state == "ARG": return self.InsertArg(string=self.string)
[ "StringFinish", "doesn", "t", "act", "on", "ATTRIBUTEs", "here", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/plist.py#L83-L86
[ "def", "StringFinish", "(", "self", ",", "*", "*", "_", ")", ":", "if", "self", ".", "state", "==", "\"ARG\"", ":", "return", "self", ".", "InsertArg", "(", "string", "=", "self", ".", "string", ")" ]
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
PlistFilterParser.AddAttributePath
Adds a path component to the current attribute.
grr/core/grr_response_core/lib/plist.py
def AddAttributePath(self, **_): """Adds a path component to the current attribute.""" attribute_path = self.current_expression.attribute if not attribute_path: attribute_path = [] attribute_path.append(self.string) self.current_expression.SetAttribute(attribute_path)
def AddAttributePath(self, **_): """Adds a path component to the current attribute.""" attribute_path = self.current_expression.attribute if not attribute_path: attribute_path = [] attribute_path.append(self.string) self.current_expression.SetAttribute(attribute_path)
[ "Adds", "a", "path", "component", "to", "the", "current", "attribute", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/plist.py#L88-L95
[ "def", "AddAttributePath", "(", "self", ",", "*", "*", "_", ")", ":", "attribute_path", "=", "self", ".", "current_expression", ".", "attribute", "if", "not", "attribute_path", ":", "attribute_path", "=", "[", "]", "attribute_path", ".", "append", "(", "self...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
PlistExpander._AtNonLeaf
Makes dictionaries expandable when dealing with plists.
grr/core/grr_response_core/lib/plist.py
def _AtNonLeaf(self, attr_value, path): """Makes dictionaries expandable when dealing with plists.""" if isinstance(attr_value, dict): for value in self.Expand(attr_value, path[1:]): yield value else: for v in objectfilter.ValueExpander._AtNonLeaf(self, attr_value, path): yield v
def _AtNonLeaf(self, attr_value, path): """Makes dictionaries expandable when dealing with plists.""" if isinstance(attr_value, dict): for value in self.Expand(attr_value, path[1:]): yield value else: for v in objectfilter.ValueExpander._AtNonLeaf(self, attr_value, path): yield v
[ "Makes", "dictionaries", "expandable", "when", "dealing", "with", "plists", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/plist.py#L108-L115
[ "def", "_AtNonLeaf", "(", "self", ",", "attr_value", ",", "path", ")", ":", "if", "isinstance", "(", "attr_value", ",", "dict", ")", ":", "for", "value", "in", "self", ".", "Expand", "(", "attr_value", ",", "path", "[", "1", ":", "]", ")", ":", "yi...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
GetMetadata
Returns a list of MetricMetadata for GRR server components.
grr/server/grr_response_server/server_metrics.py
def GetMetadata(): """Returns a list of MetricMetadata for GRR server components.""" return [ # GRR user-management metrics. stats_utils.CreateEventMetadata( "acl_check_time", fields=[("check_type", str)]), stats_utils.CreateCounterMetadata( "approval_searches", field...
def GetMetadata(): """Returns a list of MetricMetadata for GRR server components.""" return [ # GRR user-management metrics. stats_utils.CreateEventMetadata( "acl_check_time", fields=[("check_type", str)]), stats_utils.CreateCounterMetadata( "approval_searches", field...
[ "Returns", "a", "list", "of", "MetricMetadata", "for", "GRR", "server", "components", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/server_metrics.py#L13-L151
[ "def", "GetMetadata", "(", ")", ":", "return", "[", "# GRR user-management metrics.", "stats_utils", ".", "CreateEventMetadata", "(", "\"acl_check_time\"", ",", "fields", "=", "[", "(", "\"check_type\"", ",", "str", ")", "]", ")", ",", "stats_utils", ".", "Creat...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
Parse
Parses a YAML source into a Python object. Args: text: A YAML source to parse. Returns: A Python data structure corresponding to the YAML source.
grr/core/grr_response_core/lib/util/compat/yaml.py
def Parse(text): """Parses a YAML source into a Python object. Args: text: A YAML source to parse. Returns: A Python data structure corresponding to the YAML source. """ precondition.AssertType(text, Text) if compatibility.PY2: text = text.encode("utf-8") return yaml.safe_load(text)
def Parse(text): """Parses a YAML source into a Python object. Args: text: A YAML source to parse. Returns: A Python data structure corresponding to the YAML source. """ precondition.AssertType(text, Text) if compatibility.PY2: text = text.encode("utf-8") return yaml.safe_load(text)
[ "Parses", "a", "YAML", "source", "into", "a", "Python", "object", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/yaml.py#L24-L38
[ "def", "Parse", "(", "text", ")", ":", "precondition", ".", "AssertType", "(", "text", ",", "Text", ")", "if", "compatibility", ".", "PY2", ":", "text", "=", "text", ".", "encode", "(", "\"utf-8\"", ")", "return", "yaml", ".", "safe_load", "(", "text",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ParseMany
Parses many YAML documents into a list of Python objects. Args: text: A YAML source with multiple documents embedded. Returns: A list of Python data structures corresponding to the YAML documents.
grr/core/grr_response_core/lib/util/compat/yaml.py
def ParseMany(text): """Parses many YAML documents into a list of Python objects. Args: text: A YAML source with multiple documents embedded. Returns: A list of Python data structures corresponding to the YAML documents. """ precondition.AssertType(text, Text) if compatibility.PY2: text = tex...
def ParseMany(text): """Parses many YAML documents into a list of Python objects. Args: text: A YAML source with multiple documents embedded. Returns: A list of Python data structures corresponding to the YAML documents. """ precondition.AssertType(text, Text) if compatibility.PY2: text = tex...
[ "Parses", "many", "YAML", "documents", "into", "a", "list", "of", "Python", "objects", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/yaml.py#L41-L55
[ "def", "ParseMany", "(", "text", ")", ":", "precondition", ".", "AssertType", "(", "text", ",", "Text", ")", "if", "compatibility", ".", "PY2", ":", "text", "=", "text", ".", "encode", "(", "\"utf-8\"", ")", "return", "list", "(", "yaml", ".", "safe_lo...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ReadFromPath
Reads a Python object stored in a specified YAML file. Args: filepath: A filepath to the YAML file. Returns: A Python data structure corresponding to the YAML in the given file.
grr/core/grr_response_core/lib/util/compat/yaml.py
def ReadFromPath(filepath): """Reads a Python object stored in a specified YAML file. Args: filepath: A filepath to the YAML file. Returns: A Python data structure corresponding to the YAML in the given file. """ with io.open(filepath, mode="r", encoding="utf-8") as filedesc: return ReadFromFile...
def ReadFromPath(filepath): """Reads a Python object stored in a specified YAML file. Args: filepath: A filepath to the YAML file. Returns: A Python data structure corresponding to the YAML in the given file. """ with io.open(filepath, mode="r", encoding="utf-8") as filedesc: return ReadFromFile...
[ "Reads", "a", "Python", "object", "stored", "in", "a", "specified", "YAML", "file", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/yaml.py#L84-L94
[ "def", "ReadFromPath", "(", "filepath", ")", ":", "with", "io", ".", "open", "(", "filepath", ",", "mode", "=", "\"r\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "filedesc", ":", "return", "ReadFromFile", "(", "filedesc", ")" ]
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ReadManyFromPath
Reads a Python object stored in a specified YAML file. Args: filepath: A filepath to the YAML file. Returns: A Python data structure corresponding to the YAML in the given file.
grr/core/grr_response_core/lib/util/compat/yaml.py
def ReadManyFromPath(filepath): """Reads a Python object stored in a specified YAML file. Args: filepath: A filepath to the YAML file. Returns: A Python data structure corresponding to the YAML in the given file. """ with io.open(filepath, mode="r", encoding="utf-8") as filedesc: return ReadMany...
def ReadManyFromPath(filepath): """Reads a Python object stored in a specified YAML file. Args: filepath: A filepath to the YAML file. Returns: A Python data structure corresponding to the YAML in the given file. """ with io.open(filepath, mode="r", encoding="utf-8") as filedesc: return ReadMany...
[ "Reads", "a", "Python", "object", "stored", "in", "a", "specified", "YAML", "file", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/yaml.py#L97-L107
[ "def", "ReadManyFromPath", "(", "filepath", ")", ":", "with", "io", ".", "open", "(", "filepath", ",", "mode", "=", "\"r\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "filedesc", ":", "return", "ReadManyFromFile", "(", "filedesc", ")" ]
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
Dump
Stringifies a Python object into its YAML representation. Args: obj: A Python object to convert to YAML. Returns: A YAML representation of the given object.
grr/core/grr_response_core/lib/util/compat/yaml.py
def Dump(obj): """Stringifies a Python object into its YAML representation. Args: obj: A Python object to convert to YAML. Returns: A YAML representation of the given object. """ text = yaml.safe_dump(obj, default_flow_style=False, allow_unicode=True) if compatibility.PY2: text = text.decode(...
def Dump(obj): """Stringifies a Python object into its YAML representation. Args: obj: A Python object to convert to YAML. Returns: A YAML representation of the given object. """ text = yaml.safe_dump(obj, default_flow_style=False, allow_unicode=True) if compatibility.PY2: text = text.decode(...
[ "Stringifies", "a", "Python", "object", "into", "its", "YAML", "representation", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/yaml.py#L110-L124
[ "def", "Dump", "(", "obj", ")", ":", "text", "=", "yaml", ".", "safe_dump", "(", "obj", ",", "default_flow_style", "=", "False", ",", "allow_unicode", "=", "True", ")", "if", "compatibility", ".", "PY2", ":", "text", "=", "text", ".", "decode", "(", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
DumpMany
Stringifies a sequence of Python objects to a multi-document YAML. Args: objs: An iterable of Python objects to convert to YAML. Returns: A multi-document YAML representation of the given objects.
grr/core/grr_response_core/lib/util/compat/yaml.py
def DumpMany(objs): """Stringifies a sequence of Python objects to a multi-document YAML. Args: objs: An iterable of Python objects to convert to YAML. Returns: A multi-document YAML representation of the given objects. """ precondition.AssertIterableType(objs, object) text = yaml.safe_dump_all(o...
def DumpMany(objs): """Stringifies a sequence of Python objects to a multi-document YAML. Args: objs: An iterable of Python objects to convert to YAML. Returns: A multi-document YAML representation of the given objects. """ precondition.AssertIterableType(objs, object) text = yaml.safe_dump_all(o...
[ "Stringifies", "a", "sequence", "of", "Python", "objects", "to", "a", "multi", "-", "document", "YAML", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/yaml.py#L127-L143
[ "def", "DumpMany", "(", "objs", ")", ":", "precondition", ".", "AssertIterableType", "(", "objs", ",", "object", ")", "text", "=", "yaml", ".", "safe_dump_all", "(", "objs", ",", "default_flow_style", "=", "False", ",", "allow_unicode", "=", "True", ")", "...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
WriteToPath
Serializes and writes given Python object to the specified YAML file. Args: obj: A Python object to serialize. filepath: A path to the file into which the object is to be written.
grr/core/grr_response_core/lib/util/compat/yaml.py
def WriteToPath(obj, filepath): """Serializes and writes given Python object to the specified YAML file. Args: obj: A Python object to serialize. filepath: A path to the file into which the object is to be written. """ with io.open(filepath, mode="w", encoding="utf-8") as filedesc: WriteToFile(obj,...
def WriteToPath(obj, filepath): """Serializes and writes given Python object to the specified YAML file. Args: obj: A Python object to serialize. filepath: A path to the file into which the object is to be written. """ with io.open(filepath, mode="w", encoding="utf-8") as filedesc: WriteToFile(obj,...
[ "Serializes", "and", "writes", "given", "Python", "object", "to", "the", "specified", "YAML", "file", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/yaml.py#L166-L174
[ "def", "WriteToPath", "(", "obj", ",", "filepath", ")", ":", "with", "io", ".", "open", "(", "filepath", ",", "mode", "=", "\"w\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "filedesc", ":", "WriteToFile", "(", "obj", ",", "filedesc", ")" ]
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
WriteManyToPath
Serializes and writes given Python objects to a multi-document YAML file. Args: objs: An iterable of Python objects to serialize. filepath: A path to the file into which the object is to be written.
grr/core/grr_response_core/lib/util/compat/yaml.py
def WriteManyToPath(objs, filepath): """Serializes and writes given Python objects to a multi-document YAML file. Args: objs: An iterable of Python objects to serialize. filepath: A path to the file into which the object is to be written. """ with io.open(filepath, mode="w", encoding="utf-8") as filede...
def WriteManyToPath(objs, filepath): """Serializes and writes given Python objects to a multi-document YAML file. Args: objs: An iterable of Python objects to serialize. filepath: A path to the file into which the object is to be written. """ with io.open(filepath, mode="w", encoding="utf-8") as filede...
[ "Serializes", "and", "writes", "given", "Python", "objects", "to", "a", "multi", "-", "document", "YAML", "file", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/util/compat/yaml.py#L177-L185
[ "def", "WriteManyToPath", "(", "objs", ",", "filepath", ")", ":", "with", "io", ".", "open", "(", "filepath", ",", "mode", "=", "\"w\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "filedesc", ":", "WriteManyToFile", "(", "objs", ",", "filedesc", ")" ]
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
CreateWindowsRegistryExecutablePathsDetector
Creates Windows paths detector. Commandline strings can be space separated and contain options. e.g. C:\\Program Files\\ACME Corporation\\wiz.exe /quiet /blah See here for microsoft doco on commandline parsing: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx Args: vars_ma...
grr/core/grr_response_core/path_detection/windows.py
def CreateWindowsRegistryExecutablePathsDetector(vars_map=None): """Creates Windows paths detector. Commandline strings can be space separated and contain options. e.g. C:\\Program Files\\ACME Corporation\\wiz.exe /quiet /blah See here for microsoft doco on commandline parsing: http://msdn.microsoft.com/en-...
def CreateWindowsRegistryExecutablePathsDetector(vars_map=None): """Creates Windows paths detector. Commandline strings can be space separated and contain options. e.g. C:\\Program Files\\ACME Corporation\\wiz.exe /quiet /blah See here for microsoft doco on commandline parsing: http://msdn.microsoft.com/en-...
[ "Creates", "Windows", "paths", "detector", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/path_detection/windows.py#L143-L160
[ "def", "CreateWindowsRegistryExecutablePathsDetector", "(", "vars_map", "=", "None", ")", ":", "return", "core", ".", "Detector", "(", "extractors", "=", "[", "RunDllExtractor", "(", ")", ",", "ExecutableExtractor", "(", ")", "]", ",", "post_processors", "=", "[...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
DetectExecutablePaths
Detects paths in a list of Windows Registry strings. Args: source_values: A list of strings to detect paths in. vars_map: Dictionary of "string" -> "string|list", i.e. a mapping of environment variables names to their suggested values or to lists of their suggested values. Yields: ...
grr/core/grr_response_core/path_detection/windows.py
def DetectExecutablePaths(source_values, vars_map=None): """Detects paths in a list of Windows Registry strings. Args: source_values: A list of strings to detect paths in. vars_map: Dictionary of "string" -> "string|list", i.e. a mapping of environment variables names to their suggested values or...
def DetectExecutablePaths(source_values, vars_map=None): """Detects paths in a list of Windows Registry strings. Args: source_values: A list of strings to detect paths in. vars_map: Dictionary of "string" -> "string|list", i.e. a mapping of environment variables names to their suggested values or...
[ "Detects", "paths", "in", "a", "list", "of", "Windows", "Registry", "strings", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/path_detection/windows.py#L163-L179
[ "def", "DetectExecutablePaths", "(", "source_values", ",", "vars_map", "=", "None", ")", ":", "detector", "=", "CreateWindowsRegistryExecutablePathsDetector", "(", "vars_map", "=", "vars_map", ")", "for", "source_value", "in", "source_values", ":", "for", "result", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
RunDllExtractor.Extract
Extracts interesting paths from a given path. Args: components: Source string represented as a list of components. Returns: A list of extracted paths (as strings).
grr/core/grr_response_core/path_detection/windows.py
def Extract(self, components): """Extracts interesting paths from a given path. Args: components: Source string represented as a list of components. Returns: A list of extracted paths (as strings). """ rundll_index = -1 for index, component in enumerate(components): if compo...
def Extract(self, components): """Extracts interesting paths from a given path. Args: components: Source string represented as a list of components. Returns: A list of extracted paths (as strings). """ rundll_index = -1 for index, component in enumerate(components): if compo...
[ "Extracts", "interesting", "paths", "from", "a", "given", "path", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/path_detection/windows.py#L20-L46
[ "def", "Extract", "(", "self", ",", "components", ")", ":", "rundll_index", "=", "-", "1", "for", "index", ",", "component", "in", "enumerate", "(", "components", ")", ":", "if", "component", ".", "lower", "(", ")", ".", "endswith", "(", "\"rundll32.exe\...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ExecutableExtractor.Extract
Extracts interesting paths from a given path. Args: components: Source string represented as a list of components. Returns: A list of extracted paths (as strings).
grr/core/grr_response_core/path_detection/windows.py
def Extract(self, components): """Extracts interesting paths from a given path. Args: components: Source string represented as a list of components. Returns: A list of extracted paths (as strings). """ for index, component in enumerate(components): if component.lower().endswith(...
def Extract(self, components): """Extracts interesting paths from a given path. Args: components: Source string represented as a list of components. Returns: A list of extracted paths (as strings). """ for index, component in enumerate(components): if component.lower().endswith(...
[ "Extracts", "interesting", "paths", "from", "a", "given", "path", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/path_detection/windows.py#L55-L70
[ "def", "Extract", "(", "self", ",", "components", ")", ":", "for", "index", ",", "component", "in", "enumerate", "(", "components", ")", ":", "if", "component", ".", "lower", "(", ")", ".", "endswith", "(", "self", ".", "EXECUTABLE_EXTENSIONS", ")", ":",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
EnvVarsPostProcessor.Process
Processes a given path. Args: path: Path (as a string) to post-process. Returns: A list of paths with environment variables replaced with their values. If the mapping had a list of values for a particular variable, instead of just one value, then all possible replacements will be ...
grr/core/grr_response_core/path_detection/windows.py
def Process(self, path): """Processes a given path. Args: path: Path (as a string) to post-process. Returns: A list of paths with environment variables replaced with their values. If the mapping had a list of values for a particular variable, instead of just one value, then all pos...
def Process(self, path): """Processes a given path. Args: path: Path (as a string) to post-process. Returns: A list of paths with environment variables replaced with their values. If the mapping had a list of values for a particular variable, instead of just one value, then all pos...
[ "Processes", "a", "given", "path", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/path_detection/windows.py#L100-L140
[ "def", "Process", "(", "self", ",", "path", ")", ":", "path", "=", "re", ".", "sub", "(", "self", ".", "SYSTEMROOT_RE", ",", "r\"%systemroot%\"", ",", "path", ",", "count", "=", "1", ")", "path", "=", "re", ".", "sub", "(", "self", ".", "SYSTEM32_R...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
AccessControlManager.CheckDataStoreAccess
The main entry point for checking access to AFF4 resources. Args: token: An instance of ACLToken security token. subjects: The list of subject URNs which the user is requesting access to. If any of these fail, the whole request is denied. requested_access: A string specifying the desir...
grr/server/grr_response_server/access_control.py
def CheckDataStoreAccess(self, token, subjects, requested_access="r"): """The main entry point for checking access to AFF4 resources. Args: token: An instance of ACLToken security token. subjects: The list of subject URNs which the user is requesting access to. If any of these fail, the w...
def CheckDataStoreAccess(self, token, subjects, requested_access="r"): """The main entry point for checking access to AFF4 resources. Args: token: An instance of ACLToken security token. subjects: The list of subject URNs which the user is requesting access to. If any of these fail, the w...
[ "The", "main", "entry", "point", "for", "checking", "access", "to", "AFF4", "resources", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/access_control.py#L132-L149
[ "def", "CheckDataStoreAccess", "(", "self", ",", "token", ",", "subjects", ",", "requested_access", "=", "\"r\"", ")", ":", "logging", ".", "debug", "(", "\"Checking %s: %s for %s\"", ",", "token", ",", "subjects", ",", "requested_access", ")", "raise", "NotImpl...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
WriteHuntResults
Writes hunt results from a given client as part of a given hunt.
grr/server/grr_response_server/databases/db_compat.py
def WriteHuntResults(client_id, hunt_id, responses): """Writes hunt results from a given client as part of a given hunt.""" if not hunt.IsLegacyHunt(hunt_id): data_store.REL_DB.WriteFlowResults(responses) hunt.StopHuntIfCPUOrNetworkLimitsExceeded(hunt_id) return hunt_id_urn = rdfvalue.RDFURN("hunts...
def WriteHuntResults(client_id, hunt_id, responses): """Writes hunt results from a given client as part of a given hunt.""" if not hunt.IsLegacyHunt(hunt_id): data_store.REL_DB.WriteFlowResults(responses) hunt.StopHuntIfCPUOrNetworkLimitsExceeded(hunt_id) return hunt_id_urn = rdfvalue.RDFURN("hunts...
[ "Writes", "hunt", "results", "from", "a", "given", "client", "as", "part", "of", "a", "given", "hunt", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/db_compat.py#L28-L57
[ "def", "WriteHuntResults", "(", "client_id", ",", "hunt_id", ",", "responses", ")", ":", "if", "not", "hunt", ".", "IsLegacyHunt", "(", "hunt_id", ")", ":", "data_store", ".", "REL_DB", ".", "WriteFlowResults", "(", "responses", ")", "hunt", ".", "StopHuntIf...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ProcessHuntFlowError
Processes error and status message for a given hunt-induced flow.
grr/server/grr_response_server/databases/db_compat.py
def ProcessHuntFlowError(flow_obj, error_message=None, backtrace=None, status_msg=None): """Processes error and status message for a given hunt-induced flow.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): hunt.StopHuntIfCPUOrNetw...
def ProcessHuntFlowError(flow_obj, error_message=None, backtrace=None, status_msg=None): """Processes error and status message for a given hunt-induced flow.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): hunt.StopHuntIfCPUOrNetw...
[ "Processes", "error", "and", "status", "message", "for", "a", "given", "hunt", "-", "induced", "flow", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/db_compat.py#L70-L96
[ "def", "ProcessHuntFlowError", "(", "flow_obj", ",", "error_message", "=", "None", ",", "backtrace", "=", "None", ",", "status_msg", "=", "None", ")", ":", "if", "not", "hunt", ".", "IsLegacyHunt", "(", "flow_obj", ".", "parent_hunt_id", ")", ":", "hunt", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ProcessHuntFlowDone
Notifis hunt about a given hunt-induced flow completion.
grr/server/grr_response_server/databases/db_compat.py
def ProcessHuntFlowDone(flow_obj, status_msg=None): """Notifis hunt about a given hunt-induced flow completion.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): hunt_obj = hunt.StopHuntIfCPUOrNetworkLimitsExceeded( flow_obj.parent_hunt_id) hunt.CompleteHuntIfExpirationTimeReached(hunt_obj) ...
def ProcessHuntFlowDone(flow_obj, status_msg=None): """Notifis hunt about a given hunt-induced flow completion.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): hunt_obj = hunt.StopHuntIfCPUOrNetworkLimitsExceeded( flow_obj.parent_hunt_id) hunt.CompleteHuntIfExpirationTimeReached(hunt_obj) ...
[ "Notifis", "hunt", "about", "a", "given", "hunt", "-", "induced", "flow", "completion", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/db_compat.py#L99-L133
[ "def", "ProcessHuntFlowDone", "(", "flow_obj", ",", "status_msg", "=", "None", ")", ":", "if", "not", "hunt", ".", "IsLegacyHunt", "(", "flow_obj", ".", "parent_hunt_id", ")", ":", "hunt_obj", "=", "hunt", ".", "StopHuntIfCPUOrNetworkLimitsExceeded", "(", "flow_...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ProcessHuntFlowLog
Processes log message from a given hunt-induced flow.
grr/server/grr_response_server/databases/db_compat.py
def ProcessHuntFlowLog(flow_obj, log_msg): """Processes log message from a given hunt-induced flow.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): return hunt_urn = rdfvalue.RDFURN("hunts").Add(flow_obj.parent_hunt_id) flow_urn = hunt_urn.Add(flow_obj.flow_id) log_entry = rdf_flows.FlowLog( ...
def ProcessHuntFlowLog(flow_obj, log_msg): """Processes log message from a given hunt-induced flow.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): return hunt_urn = rdfvalue.RDFURN("hunts").Add(flow_obj.parent_hunt_id) flow_urn = hunt_urn.Add(flow_obj.flow_id) log_entry = rdf_flows.FlowLog( ...
[ "Processes", "log", "message", "from", "a", "given", "hunt", "-", "induced", "flow", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/db_compat.py#L136-L151
[ "def", "ProcessHuntFlowLog", "(", "flow_obj", ",", "log_msg", ")", ":", "if", "not", "hunt", ".", "IsLegacyHunt", "(", "flow_obj", ".", "parent_hunt_id", ")", ":", "return", "hunt_urn", "=", "rdfvalue", ".", "RDFURN", "(", "\"hunts\"", ")", ".", "Add", "("...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ProcessHuntClientCrash
Processes client crash triggerted by a given hunt-induced flow.
grr/server/grr_response_server/databases/db_compat.py
def ProcessHuntClientCrash(flow_obj, client_crash_info): """Processes client crash triggerted by a given hunt-induced flow.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): hunt.StopHuntIfCrashLimitExceeded(flow_obj.parent_hunt_id) return hunt_urn = rdfvalue.RDFURN("hunts").Add(flow_obj.parent_hunt...
def ProcessHuntClientCrash(flow_obj, client_crash_info): """Processes client crash triggerted by a given hunt-induced flow.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): hunt.StopHuntIfCrashLimitExceeded(flow_obj.parent_hunt_id) return hunt_urn = rdfvalue.RDFURN("hunts").Add(flow_obj.parent_hunt...
[ "Processes", "client", "crash", "triggerted", "by", "a", "given", "hunt", "-", "induced", "flow", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/db_compat.py#L154-L166
[ "def", "ProcessHuntClientCrash", "(", "flow_obj", ",", "client_crash_info", ")", ":", "if", "not", "hunt", ".", "IsLegacyHunt", "(", "flow_obj", ".", "parent_hunt_id", ")", ":", "hunt", ".", "StopHuntIfCrashLimitExceeded", "(", "flow_obj", ".", "parent_hunt_id", "...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ValidateVfsPath
Validates a VFS path.
grr/server/grr_response_server/gui/api_plugins/vfs.py
def ValidateVfsPath(path): """Validates a VFS path.""" components = (path or "").lstrip("/").split("/") if not components: raise ValueError("Empty path is not a valid path: %s." % utils.SmartStr(path)) if components[0] not in ROOT_FILES_WHITELIST: raise ValueError( "First ...
def ValidateVfsPath(path): """Validates a VFS path.""" components = (path or "").lstrip("/").split("/") if not components: raise ValueError("Empty path is not a valid path: %s." % utils.SmartStr(path)) if components[0] not in ROOT_FILES_WHITELIST: raise ValueError( "First ...
[ "Validates", "a", "VFS", "path", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L52-L65
[ "def", "ValidateVfsPath", "(", "path", ")", ":", "components", "=", "(", "path", "or", "\"\"", ")", ".", "lstrip", "(", "\"/\"", ")", ".", "split", "(", "\"/\"", ")", "if", "not", "components", ":", "raise", "ValueError", "(", "\"Empty path is not a valid ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
_GenerateApiFileDetails
Generate file details based on path infos history.
grr/server/grr_response_server/gui/api_plugins/vfs.py
def _GenerateApiFileDetails(path_infos): """Generate file details based on path infos history.""" type_attrs = [] hash_attrs = [] size_attrs = [] stat_attrs = [] pathspec_attrs = [] def _Value(age, value): """Generate ApiAff4ObjectAttributeValue from an age and a value.""" v = ApiAff4ObjectAttr...
def _GenerateApiFileDetails(path_infos): """Generate file details based on path infos history.""" type_attrs = [] hash_attrs = [] size_attrs = [] stat_attrs = [] pathspec_attrs = [] def _Value(age, value): """Generate ApiAff4ObjectAttributeValue from an age and a value.""" v = ApiAff4ObjectAttr...
[ "Generate", "file", "details", "based", "on", "path", "infos", "history", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L305-L382
[ "def", "_GenerateApiFileDetails", "(", "path_infos", ")", ":", "type_attrs", "=", "[", "]", "hash_attrs", "=", "[", "]", "size_attrs", "=", "[", "]", "stat_attrs", "=", "[", "]", "pathspec_attrs", "=", "[", "]", "def", "_Value", "(", "age", ",", "value",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
_Aff4Size
Retrieves the total size in bytes of an AFF4 object. Args: aff4_obj: An AFF4 stream instance to retrieve size for. Returns: An integer representing number of bytes. Raises: TypeError: If `aff4_obj` is not an instance of AFF4 stream.
grr/server/grr_response_server/gui/api_plugins/vfs.py
def _Aff4Size(aff4_obj): """Retrieves the total size in bytes of an AFF4 object. Args: aff4_obj: An AFF4 stream instance to retrieve size for. Returns: An integer representing number of bytes. Raises: TypeError: If `aff4_obj` is not an instance of AFF4 stream. """ if not isinstance(aff4_obj, ...
def _Aff4Size(aff4_obj): """Retrieves the total size in bytes of an AFF4 object. Args: aff4_obj: An AFF4 stream instance to retrieve size for. Returns: An integer representing number of bytes. Raises: TypeError: If `aff4_obj` is not an instance of AFF4 stream. """ if not isinstance(aff4_obj, ...
[ "Retrieves", "the", "total", "size", "in", "bytes", "of", "an", "AFF4", "object", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L695-L711
[ "def", "_Aff4Size", "(", "aff4_obj", ")", ":", "if", "not", "isinstance", "(", "aff4_obj", ",", "aff4", ".", "AFF4Stream", ")", ":", "message", "=", "\"Expected an instance of `%s` but received `%s`\"", "raise", "TypeError", "(", "message", "%", "(", "aff4", "."...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
_Aff4Read
Reads contents of given AFF4 file. Args: aff4_obj: An AFF4 stream instance to retrieve contents for. offset: An offset to start the reading from. length: A number of bytes to read. Reads the whole file if 0. Returns: Contents of specified AFF4 stream. Raises: TypeError: If `aff4_obj` is not...
grr/server/grr_response_server/gui/api_plugins/vfs.py
def _Aff4Read(aff4_obj, offset, length): """Reads contents of given AFF4 file. Args: aff4_obj: An AFF4 stream instance to retrieve contents for. offset: An offset to start the reading from. length: A number of bytes to read. Reads the whole file if 0. Returns: Contents of specified AFF4 stream. ...
def _Aff4Read(aff4_obj, offset, length): """Reads contents of given AFF4 file. Args: aff4_obj: An AFF4 stream instance to retrieve contents for. offset: An offset to start the reading from. length: A number of bytes to read. Reads the whole file if 0. Returns: Contents of specified AFF4 stream. ...
[ "Reads", "contents", "of", "given", "AFF4", "file", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L714-L731
[ "def", "_Aff4Read", "(", "aff4_obj", ",", "offset", ",", "length", ")", ":", "length", "=", "length", "or", "(", "_Aff4Size", "(", "aff4_obj", ")", "-", "offset", ")", "aff4_obj", ".", "Seek", "(", "offset", ")", "return", "aff4_obj", ".", "Read", "(",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
_GetTimelineStatEntriesLegacy
Gets timeline entries from AFF4.
grr/server/grr_response_server/gui/api_plugins/vfs.py
def _GetTimelineStatEntriesLegacy(client_id, file_path, with_history=True): """Gets timeline entries from AFF4.""" folder_urn = aff4.ROOT_URN.Add(str(client_id)).Add(file_path) child_urns = [] for _, children in aff4.FACTORY.RecursiveMultiListChildren([folder_urn]): child_urns.extend(children) if with_...
def _GetTimelineStatEntriesLegacy(client_id, file_path, with_history=True): """Gets timeline entries from AFF4.""" folder_urn = aff4.ROOT_URN.Add(str(client_id)).Add(file_path) child_urns = [] for _, children in aff4.FACTORY.RecursiveMultiListChildren([folder_urn]): child_urns.extend(children) if with_...
[ "Gets", "timeline", "entries", "from", "AFF4", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L1203-L1237
[ "def", "_GetTimelineStatEntriesLegacy", "(", "client_id", ",", "file_path", ",", "with_history", "=", "True", ")", ":", "folder_urn", "=", "aff4", ".", "ROOT_URN", ".", "Add", "(", "str", "(", "client_id", ")", ")", ".", "Add", "(", "file_path", ")", "chil...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
_GetTimelineStatEntriesRelDB
Gets timeline entries from REL_DB.
grr/server/grr_response_server/gui/api_plugins/vfs.py
def _GetTimelineStatEntriesRelDB(api_client_id, file_path, with_history=True): """Gets timeline entries from REL_DB.""" path_type, components = rdf_objects.ParseCategorizedPath(file_path) client_id = str(api_client_id) try: root_path_info = data_store.REL_DB.ReadPathInfo(client_id, path_type, ...
def _GetTimelineStatEntriesRelDB(api_client_id, file_path, with_history=True): """Gets timeline entries from REL_DB.""" path_type, components = rdf_objects.ParseCategorizedPath(file_path) client_id = str(api_client_id) try: root_path_info = data_store.REL_DB.ReadPathInfo(client_id, path_type, ...
[ "Gets", "timeline", "entries", "from", "REL_DB", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L1240-L1276
[ "def", "_GetTimelineStatEntriesRelDB", "(", "api_client_id", ",", "file_path", ",", "with_history", "=", "True", ")", ":", "path_type", ",", "components", "=", "rdf_objects", ".", "ParseCategorizedPath", "(", "file_path", ")", "client_id", "=", "str", "(", "api_cl...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
_GetTimelineStatEntries
Gets timeline entries from the appropriate data source (AFF4 or REL_DB).
grr/server/grr_response_server/gui/api_plugins/vfs.py
def _GetTimelineStatEntries(client_id, file_path, with_history=True): """Gets timeline entries from the appropriate data source (AFF4 or REL_DB).""" if data_store.RelationalDBEnabled(): fn = _GetTimelineStatEntriesRelDB else: fn = _GetTimelineStatEntriesLegacy for v in fn(client_id, file_path, with_hi...
def _GetTimelineStatEntries(client_id, file_path, with_history=True): """Gets timeline entries from the appropriate data source (AFF4 or REL_DB).""" if data_store.RelationalDBEnabled(): fn = _GetTimelineStatEntriesRelDB else: fn = _GetTimelineStatEntriesLegacy for v in fn(client_id, file_path, with_hi...
[ "Gets", "timeline", "entries", "from", "the", "appropriate", "data", "source", "(", "AFF4", "or", "REL_DB", ")", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L1279-L1288
[ "def", "_GetTimelineStatEntries", "(", "client_id", ",", "file_path", ",", "with_history", "=", "True", ")", ":", "if", "data_store", ".", "RelationalDBEnabled", "(", ")", ":", "fn", "=", "_GetTimelineStatEntriesRelDB", "else", ":", "fn", "=", "_GetTimelineStatEnt...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
_GetTimelineItems
Gets timeline items for a given client id and path.
grr/server/grr_response_server/gui/api_plugins/vfs.py
def _GetTimelineItems(client_id, file_path): """Gets timeline items for a given client id and path.""" items = [] for file_path, stat_entry, _ in _GetTimelineStatEntries( client_id, file_path, with_history=True): # It may be that for a given timestamp only hash entry is available, we're # skippin...
def _GetTimelineItems(client_id, file_path): """Gets timeline items for a given client id and path.""" items = [] for file_path, stat_entry, _ in _GetTimelineStatEntries( client_id, file_path, with_history=True): # It may be that for a given timestamp only hash entry is available, we're # skippin...
[ "Gets", "timeline", "items", "for", "a", "given", "client", "id", "and", "path", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L1291-L1325
[ "def", "_GetTimelineItems", "(", "client_id", ",", "file_path", ")", ":", "items", "=", "[", "]", "for", "file_path", ",", "stat_entry", ",", "_", "in", "_GetTimelineStatEntries", "(", "client_id", ",", "file_path", ",", "with_history", "=", "True", ")", ":"...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiAff4ObjectType.InitFromAff4Object
Initializes the current instance from an Aff4Object. Iterates over all attributes of the Aff4Object defined by a given class and adds a representation of them to the current instance. Args: aff4_obj: An Aff4Object to take the attributes from. aff4_cls: A class in the inheritance hierarchy of t...
grr/server/grr_response_server/gui/api_plugins/vfs.py
def InitFromAff4Object(self, aff4_obj, aff4_cls, attr_blacklist): """Initializes the current instance from an Aff4Object. Iterates over all attributes of the Aff4Object defined by a given class and adds a representation of them to the current instance. Args: aff4_obj: An Aff4Object to take the a...
def InitFromAff4Object(self, aff4_obj, aff4_cls, attr_blacklist): """Initializes the current instance from an Aff4Object. Iterates over all attributes of the Aff4Object defined by a given class and adds a representation of them to the current instance. Args: aff4_obj: An Aff4Object to take the a...
[ "Initializes", "the", "current", "instance", "from", "an", "Aff4Object", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L117-L167
[ "def", "InitFromAff4Object", "(", "self", ",", "aff4_obj", ",", "aff4_cls", ",", "attr_blacklist", ")", ":", "self", ".", "name", "=", "str", "(", "aff4_cls", ".", "__name__", ")", "self", ".", "attributes", "=", "[", "]", "schema", "=", "aff4_cls", ".",...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiAff4ObjectRepresentation.InitFromAff4Object
Initializes the current instance from an Aff4Object. Iterates the inheritance hierarchy of the given Aff4Object and adds a ApiAff4ObjectType for each class found in the hierarchy. Args: aff4_obj: An Aff4Object as source for the initialization. Returns: A reference to the current instance.
grr/server/grr_response_server/gui/api_plugins/vfs.py
def InitFromAff4Object(self, aff4_obj): """Initializes the current instance from an Aff4Object. Iterates the inheritance hierarchy of the given Aff4Object and adds a ApiAff4ObjectType for each class found in the hierarchy. Args: aff4_obj: An Aff4Object as source for the initialization. Retu...
def InitFromAff4Object(self, aff4_obj): """Initializes the current instance from an Aff4Object. Iterates the inheritance hierarchy of the given Aff4Object and adds a ApiAff4ObjectType for each class found in the hierarchy. Args: aff4_obj: An Aff4Object as source for the initialization. Retu...
[ "Initializes", "the", "current", "instance", "from", "an", "Aff4Object", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L182-L211
[ "def", "InitFromAff4Object", "(", "self", ",", "aff4_obj", ")", ":", "attr_blacklist", "=", "[", "]", "# We use this to show attributes only once.", "self", ".", "types", "=", "[", "]", "for", "aff4_cls", "in", "aff4_obj", ".", "__class__", ".", "__mro__", ":", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiFile.InitFromAff4Object
Initializes the current instance from an Aff4Stream. Args: file_obj: An Aff4Stream representing a file. stat_entry: An optional stat entry object to be used. If none is provided, the one stored in the AFF4 data store is used. hash_entry: An optional hash entry object to be used. If none i...
grr/server/grr_response_server/gui/api_plugins/vfs.py
def InitFromAff4Object(self, file_obj, stat_entry=None, hash_entry=None, with_details=False): """Initializes the current instance from an Aff4Stream. Args: file_obj: An Aff4Stream representing a file. ...
def InitFromAff4Object(self, file_obj, stat_entry=None, hash_entry=None, with_details=False): """Initializes the current instance from an Aff4Stream. Args: file_obj: An Aff4Stream representing a file. ...
[ "Initializes", "the", "current", "instance", "from", "an", "Aff4Stream", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L230-L275
[ "def", "InitFromAff4Object", "(", "self", ",", "file_obj", ",", "stat_entry", "=", "None", ",", "hash_entry", "=", "None", ",", "with_details", "=", "False", ")", ":", "self", ".", "name", "=", "file_obj", ".", "urn", ".", "Basename", "(", ")", "self", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
ApiGetFileTextHandler._Decode
Decode data with the given codec name.
grr/server/grr_response_server/gui/api_plugins/vfs.py
def _Decode(self, codec_name, data): """Decode data with the given codec name.""" try: return data.decode(codec_name, "replace") except LookupError: raise RuntimeError("Codec could not be found.") except AssertionError: raise RuntimeError("Codec failed to decode")
def _Decode(self, codec_name, data): """Decode data with the given codec name.""" try: return data.decode(codec_name, "replace") except LookupError: raise RuntimeError("Codec could not be found.") except AssertionError: raise RuntimeError("Codec failed to decode")
[ "Decode", "data", "with", "the", "given", "codec", "name", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L740-L747
[ "def", "_Decode", "(", "self", ",", "codec_name", ",", "data", ")", ":", "try", ":", "return", "data", ".", "decode", "(", "codec_name", ",", "\"replace\"", ")", "except", "LookupError", ":", "raise", "RuntimeError", "(", "\"Codec could not be found.\"", ")", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
WindowsSigntoolCodeSigner.SignFiles
Signs multiple files at once.
grr/client_builder/grr_response_client_builder/builders/signing.py
def SignFiles(self, filenames): """Signs multiple files at once.""" file_list = " ".join(filenames) subprocess.check_call("%s %s" % (self._signing_cmdline, file_list)) if self._verification_cmdline: subprocess.check_call("%s %s" % (self._verification_cmdline, file_list))
def SignFiles(self, filenames): """Signs multiple files at once.""" file_list = " ".join(filenames) subprocess.check_call("%s %s" % (self._signing_cmdline, file_list)) if self._verification_cmdline: subprocess.check_call("%s %s" % (self._verification_cmdline, file_list))
[ "Signs", "multiple", "files", "at", "once", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client_builder/grr_response_client_builder/builders/signing.py#L68-L73
[ "def", "SignFiles", "(", "self", ",", "filenames", ")", ":", "file_list", "=", "\" \"", ".", "join", "(", "filenames", ")", "subprocess", ".", "check_call", "(", "\"%s %s\"", "%", "(", "self", ".", "_signing_cmdline", ",", "file_list", ")", ")", "if", "s...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
WindowsOsslsigncodeCodeSigner.SignBuffer
Sign a buffer via temp files. Our signing tool can't sign a buffer, so we work around it using temporary files. Args: in_buffer: data to sign Returns: signed data
grr/client_builder/grr_response_client_builder/builders/signing.py
def SignBuffer(self, in_buffer): """Sign a buffer via temp files. Our signing tool can't sign a buffer, so we work around it using temporary files. Args: in_buffer: data to sign Returns: signed data """ precondition.AssertType(in_buffer, bytes) with tempfile.NamedTemporary...
def SignBuffer(self, in_buffer): """Sign a buffer via temp files. Our signing tool can't sign a buffer, so we work around it using temporary files. Args: in_buffer: data to sign Returns: signed data """ precondition.AssertType(in_buffer, bytes) with tempfile.NamedTemporary...
[ "Sign", "a", "buffer", "via", "temp", "files", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client_builder/grr_response_client_builder/builders/signing.py#L85-L103
[ "def", "SignBuffer", "(", "self", ",", "in_buffer", ")", ":", "precondition", ".", "AssertType", "(", "in_buffer", ",", "bytes", ")", "with", "tempfile", ".", "NamedTemporaryFile", "(", ")", "as", "temp_in", ":", "temp_in", ".", "write", "(", "in_buffer", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
WindowsOsslsigncodeCodeSigner.SignFile
Sign a file using osslsigncode. Args: in_filename: file to read from out_filename: file to output to, if none we output to the same filename as the input with a .signed suffix. Returns: output filename string Raises: pexpect.ExceptionPexpect: if the expect invocation of oss...
grr/client_builder/grr_response_client_builder/builders/signing.py
def SignFile(self, in_filename, out_filename=None): """Sign a file using osslsigncode. Args: in_filename: file to read from out_filename: file to output to, if none we output to the same filename as the input with a .signed suffix. Returns: output filename string Raises: ...
def SignFile(self, in_filename, out_filename=None): """Sign a file using osslsigncode. Args: in_filename: file to read from out_filename: file to output to, if none we output to the same filename as the input with a .signed suffix. Returns: output filename string Raises: ...
[ "Sign", "a", "file", "using", "osslsigncode", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client_builder/grr_response_client_builder/builders/signing.py#L105-L150
[ "def", "SignFile", "(", "self", ",", "in_filename", ",", "out_filename", "=", "None", ")", ":", "if", "out_filename", "is", "None", ":", "out_filename", "=", "\"%s.signed\"", "%", "in_filename", "args", "=", "[", "\"-certs\"", ",", "self", ".", "cert", ","...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74
train
RPMCodeSigner.AddSignatureToRPMs
Sign RPM with rpmsign.
grr/client_builder/grr_response_client_builder/builders/signing.py
def AddSignatureToRPMs(self, rpm_filenames): """Sign RPM with rpmsign.""" # The horrible second argument here is necessary to get a V3 signature to # support CentOS 5 systems. See: # http://ilostmynotes.blogspot.com/2016/03/the-horror-of-signing-rpms-that-support.html args = [ "--define=%%_g...
def AddSignatureToRPMs(self, rpm_filenames): """Sign RPM with rpmsign.""" # The horrible second argument here is necessary to get a V3 signature to # support CentOS 5 systems. See: # http://ilostmynotes.blogspot.com/2016/03/the-horror-of-signing-rpms-that-support.html args = [ "--define=%%_g...
[ "Sign", "RPM", "with", "rpmsign", "." ]
google/grr
python
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client_builder/grr_response_client_builder/builders/signing.py#L165-L202
[ "def", "AddSignatureToRPMs", "(", "self", ",", "rpm_filenames", ")", ":", "# The horrible second argument here is necessary to get a V3 signature to", "# support CentOS 5 systems. See:", "# http://ilostmynotes.blogspot.com/2016/03/the-horror-of-signing-rpms-that-support.html", "args", "=", ...
5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74