Skip to content

Commit e368efd

Browse files
committed
Multiple changes.
* GSOC 2021 ideas list: GRR has been accepted. * Return empty examples instead of failing when KbAttribute is missing. * Show raw glob-expression when explanation is loading/failed. * Show artifact links under sources. * Sandboxing: refactor handling of shared file descriptors. * Make approval toggle more intuitive with hover effect and toggle button. * Windows MSI: add support for signing. * Bump the used `pytest-xdist` version to 2.2.1. * Bump the used `pytest` version to 6.2.2. * Add WindowsRegistryInstalledSoftware to populate installed applications from registry * Introduced incremental updates for client actions (with memory, MySQL implementations). * Restyle approval bottom sheet header. * Clear FlowPicker after flow is started. * Introduced HumanReadableToMicrosecondsSinceEpoch helper function. * Use new super() syntax. * Create auxiliary constructors for the action mock. * Fixing Linux RPM command parser. * Fixing OSXInstallHistoryPlistParser. * Fixing FileFinderResultExportConverter. * Reduced the amount of info-logging and fixed the logging bug. * Index clients by UUID and serial number. * Type annotate client_index. * Introduce tree view to show child artifact sources. * Speed up ListArtifacts 4x by looping through raw ArtifactParser types. * Sandboxing: refactor to support multiple RPC interfaces in the unprivileged server. * Additional logging in the fleetspeak frontend. * Fixing accelerated.c varint_decode and py_split_buffer. * Fix issue with HTTP API not ignoring excessive GET parameters. * Deprecate Proto ACLToken. * Sandboxing: add unprivileged TSK implementation. * Remove all remaining ACLToken uses. 🎉🎉 * Refactor Events, remove legacy token. * Remove legacy token from Cronjobs. * Remove legacy token from OutputPlugins. * Remove legacy token from most tests. * Remove self.token.username in tests. * Remove legacy token from flows. * Remove legacy ACLToken fields requested_access, is_emergency, supervisor. * Remove legacy token from report plugins. * Preview sources of selected artifact. * Merging #916
1 parent 1194c97 commit e368efd

File tree

340 files changed

+4792
-2452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+4792
-2452
lines changed

api_client/python/grr_api_client/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GrrApi(object):
3232
"""Root GRR API object."""
3333

3434
def __init__(self, connector: connectors.Connector):
35-
super(GrrApi, self).__init__()
35+
super().__init__()
3636

3737
self._context = context.GrrApiContext(connector=connector)
3838
self.types = types.Types(context=self._context) # type: types.Types

api_client/python/grr_api_client/api_shell.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GrrApiShellArgParser(argparse.ArgumentParser):
1818
"""API shell args parser."""
1919

2020
def __init__(self):
21-
super(GrrApiShellArgParser, self).__init__()
21+
super().__init__()
2222

2323
self.add_argument(
2424
"api_endpoint", type=str, help="API endpoint specified as host[:port]")

api_client/python/grr_api_client/client.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self,
2222
approval_id=None,
2323
username=None,
2424
context=None):
25-
super(ClientApprovalBase, self).__init__()
25+
super().__init__()
2626

2727
if not client_id:
2828
raise ValueError("client_id can't be empty.")
@@ -89,7 +89,7 @@ def __init__(self, data=None, username=None, context=None):
8989
if data is None:
9090
raise ValueError("data can't be None")
9191

92-
super(ClientApproval, self).__init__(
92+
super().__init__(
9393
client_id=utils.UrnStringToClientId(data.subject.urn),
9494
approval_id=data.id,
9595
username=username,
@@ -102,7 +102,7 @@ class ClientCrash(object):
102102
"""Wrapper class for client crashes."""
103103

104104
def __init__(self, data=None, context=None):
105-
super(ClientCrash, self).__init__()
105+
super().__init__()
106106

107107
self.data = data
108108

@@ -118,7 +118,7 @@ class ClientBase(object):
118118
"""Base class for Client and ClientRef."""
119119

120120
def __init__(self, client_id=None, context=None):
121-
super(ClientBase, self).__init__()
121+
super().__init__()
122122

123123
if not client_id:
124124
raise ValueError("client_id can't be empty.")
@@ -291,7 +291,7 @@ def __init__(self, data=None, context=None):
291291
if data is None:
292292
raise ValueError("data can't be None")
293293

294-
super(Client, self).__init__(
294+
super().__init__(
295295
client_id=utils.UrnStringToClientId(data.urn), context=context)
296296

297297
self.data = data

api_client/python/grr_api_client/config.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(
1818
path: str,
1919
context: api_context.GrrApiContext,
2020
):
21-
super(GrrBinaryBase, self).__init__()
21+
super().__init__()
2222

2323
self.binary_type = binary_type
2424
self.path = path
@@ -51,8 +51,7 @@ def __init__(
5151
data: config_pb2.ApiGrrBinary,
5252
context: api_context.GrrApiContext,
5353
):
54-
super(GrrBinary, self).__init__(
55-
binary_type=data.type, path=data.path, context=context)
54+
super().__init__(binary_type=data.type, path=data.path, context=context)
5655

5756
self.data = data # type: config_pb2.ApiGrrBinary
5857

api_client/python/grr_api_client/connectors/http.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(
131131
page_size: Optional[int] = None,
132132
validate_version: Optional[bool] = None,
133133
):
134-
super(HttpConnector, self).__init__()
134+
super().__init__()
135135

136136
if verify is None:
137137
verify = True

api_client/python/grr_api_client/context.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class GrrApiContext(object):
1919
"""API context object. Used to make every API request."""
2020

2121
def __init__(self, connector: connectors.Connector):
22-
super(GrrApiContext, self).__init__()
22+
super().__init__()
2323

2424
self.connector = connector # type: connectors.Connector
2525
self.user = None # type: Optional[user_pb2.ApiGrrUser]

api_client/python/grr_api_client/flow.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(
2222
self,
2323
data: flow_pb2.ApiFlowResult,
2424
):
25-
super(FlowResult, self).__init__()
25+
super().__init__()
2626
self.data = data # type: flow_pb2.ApiFlowResult
2727
self.timestamp = data.timestamp # type: int
2828

@@ -41,7 +41,7 @@ def __init__(
4141
self,
4242
data: flow_pb2.ApiFlowLog,
4343
):
44-
super(FlowLog, self).__init__()
44+
super().__init__()
4545

4646
self.data = data # type: flow_pb2.ApiFlowLog
4747
self.log_message = self.data.log_message # type: str
@@ -56,7 +56,7 @@ def __init__(
5656
flow_id: str,
5757
context: api_context.GrrApiContext,
5858
):
59-
super(FlowBase, self).__init__()
59+
super().__init__()
6060

6161
if not client_id:
6262
raise ValueError("client_id can't be empty.")
@@ -192,8 +192,7 @@ def __init__(
192192
client_id = utils.UrnStringToClientId(data.urn)
193193
flow_id = data.flow_id
194194

195-
super(Flow, self).__init__(
196-
client_id=client_id, flow_id=flow_id, context=context)
195+
super().__init__(client_id=client_id, flow_id=flow_id, context=context)
197196

198197
self.data = data # type: flow_pb2.ApiFlow
199198

api_client/python/grr_api_client/hunt.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(
2929
username: str,
3030
context: context_lib.GrrApiContext,
3131
):
32-
super(HuntApprovalBase, self).__init__()
32+
super().__init__()
3333

3434
if not hunt_id:
3535
raise ValueError("hunt_id can't be empty.")
@@ -108,7 +108,7 @@ def __init__(
108108
username: str,
109109
context: context_lib.GrrApiContext,
110110
):
111-
super(HuntApproval, self).__init__(
111+
super().__init__(
112112
hunt_id=utils.UrnStringToHuntId(data.subject.urn),
113113
approval_id=data.id,
114114
username=username,
@@ -125,7 +125,7 @@ def __init__(
125125
data: hunt_pb2.ApiHuntResult,
126126
context: context_lib.GrrApiContext,
127127
):
128-
super(HuntResult, self).__init__()
128+
super().__init__()
129129
self.data = data # type: hunt_pb2.ApiHuntResult
130130

131131
self.client = client.ClientRef(
@@ -146,7 +146,7 @@ def __init__(
146146
data: hunt_pb2.ApiHuntError,
147147
context: context_lib.GrrApiContext,
148148
):
149-
super(HuntError, self).__init__()
149+
super().__init__()
150150

151151
self.data = data # type: hunt_pb2.ApiHuntError
152152
self.log_message = self.data.log_message # type: str
@@ -165,7 +165,7 @@ def __init__(
165165
data: hunt_pb2.ApiHuntLog,
166166
context: context_lib.GrrApiContext,
167167
):
168-
super(HuntLog, self).__init__()
168+
super().__init__()
169169

170170
self.data = data # type: hunt_pb2.ApiHuntLog
171171
self.log_message = self.data.log_message # str
@@ -184,7 +184,7 @@ def __init__(
184184
data: hunt_pb2.ApiHuntClient,
185185
context: context_lib.GrrApiContext,
186186
):
187-
super(HuntClient, self).__init__(client_id=data.client_id, context=context)
187+
super().__init__(client_id=data.client_id, context=context)
188188

189189
self.data = data # type: hunt_pb2.ApiHuntClient
190190

@@ -197,7 +197,7 @@ def __init__(
197197
hunt_id: str,
198198
context: context_lib.GrrApiContext,
199199
):
200-
super(HuntBase, self).__init__()
200+
super().__init__()
201201

202202
if not hunt_id:
203203
raise ValueError("hunt_id can't be empty.")
@@ -400,7 +400,7 @@ def __init__(
400400
):
401401
hunt_id = utils.UrnStringToHuntId(data.urn)
402402

403-
super(Hunt, self).__init__(hunt_id=hunt_id, context=context)
403+
super().__init__(hunt_id=hunt_id, context=context)
404404

405405
self.data = data # type: hunt_pb2.ApiHunt
406406

api_client/python/grr_api_client/root.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(
3333
username: str,
3434
context: api_context.GrrApiContext,
3535
):
36-
super(GrrUserBase, self).__init__()
36+
super().__init__()
3737

3838
self.username = username # type: str
3939
self._context = context # type: api_context.GrrApiContext
@@ -97,7 +97,7 @@ def __init__(
9797
data: user_pb2.ApiGrrUser,
9898
context: api_context.GrrApiContext,
9999
):
100-
super(GrrUser, self).__init__(username=data.username, context=context)
100+
super().__init__(username=data.username, context=context)
101101

102102
self.data = data # type: user_pb2.ApiGrrUser
103103

@@ -113,7 +113,7 @@ def __init__(
113113
path: str,
114114
context: api_context.GrrApiContext,
115115
):
116-
super(GrrBinaryRef, self).__init__()
116+
super().__init__()
117117

118118
self.binary_type = binary_type # type: config_pb2.ApiGrrBinary.Type
119119
self.path = path # type: str
@@ -202,7 +202,7 @@ def __init__(
202202
self,
203203
context: api_context.GrrApiContext,
204204
):
205-
super(RootGrrApi, self).__init__()
205+
super().__init__()
206206
self._context = context # type: api_context.GrrApiContext
207207

208208
# TODO(hanuszczak): Python's protobuf enums don't currently work with

api_client/python/grr_api_client/types.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(
2828
self,
2929
context: api_context.GrrApiContext,
3030
):
31-
super(Types, self).__init__()
31+
super().__init__()
3232

3333
self._context = context # type: api_context.GrrApiContext
3434
self._flow_descriptors = None

api_client/python/grr_api_client/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class BinaryChunkIterator(object):
9393
"""Iterator object for binary streams."""
9494

9595
def __init__(self, chunks: Iterator[bytes]) -> None:
96-
super(BinaryChunkIterator, self).__init__()
96+
super().__init__()
9797

9898
self.chunks = chunks # type: Iterator[bytes]
9999

@@ -214,7 +214,7 @@ def __init__(
214214
proto_type: str,
215215
proto_any: any_pb2.Any,
216216
) -> None:
217-
super(UnknownProtobuf, self).__init__()
217+
super().__init__()
218218

219219
self.type = proto_type # type: str
220220
self.original_value = proto_any # type: any_pb2.Any

api_client/python/grr_api_client/vfs.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(
3838
target_file: "FileBase",
3939
context: api_context.GrrApiContext,
4040
):
41-
super(FileOperation, self).__init__()
41+
super().__init__()
4242

4343
if not client_id:
4444
raise ValueError("client_id can't be empty")
@@ -145,7 +145,7 @@ def __init__(
145145
path: str,
146146
context: api_context.GrrApiContext,
147147
):
148-
super(FileBase, self).__init__()
148+
super().__init__()
149149

150150
if not client_id:
151151
raise ValueError("client_id can't be empty")
@@ -290,8 +290,7 @@ def __init__(
290290
data: vfs_pb2.ApiFile,
291291
context: api_context.GrrApiContext,
292292
):
293-
super(File, self).__init__(
294-
client_id=client_id, path=data.path, context=context)
293+
super().__init__(client_id=client_id, path=data.path, context=context)
295294

296295
self.data = data # type: vfs_pb2.ApiFile
297296

appveyor/tests/appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ install:
2626
wget "https://dl.google.com/linux/direct/${CHROME_DEB}" && sudo apt install -y "./${CHROME_DEB}";
2727
fi
2828
- python3.6 -m venv "${HOME}/INSTALL"
29-
- ${HOME}/INSTALL/bin/pip install pytest-xdist==1.28.0
29+
- ${HOME}/INSTALL/bin/pip install pytest-xdist==2.2.1
3030
- travis/install.sh
3131

3232
# Appveyor will try to build any Visual Studio projects it finds

colab/grr_colab/client_test.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ def testRequestApproval(self):
350350
client.request_approval(reason='test', approvers=['foo'])
351351

352352
approvals = data_store.REL_DB.ReadApprovalRequests(
353-
self.token.username, objects_pb2.ApprovalRequest.APPROVAL_TYPE_CLIENT,
353+
self.test_username, objects_pb2.ApprovalRequest.APPROVAL_TYPE_CLIENT,
354354
ClientTest.FAKE_CLIENT_ID)
355355

356356
self.assertLen(approvals, 1)
357-
self.assertEqual(approvals[0].requestor_username, self.token.username)
357+
self.assertEqual(approvals[0].requestor_username, self.test_username)
358358
self.assertEqual(approvals[0].notified_users, ['foo'])
359359
self.assertEqual(approvals[0].reason, 'test')
360360

@@ -368,15 +368,15 @@ def testRequestApprovalAndWait(self):
368368
def ProcessApproval():
369369
while True:
370370
approvals = data_store.REL_DB.ReadApprovalRequests(
371-
self.token.username,
371+
self.test_username,
372372
objects_pb2.ApprovalRequest.APPROVAL_TYPE_CLIENT,
373373
ClientTest.FAKE_CLIENT_ID)
374374
if not approvals:
375375
time.sleep(1)
376376
continue
377377

378378
approval_id = approvals[0].approval_id
379-
data_store.REL_DB.GrantApproval(self.token.username, approval_id, 'foo')
379+
data_store.REL_DB.GrantApproval(self.test_username, approval_id, 'foo')
380380
break
381381

382382
thread = threading.Thread(name='ProcessApprover', target=ProcessApproval)
@@ -385,11 +385,11 @@ def ProcessApproval():
385385
try:
386386
client.request_approval_and_wait(reason='test', approvers=['foo'])
387387
approvals = data_store.REL_DB.ReadApprovalRequests(
388-
self.token.username, objects_pb2.ApprovalRequest.APPROVAL_TYPE_CLIENT,
388+
self.test_username, objects_pb2.ApprovalRequest.APPROVAL_TYPE_CLIENT,
389389
ClientTest.FAKE_CLIENT_ID)
390390
self.assertLen(approvals, 1)
391391

392-
approval = client._client.Approval(self.token.username,
392+
approval = client._client.Approval(self.test_username,
393393
approvals[0].approval_id).Get()
394394
self.assertTrue(approval.data.is_valid)
395395
finally:

0 commit comments

Comments
 (0)