fixes on sensitive data for publication
This commit is contained in:
2
server/.gitignore
vendored
Normal file
2
server/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
transfer_service.db
|
||||
locked_ips.txt
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
10.0.0.235
|
||||
41
server/reset_db.py
Normal file
41
server/reset_db.py
Normal 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.
Reference in New Issue
Block a user