fixes on sensitive data for publication

This commit is contained in:
klein panic
2024-10-01 23:29:19 -04:00
parent d01d5e3b3a
commit 404d680419
5 changed files with 43 additions and 1 deletions

2
server/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
transfer_service.db
locked_ips.txt

View File

@@ -1 +0,0 @@
10.0.0.235

41
server/reset_db.py Normal file
View File

@@ -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()

Binary file not shown.