title: Python SQLi Scripts on WSL2 Errno 111
body: <p>I am trying to complete a portswigger academy exercise with the following python script.</p>
  <pre><code>    proxies = {'http': 'http://127.0.0.1:8080', 'https': 'https://127.0.0.1:8080'}
      def sqli_password(url):
      password_extracted = &quot;&quot;
      for i in range(1,21):   #Numbers of characters in the password
          for j in range(32,126):    #Iterating through the ASCII tables from 32 to 126
              sqli_payload = &quot;' and (select ascii(substring(password,%s,1)) from users where username='administrator')='%s'--';&quot; %(i,j)
              sqli_payload_encoded = urllib.parse.quote(sqli_payload)
              cookie = {'TrackingId':'hbORcjYUFBvjTbbq' + sqli_payload_encoded, 'session':'m6xmtbeL2CHAG8PMJjijbSZ9EqaWDwuY'}
              r = requests.get(url, cookies=cookie, verify=False)
  </code></pre>
  <p>I am proxying the requests through Burp using the localhost. I get the following error:</p>
  <pre><code>(+) Retrieving administrator password...
  Traceback (most recent call last):
    File &quot;/usr/lib/python3/dist-packages/urllib3/connection.py&quot;, line 159, in _new_conn
      conn = connection.create_connection(
    File &quot;/usr/lib/python3/dist-packages/urllib3/util/connection.py&quot;, line 84, in create_connection
      raise err
    File &quot;/usr/lib/python3/dist-packages/urllib3/util/connection.py&quot;, line 74, in create_connection
      sock.connect(sa)
  ConnectionRefusedError: [Errno 111] Connection refused
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;/usr/lib/python3/dist-packages/urllib3/connectionpool.py&quot;, line 662, in urlopen
      self._prepare_proxy(conn)
    File &quot;/usr/lib/python3/dist-packages/urllib3/connectionpool.py&quot;, line 950, in _prepare_proxy
      conn.connect()
    File &quot;/usr/lib/python3/dist-packages/urllib3/connection.py&quot;, line 314, in connect
      conn = self._new_conn()
    File &quot;/usr/lib/python3/dist-packages/urllib3/connection.py&quot;, line 171, in _new_conn
      raise NewConnectionError(
  urllib3.exceptions.NewConnectionError: &lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7fa9337d9e20&gt;: Failed to establish a new connection: [Errno 111] Connection refused
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;/usr/lib/python3/dist-packages/requests/adapters.py&quot;, line 439, in send
      resp = conn.urlopen(
    File &quot;/usr/lib/python3/dist-packages/urllib3/connectionpool.py&quot;, line 719, in urlopen
      retries = retries.increment(
    File &quot;/usr/lib/python3/dist-packages/urllib3/util/retry.py&quot;, line 436, in increment
      raise MaxRetryError(_pool, url, error or ResponseError(cause))
  urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ac181f151f07cec480be1f2b002c00f6.web-security-academy.net', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('&lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7fa9337d9e20&gt;: Failed to establish a new connection: [Errno 111] Connection refused')))
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    ...
  requests.exceptions.ProxyError: HTTPSConnectionPool(host='ac181f151f07cec480be1f2b002c00f6.web-security-academy.net', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('&lt;urllib3.connection.VerifiedHTTPSConnection object at 0x7fa9337d9e20&gt;: Failed to establish a new connection: [Errno 111] Connection refused')))
  </code></pre>
  <p>I tried to debug the code by using print, and I noticed that I couldn't print the state of the request. When removing proxies, the script is working perfectly. I assume the script is not able to proxy through burp. It might be because I am using WSL2. Burp is installed on my windows. I do not know how to fix this problem as interoperability should be enabled as I am able to access my Windows10 filesystem from WSL. I tried to launch this code from within the C drive using WSL2 but it's also not working. Is there a way to fix this interoperability problem?</p>