From 0598a22d8d0c8f21b746f706a4fdae1376cd3e84 Mon Sep 17 00:00:00 2001 From: cccs-rs <62077998+cccs-rs@users.noreply.github.com> Date: Tue, 30 Jul 2024 17:38:58 +0000 Subject: [PATCH 1/3] Modify APIs to support passing submission profile names --- assemblyline_client/v4_client/module/ingest.py | 6 ++++-- assemblyline_client/v4_client/module/submit.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/assemblyline_client/v4_client/module/ingest.py b/assemblyline_client/v4_client/module/ingest.py index b056744..44d26f1 100644 --- a/assemblyline_client/v4_client/module/ingest.py +++ b/assemblyline_client/v4_client/module/ingest.py @@ -11,7 +11,7 @@ def __init__(self, connection): self._connection = connection def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, - alert=False, nq=None, nt=None, ingest_type='AL_CLIENT'): + alert=False, nq=None, nt=None, ingest_type='AL_CLIENT', profile=None): """\ Submit a file to the ingestion queue. @@ -30,6 +30,7 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam nt : Notification threshold. (int) params : Additional submission parameters. (dict) ingest_type: Ingestion type, one word to describe how the data is ingested. Default: AL_CLIENT (string) +profile : Submission profile name If content is provided, the path is used as metadata only. """ @@ -87,7 +88,8 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam request['notification_threshold'] = int(nt) if params: request['params'] = params - + if profile: + request['profile'] = profile if files: data = {'json': dumps(request)} headers = {'content-type': None} diff --git a/assemblyline_client/v4_client/module/submit.py b/assemblyline_client/v4_client/module/submit.py index a86037d..06afbc1 100644 --- a/assemblyline_client/v4_client/module/submit.py +++ b/assemblyline_client/v4_client/module/submit.py @@ -10,7 +10,7 @@ class Submit(object): def __init__(self, connection): self._connection = connection - def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None): + def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, profile=None): """\ Submit a file to be dispatched. @@ -22,9 +22,10 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam url : Url to scan (string) Optional -fname : Name of the file to scan -metadata : Metadata to include with submission. (dict) -params : Additional submission parameters. (dict) +fname : Name of the file to scan +metadata : Metadata to include with submission. (dict) +params : Additional submission parameters. (dict) +profile : Submission profile name If content is provided, the path is used as metadata only. """ @@ -73,6 +74,9 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam if metadata: request['metadata'] = metadata + if profile: + request['profile'] = metadata + if files: data = {'json': dumps(request)} headers = {'content-type': None} From 1e885c00e08e67f5ac409cb5100cf94c4c65264e Mon Sep 17 00:00:00 2001 From: cccs-rs <62077998+cccs-rs@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:40:51 +0000 Subject: [PATCH 2/3] Update paramater name --- assemblyline_client/v4_client/module/ingest.py | 8 ++++---- assemblyline_client/v4_client/module/submit.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/assemblyline_client/v4_client/module/ingest.py b/assemblyline_client/v4_client/module/ingest.py index 44d26f1..c318625 100644 --- a/assemblyline_client/v4_client/module/ingest.py +++ b/assemblyline_client/v4_client/module/ingest.py @@ -11,7 +11,7 @@ def __init__(self, connection): self._connection = connection def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, - alert=False, nq=None, nt=None, ingest_type='AL_CLIENT', profile=None): + alert=False, nq=None, nt=None, ingest_type='AL_CLIENT', profile_name=None): """\ Submit a file to the ingestion queue. @@ -30,7 +30,7 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam nt : Notification threshold. (int) params : Additional submission parameters. (dict) ingest_type: Ingestion type, one word to describe how the data is ingested. Default: AL_CLIENT (string) -profile : Submission profile name +profile_name : Submission profile name If content is provided, the path is used as metadata only. """ @@ -88,8 +88,8 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam request['notification_threshold'] = int(nt) if params: request['params'] = params - if profile: - request['profile'] = profile + if profile_name: + request['profile_name'] = profile_name if files: data = {'json': dumps(request)} headers = {'content-type': None} diff --git a/assemblyline_client/v4_client/module/submit.py b/assemblyline_client/v4_client/module/submit.py index 06afbc1..70cdb52 100644 --- a/assemblyline_client/v4_client/module/submit.py +++ b/assemblyline_client/v4_client/module/submit.py @@ -10,7 +10,7 @@ class Submit(object): def __init__(self, connection): self._connection = connection - def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, profile=None): + def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, profile_name=None): """\ Submit a file to be dispatched. @@ -25,7 +25,7 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam fname : Name of the file to scan metadata : Metadata to include with submission. (dict) params : Additional submission parameters. (dict) -profile : Submission profile name +profile_name : Submission profile name If content is provided, the path is used as metadata only. """ @@ -74,8 +74,8 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam if metadata: request['metadata'] = metadata - if profile: - request['profile'] = metadata + if profile_name: + request['profile_name'] = profile_name if files: data = {'json': dumps(request)} From 3bb994175ef380336fd3a2e1d9279a4943009d04 Mon Sep 17 00:00:00 2001 From: cccs-rs <62077998+cccs-rs@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:46:20 +0000 Subject: [PATCH 3/3] Rename parameter --- assemblyline_client/v4_client/module/ingest.py | 8 ++++---- assemblyline_client/v4_client/module/submit.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/assemblyline_client/v4_client/module/ingest.py b/assemblyline_client/v4_client/module/ingest.py index c318625..4b6cb72 100644 --- a/assemblyline_client/v4_client/module/ingest.py +++ b/assemblyline_client/v4_client/module/ingest.py @@ -11,7 +11,7 @@ def __init__(self, connection): self._connection = connection def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, - alert=False, nq=None, nt=None, ingest_type='AL_CLIENT', profile_name=None): + alert=False, nq=None, nt=None, ingest_type='AL_CLIENT', submission_profile=None): """\ Submit a file to the ingestion queue. @@ -30,7 +30,7 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam nt : Notification threshold. (int) params : Additional submission parameters. (dict) ingest_type: Ingestion type, one word to describe how the data is ingested. Default: AL_CLIENT (string) -profile_name : Submission profile name +submission_profile : Submission profile name If content is provided, the path is used as metadata only. """ @@ -88,8 +88,8 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam request['notification_threshold'] = int(nt) if params: request['params'] = params - if profile_name: - request['profile_name'] = profile_name + if submission_profile: + request['submission_profile'] = submission_profile if files: data = {'json': dumps(request)} headers = {'content-type': None} diff --git a/assemblyline_client/v4_client/module/submit.py b/assemblyline_client/v4_client/module/submit.py index 70cdb52..412b26d 100644 --- a/assemblyline_client/v4_client/module/submit.py +++ b/assemblyline_client/v4_client/module/submit.py @@ -10,7 +10,7 @@ class Submit(object): def __init__(self, connection): self._connection = connection - def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, profile_name=None): + def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fname=None, params=None, metadata=None, submission_profile=None): """\ Submit a file to be dispatched. @@ -25,7 +25,7 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam fname : Name of the file to scan metadata : Metadata to include with submission. (dict) params : Additional submission parameters. (dict) -profile_name : Submission profile name +submission_profile : Submission profile name If content is provided, the path is used as metadata only. """ @@ -74,8 +74,8 @@ def __call__(self, fh=None, path=None, content=None, url=None, sha256=None, fnam if metadata: request['metadata'] = metadata - if profile_name: - request['profile_name'] = profile_name + if submission_profile: + request['submission_profile'] = submission_profile if files: data = {'json': dumps(request)}