re simplified the python flask endpoint, remade the order so after update it dispalys motd in vgui menu invisibly, then after 5 seconds it checks the generated fingerprint for ban avoiding
This commit is contained in:
@@ -26,32 +26,25 @@ def get_answer():
|
||||
with get_connection_ban_detector() as conn:
|
||||
with conn.cursor(buffered=True) as cur: #wtf is this buffered shit even
|
||||
sql_statement = """
|
||||
UPDATE ban_detector.ban_detector x
|
||||
SET fingerprint = %s,
|
||||
modified_on = now()
|
||||
WHERE
|
||||
UPDATE ban_detector.ban_detector x
|
||||
SET fingerprint = %s,
|
||||
modified_on = now()
|
||||
WHERE
|
||||
x.ip = %s
|
||||
and
|
||||
x.last_connect = (select last_connect
|
||||
from ban_detector.ban_detector x1
|
||||
where
|
||||
x1.ip = x.ip
|
||||
and
|
||||
x.last_connect = (select last_connect
|
||||
from ban_detector.ban_detector x1
|
||||
where
|
||||
x1.ip = x.ip
|
||||
order by last_connect desc limit 1);
|
||||
"""
|
||||
cur.execute(sql_statement, [name, ip])
|
||||
crowcount = cur.rowcount
|
||||
conn.commit()
|
||||
conn.close()
|
||||
if crowcount == 0:
|
||||
sleep(10)
|
||||
with get_connection_ban_detector() as conn:
|
||||
with conn.cursor(buffered=True) as cur: #wtf is this buffered shit even
|
||||
cur.execute(sql_statement, [name, ip])
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print("comitting content: ", content)
|
||||
return ""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from waitress import serve
|
||||
serve(app, host="localhost", port=5085, threads = 8)
|
||||
|
||||
Reference in New Issue
Block a user