@@ -3099,7 +3099,8 @@ class DynamicAnalysis(TiCloudAPI):
3099
3099
__DETONATE_ARCHIVE_ENDPOINT = "/api/dynamic/analysis/analyze/v1/archive/query/json"
3100
3100
__GET_FILE_RESULTS = "/api/dynamic/analysis/report/v1/query/sha1"
3101
3101
__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"
3103
3104
3104
3105
def __init__ (self , host , username , password , verify = True , proxies = None , user_agent = DEFAULT_USER_AGENT ,
3105
3106
allow_none_return = False ):
@@ -3206,14 +3207,17 @@ def __detonate(self, platform, sample_sha1=None, url_string=None, is_archive=Fal
3206
3207
3207
3208
return response
3208
3209
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 ,
3210
3211
analysis_id = None ):
3211
3212
"""Returns dynamic analysis results for a desired file, URL or a file archive.
3212
3213
The analysis of the selected artifact must be finished for the results to be available.
3213
3214
:param sample_hash: SHA-1 hash of a desired sample or archive. mutually exclusive with url
3214
3215
:type sample_hash: str
3215
- :param url: URL string. mutually exclusive with sample_hash
3216
+ :param url: URL string; mutually exclusive with sample_hash
3216
3217
: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
3217
3221
:param is_archive: needs to be set to True if results for a file archive are being fetched;
3218
3222
currently supported archive types: .zip; used only with sample_hash
3219
3223
:type is_archive: bool
@@ -3242,7 +3246,15 @@ def get_dynamic_analysis_results(self, sample_hash=None, url=None, is_archive=Fa
3242
3246
raise WrongInputError ("url parameter must be a string" )
3243
3247
3244
3248
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
3246
3258
3247
3259
else :
3248
3260
raise WrongInputError ("Either sample_hash or url need to be defined as parameters" )
0 commit comments