Files
2020-12-30 15:34:50 +01:00

31 lines
622 B
Python
Executable File

#!/usr/bin/python
print("Content-type: text/html\n")
import os
import cgi
import cgitb
origin_url = "https://augustiner-kantorei.de/upload"
cgitb.enable()
form = cgi.FieldStorage()
fileitem = form['myfile']
if fileitem.filename:
# strip leading path from file name to avoid
# directory traversal attacks
fn = os.path.basename(fileitem.filename)
open('../downloads/' + fn, 'wb').write(fileitem.file.read())
print(f"""
<html>
<head>
<!--meta http-equiv="refresh" content="0; url={origin_url}" /-->
</head>
<body>
<h2>Erfolgreich hochgeladen</h2>
<a href={origin_url}>Zurück zur Maske</a>
</body>
</html>
""")