assemblyline-core 4.6.1.dev69__tar.gz → 4.6.1.dev73__tar.gz
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_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/PKG-INFO +1 -1
- assemblyline_core-4.6.1.dev73/assemblyline_core/VERSION +1 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/client.py +23 -9
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/loader/run_worker.py +7 -6
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/controllers/docker_ctl.py +1 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core.egg-info/PKG-INFO +1 -1
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_replay.py +47 -5
- assemblyline_core-4.6.1.dev69/assemblyline_core/VERSION +0 -1
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/LICENCE.md +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/README.md +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/alerter/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/alerter/processing.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/alerter/run_alerter.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/archiver/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/archiver/run_archiver.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/badlist_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/dispatching/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/dispatching/__main__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/dispatching/client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/dispatching/dispatcher.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/dispatching/schedules.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/dispatching/timeout.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/expiry/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/expiry/run_expiry.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/ingester/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/ingester/__main__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/ingester/constants.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/ingester/ingester.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/es_metrics.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/heartbeat_formatter.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/helper.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/metrics_server.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/run_heartbeat_manager.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/run_metrics_aggregator.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/run_statistics_aggregator.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/plumber/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/plumber/run_plumber.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/creator/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/creator/run.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/creator/run_worker.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/loader/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/loader/run.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/replay.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/safelist_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/collection.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/controllers/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/controllers/interface.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/controllers/kubernetes_ctl.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/run_scaler.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/scaler_server.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/server_base.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/signature_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/submission_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/tasking_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/updater/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/updater/helper.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/updater/run_updater.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/crawler.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/department_map.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/safelist.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/stream_map.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/worker.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/workflow/__init__.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/workflow/run_workflow.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core.egg-info/SOURCES.txt +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core.egg-info/dependency_links.txt +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core.egg-info/requires.txt +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core.egg-info/top_level.txt +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/setup.cfg +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/setup.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_alerter.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_badlist_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_dispatcher.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_expiry.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_plumber.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_safelist_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_scaler.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_scheduler.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_signature_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_simulation.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_tasking_client.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_vacuum.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_worker_ingest.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_worker_submit.py +0 -0
- {assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_workflow.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
4.6.1.dev73
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/client.py
RENAMED
@@ -4,13 +4,13 @@ import time
|
|
4
4
|
|
5
5
|
from assemblyline.common import forge
|
6
6
|
from assemblyline.common.bundling import create_bundle, import_bundle
|
7
|
+
from assemblyline.common.classification import InvalidClassification
|
7
8
|
from assemblyline.odm import Model
|
8
|
-
from assemblyline.remote.datatypes.queues.named import NamedQueue
|
9
9
|
from assemblyline.remote.datatypes.hash import Hash
|
10
|
-
from
|
10
|
+
from assemblyline.remote.datatypes.queues.named import NamedQueue
|
11
11
|
from assemblyline_core.badlist_client import BadlistClient
|
12
|
+
from assemblyline_core.replay.replay import INPUT_TYPES
|
12
13
|
from assemblyline_core.safelist_client import SafelistClient
|
13
|
-
from assemblyline_core.signature_client import SignatureClient
|
14
14
|
|
15
15
|
EMPTY_WAIT_TIME = int(os.environ.get('EMPTY_WAIT_TIME', '30'))
|
16
16
|
REPLAY_REQUESTED = 'requested'
|
@@ -296,13 +296,14 @@ class APIClient(ClientBase):
|
|
296
296
|
def create_al_bundle(self, id, bundle_path, use_alert=False):
|
297
297
|
self.al_client.bundle.create(id, output=bundle_path, use_alert=use_alert)
|
298
298
|
|
299
|
-
def load_bundle(self, bundle_path, min_classification, rescan_services, exist_ok=True):
|
299
|
+
def load_bundle(self, bundle_path, min_classification, rescan_services, exist_ok=True, reclassification=None):
|
300
300
|
self.al_client.bundle.import_bundle(bundle_path,
|
301
301
|
min_classification=min_classification,
|
302
302
|
rescan_services=rescan_services,
|
303
|
-
exist_ok=exist_ok
|
303
|
+
exist_ok=exist_ok,
|
304
|
+
reclassification=reclassification)
|
304
305
|
|
305
|
-
def load_json(self, file_path):
|
306
|
+
def load_json(self, file_path, reclassification=None):
|
306
307
|
from assemblyline_client import ClientError
|
307
308
|
|
308
309
|
# We're assuming all JSON that loaded has an "enabled" field
|
@@ -374,6 +375,7 @@ class DirectClient(ClientBase):
|
|
374
375
|
# Initialize connection to redis-persistent for checkpointing
|
375
376
|
redis_persist = get_client(config.core.redis.persistent.host,
|
376
377
|
config.core.redis.persistent.port, False)
|
378
|
+
self.classification = forge.get_classification()
|
377
379
|
self.datastore = forge.get_datastore(config=config)
|
378
380
|
self.queues = {
|
379
381
|
queue_type: NamedQueue(f"replay_{queue_type}", host=redis)
|
@@ -409,13 +411,14 @@ class DirectClient(ClientBase):
|
|
409
411
|
temp_bundle_file = create_bundle(id, working_dir=os.path.dirname(bundle_path), use_alert=use_alert)
|
410
412
|
os.rename(temp_bundle_file, bundle_path)
|
411
413
|
|
412
|
-
def load_bundle(self, bundle_path, min_classification, rescan_services, exist_ok=True):
|
414
|
+
def load_bundle(self, bundle_path, min_classification, rescan_services, exist_ok=True, reclassification=None):
|
413
415
|
import_bundle(bundle_path,
|
414
416
|
min_classification=min_classification,
|
415
417
|
rescan_services=rescan_services,
|
416
|
-
exist_ok=exist_ok
|
418
|
+
exist_ok=exist_ok,
|
419
|
+
reclassification=reclassification)
|
417
420
|
|
418
|
-
def load_json(self, file_path):
|
421
|
+
def load_json(self, file_path, reclassification=None):
|
419
422
|
# We're assuming all JSON that loaded has an "enabled" field
|
420
423
|
collection = os.path.basename(file_path).split('_', 1)[0]
|
421
424
|
with open(file_path) as fp:
|
@@ -428,6 +431,17 @@ class DirectClient(ClientBase):
|
|
428
431
|
|
429
432
|
# Let's see if there's an existing document with the same ID in the collection
|
430
433
|
obj = es_collection.get_if_exists(id, as_obj=False)
|
434
|
+
if obj:
|
435
|
+
# Check if the classification of the object is compatible with the system's classification
|
436
|
+
try:
|
437
|
+
self.classification.normalize_classification(obj['classification'])
|
438
|
+
except InvalidClassification:
|
439
|
+
if reclassification:
|
440
|
+
# If reclassification is requested, then we can change the classification
|
441
|
+
obj['classification'] = reclassification
|
442
|
+
else:
|
443
|
+
raise
|
444
|
+
|
431
445
|
|
432
446
|
if collection == "workflow":
|
433
447
|
# If there has been any edits by another user, then preserve the enabled state
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import shutil
|
2
1
|
import os
|
2
|
+
import shutil
|
3
3
|
|
4
4
|
from cart import unpack_file
|
5
5
|
|
@@ -32,15 +32,16 @@ class ReplayLoaderWorker(ReplayBase):
|
|
32
32
|
if file_path.endswith(".al_bundle"):
|
33
33
|
self.client.load_bundle(file_path,
|
34
34
|
min_classification=self.replay_config.loader.min_classification,
|
35
|
-
rescan_services=self.replay_config.loader.rescan
|
35
|
+
rescan_services=self.replay_config.loader.rescan,
|
36
|
+
reclassification=self.replay_config.loader.reclassification)
|
36
37
|
elif file_path.endswith(".al_json"):
|
37
|
-
self.client.load_json(file_path)
|
38
|
+
self.client.load_json(file_path, reclassification=self.replay_config.loader.reclassification)
|
38
39
|
|
39
40
|
elif file_path.endswith(".al_json.cart"):
|
40
41
|
cart_path = file_path
|
41
42
|
file_path = file_path[:-5]
|
42
43
|
unpack_file(cart_path, file_path)
|
43
|
-
self.client.load_json(file_path)
|
44
|
+
self.client.load_json(file_path, reclassification=self.replay_config.loader.reclassification)
|
44
45
|
os.unlink(cart_path)
|
45
46
|
|
46
47
|
if os.path.exists(file_path):
|
@@ -55,11 +56,11 @@ class ReplayLoaderWorker(ReplayBase):
|
|
55
56
|
# Terminate on NFS-related error
|
56
57
|
self.log.warning("'Invalid cross-device link' exception detected. Terminating..")
|
57
58
|
self.stop()
|
58
|
-
except Exception:
|
59
|
+
except Exception as e:
|
59
60
|
# Make sure failed directory exists
|
60
61
|
os.makedirs(self.replay_config.loader.failed_directory, exist_ok=True)
|
61
62
|
|
62
|
-
self.log.error(f"Failed to load the bundle file {file_path}, moving it to the failed directory.")
|
63
|
+
self.log.error(f"Failed to load the bundle file {file_path}, moving it to the failed directory. Reason: {e}")
|
63
64
|
failed_path = os.path.join(self.replay_config.loader.failed_directory, os.path.basename(file_path))
|
64
65
|
shutil.move(file_path, failed_path)
|
65
66
|
|
@@ -500,6 +500,7 @@ class DockerController(ControllerInterface):
|
|
500
500
|
instance_key = uuid.uuid4().hex
|
501
501
|
|
502
502
|
volumes = {_n: {'bind': _v.mount_path, 'mode': 'rw'} for _n, _v in spec.volumes.items()}
|
503
|
+
volumes.update({row[0]: {'bind': row[1], 'mode': 'ro'} for row in self.global_mounts})
|
503
504
|
if spec.run_as_core:
|
504
505
|
volumes.update({row[0]: {'bind': row[1], 'mode': 'ro'} for row in self.core_mounts})
|
505
506
|
|
@@ -2,17 +2,32 @@ import collections
|
|
2
2
|
import json
|
3
3
|
import os
|
4
4
|
import random
|
5
|
-
import
|
5
|
+
import tarfile
|
6
|
+
import tempfile
|
6
7
|
|
8
|
+
import cart
|
7
9
|
import pytest
|
8
|
-
|
9
|
-
from assemblyline.common import forge
|
10
|
-
from assemblyline.odm.random_data import create_alerts, wipe_alerts, wipe_submissions, create_submission, create_badlists, create_safelists, create_workflows, wipe_badlist, wipe_safelist, wipe_workflows, create_signatures, wipe_signatures
|
11
10
|
from assemblyline_core.replay.creator.run import ReplayCreator
|
12
11
|
from assemblyline_core.replay.creator.run_worker import ReplayCreatorWorker
|
13
12
|
from assemblyline_core.replay.loader.run import ReplayLoader
|
14
13
|
from assemblyline_core.replay.loader.run_worker import ReplayLoaderWorker
|
15
14
|
|
15
|
+
from assemblyline.common import forge
|
16
|
+
from assemblyline.odm.random_data import (
|
17
|
+
create_alerts,
|
18
|
+
create_badlists,
|
19
|
+
create_safelists,
|
20
|
+
create_signatures,
|
21
|
+
create_submission,
|
22
|
+
create_workflows,
|
23
|
+
wipe_alerts,
|
24
|
+
wipe_badlist,
|
25
|
+
wipe_safelist,
|
26
|
+
wipe_signatures,
|
27
|
+
wipe_submissions,
|
28
|
+
wipe_workflows,
|
29
|
+
)
|
30
|
+
|
16
31
|
NUM_ALERTS = 1
|
17
32
|
NUM_BADLIST_ITEMS = 1
|
18
33
|
NUM_SAFELIST_ITEMS = 1
|
@@ -189,6 +204,7 @@ def test_replay_single_alert(config, datastore, creator, creator_worker, loader,
|
|
189
204
|
def test_replay_single_submission(config, datastore, creator, creator_worker, loader, loader_worker):
|
190
205
|
output_dir = creator.replay_config.creator.output_filestore.replace('file://', '')
|
191
206
|
input_dir = loader.replay_config.loader.input_directory
|
207
|
+
loader_worker.replay_config.loader.reclassification = "TLP:CLEAR"
|
192
208
|
|
193
209
|
# Make sure the submission get picked up by the creator
|
194
210
|
sub = random.choice(all_submissions).as_primitives()
|
@@ -213,6 +229,30 @@ def test_replay_single_submission(config, datastore, creator, creator_worker, lo
|
|
213
229
|
datastore.submission.delete(sub['sid'])
|
214
230
|
datastore.submission.commit()
|
215
231
|
|
232
|
+
# Manipulate the classfication of the bundle to something that's invalid to the system importing
|
233
|
+
with tempfile.TemporaryDirectory() as temp_dir:
|
234
|
+
# Unpack the bundle to manipulate the results.json file
|
235
|
+
tar_file = os.path.join(temp_dir, "bundle.tar.gz")
|
236
|
+
with open(tar_file, 'wb') as fp:
|
237
|
+
with open(filename, 'rb') as ffp:
|
238
|
+
hdr, _ = cart.unpack_stream(ffp, fp)
|
239
|
+
|
240
|
+
|
241
|
+
with tarfile.open(tar_file, 'r:gz') as tar:
|
242
|
+
results = json.load(tar.extractfile("results.json"))
|
243
|
+
|
244
|
+
# Insert a random classification string that isn't recognized by the Assemblyline system
|
245
|
+
results['submission']['classification'] = "ASSEMBLYLINE"
|
246
|
+
|
247
|
+
with tarfile.open(tar_file, 'w:gz') as tar:
|
248
|
+
with tempfile.NamedTemporaryFile("w") as temp_result:
|
249
|
+
json.dump(results, temp_result)
|
250
|
+
temp_result.seek(0)
|
251
|
+
tar.add(temp_result.name, "results.json")
|
252
|
+
|
253
|
+
# Cart the file and overwrite the original file
|
254
|
+
cart.pack_file(tar_file, filename, optional_header=hdr)
|
255
|
+
|
216
256
|
# In case the replay.yaml config creator output is not the same as loader input
|
217
257
|
new_filename = filename.replace(output_dir, input_dir)
|
218
258
|
if filename != new_filename:
|
@@ -231,10 +271,12 @@ def test_replay_single_submission(config, datastore, creator, creator_worker, lo
|
|
231
271
|
|
232
272
|
loaded_submission = datastore.submission.get(sub['sid'], as_obj=False)
|
233
273
|
assert 'bundle.loaded' in loaded_submission['metadata']
|
274
|
+
# Check to see if the reclassification took place and if we're preserving the original classification in the metadata
|
275
|
+
assert loaded_submission['classification'] in ["TLP:CLEAR", "TLP:C"]
|
276
|
+
assert loaded_submission['metadata']['bundle.classification'] == "ASSEMBLYLINE"
|
234
277
|
assert sub['sid'] == loaded_submission['sid']
|
235
278
|
assert 'replay' not in loaded_submission['metadata']
|
236
279
|
|
237
|
-
|
238
280
|
@pytest.mark.parametrize("collection", ["badlist", "safelist", "signature", "workflow"])
|
239
281
|
def test_replay_single_data_collection(datastore, creator, creator_worker, loader, loader_worker, collection):
|
240
282
|
output_dir = creator.replay_config.creator.output_filestore.replace('file://', '')
|
@@ -1 +0,0 @@
|
|
1
|
-
4.6.1.dev69
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/badlist_client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/expiry/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/metrics/helper.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/replay/replay.py
RENAMED
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/safelist_client.py
RENAMED
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/scaler/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/server_base.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/tasking_client.py
RENAMED
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/updater/helper.py
RENAMED
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/__init__.py
RENAMED
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/crawler.py
RENAMED
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/safelist.py
RENAMED
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/assemblyline_core/vacuum/worker.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_safelist_client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{assemblyline_core-4.6.1.dev69 → assemblyline_core-4.6.1.dev73}/test/test_signature_client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|