Skip to content

Commit

Permalink
Fix doc for signatures
Browse files Browse the repository at this point in the history
Removed unused safe download
Added signature stats
  • Loading branch information
cccs-sgaron committed May 21, 2020
1 parent 418c5fb commit 4a2dafd
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions assemblyline_client/v4_client/module/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": <ID of the saved signature>
}
"""
return self._connection.post(api_path_by_module(self, **get_funtion_kwargs('data', 'self')), json=data)

Expand All @@ -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.
"""
Expand All @@ -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.
Expand Down

0 comments on commit 4a2dafd

Please sign in to comment.