XSStrike icon indicating copy to clipboard operation
XSStrike copied to clipboard

requests.exceptions.ConnectTimeout Error

Open oldesec opened this issue 5 years ago • 7 comments

Hi.

I can sometimes see the following error.

I can access the site through a browser.

This site is fast enough.

Increasing the "timeout" option does not resolve this issue.

Thanks.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 146, in _new_conn
    (self.host, self.timeout))
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7f9a07985518>, 'Connection to www. example.com timed out. (connect timeout=10)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='www. example.com', port=80): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f9a07985518>, 'Connection to www. example.com timed out. (connect timeout=10)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "xsstrike.py", line 167, in <module>
    scan(target, paramData, encoding, headers, delay, timeout, skipDOM, find, skip)
  File "/root/XSStrike/modes/scan.py", line 34, in scan
    response = requester(target, {}, headers, GET, delay, timeout).text
  File "/root/XSStrike/core/requester.py", line 39, in requester
    timeout=timeout, verify=False, proxies=core.config.proxies)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 496, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='www. example.com', port=80): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f9a07985518>, 'Connection to www. example.com timed out. (connect timeout=10)'))

oldesec avatar Mar 25 '19 12:03 oldesec

Hi there,

Sorry for such a late response, I was busy with my exams. Would it be possible for you to provide the website so I can reproduce the issue and see what's going on?

Thank you.

s0md3v avatar Apr 06 '19 08:04 s0md3v

I'm facing a similar issue with one of my target websites. I am using the latest version of XSStrike and had issued the following command python3 xsstrike.py -u "http://target.website.com" I even tried increasing the timeout but it did not help and the website runs smoothly on a web browser. I have DMed you the target website on Twitter.

Zatyam avatar May 30 '19 18:05 Zatyam

python3 -m pip install --upgrade urllib3

Run this command, this will solve the issue

steffinstanly avatar Feb 06 '20 10:02 steffinstanly

can confirm. I am getting this error pretty regularly. i run "python3 -m pip install --upgrade urllib3" but it does not help.

Here is an example: python3 xsstrike.py -u "https://liki24.com/uk/search/?q=%D0%90%D1%80%D0%BE%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0"

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/urllib3/connection.py", line 160, in _new_conn (self._dns_host, self.port), self.timeout, **extra_kw File "/usr/local/lib/python3.7/dist-packages/urllib3/util/connection.py", line 61, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/usr/lib/python3.7/socket.py", line 752, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 677, in urlopen chunked=chunked, File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 381, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 976, in _validate_conn conn.connect() File "/usr/local/lib/python3.7/dist-packages/urllib3/connection.py", line 308, in connect conn = self._new_conn() File "/usr/local/lib/python3.7/dist-packages/urllib3/connection.py", line 172, in _new_conn self, "Failed to establish a new connection: %s" % e urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fd86d6550d0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 725, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/usr/local/lib/python3.7/dist-packages/urllib3/util/retry.py", line 439, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='liki24.com', port=443): Max retries exceeded with url: /uk/search/?q=st4r7s</TItle=>=<deTaIlSOnpointeReNTeR=confirm()//3nd (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fd86d6550d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "xsstrike.py", line 174, in scan(target, paramData, encoding, headers, delay, timeout, skipDOM, find, skip) File "/root/XSStrike/modes/scan.py", line 103, in scan url, paramsCopy, headers, GET, delay, vect, positions, timeout, encoding) File "/root/XSStrike/core/checker.py", line 16, in checker params, xsschecker, checkString, copy.deepcopy), headers, GET, delay, timeout).text.lower() File "/root/XSStrike/core/requester.py", line 38, in requester timeout=timeout, verify=False, proxies=core.config.proxies) File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 75, in get return request('get', url, params=params, **kwargs) File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 668, in send history = [resp for resp in gen] if allow_redirects else [] File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 668, in history = [resp for resp in gen] if allow_redirects else [] File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 247, in resolve_redirects **adapter_kwargs File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='liki24.com', port=443): Max retries exceeded with url: /uk/search/?q=st4r7s</TItle=>=<deTaIlSOnpointeReNTeR=confirm()//3nd (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fd86d6550d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

In the /requests/adapter.py file set timeout = None in line 450.

worked for me.

masoodjalal5 avatar Apr 03 '22 11:04 masoodjalal5

reset environment variables and then again bootstrap

AbhiLitmus avatar Jul 19 '22 07:07 AbhiLitmus

trying to install presidio through this link https://microsoft.github.io/presidio/getting_started/ while executing this step python -m spacy download en_core_web_lg I am getting the following error. I have a Windows 10 machine , have installed python, pip 23.0.1. And I am new to Python though.

============================ Please find the Error Message below :

python -m spacy download en_core_web_lg Traceback (most recent call last): File "E:\Python\Python310\lib\site-packages\urllib3\connection.py", line 174, in _new_conn conn = connection.create_connection( File "E:\Python\Python310\lib\site-packages\urllib3\util\connection.py", line 95, in create_connection raise err File "E:\Python\Python310\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "E:\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "E:\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn conn.connect() File "E:\Python\Python310\lib\site-packages\urllib3\connection.py", line 358, in connect self.sock = conn = self._new_conn() File "E:\Python\Python310\lib\site-packages\urllib3\connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x0000026387DB0160>, 'Connection to raw.githubusercontent.com timed out. (connect timeout=None)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\Python\Python310\lib\site-packages\requests\adapters.py", line 489, in send resp = conn.urlopen( File "E:\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen retries = retries.increment( File "E:\Python\Python310\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /explosion/spacy-models/master/compatibility.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000026387DB0160>, 'Connection to raw.githubusercontent.com timed out. (connect timeout=None)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "E:\Python\Python310\lib\runpy.py", line 86, in run_code exec(code, run_globals) File "E:\Python\Python310\lib\site-packages\spacy_main.py", line 4, in setup_cli() File "E:\Python\Python310\lib\site-packages\spacy\cli_util.py", line 74, in setup_cli command(prog_name=COMMAND) File "E:\Python\Python310\lib\site-packages\click\core.py", line 1130, in call return self.main(*args, **kwargs) File "E:\Python\Python310\lib\site-packages\typer\core.py", line 778, in main return _main( File "E:\Python\Python310\lib\site-packages\typer\core.py", line 216, in _main rv = self.invoke(ctx) File "E:\Python\Python310\lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "E:\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "E:\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke return __callback(*args, **kwargs) File "E:\Python\Python310\lib\site-packages\typer\main.py", line 683, in wrapper return callback(**use_params) # type: ignore File "E:\Python\Python310\lib\site-packages\spacy\cli\download.py", line 36, in download_cli download(model, direct, sdist, *ctx.args) File "E:\Python\Python310\lib\site-packages\spacy\cli\download.py", line 70, in download compatibility = get_compatibility() File "E:\Python\Python310\lib\site-packages\spacy\cli\download.py", line 97, in get_compatibility r = requests.get(about.compatibility) File "E:\Python\Python310\lib\site-packages\requests\api.py", line 73, in get return request("get", url, params=params, **kwargs) File "E:\Python\Python310\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "E:\Python\Python310\lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "E:\Python\Python310\lib\site-packages\requests\sessions.py", line 701, in send r = adapter.send(request, **kwargs) File "E:\Python\Python310\lib\site-packages\requests\adapters.py", line 553, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /explosion/spacy-models/master/compatibility.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000026387DB0160>, 'Connection to raw.githubusercontent.com timed out. (connect timeout=None)'))

==================EOF=======================

Kindly let me know the fix, Thank you.

LakshmigeethaS avatar Feb 22 '23 14:02 LakshmigeethaS