diff --git a/anyrun.json b/anyrun.json index 2c22794..af1ced6 100644 --- a/anyrun.json +++ b/anyrun.json @@ -11,7 +11,7 @@ "product_version_regex": ".*", "publisher": "ANYRUN FZCO", "license": "Copyright (c) ANYRUN FZCO, 2024", - "app_version": "1.1.0", + "app_version": "1.2.0", "utctime_updated": "2024-03-01T10:28:44.583548Z", "package_name": "phantom_any.run", "main_module": "anyrun_connector.py", @@ -1022,9 +1022,6 @@ "Windows7x32_clean", "Windows7x32_office", "Windows7x32_complete", - "Windows8.1x32_clean", - "Windows8.1x32_office", - "Windows8.1x32_complete", "Windows10x32_clean", "Windows10x32_office", "Windows10x32_complete", @@ -1034,9 +1031,6 @@ "Windows7x64_clean", "Windows7x64_office", "Windows7x64_complete", - "Windows8.1x64_clean", - "Windows8.1x64_office", - "Windows8.1x64_complete", "Windows10x64_clean", "Windows10x64_office", "Windows10x64_complete", @@ -1604,9 +1598,6 @@ "Windows7x32_clean", "Windows7x32_office", "Windows7x32_complete", - "Windows8.1x32_clean", - "Windows8.1x32_office", - "Windows8.1x32_complete", "Windows10x32_clean", "Windows10x32_office", "Windows10x32_complete", @@ -1616,9 +1607,6 @@ "Windows7x64_clean", "Windows7x64_office", "Windows7x64_complete", - "Windows8.1x64_clean", - "Windows8.1x64_office", - "Windows8.1x64_complete", "Windows10x64_clean", "Windows10x64_office", "Windows10x64_complete", @@ -2797,7 +2785,7 @@ }, { "module": "anyrun", - "input_file": "wheels/anyrun_py-0.1.1-py3-none-any.whl" + "input_file": "wheels/anyrun_py-0.1.2-py3-none-any.whl" } ] }, @@ -2841,7 +2829,7 @@ }, { "module": "anyrun", - "input_file": "wheels/py3/anyrun_py-0.1.1-py3-none-any.whl" + "input_file": "wheels/py3/anyrun_py-0.1.2-py3-none-any.whl" } ] } diff --git a/anyrun_connector.py b/anyrun_connector.py index 74f7239..c6915d8 100755 --- a/anyrun_connector.py +++ b/anyrun_connector.py @@ -16,6 +16,7 @@ from __future__ import print_function, unicode_literals import re +import time # Phantom App imports import phantom.app as phantom @@ -467,18 +468,23 @@ def _handle_detonate_url(self, param): # Making an API call self.save_progress(f"Detonating URL: {obj_url}") - try: - error_message = None - response = self._anyrun_sandbox.submit_url(obj_url, obj_type, data) - except APIError as exc: - error_message = self._get_error_message_from_exception(exc) - except Exception as exc: # pylint: disable=broad-except - error_message = self._get_error_message_from_exception(exc) - error_message = ANYRUN_REST_API_ERROR.format(ACTION_ID_ANYRUN_DETONATE_URL, error_message) - finally: - if error_message: - self.save_progress(error_message) - return action_result.set_status(phantom.APP_ERROR, error_message) + response = None + while response is None: + try: + error_message = None + response = self._anyrun_sandbox.submit_url(obj_url, obj_type, data) + except APIError as exc: + if exc.message == "Parallel task limit": + time.sleep(5) + continue + error_message = self._get_error_message_from_exception(exc) + except Exception as exc: # pylint: disable=broad-except + error_message = self._get_error_message_from_exception(exc) + error_message = ANYRUN_REST_API_ERROR.format(ACTION_ID_ANYRUN_DETONATE_URL, error_message) + finally: + if error_message: + self.save_progress(error_message) + return action_result.set_status(phantom.APP_ERROR, error_message) self.save_progress(ANYRUN_SUCCESS_DETONATE_URL.format(obj_url)) # Processing server response @@ -548,18 +554,24 @@ def _handle_detonate_file(self, param): # Making an API call self.save_progress(f"Detonating file with vault ID: {vault_id}") - try: - error_message = None - response = self._anyrun_sandbox.submit_file(file_path, data) - except APIError as exc: - error_message = self._get_error_message_from_exception(exc) - except Exception as exc: # pylint: disable=broad-except - error_message = self._get_error_message_from_exception(exc) - error_message = ANYRUN_REST_API_ERROR.format(ACTION_ID_ANYRUN_DETONATE_FILE, error_message) - finally: - if error_message: - self.save_progress(error_message) - return action_result.set_status(phantom.APP_ERROR, error_message) + response = None + while response is None: + try: + error_message = None + with open(file_path, "rb") as file: + response = self._anyrun_sandbox.submit_file(file, data) + except APIError as exc: + if exc.message == "Parallel task limit": + time.sleep(5) + continue + error_message = self._get_error_message_from_exception(exc) + except Exception as exc: # pylint: disable=broad-except + error_message = self._get_error_message_from_exception(exc) + error_message = ANYRUN_REST_API_ERROR.format(ACTION_ID_ANYRUN_DETONATE_FILE, error_message) + finally: + if error_message: + self.save_progress(error_message) + return action_result.set_status(phantom.APP_ERROR, error_message) self.save_progress(ANYRUN_SUCCESS_DETONATE_FILE.format(vault_id)) # Processing server response diff --git a/manual_readme_content.md b/manual_readme_content.md index 50630d6..1615fc4 100755 --- a/manual_readme_content.md +++ b/manual_readme_content.md @@ -18,4 +18,4 @@ This connector comes with some additional python 3 libraries, that it depends on - yarl-1.9.4 (Apache License 2.0, Copyright 2016-2021, Andrew Svetlov and aio-libs team) - frozenlist-1.4.1 (Apache License 2.0, Copyright 2013-2019 Nikolay Kim and Andrew Svetlov) - aiohttp-3.10.2 (Apache License 2.0, Copyright aio-libs contributors) - - anyrun_py-0.1.1 + - anyrun_py-0.1.2 diff --git a/release_notes/unreleased.md b/release_notes/unreleased.md index fbcb2fd..e779e04 100644 --- a/release_notes/unreleased.md +++ b/release_notes/unreleased.md @@ -1 +1,4 @@ **Unreleased** +* Removed Windows 8.1 options from `detonate` actions +* Added "Parallel task limit" error handling to `detonate` actions +* Updated anyrun-py lib \ No newline at end of file diff --git a/wheels/anyrun_py-0.1.1-py3-none-any.whl b/wheels/anyrun_py-0.1.1-py3-none-any.whl deleted file mode 100644 index 208e637..0000000 Binary files a/wheels/anyrun_py-0.1.1-py3-none-any.whl and /dev/null differ diff --git a/wheels/anyrun_py-0.1.2-py3-none-any.whl b/wheels/anyrun_py-0.1.2-py3-none-any.whl new file mode 100644 index 0000000..d402df7 Binary files /dev/null and b/wheels/anyrun_py-0.1.2-py3-none-any.whl differ diff --git a/wheels/py3/anyrun_py-0.1.1-py3-none-any.whl b/wheels/py3/anyrun_py-0.1.1-py3-none-any.whl deleted file mode 100644 index 208e637..0000000 Binary files a/wheels/py3/anyrun_py-0.1.1-py3-none-any.whl and /dev/null differ diff --git a/wheels/py3/anyrun_py-0.1.2-py3-none-any.whl b/wheels/py3/anyrun_py-0.1.2-py3-none-any.whl new file mode 100644 index 0000000..d402df7 Binary files /dev/null and b/wheels/py3/anyrun_py-0.1.2-py3-none-any.whl differ