assemblyline-v4-service 4.6.0.dev11__py3-none-any.whl → 4.6.0.2__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.
Potentially problematic release.
This version of assemblyline-v4-service might be problematic. Click here for more details.
- assemblyline_v4_service/VERSION +1 -1
- assemblyline_v4_service/common/utils.py +5 -4
- assemblyline_v4_service/dev/run_service_once.py +3 -5
- assemblyline_v4_service/run_privileged_service.py +9 -10
- assemblyline_v4_service/updater/helper.py +19 -3
- {assemblyline_v4_service-4.6.0.dev11.dist-info → assemblyline_v4_service-4.6.0.2.dist-info}/METADATA +1 -1
- {assemblyline_v4_service-4.6.0.dev11.dist-info → assemblyline_v4_service-4.6.0.2.dist-info}/RECORD +10 -10
- {assemblyline_v4_service-4.6.0.dev11.dist-info → assemblyline_v4_service-4.6.0.2.dist-info}/WHEEL +1 -1
- {assemblyline_v4_service-4.6.0.dev11.dist-info → assemblyline_v4_service-4.6.0.2.dist-info}/licenses/LICENCE.md +0 -0
- {assemblyline_v4_service-4.6.0.dev11.dist-info → assemblyline_v4_service-4.6.0.2.dist-info}/top_level.txt +0 -0
assemblyline_v4_service/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.6.0.
|
|
1
|
+
4.6.0.2
|
|
@@ -80,14 +80,14 @@ def __extract_passwords_from_lines(texts, password_word, password_regex):
|
|
|
80
80
|
password_keyword = f"{password_word}:"
|
|
81
81
|
for line in texts:
|
|
82
82
|
if password_keyword in line.lower():
|
|
83
|
-
new_passwords = re.split(password_regex, line)
|
|
83
|
+
new_passwords = set(re.split(password_regex, line))
|
|
84
84
|
index = line.lower().rindex(password_keyword)
|
|
85
85
|
if index > 0 and line[index - 1] != " ":
|
|
86
86
|
special_char = line[index - 1]
|
|
87
87
|
if special_char in BRACKET_PAIRS:
|
|
88
88
|
special_char = BRACKET_PAIRS[special_char]
|
|
89
|
-
for password in new_passwords:
|
|
90
|
-
new_passwords.
|
|
89
|
+
for password in list(new_passwords):
|
|
90
|
+
new_passwords.update([password[:i] for i, ltr in enumerate(password) if ltr == special_char])
|
|
91
91
|
|
|
92
92
|
new_passwords = set(new_passwords)
|
|
93
93
|
new_passwords.discard("")
|
|
@@ -121,7 +121,8 @@ def _is_dev_mode() -> bool:
|
|
|
121
121
|
stack_trace.seek(0)
|
|
122
122
|
read_stack_trace = stack_trace.read()
|
|
123
123
|
|
|
124
|
-
if any(msg in read_stack_trace
|
|
124
|
+
if any(msg in read_stack_trace
|
|
125
|
+
for msg in ['run_service_once', 'pytest', 'assemblyline_v4_service.testing.helper']):
|
|
125
126
|
return True
|
|
126
127
|
|
|
127
128
|
return False
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import cProfile
|
|
3
|
-
import importlib
|
|
4
3
|
import json
|
|
5
4
|
import logging
|
|
6
5
|
import os
|
|
@@ -9,8 +8,6 @@ import shutil
|
|
|
9
8
|
import tempfile
|
|
10
9
|
from typing import Dict, Union
|
|
11
10
|
|
|
12
|
-
from cart import get_metadata_only, unpack_stream
|
|
13
|
-
|
|
14
11
|
from assemblyline.common import forge
|
|
15
12
|
from assemblyline.common.heuristics import HeuristicHandler, InvalidHeuristicException
|
|
16
13
|
from assemblyline.common.importing import load_module_by_path
|
|
@@ -22,11 +19,12 @@ from assemblyline.odm.models.service import Service
|
|
|
22
19
|
from assemblyline_v4_service.common.base import ServiceBase
|
|
23
20
|
from assemblyline_v4_service.common.helper import get_heuristics, get_service_manifest
|
|
24
21
|
from assemblyline_v4_service.dev.updater import load_rules
|
|
22
|
+
from cart import get_metadata_only, unpack_stream
|
|
25
23
|
|
|
26
24
|
|
|
27
25
|
class RunService:
|
|
28
26
|
def __init__(self):
|
|
29
|
-
self.service: ServiceBase = None
|
|
27
|
+
self.service: Union[ServiceBase, None] = None
|
|
30
28
|
self.service_class = None
|
|
31
29
|
self.submission_params = None
|
|
32
30
|
self.file_dir = None
|
|
@@ -185,7 +183,7 @@ class RunService:
|
|
|
185
183
|
LOG.info(f"Cleaning up file used for temporary processing: {target_file}")
|
|
186
184
|
os.unlink(target_file)
|
|
187
185
|
|
|
188
|
-
if self.service.rules_directory:
|
|
186
|
+
if self.service.rules_directory and self.service.rules_directory != "/":
|
|
189
187
|
LOG.info("Cleaning up downloaded signatures..")
|
|
190
188
|
shutil.rmtree(self.service.rules_directory)
|
|
191
189
|
|
|
@@ -3,23 +3,22 @@ import json
|
|
|
3
3
|
import os
|
|
4
4
|
import shutil
|
|
5
5
|
import tempfile
|
|
6
|
-
import yaml
|
|
7
|
-
|
|
8
|
-
from json import JSONDecodeError
|
|
9
6
|
from io import BytesIO
|
|
7
|
+
from json import JSONDecodeError
|
|
8
|
+
|
|
9
|
+
import yaml
|
|
10
|
+
from assemblyline_core.server_base import ServerBase
|
|
11
|
+
from assemblyline_core.tasking_client import TaskingClient
|
|
10
12
|
|
|
11
|
-
from assemblyline.common import forge
|
|
12
13
|
from assemblyline.common.digests import get_sha256_for_file
|
|
13
14
|
from assemblyline.common.importing import load_module_by_path
|
|
14
15
|
from assemblyline.common.metrics import MetricsFactory
|
|
15
16
|
from assemblyline.common.str_utils import StringTable
|
|
16
|
-
from assemblyline.common.version import FRAMEWORK_VERSION, SYSTEM_VERSION
|
|
17
|
+
from assemblyline.common.version import BUILD_MINOR, FRAMEWORK_VERSION, SYSTEM_VERSION
|
|
17
18
|
from assemblyline.filestore import FileStoreException
|
|
18
|
-
from assemblyline.remote.datatypes import get_client
|
|
19
19
|
from assemblyline.odm.messages.service_heartbeat import Metrics
|
|
20
20
|
from assemblyline.odm.messages.task import Task as ServiceTask
|
|
21
|
-
from
|
|
22
|
-
from assemblyline_core.server_base import ServerBase
|
|
21
|
+
from assemblyline.remote.datatypes import get_client
|
|
23
22
|
from assemblyline_v4_service.common.base import is_recoverable_runtime_error
|
|
24
23
|
|
|
25
24
|
SERVICE_PATH = os.environ['SERVICE_PATH']
|
|
@@ -74,7 +73,7 @@ class RunPrivilegedService(ServerBase):
|
|
|
74
73
|
|
|
75
74
|
self.status = STATUSES.INITIALIZING
|
|
76
75
|
self.metric_factory = None
|
|
77
|
-
|
|
76
|
+
|
|
78
77
|
def _load_manifest(self):
|
|
79
78
|
bio = BytesIO()
|
|
80
79
|
with open(SERVICE_MANIFEST, "rb") as srv_manifest:
|
|
@@ -126,6 +125,7 @@ class RunPrivilegedService(ServerBase):
|
|
|
126
125
|
|
|
127
126
|
# Load on-disk manifest for bootstrap/registration
|
|
128
127
|
service_manifest = self._load_manifest()
|
|
128
|
+
file_required = service_manifest.get('file_required', True)
|
|
129
129
|
|
|
130
130
|
# Register the service
|
|
131
131
|
registration = self.tasking_client.register_service(service_manifest)
|
|
@@ -146,7 +146,6 @@ class RunPrivilegedService(ServerBase):
|
|
|
146
146
|
self.service_tool_version = self.service.get_tool_version()
|
|
147
147
|
self.metric_factory = MetricsFactory('service', Metrics, name=self.service_name,
|
|
148
148
|
export_zero=False, redis=self.redis)
|
|
149
|
-
file_required = self.service_config.get('file_required', True)
|
|
150
149
|
|
|
151
150
|
# Start the service
|
|
152
151
|
self.service.start_service()
|
|
@@ -12,6 +12,7 @@ import psutil
|
|
|
12
12
|
import regex as re
|
|
13
13
|
import requests
|
|
14
14
|
from git import Repo
|
|
15
|
+
from azure.identity import DefaultAzureCredential
|
|
15
16
|
|
|
16
17
|
from assemblyline.common.digests import get_sha256_for_file
|
|
17
18
|
from assemblyline.common.identify import Identify
|
|
@@ -187,6 +188,7 @@ def git_clone_repo(source: Dict[str, Any], previous_update: int = None, logger=N
|
|
|
187
188
|
name = source['name']
|
|
188
189
|
url = source['uri']
|
|
189
190
|
key = source.get('private_key', None)
|
|
191
|
+
use_managed_identity = source.get('use_managed_identity', False)
|
|
190
192
|
username = source.get('username', None)
|
|
191
193
|
password = source.get('password', None)
|
|
192
194
|
branch = source.get('git_branch', None) or None
|
|
@@ -195,15 +197,29 @@ def git_clone_repo(source: Dict[str, Any], previous_update: int = None, logger=N
|
|
|
195
197
|
ca_cert = source.get("ca_cert")
|
|
196
198
|
proxy = source.get('proxy', None)
|
|
197
199
|
auth = None
|
|
198
|
-
|
|
200
|
+
git_env = {}
|
|
201
|
+
|
|
202
|
+
if use_managed_identity:
|
|
203
|
+
# Get Azure managed identity token
|
|
204
|
+
try:
|
|
205
|
+
credential = DefaultAzureCredential()
|
|
206
|
+
except Exception as e:
|
|
207
|
+
logger.warning(f"No managed identity available: {str(e)}")
|
|
208
|
+
raise SkipSource()
|
|
209
|
+
# Get token for Azure DevOps scope
|
|
210
|
+
token = credential.get_token("499b84ac-1321-427f-aa17-267ca6975798/.default")
|
|
211
|
+
|
|
212
|
+
git_env['GIT_CONFIG_COUNT'] = '1'
|
|
213
|
+
git_env['GIT_CONFIG_KEY_0'] = 'http.extraheader'
|
|
214
|
+
git_env['GIT_CONFIG_VALUE_0'] = f'AUTHORIZATION: bearer {token.token}'
|
|
215
|
+
auth = None
|
|
216
|
+
elif username and password:
|
|
199
217
|
# Basic authentication scheme
|
|
200
218
|
auth = f'{username}:{password}@'
|
|
201
219
|
elif password:
|
|
202
220
|
# Token-based authentication
|
|
203
221
|
auth = f'{password}@'
|
|
204
222
|
|
|
205
|
-
git_env = {}
|
|
206
|
-
|
|
207
223
|
if ignore_ssl_errors:
|
|
208
224
|
git_env['GIT_SSL_NO_VERIFY'] = '1'
|
|
209
225
|
|
{assemblyline_v4_service-4.6.0.dev11.dist-info → assemblyline_v4_service-4.6.0.2.dist-info}/RECORD
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
assemblyline_v4_service/VERSION,sha256=
|
|
1
|
+
assemblyline_v4_service/VERSION,sha256=oxoj6kFkfXeSNEzzudVBzRw3Nm6upadZpg04xAdLLWY,8
|
|
2
2
|
assemblyline_v4_service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
assemblyline_v4_service/healthz.py,sha256=3QGBg0EZuXC6UN411HFwpLNEop9UvS9feFhvBUTP-k4,1576
|
|
4
4
|
assemblyline_v4_service/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
assemblyline_v4_service/run_privileged_service.py,sha256=
|
|
5
|
+
assemblyline_v4_service/run_privileged_service.py,sha256=un2zcZjQVKYwMWihLLmeUc3IMJ6ALnFbR1FPeMW1U2A,14486
|
|
6
6
|
assemblyline_v4_service/run_service.py,sha256=XfdABk3hEZsIw31tmFcJc-FbcxvBF9tiDIlg9oHCtZA,5900
|
|
7
7
|
assemblyline_v4_service/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
assemblyline_v4_service/common/api.py,sha256=Xzp8j4HCCfjPvNSGKiZl5ttH2_Itg47cjlH0NXNtth0,6849
|
|
@@ -13,18 +13,18 @@ assemblyline_v4_service/common/ontology_helper.py,sha256=9Ad81qbddg_pRMupT8o_Kzx
|
|
|
13
13
|
assemblyline_v4_service/common/request.py,sha256=W7fqC2xQE3i5i2jlCDyUDp3ZqJQQqSshNW0mQfJMkFg,11792
|
|
14
14
|
assemblyline_v4_service/common/result.py,sha256=9AqM6qCYiia_Bpyn_fBFhzNQMcqJbtFSiGjp57fXW2E,32713
|
|
15
15
|
assemblyline_v4_service/common/task.py,sha256=dJsvRpW0x88CCF_LW6w87jQ_UKTVaOs2Gb117IDNiU8,14233
|
|
16
|
-
assemblyline_v4_service/common/utils.py,sha256=
|
|
16
|
+
assemblyline_v4_service/common/utils.py,sha256=umEtTF92Q_Boq0gaIaY8twlwNHAmQOK9HWN6piWR42w,3916
|
|
17
17
|
assemblyline_v4_service/dev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
assemblyline_v4_service/dev/run_service_once.py,sha256=
|
|
18
|
+
assemblyline_v4_service/dev/run_service_once.py,sha256=W9kR49IUbkt8tNXjCT40ZMh-8p5W_odxlkDx6nhTAYM,10656
|
|
19
19
|
assemblyline_v4_service/dev/updater.py,sha256=b-FK6XPRZbETbl-SIYEhnYGT-W7EcQhnxwD6x2NMC7g,6411
|
|
20
20
|
assemblyline_v4_service/updater/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
assemblyline_v4_service/updater/__main__.py,sha256=9Os-u8Tf7MD73JSrUSPmOaErTgfvesNLiEeszU4ujXA,133
|
|
22
22
|
assemblyline_v4_service/updater/app.py,sha256=Mtmx4bkXfP4nFqqa5q15jW8QIXr4JK84lCovxAVyvPs,3317
|
|
23
23
|
assemblyline_v4_service/updater/client.py,sha256=tLY84gaGdFBVIDaMgRHIEa7x2S8jBl7lQLzp4seC6aI,11200
|
|
24
24
|
assemblyline_v4_service/updater/gunicorn_config.py,sha256=p3j2KPBeD5jvMw9O5i7vAtlRgPSVVxIG9AO0DfN82J8,1247
|
|
25
|
-
assemblyline_v4_service/updater/helper.py,sha256=
|
|
25
|
+
assemblyline_v4_service/updater/helper.py,sha256=GeXrfuPQL0RB5IGcgvx30vcCEehUueorw6SMSExjE9Q,10751
|
|
26
26
|
assemblyline_v4_service/updater/updater.py,sha256=kli-5v1uVmk2FARAI9DsZ9YM4EhgirkmWJaMJWdm9GI,31795
|
|
27
|
-
assemblyline_v4_service-4.6.0.
|
|
27
|
+
assemblyline_v4_service-4.6.0.2.dist-info/licenses/LICENCE.md,sha256=NSkYo9EH8h5oOkzg4VhjAHF4339MqPP2cQ8msTPgl-c,1396
|
|
28
28
|
test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
29
|
test/conftest.py,sha256=W3SieQpZsZpGEmtLqY4aIlxREDSsHceyCrFcFsWUM0U,1851
|
|
30
30
|
test/test_healthz.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
|
|
@@ -40,7 +40,7 @@ test/test_common/test_request.py,sha256=Ceyds8BNO1O0f1kH1VEb84faJcaupvSjVKIrGdHe
|
|
|
40
40
|
test/test_common/test_result.py,sha256=6BiOKxEPrKBjOY44jv3TY-yiXm0qI1ok_CZBnjP9TM4,45447
|
|
41
41
|
test/test_common/test_task.py,sha256=P44mNcSe-3tJgDk9ppN3KbM7oN4LBVIuhONG-Gveh74,19007
|
|
42
42
|
test/test_common/test_utils.py,sha256=TbnBxqpS_ZC5ptXR9XJX3xtbItD0mTbtiBxxdyP8J5k,5904
|
|
43
|
-
assemblyline_v4_service-4.6.0.
|
|
44
|
-
assemblyline_v4_service-4.6.0.
|
|
45
|
-
assemblyline_v4_service-4.6.0.
|
|
46
|
-
assemblyline_v4_service-4.6.0.
|
|
43
|
+
assemblyline_v4_service-4.6.0.2.dist-info/METADATA,sha256=1Vl8sqdYaXOgUPEq35RTfFYjmm2aS62foaxCdYhbQYc,5620
|
|
44
|
+
assemblyline_v4_service-4.6.0.2.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
45
|
+
assemblyline_v4_service-4.6.0.2.dist-info/top_level.txt,sha256=LpTOEaVCatkrvbVq3EZseMSIa2PQZU-2rhuO_FTpZgY,29
|
|
46
|
+
assemblyline_v4_service-4.6.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|