From 404d680419e22ce12e7337fa94ad4e62b134b493 Mon Sep 17 00:00:00 2001 From: klein panic Date: Tue, 1 Oct 2024 23:29:19 -0400 Subject: [PATCH] fixes on sensitive data for publication --- server/.gitignore | 2 + server/__pycache__/security.cpython-311.pyc | Bin 3534 -> 3534 bytes server/locked_ips.txt | 1 - server/reset_db.py | 41 ++++++++++++++++++++ server/transfer_service.db | Bin 16384 -> 0 bytes 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 server/.gitignore delete mode 100644 server/locked_ips.txt create mode 100644 server/reset_db.py delete mode 100644 server/transfer_service.db diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 0000000..dbd990c --- /dev/null +++ b/server/.gitignore @@ -0,0 +1,2 @@ +transfer_service.db +locked_ips.txt diff --git a/server/__pycache__/security.cpython-311.pyc b/server/__pycache__/security.cpython-311.pyc index cb17c8d6a8d92b6f9bd4566e499848b263a04667..2ee662ab0f5eddf3f1fcafc5c33fcaee1e409462 100644 GIT binary patch delta 19 acmX>neNLKdIWI340|NsC)1Hl7M|c4=I|T9o delta 19 bcmX>neNLKdIWI340|NuY{4E=~j_?8iH^Bvm diff --git a/server/locked_ips.txt b/server/locked_ips.txt deleted file mode 100644 index b999c3a..0000000 --- a/server/locked_ips.txt +++ /dev/null @@ -1 +0,0 @@ -10.0.0.235 diff --git a/server/reset_db.py b/server/reset_db.py new file mode 100644 index 0000000..da52edb --- /dev/null +++ b/server/reset_db.py @@ -0,0 +1,41 @@ +import os +import sqlite3 +from contextlib import closing + +DATABASE = 'transfer_service.db' + +def reset_database(): + # Remove the existing database file + if os.path.exists(DATABASE): + os.remove(DATABASE) + print(f"Removed existing database '{DATABASE}'.") + + # Recreate the database structure + with closing(sqlite3.connect(DATABASE)) as conn, conn, closing(conn.cursor()) as c: + # Create users table + c.execute(''' + CREATE TABLE IF NOT EXISTS users ( + id INTEGER PRIMARY KEY, + username TEXT UNIQUE NOT NULL, + password TEXT NOT NULL, + salt TEXT NOT NULL, -- Added salt column + login_attempts INTEGER DEFAULT 0 + ) + ''') + + # Create uploads table for storing links, files, and images + c.execute(''' + CREATE TABLE IF NOT EXISTS uploads ( + id INTEGER PRIMARY KEY, + uploader TEXT NOT NULL, + file_type TEXT NOT NULL, -- 'link', 'file', or 'image' + content TEXT NOT NULL, -- The actual link, filename, or file path + uploaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) + ''') + + conn.commit() + print("Database initialized successfully.") + +if __name__ == '__main__': + reset_database() diff --git a/server/transfer_service.db b/server/transfer_service.db deleted file mode 100644 index be135b7d1a85057fc904373f1b18699b26415286..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmWFz^vNtqRY=P(%1ta$FlG>7U}R))P*7lCV8~}+U|?ZD0A@5kBSH!%E1y9xnUR<8 zApaSl=EWzLl%(bsloZ3A;^OM&80r(EV1VKd9fjh=oD#5+noX+A?BdeWj4g@~Zx`g` zC#DpaLMRqguR{bW@jTds)FQCeczm6fnUfk{Qds~ECAha06m)eJ)N?ZPvegyxixku| za}(23)lvKgik9U3ypq&BhzIf5l35&|l3$(&@^C65_OJ(;CjSqHHw049u#wheViUI& zXJp9COG&LLF3ia+NsUh|Ey)M-<3TC7INlIUf%@_sAb;~RFfcIkFJj