update for now. technically speaking could some kind of fingerprinting be very usefull here

This commit is contained in:
jenz 2022-04-28 21:12:51 +02:00
parent 7892a73726
commit e51c8d87ad
3 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,49 @@
#!/home/nonroot/import_bans/venv/bin/python3
from settings import (get_connection)
def create_tables():
with get_connection() as conn:
with conn.cursor() as cur:
sql_statement = """
CREATE TABLE IF NOT EXISTS
`unloze_anti-spoofing`.kicklist
(
steam_id varchar(64) not null,
ipv4 varchar(64) not null,
kick boolean default FALSE,
inserted_on datetime default now(),
primary key (steam_id, ipv4)
)
"""
cur.execute(sql_statement)
def select_into_recent_bans():
with get_connection() as conn:
with conn.cursor() as cur:
sql_statement = """
insert IGNORE
`unloze_anti-spoofing`.kicklist(steam_id, ipv4)
select
cr.steam_id, cr.ipv4
from `unloze_anti-spoofing`.connect_restriction cr
where cr.cooldown > NOW()
"""
cur.execute(sql_statement)
def update_kick_flag():
with get_connection() as conn:
with conn.cursor() as cur:
sql_statement = """
update `unloze_anti-spoofing`.kicklist set kick = true
"""
cur.execute(sql_statement)
def main():
create_tables()
print("new iteration")
select_into_recent_bans()
#TODO generate some fingerprints to base the kick flag being set by
update_kick_flag()
if __name__ == '__main__':
main()

View File

@ -257,7 +257,7 @@ public void sql_truncate_sb_bans_shortened(Database db, DBResultSet results, con
if ((client = GetClientFromSerial(data)) == 0) if ((client = GetClientFromSerial(data)) == 0)
return; return;
char sql_statement[512]; char sql_statement[512];
Format(sql_statement, sizeof(sql_statement), "select distinct ip, authid from sb_bans where ip is not null and ip != '' and authid is not null and authid != '' and (RemoveType != 'U' or RemoveType is NULL) and (ends = created or ends > UNIX_TIMESTAMP())"); Format(sql_statement, sizeof(sql_statement), "select distinct ip, authid, name from sb_bans where ip is not null and ip != '' and authid is not null and authid != '' and (RemoveType != 'U' or RemoveType is NULL) and created > UNIX_TIMESTAMP(NOW() - INTERVAL 5 DAY) and (ends > UNIX_TIMESTAMP() or ends = created) order by created desc");
g_hDatabase_sourceban.Query(sql_select_sb_bans, sql_statement, GetClientSerial(client), DBPrio_High); g_hDatabase_sourceban.Query(sql_select_sb_bans, sql_statement, GetClientSerial(client), DBPrio_High);
delete results; delete results;
} }

View File

@ -0,0 +1,10 @@
[Unit]
Description=constantly updating the kicklist
[Service]
Type=simple
User=nonroot
WorkingDirectory=/home/nonroot/nosteam_verifier
Restart=always
RestartSec=5
ExecStart=/home/nonroot/nosteam_verifier/nosteam_checker.py