assemblyline-service-client 4.6.1.dev120__py3-none-any.whl → 4.6.1.dev236__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- assemblyline_service_client/VERSION +1 -1
- assemblyline_service_client/task_handler.py +11 -3
- {assemblyline_service_client-4.6.1.dev120.dist-info → assemblyline_service_client-4.6.1.dev236.dist-info}/METADATA +1 -1
- assemblyline_service_client-4.6.1.dev236.dist-info/RECORD +8 -0
- assemblyline_service_client-4.6.1.dev120.dist-info/RECORD +0 -8
- {assemblyline_service_client-4.6.1.dev120.dist-info → assemblyline_service_client-4.6.1.dev236.dist-info}/WHEEL +0 -0
- {assemblyline_service_client-4.6.1.dev120.dist-info → assemblyline_service_client-4.6.1.dev236.dist-info}/licenses/LICENCE.md +0 -0
- {assemblyline_service_client-4.6.1.dev120.dist-info → assemblyline_service_client-4.6.1.dev236.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
4.6.1.
|
|
1
|
+
4.6.1.dev236
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import copy
|
|
2
2
|
import json
|
|
3
|
-
import logging
|
|
4
3
|
import os
|
|
4
|
+
import re
|
|
5
5
|
import select
|
|
6
6
|
import shutil
|
|
7
7
|
import signal
|
|
@@ -12,11 +12,13 @@ from typing import Any, Optional
|
|
|
12
12
|
|
|
13
13
|
import requests
|
|
14
14
|
import yaml
|
|
15
|
+
from assemblyline_core.server_base import ServerBase
|
|
16
|
+
|
|
15
17
|
from assemblyline.common.digests import get_sha256_for_file
|
|
16
18
|
from assemblyline.common.str_utils import StringTable
|
|
19
|
+
from assemblyline.odm import SHA256_REGEX as SHA256_REGEX_PATTERN
|
|
17
20
|
from assemblyline.odm.messages.task import Task as ServiceTask
|
|
18
21
|
from assemblyline.odm.models.service import Service
|
|
19
|
-
from assemblyline_core.server_base import ServerBase
|
|
20
22
|
|
|
21
23
|
STATUSES = StringTable('STATUSES', [
|
|
22
24
|
('INITIALIZING', 0),
|
|
@@ -36,7 +38,7 @@ SUPPORTED_API = 'v1'
|
|
|
36
38
|
DEFAULT_REQUEST_TIMEOUT = int(os.environ.get("SERVICE_CLIENT_DEFAULT_REQUEST_TIMEOUT", 180))
|
|
37
39
|
TASK_REQUEST_TIMEOUT = int(os.environ.get('TASK_REQUEST_TIMEOUT', 30))
|
|
38
40
|
FILE_REQUEST_TIMEOUT = int(os.environ.get('FILE_REQUEST_TIMEOUT', 180))
|
|
39
|
-
|
|
41
|
+
SHA256_REGEX = re.compile(SHA256_REGEX_PATTERN)
|
|
40
42
|
|
|
41
43
|
# The number of tasks a service will complete before stopping, letting the environment start a new container.
|
|
42
44
|
# By default there is no limit, but this lets the orchestration environment set one
|
|
@@ -365,6 +367,12 @@ class TaskHandler(ServerBase):
|
|
|
365
367
|
return task
|
|
366
368
|
|
|
367
369
|
def download_file(self, sha256, sid) -> Optional[str]:
|
|
370
|
+
if not SHA256_REGEX.match(sha256):
|
|
371
|
+
# If the SHA256 is not valid, we cannot download the file
|
|
372
|
+
self.log.error(f"[{sid}] Invalid SHA256 provided: {sha256}")
|
|
373
|
+
self.status = STATUSES.ERROR_FOUND
|
|
374
|
+
return None
|
|
375
|
+
|
|
368
376
|
self.status = STATUSES.DOWNLOADING_FILE
|
|
369
377
|
received_file_sha256 = ''
|
|
370
378
|
file_path = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: assemblyline-service-client
|
|
3
|
-
Version: 4.6.1.
|
|
3
|
+
Version: 4.6.1.dev236
|
|
4
4
|
Summary: Assemblyline 4 - Service client
|
|
5
5
|
Home-page: https://github.com/CybercentreCanada/assemblyline-service-client/
|
|
6
6
|
Author: CCCS Assemblyline development team
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
assemblyline_service_client/VERSION,sha256=sxfL1RVB0eREtA0ANqB7bBr3JRdbLOhg2iPaqVnV_ys,13
|
|
2
|
+
assemblyline_service_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
assemblyline_service_client/task_handler.py,sha256=sOtpuo0jlnDRQBex50ZesXgNwaVfK1pigV208Bo0jKU,23914
|
|
4
|
+
assemblyline_service_client-4.6.1.dev236.dist-info/licenses/LICENCE.md,sha256=NSkYo9EH8h5oOkzg4VhjAHF4339MqPP2cQ8msTPgl-c,1396
|
|
5
|
+
assemblyline_service_client-4.6.1.dev236.dist-info/METADATA,sha256=_Dywcm0bc1SqYlGOhaDzdU39k60ttnS9sRITJyguX6E,1677
|
|
6
|
+
assemblyline_service_client-4.6.1.dev236.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
assemblyline_service_client-4.6.1.dev236.dist-info/top_level.txt,sha256=clNWHvn8nw0kR15l5TASxWxIQvKGKe5Pso3kVPMiJv0,28
|
|
8
|
+
assemblyline_service_client-4.6.1.dev236.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
assemblyline_service_client/VERSION,sha256=AqCHZgZTkS8o8NeSJADCV-yamCUfON65KWCSQxfTdC8,13
|
|
2
|
-
assemblyline_service_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
assemblyline_service_client/task_handler.py,sha256=XB2vSF-Zmff0veX6JOFqVPex7pNkxsZCNuhtY3LvRcM,23547
|
|
4
|
-
assemblyline_service_client-4.6.1.dev120.dist-info/licenses/LICENCE.md,sha256=NSkYo9EH8h5oOkzg4VhjAHF4339MqPP2cQ8msTPgl-c,1396
|
|
5
|
-
assemblyline_service_client-4.6.1.dev120.dist-info/METADATA,sha256=ztO61pOfdhC9eXfKaFyKQV0TMT_pSoIoSiUo52RAUws,1677
|
|
6
|
-
assemblyline_service_client-4.6.1.dev120.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
assemblyline_service_client-4.6.1.dev120.dist-info/top_level.txt,sha256=clNWHvn8nw0kR15l5TASxWxIQvKGKe5Pso3kVPMiJv0,28
|
|
8
|
-
assemblyline_service_client-4.6.1.dev120.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|