I'm trying to use requests python to create a post request together with the submit form data. Here it is the HTML form:
<form action="" method="POST" enctype="multipart/form-data">
<div class="dropzone">
<div class="content">
<img src="https://100dayscss.com/codepen/upload.svg" class="upload">
<span class="filename"></span>
<input type="file" class="input" name="image">
</div>
</div>
<input class="upload-btn" type="submit" value="Upload Image" name="submit">
</form>
Here it is an image of the original request (which works) using BurpSuite:

Then made this request in python:
payload_img = make_payload_img() # Creates an image and returns the name of it
post_url = f"{target}/upload.php" # Target is the ip of who we are sending the request to
files = {
'image': (payload_img, open(payload_img, 'rb'), "image/png"),
}
headers = {"Cache-Control": "max-age=0", "Upgrade-Insecure-Requests": "1", "Origin": "http://10.10.10.185", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Referer": "http://10.10.10.185/upload.php"}
# The proxies are just to intercept the request on BurpSuite
proxies = {
"http": "http://127.0.0.1:8080",
"https": "http://127.0.0.1:8080",
}
upload_file = s.post(post_url,files=files,headers=headers,proxies=proxies)
However in the intercepted request on BurpSuite is missing Content-Disposition: form-data; name="submit" at the end:
Is it possible to add it manually or python requests multipart doesn't allow you to do so?
