Add error handling for refused connections. This will allow the tool to continue testing if one or more of the target urls refuses connections. Previously, this would cause the tool to stop once it encoutered a URL that refused a connection.

This commit is contained in:
David McKennirey
2021-01-15 07:42:47 -05:00
parent 437504ad80
commit b6dec2138e

View File

@@ -4,6 +4,7 @@
import sys
import json
import argparse
from requests.exceptions import ConnectionError
from core.tests import active_tests
from core.utils import host, prompt, format_result, extractHeaders, create_url_list
@@ -63,7 +64,10 @@ def cors(target, header_dict, delay):
netloc = parsed.netloc
scheme = parsed.scheme
url = scheme + '://' + netloc
return active_tests(url, root, scheme, header_dict, delay)
try:
return active_tests(url, root, scheme, header_dict, delay)
except ConnectionError as exc:
print(f'[WARNING] Unable to connect to {target}: {exc}')
if urls: