1) "We could not scan this website" - 404 error
when the target website is down, Resilient fail in downloading the image generated link : 
and failed in downloading the API report: https://urlscan.io/api/v1/result/3b42b797-6a48-4f32-ae17-6090c9ab4b25/
Results is an integration application log error, and losing valid report link of website, report that exist at ScanIO, and delivering an error in the Action & Workflow status, not mentioned to Analyst.
Log details:
2021-03-24 23:06:56,083 INFO [decorators] [urlscanio] StatusMessage: Downloaded report from https://urlscan.io/api/v1/result/3b42b797-6a48-4f32-ae17-6090c9ab4b25/
2021-03-24 23:06:56,264 ERROR [requests_common] 404 Client Error: Not Found for url: https://urlscan.io/screenshots/3b42b797-6a48-4f32-ae17-6090c9ab4b25.png
2021-03-24 23:06:56,289 ERROR [actions_component] <task[functionworker] (<function function.__call__.<locals>.decorated.<locals>._call_the_task at 0x7f650c65f1e0>, <urlscanio[functions.urlscanio] (id=133, workflow=enrichment_scanio, user=analyst@local.io) 2021-03-24 23:06:23.744000> urlscanio_url='https://telefonfiyatlari.org', incident_id=2135)> (<class 'resilient_circuits.action_message.FunctionException_'>):
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 130, in execute_call_v2
response.raise_for_status()
File "/opt/app-root/lib/python3.6/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://urlscan.io/screenshots/3b42b797-6a48-4f32-ae17-6090c9ab4b25.png
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/fn_urlscanio/components/urlscanio.py", line 103, in _urlscanio_function
urlscanio_png_get = req_common.execute_call_v2("GET", urlscanio_png_url, self.timeout)
File "/opt/app-root/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 138, in execute_call_v2
raise IntegrationError(msg)
resilient_lib.components.integration_errors.IntegrationError: '404 Client Error: Not Found for url: https://urlscan.io/screenshots/3b42b797-6a48-4f32-ae17-6090c9ab4b25.png'
2) Error: 429 Client Error: Too Many Requests for url
When getting multiple URL artifact in a new incident, SCanIO refuse to deliver the result, as too many requests are made.
Looking at the error and looping with a pause before re-submitting should avoid those errors, only visible in the Action & Workflow status, not mentioned to Analyst, and can't be use in a workflow process design (Pause - resubmit)
Traceback (most recent call last): File "/opt/app-root/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 130, in execute_call_v2 response.raise_for_status() File "/opt/app-root/lib/python3.6/site-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://urlscan.io/api/v1/scan/ During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/app-root/lib/python3.6/site-packages/fn_urlscanio/components/urlscanio.py", line 70, in _urlscanio_function data=json.dumps(urlscanio_data)) File "/opt/app-root/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 138, in execute_call_v2 raise IntegrationError(msg) resilient_lib.components.integration_errors.IntegrationError: '429 Client Error: Too Many Requests for url: https://urlscan.io/api/v1/scan/'
Log:
2021-03-25 08:25:35,386 INFO [urlscanio] urlscanio_url: https://kindlink.global
2021-03-25 08:25:35,487 ERROR [requests_common] 429 Client Error: Too Many Requests for url: https://urlscan.io/api/v1/scan/
2021-03-25 08:25:35,488 ERROR [actions_component] <task[functionworker] (<function function.__call__.<locals>.decorated.<locals>._call_the_task at 0x7f6850634840>, <urlscanio[functions.urlscanio] (id=133, workflow=enrichment_scanio, user=analyst@local.io) 2021-03-25 08:25:34.090000> urlscanio_url='https://kindlink.global', incident_id=2135)> (<class 'resilient_circuits.action_message.FunctionException_'>):
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 130, in execute_call_v2
response.raise_for_status()
File "/opt/app-root/lib/python3.6/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://urlscan.io/api/v1/scan/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/fn_urlscanio/components/urlscanio.py", line 70, in _urlscanio_function
data=json.dumps(urlscanio_data))
File "/opt/app-root/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 138, in execute_call_v2
raise IntegrationError(msg)
resilient_lib.components.integration_errors.IntegrationError: '429 Client Error: Too Many Requests for url: https://urlscan.io/api/v1/scan/'
3) 400 error
On some Websites we get a 400 error - See log below
Results is an integration application log error, and losing a valid report link of website, report that exist at ScanIO, and delivering an error in the Action & Workflow status, not mentioned to Analyst.
021-03-24 23:06:32,775 INFO [urlscanio] urlscanio_url: https://www.antibasic.ga
2021-03-24 23:06:34,120 ERROR [requests_common] 400 Client Error: Bad Request for url: https://urlscan.io/api/v1/scan/
2021-03-24 23:06:34,180 ERROR [actions_component] <task[functionworker] (<function function.__call__.<locals>.decorated.<locals>._call_the_task at 0x7f650c4e38c8>, <urlscanio[functions.urlscanio] (id=133, workflow=enrichment_scanio, user=analyst@local.io) 2021-03-24 23:06:32.269000> urlscanio_url='https://www.antibasic.ga', incident_id=2135)> (<class 'resilient_circuits.action_message.FunctionException_'>):
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 130, in execute_call_v2
response.raise_for_status()
File "/opt/app-root/lib/python3.6/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://urlscan.io/api/v1/scan/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/app-root/lib/python3.6/site-packages/fn_urlscanio/components/urlscanio.py", line 70, in _urlscanio_function
data=json.dumps(urlscanio_data))
File "/opt/app-root/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 138, in execute_call_v2
raise IntegrationError(msg)
resilient_lib.components.integration_errors.IntegrationError: '400 Client Error: Bad Request for url: https://urlscan.io/api/v1/scan/'
How can the code be modified to push back the error when there is one (to be processed by the workflow), and not just break the action and the workflow?
------------------------------
BENOIT ROSTAGNI
------------------------------