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:
4
corsy.py
4
corsy.py
@@ -4,6 +4,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import argparse
|
import argparse
|
||||||
|
from requests.exceptions import ConnectionError
|
||||||
|
|
||||||
from core.tests import active_tests
|
from core.tests import active_tests
|
||||||
from core.utils import host, prompt, format_result, extractHeaders, create_url_list
|
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
|
netloc = parsed.netloc
|
||||||
scheme = parsed.scheme
|
scheme = parsed.scheme
|
||||||
url = scheme + '://' + netloc
|
url = scheme + '://' + netloc
|
||||||
|
try:
|
||||||
return active_tests(url, root, scheme, header_dict, delay)
|
return active_tests(url, root, scheme, header_dict, delay)
|
||||||
|
except ConnectionError as exc:
|
||||||
|
print(f'[WARNING] Unable to connect to {target}: {exc}')
|
||||||
|
|
||||||
|
|
||||||
if urls:
|
if urls:
|
||||||
|
|||||||
Reference in New Issue
Block a user