From 4a2dafd38c10dfcadefe12a4b75b88b16e0e93d2 Mon Sep 17 00:00:00 2001 From: Steve Garon Date: Wed, 20 May 2020 22:02:47 -0400 Subject: [PATCH] Fix doc for signatures Removed unused safe download Added signature stats --- .../v4_client/module/signature.py | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/assemblyline_client/v4_client/module/signature.py b/assemblyline_client/v4_client/module/signature.py index 53a5efa..625a1e9 100644 --- a/assemblyline_client/v4_client/module/signature.py +++ b/assemblyline_client/v4_client/module/signature.py @@ -30,6 +30,15 @@ def add_update(self, data, dedup_name=True): "data": "rule sample {...}", # Data of the rule to be added "source": "yara_signatures" # Source from where the signature has been gathered } + +Optional: +dedup_name : Should we check if the signature already exist before inserting it (default: True) + +Returns: +{ + "success": True, + "signature_id": +} """ return self._connection.post(api_path_by_module(self, **get_funtion_kwargs('data', 'self')), json=data) @@ -53,18 +62,27 @@ def add_update_many(self, source, sig_type, data, dedup_name=True): }, ... ] + +Optional: +dedup_name : Should we check if the signatures already exist before inserting it (default: True) + +Returns: +{ + "success": 23, # Number of successful inserts + "errors": [], # List of signature that failed + "skipped": [], # List of skipped signatures, they already exist +} """ return self._connection.post(api_path_by_module(self, **get_funtion_kwargs('data', 'self')), json=data) # noinspection PyUnusedLocal - def download(self, output=None, query=None, safe=True): + def download(self, output=None, query=None): """\ Download the signatures. Defaults to all if no query is provided. Optional: output : Path or file handle. (string or file-like object) query : lucene query (string) -safe : Ensure signatures can be compiled. (boolean) If output is not specified the content is returned. """ @@ -73,6 +91,13 @@ def download(self, output=None, query=None, safe=True): return self._connection.download(path, stream_output(output)) return self._connection.download(path, raw_output) + def stats(self): + """\ +Gather statistics about all the signatures in the system. + +""" + return self._connection.get(api_path('signature/stats')) + def update_available(self, since='', sig_type='*'): """\ Check if updated signatures are available.