From 0725537b661b4e2facfff4612540bf4fe5fbb591 Mon Sep 17 00:00:00 2001 From: overcuriousity Date: Wed, 8 Oct 2025 13:27:51 +0200 Subject: [PATCH] initialize repository --- .gitignore | 3 +- .vscode/launch.json | 21 ++++ .vscode/settings.json | 15 +++ pyproject.toml | 59 ++++++++++++ src/forensictrails/__init__.py | 0 src/forensictrails/__main__.py | 24 +++++ src/forensictrails/core/__init__.py | 0 src/forensictrails/db/__init__.py | 0 src/forensictrails/db/schema.sql | 107 +++++++++++++++++++++ src/forensictrails/gui/__init__.py | 0 src/forensictrails/gui/dialogs/__init__.py | 0 src/forensictrails/gui/widgets/__init__.py | 0 src/forensictrails/utils/__init__.py | 0 tests/__init__.py | 0 14 files changed, 227 insertions(+), 2 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 pyproject.toml create mode 100644 src/forensictrails/__init__.py create mode 100644 src/forensictrails/__main__.py create mode 100644 src/forensictrails/core/__init__.py create mode 100644 src/forensictrails/db/__init__.py create mode 100644 src/forensictrails/db/schema.sql create mode 100644 src/forensictrails/gui/__init__.py create mode 100644 src/forensictrails/gui/dialogs/__init__.py create mode 100644 src/forensictrails/gui/widgets/__init__.py create mode 100644 src/forensictrails/utils/__init__.py create mode 100644 tests/__init__.py diff --git a/.gitignore b/.gitignore index 0dbf2f2..40305fc 100644 --- a/.gitignore +++ b/.gitignore @@ -166,5 +166,4 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ - +#.idea/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..e62cfac --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Python: ForensicTrails", + "type": "debugpy", + "request": "launch", + "module": "forensictrails", + "console": "integratedTerminal", + "justMyCode": true + }, + { + "name": "Python: Current File", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2866753 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "python.defaultInterpreterPath": "${workspaceFolder}/venv/bin/python", + "python.testing.pytestEnabled": true, + "python.testing.pytestArgs": [ + "tests" + ], + "editor.formatOnSave": true, + "editor.rulers": [ + 100 + ], + "files.exclude": { + "**/__pycache__": true, + "**/*.pyc": true + } +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9654100 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,59 @@ +[build-system] +requires = ["setuptools>=68.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "forensictrails" +version = "0.1.0" +description = "Forensic Investigation Documentation System" +readme = "README.md" +requires-python = ">=3.12" +license = {text = "MIT"} # Change as needed +authors = [ + {name = "Your Name", email = "your.email@example.com"} +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Legal Industry", + "Programming Language :: Python :: 3.12", +] + +dependencies = [ + "PyQt6>=6.6.0", + "PyQt6-WebEngine>=6.6.0", + "reportlab>=4.0.0", + "python-docx>=1.0.0", + "Pillow>=10.0.0", + "cryptography>=41.0.0", + "pyinstaller>=6.0.0", +] + +[project.optional-dependencies] +dev = [ + "pytest>=7.4.0", + "pytest-qt>=4.2.0", + "pytest-cov>=4.1.0", + "black>=23.0.0", + "ruff>=0.1.0", + "mypy>=1.5.0", +] + +[project.scripts] +forensictrails = "forensictrails.__main__:main" + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.black] +line-length = 100 +target-version = ['py313'] + +[tool.ruff] +line-length = 100 +target-version = "py313" + +[tool.pytest.ini_options] +testpaths = ["tests"] +python_files = ["test_*.py"] +python_classes = ["Test*"] +python_functions = ["test_*"] \ No newline at end of file diff --git a/src/forensictrails/__init__.py b/src/forensictrails/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/forensictrails/__main__.py b/src/forensictrails/__main__.py new file mode 100644 index 0000000..75f7f76 --- /dev/null +++ b/src/forensictrails/__main__.py @@ -0,0 +1,24 @@ +"""Entry point for ForensicTrails application.""" +import sys +from PyQt6.QtWidgets import QApplication + + +def main(): + """Main entry point for the application.""" + app = QApplication(sys.argv) + app.setApplicationName("ForensicTrails") + app.setOrganizationName("Your Organization") + + # TODO: Create and show main window + # from forensictrails.gui.main_window import MainWindow + # window = MainWindow() + # window.show() + + print("ForensicTrails - Forensic Investigation Documentation System") + print("Application starting...") + + sys.exit(app.exec()) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/src/forensictrails/core/__init__.py b/src/forensictrails/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/forensictrails/db/__init__.py b/src/forensictrails/db/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/forensictrails/db/schema.sql b/src/forensictrails/db/schema.sql new file mode 100644 index 0000000..d44e473 --- /dev/null +++ b/src/forensictrails/db/schema.sql @@ -0,0 +1,107 @@ +-- Cases table +CREATE TABLE cases ( + case_id TEXT PRIMARY KEY, + title TEXT NOT NULL, + date_opened TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + lead_investigator TEXT NOT NULL, + classification TEXT, + summary TEXT, + status TEXT DEFAULT 'Active', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + modified_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +-- Notes table (append-only, immutable) +CREATE TABLE notes ( + note_id TEXT PRIMARY KEY, + case_id TEXT NOT NULL, + timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + content TEXT NOT NULL, + investigator TEXT NOT NULL, + question_tags TEXT, -- JSON array: ["WHO", "WHAT", etc.] + hash TEXT NOT NULL, -- SHA256 of content + timestamp + FOREIGN KEY (case_id) REFERENCES cases(case_id) +); + +-- Evidence table +CREATE TABLE evidence ( + evidence_id TEXT PRIMARY KEY, + case_id TEXT, + description TEXT NOT NULL, + filename TEXT, + file_size INTEGER, + md5_hash TEXT, + sha256_hash TEXT, + source_origin TEXT, + received_date DATE, + received_by TEXT, + physical_location TEXT, + notes TEXT, + status TEXT DEFAULT 'Active', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (case_id) REFERENCES cases(case_id) +); + +-- Chain of Custody table +CREATE TABLE chain_of_custody ( + coc_id TEXT PRIMARY KEY, + evidence_id TEXT NOT NULL, + timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + action TEXT NOT NULL, -- 'received', 'transferred', 'accessed', 'archived' + from_person TEXT, + to_person TEXT, + location TEXT, + purpose TEXT, + signature_hash TEXT, -- Digital signature if needed + FOREIGN KEY (evidence_id) REFERENCES evidence(evidence_id) +); + +-- Attachments table (screenshots, documents) +CREATE TABLE attachments ( + attachment_id TEXT PRIMARY KEY, + case_id TEXT NOT NULL, + note_id TEXT, -- Optional link to specific note + filename TEXT NOT NULL, + file_path TEXT NOT NULL, + file_hash TEXT NOT NULL, + mime_type TEXT, + timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (case_id) REFERENCES cases(case_id), + FOREIGN KEY (note_id) REFERENCES notes(note_id) +); + +-- Investigation Questions tracking +CREATE TABLE question_entries ( + entry_id TEXT PRIMARY KEY, + case_id TEXT NOT NULL, + note_id TEXT NOT NULL, + question_type TEXT NOT NULL, -- WHO/WHAT/WHEN/WHERE/HOW/WHY/WITH_WHAT + entry_text TEXT NOT NULL, + timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (case_id) REFERENCES cases(case_id), + FOREIGN KEY (note_id) REFERENCES notes(note_id) +); + +-- User settings (for multi-user) +CREATE TABLE users ( + user_id TEXT PRIMARY KEY, + username TEXT UNIQUE NOT NULL, + full_name TEXT NOT NULL, + role TEXT DEFAULT 'Investigator', -- Investigator/Manager/Admin + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +-- Optional: Task assignments (team mode) +CREATE TABLE tasks ( + task_id TEXT PRIMARY KEY, + case_id TEXT NOT NULL, + title TEXT NOT NULL, + description TEXT, + assigned_to TEXT, + assigned_by TEXT, + priority TEXT, + due_date DATE, + status TEXT DEFAULT 'Open', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (case_id) REFERENCES cases(case_id) +); \ No newline at end of file diff --git a/src/forensictrails/gui/__init__.py b/src/forensictrails/gui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/forensictrails/gui/dialogs/__init__.py b/src/forensictrails/gui/dialogs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/forensictrails/gui/widgets/__init__.py b/src/forensictrails/gui/widgets/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/forensictrails/utils/__init__.py b/src/forensictrails/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29