The Burp Suite User Forum was discontinued on the 1st November 2024.

Burp Suite User Forum

For support requests, go to the Support Center. To discuss with other Burp users, head to our Discord page.

SUPPORT CENTER DISCORD

InsecureRequestWarning error when using proxy with python requests

Nicholas | Last updated: Dec 18, 2022 07:34PM UTC

I have a basic python request script that I want to view through a proxy first so I can review all the requests I make easily. I opened up burpsuite pre-installed version on Kali and have this code, ``` proxies = {"http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080"} r = session.get("https://www.google.com/", proxies=proxies, verify=False) print(r.text) ``` I check and burp is running open ports, nmap shows ``` PORT STATE SERVICE 8080/tcp open http-proxy ``` My problem is that when I run the script with python version 3.10.8 the request goes through, I can see the request in the burp proxy but my python script then hangs on the request with this error on stdout, ``` /usr/lib/python3/dist-packages/urllib3/connectionpool.py:1048: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings warnings.warn( ``` so it all goes through but my script wont progress. If I press ctrl+c I get this massive error, ``` ^CTraceback (most recent call last): File "/home/kali/Documents/Projects/Requests-IP-Rotator/main.py", line 24, in <module> main() File "/home/kali/Documents/Projects/Requests-IP-Rotator/main.py", line 20, in main r = session.get("https://www.google.com/", proxies=proxies, verify=False) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in get return self.request('GET', url, **kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 529, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 645, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send resp = conn.urlopen( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 704, in urlopen httplib_response = self._make_request( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 450, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 445, in _make_request httplib_response = conn.getresponse() File "/usr/lib/python3.10/http/client.py", line 1374, in getresponse response.begin() File "/usr/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File "/usr/lib/python3.10/http/client.py", line 279, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/lib/python3.10/socket.py", line 705, in readinto return self._sock.recv_into(b) File "/usr/lib/python3.10/ssl.py", line 1274, in recv_into return self.read(nbytes, buffer) File "/usr/lib/python3.10/ssl.py", line 1130, in read return self._sslobj.read(len, buffer) KeyboardInterrupt ``` I looked online and all I see is that I have to simply add the proxy line in python and it should be good to go to use burp proxy but I am still getting errors. I cant really find anything on how to create the certs or use them. All I do is open up burp and click on proxy maybe I am missing something. running on 6.0.0-kali5-amd64

Michelle, PortSwigger Agent | Last updated: Dec 19, 2022 10:06AM UTC