Compare commits
No commits in common. "main" and "1.1.1" have entirely different histories.
2 changed files with 9 additions and 13 deletions
20
app.py
20
app.py
|
@ -36,11 +36,6 @@ def return_error(message: string, code: int):
|
|||
resp.headers["Content-Type"] = "application/json"
|
||||
return resp
|
||||
|
||||
def no_cf_chunking(txt):
|
||||
resp = flask.Response(txt)
|
||||
resp.headers["X-Content-Length"] = len(txt.encode("utf-8")) # Cloudflares Proxy strips "Content-Length" when chunking, so we just re-add it manually.
|
||||
return resp
|
||||
|
||||
# docker
|
||||
if config["docker"]:
|
||||
report_dir = "/data/reports"
|
||||
|
@ -69,7 +64,8 @@ def index():
|
|||
|
||||
return render_template("index.html", uploadIndex=uploadIndex, report_count=report_count[0][0], svr_ver=config["version"]), 200
|
||||
|
||||
@app.route("/syscheck_receiver.php", methods=["POST"])
|
||||
@app.route("/syscheck_up.php", methods=["POST"]) # SysCheckME-dev
|
||||
@app.route("/syscheck_receiver.php", methods=["POST"]) # literally anything else (DNS?)
|
||||
def syscheck_report():
|
||||
form_data = request.form.to_dict(flat=False)
|
||||
report_txt = form_data["syscheck"][0]
|
||||
|
@ -77,12 +73,12 @@ def syscheck_report():
|
|||
|
||||
# check if console id: is present
|
||||
if console_id == "0":
|
||||
return no_cf_chunking("ERROR: Not a valid sysCheck!"), 200
|
||||
return "ERROR: Not a valid sysCheck!", 200
|
||||
# check if syscheck isn't too small or too large
|
||||
if len(report_txt.encode("utf-8")) > 6144:
|
||||
return no_cf_chunking("ERROR: Report is too large! Max is 6KB."), 200
|
||||
return "ERROR: Report is too large! Max is 6KB.", 200
|
||||
elif len(report_txt.encode("utf-8")) < 1330:
|
||||
return no_cf_chunking("ERROR: Report is too small! Min is 1.3KB."), 200
|
||||
return "ERROR: Report is too small! Min is 1.3KB.", 200
|
||||
|
||||
timestamp = int(time.time())
|
||||
report_id = id_generator(6, 'AaBbCcDdFfeEgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWXxYyZz1234567890')
|
||||
|
@ -98,12 +94,12 @@ def syscheck_report():
|
|||
db.commit()
|
||||
db.close()
|
||||
|
||||
return no_cf_chunking(f"Success! Report ID: {report_id}"), 200
|
||||
return f"Success! Report ID: {report_id}", 200
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
return no_cf_chunking("ERROR: Failed to save SysCheck report!"), 200
|
||||
return "ERROR: Failed to save SysCheck report!", 200
|
||||
else:
|
||||
return no_cf_chunking("ERROR: Unauthorized"), 200
|
||||
return "ERROR: Unauthorized", 200
|
||||
|
||||
@app.route("/download_csv", methods=["GET"], defaults={'_route': 'direct'})
|
||||
@app.route("/view_report", methods=["GET"], defaults={'_route': 'template'})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"ip": "0.0.0.0",
|
||||
"port": "6969",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.1",
|
||||
"upload_password": "B277eNGp789a",
|
||||
"docker": false
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue