INNER CODE UNIT · Python
__init__
yashab-cyber/HackGpt · workbench/server.py:36
def __init__(self, directory):
directory = Path(directory)
directory.mkdir(parents=True, exist_ok=True, mode=0o700)
self.path = directory / "reports.sqlite3"
with closing(sqlite3.connect(self.path)) as connection:
connection.execute(
"CREATE TABLE IF NOT EXISTS reports (id TEXT PRIMARY KEY, started TEXT NOT NULL, content TEXT NOT NULL)"
)
connection.execute(
"CREATE TABLE IF NOT EXISTS active_runs (id TEXT PRIMARY KEY, started TEXT NOT NULL, content TEXT NOT NULL)"
)
connection.commit()
try:
self.path.chmod(0o600)
except OSError:
pass
def save_active(self, report):