Skip to content

Commit 1468d03

Browse files
committed
1 parent 0e73561 commit 1468d03

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

src/core/requests/proxy.py

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,44 +37,32 @@ def do_check(url):
3737
try:
3838
response = _urllib.request.urlopen(request, timeout=settings.TIMEOUT)
3939
return response
40-
except Exception as err:
41-
if "Connection refused" in str(err):
42-
err_msg = "Unable to connect to the target URL or proxy ("
43-
err_msg += str(menu.options.proxy)
44-
err_msg += ")."
45-
print(settings.print_critical_msg(err_msg))
46-
raise SystemExit()
40+
except (_urllib.error.URLError, _urllib.error.HTTPError, _http_client.BadStatusLine) as err:
41+
err_msg = "Unable to connect to the target URL or proxy."
42+
print(settings.print_critical_msg(err_msg))
43+
raise SystemExit()
4744

4845
"""
4946
Use the defined HTTP Proxy
5047
"""
5148
def use_proxy(request):
49+
_ = True
5250
headers.do_check(request)
5351
request.set_proxy(menu.options.proxy, settings.PROXY_SCHEME)
5452
try:
5553
response = _urllib.request.urlopen(request, timeout=settings.TIMEOUT)
5654
return response
57-
except _http_client.BadStatusLine as err:
58-
err_msg = "Unable to connect to the target URL or proxy ("
59-
err_msg += str(menu.options.proxy)
60-
err_msg += ")."
61-
print(settings.print_critical_msg(err_msg))
62-
raise SystemExit()
6355
except _urllib.error.HTTPError as err:
6456
if str(err.code) == settings.INTERNAL_SERVER_ERROR or str(err.code) == settings.BAD_REQUEST:
65-
return False
66-
elif "Connection refused" in str(err):
67-
err_msg = "Unable to connect to the target URL or proxy ("
68-
err_msg += str(menu.options.proxy)
69-
err_msg += ")."
70-
print(settings.print_critical_msg(err_msg))
71-
raise SystemExit()
57+
return False
7258
else:
73-
try:
74-
err_msg = str(err.args[0]).split("] ")[1] + "."
75-
except IndexError:
76-
err_msg = str(err).replace(": "," (") + ")."
77-
print(settings.print_critical_msg(err_msg))
78-
raise SystemExit()
59+
_ = False
60+
except (_urllib.error.URLError, _http_client.BadStatusLine) as err:
61+
_ = False
62+
if not _:
63+
err_msg = "Unable to connect to the target URL or proxy."
64+
print(settings.print_critical_msg(err_msg))
65+
raise SystemExit()
66+
7967

8068
# eof

src/utils/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def sys_argv_errors():
216216
DESCRIPTION = "The command injection exploiter"
217217
AUTHOR = "Anastasios Stasinopoulos"
218218
VERSION_NUM = "3.4"
219-
REVISION = "1"
219+
REVISION = "2"
220220
STABLE_RELEASE = False
221221
if STABLE_RELEASE:
222222
VERSION = "v" + VERSION_NUM + "-stable"

0 commit comments

Comments
 (0)