Skip to content

Commit 05e517e

Browse files
Add support for fetching the URL dynamic analysis by URL SHA1
1 parent 4fbfcc6 commit 05e517e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

ReversingLabs/SDK/ticloud.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,7 +3099,8 @@ class DynamicAnalysis(TiCloudAPI):
30993099
__DETONATE_ARCHIVE_ENDPOINT = "/api/dynamic/analysis/analyze/v1/archive/query/json"
31003100
__GET_FILE_RESULTS = "/api/dynamic/analysis/report/v1/query/sha1"
31013101
__GET_ARCHIVE_RESULTS_ENDPOINT = "/api/dynamic/analysis/report/v1/archive/query/sha1"
3102-
__GET_URL_RESULTS = "/api/dynamic/analysis/report/v1/query/url/base64"
3102+
__GET_URL_RESULTS_BASE64 = "/api/dynamic/analysis/report/v1/query/url/base64"
3103+
__GET_URL_RESULTS_SHA1 = "/api/dynamic/analysis/report/v1/query/url/sha1"
31033104

31043105
def __init__(self, host, username, password, verify=True, proxies=None, user_agent=DEFAULT_USER_AGENT,
31053106
allow_none_return=False):
@@ -3206,14 +3207,17 @@ def __detonate(self, platform, sample_sha1=None, url_string=None, is_archive=Fal
32063207

32073208
return response
32083209

3209-
def get_dynamic_analysis_results(self, sample_hash=None, url=None, is_archive=False, latest=False,
3210+
def get_dynamic_analysis_results(self, sample_hash=None, url=None, url_sha1=None, is_archive=False, latest=False,
32103211
analysis_id=None):
32113212
"""Returns dynamic analysis results for a desired file, URL or a file archive.
32123213
The analysis of the selected artifact must be finished for the results to be available.
32133214
:param sample_hash: SHA-1 hash of a desired sample or archive. mutually exclusive with url
32143215
:type sample_hash: str
3215-
:param url: URL string. mutually exclusive with sample_hash
3216+
:param url: URL string; mutually exclusive with sample_hash
32163217
:type url: str
3218+
:param url_sha1: the sha1 of the submitter URL; it can be found in the response of the
3219+
DynamicAnalysis.detonate_url method; mutually exclusive with sample_hash and url
3220+
:type url_sha1: str
32173221
:param is_archive: needs to be set to True if results for a file archive are being fetched;
32183222
currently supported archive types: .zip; used only with sample_hash
32193223
:type is_archive: bool
@@ -3242,7 +3246,15 @@ def get_dynamic_analysis_results(self, sample_hash=None, url=None, is_archive=Fa
32423246
raise WrongInputError("url parameter must be a string")
32433247

32443248
indicator = base64.urlsafe_b64encode(url.encode("utf-8")).strip(b"=").decode()
3245-
endpoint_base = self.__GET_URL_RESULTS
3249+
endpoint_base = self.__GET_URL_RESULTS_BASE64
3250+
3251+
elif url_sha1:
3252+
validate_hashes(
3253+
hash_input=[url_sha1],
3254+
allowed_hash_types=(SHA1,)
3255+
)
3256+
indicator = url_sha1
3257+
endpoint_base = self.__GET_URL_RESULTS_SHA1
32463258

32473259
else:
32483260
raise WrongInputError("Either sample_hash or url need to be defined as parameters")

0 commit comments

Comments
 (0)