A HTTP(S) proxy built in python 3
- Easy to use
- Supports both IPv4 and IPv6
- Supports generating dynamic SSL certificates
- Parse requests and respones
- Python3
- pyOpenSSL
pip3 install -r requirements.txt
python3 test.py
By default the proxy will be running on 127.0.0.1:8888 To change the port or IP edit the test.py file and change the below code
startproxy(ip='<ip>', port=<port_no>)
To intercept HTTPS traffic, make sure to trust the ca.crt, which will be generated in certificates once you run the code. And all dynamic certificates will be generated in certicates/dynamic/ folder.
If you want to access the request and response, you can customize the callback code in test.py file
def callback(request, response):
# can handle the request and response
pass
request.headers
: Returns a dictonary of request headersrequest.parms
: Returns a dictonary of query parameters or Falserequest.body
: Returns a dictonary of post body parameters or Falserequest.json
: Returns True or False to let you know if the request.body are query parameters or JSONrequest.cookies
: Returns a dictonary of cookies or Falserequest.method
: Returns request method (GET, POST, PUT, DELETE etc)request.url
: Returns request url
response.headers
: Returns dictionary of respones headersresponse.text
: Returns response bodyresponse.cookies
: Returns list of cookies from set-cookie
To access attributes of cookies
for cookie in response.cookies:
'''
returns cookie name
'''
print(cookie.name)
'''
return cookie domain
'''
print(cookie.domain)
'''
return cookie path
'''
print(cookie.path)
'''
return cookie secure flag
'''
print(cookie.secure) // returns True or False
'''
return cookie http Flag
'''
print(cookie.http) // returns True or False
'''
return cookie expires
'''
print(cookie.expires)
'''
return cookie value
'''
print(cookie.value)