📋 Unified Requirements Management & Setup Instructions
🎯 Overview
The repository currently lacks a single, authoritative dependency management and setup flow. That causes onboarding friction and inconsistent runtime behaviour across contributors and users. This document centralizes dependency definitions, setup instructions, dev tooling, and CI checks so the project is reproducible and easy to contribute to.
🔍 Current State
- Individual scripts in
python-scripts/ (and other directories) use third-party libraries without documented requirements.
- Only one
requirements.txt exists at sql-injection-lab/requirements.txt (contains Flask and pytest).
- No repository root-level
requirements.txt or requirements-dev.txt.
- No setup instructions for Python environment configuration or platform notes.
- Dependencies are not version-pinned, increasing the risk of breakage.
📚 Dependencies Identified
Core Dependencies (used across scripts)
scapy — Network packet manipulation
requests — HTTP requests
beautifulsoup4 — HTML parsing
cryptography — SSL/TLS analysis
geoip2 — IP geolocation
urllib3 — HTTP client utilities
paramiko — SSH connections (implied)
Optional / Development Dependencies
pytest>=7.0 — Testing framework
Flask>=2.0 — Web framework (sql injection lab)
Note: exact minimum versions should be derived from static analysis & running the test matrix (Phase 1).
🎯 Proposed Solution (High-level)
- Add a repository root
requirements.txt with pinned (minimum) versions for core runtime dependencies.
- Add
requirements-dev.txt for developer tools and testing libraries.
- Add comprehensive setup docs:
README.md additions + SETUP.md with platform-specific notes.
- Optionally add
pyproject.toml or setup.py for packaging/distribution, and a Dockerfile for reproducible environments.
- Add CI checks to validate dependency installation and run smoke tests.
📋 Tasks & Phases
Phase 1: Core Requirements
- Analyze every Python file to enumerate
import statements and map them to PyPI package names.
- Determine minimum versions by running scripts on a clean environment and noting any version-specific features/errors.
- Create
requirements.txt at repository root with pinned minimum versions (use package>=min_version,<next_major where appropriate).
- Test the
requirements.txt by creating a fresh virtual environment and installing.
- Update
sql-injection-lab/requirements.txt to reference or include the root file (see examples).
Deliverables: requirements.txt (root), verification notes, updated sql-injection-lab/requirements.txt.
Phase 2: Documentation & Setup
- README.md / SETUP.md: Add step-by-step environment setup (venv, pip, Windows/Linux/macOS specifics).
- Platform Notes: Npcap installation (Windows),
sudo/capabilities for Scapy (Linux), macOS permissions.
- Troubleshooting: Common permission errors, binary dependency issues, SSL issues,
pip wheels vs. source builds.
- Activation scripts: Provide shell and PowerShell snippets for activating venvs.
Deliverables: SETUP.md, patches to README.md.
Phase 3: Development Environment
- Create
requirements-dev.txt — contains pytest, linters, pre-commit hooks, black, isort, mypy (optional)
- Pre-commit: Add
.pre-commit-config.yaml and example hooks.
- CI Workflow: Add GitHub Actions workflow to validate installs and run unit tests on PRs.
- Virtualenv helper scripts:
scripts/activate_venv.sh and scripts/activate_venv.ps1.
Deliverables: requirements-dev.txt, .pre-commit-config.yaml, .github/workflows/ci.yml, helper scripts.
Phase 4: Advanced (Optional)
pyproject.toml with build-system metadata and dependency groups.
Dockerfile and docker-compose.yml for development.
- One-command install script:
scripts/bootstrap.sh / scripts/bootstrap.ps1.
🎁 Benefits
Contributors
- Consistent environments and faster onboarding.
Users
- Clear, tested setup steps and platform guidance.
Maintainers
- Easier dependency tracking, versioning, and security scanning.
🔧 Technical Considerations
- Python support: Target Python 3.8+ unless older syntax mandates otherwise.
- Pinning policy: Use minimum pinned versions with a compatibility upper bound (e.g.,
requests>=2.28.0,<3.0.0).
- Platform-specific notes: Document packet-capture privileges (Linux capabilities or running as root) for
scapy, and Npcap installer for Windows.
- Security: Prefer well-maintained packages; add
pip-audit or safety in requirements-dev.txt.
⚙️ Example Files & Snippets
Save these as examples in the repo (e.g., examples/requirements_samples/).
Example: requirements.txt (root)
# Core runtime dependencies (minimum pinned versions)
scapy>=2.4.5,<3.0
requests>=2.28.0,<3.0
beautifulsoup4>=4.11.1,<5.0
cryptography>=39.0.0,<40.0
geoip2>=4.6.0,<5.0
urllib3>=1.26.14,<2.0
paramiko>=2.11.0,<3.0
Example: requirements-dev.txt
-r requirements.txt
pytest>=7.0
black
isort
mypy
pre-commit
pip-audit
Example: sql-injection-lab/requirements.txt (wrapper)
# include core requirements from root
-r ../requirements.txt
# lab-specific additions
Flask>=2.0
pytest>=7.0
🧭 README / SETUP.md — Key Sections to Add
- Quickstart (30 seconds): create venv, install deps, run a sample script.
- Full Setup (detailed): platform-specific steps and troubleshooting.
- Running tests and lints.
- Contributing guide with dev workflow and commit hooks.
- How to add new dependencies (policy for pinning and PR process).
🛠️ Example SETUP.md Outline (detailed)
-
Prerequisites
- Python 3.8+ installed
pip up-to-date: python -m pip install --upgrade pip
-
Linux / macOS
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
-
Windows (PowerShell)
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements-dev.txt
- Install Npcap (WinPcap-compatible) for packet capture.
-
Virtual Environment Activation Shortcuts
scripts/activate_venv.sh and scripts/activate_venv.ps1 provided.
-
Troubleshooting
- Permission errors with Scapy: use
sudo or capabilities.
- Binary wheel build failures: install system-level build tools (
build-essential / python3-dev).
pip cache issues: pip cache purge then reinstall.
📋 Unified Requirements Management & Setup Instructions
🎯 Overview
The repository currently lacks a single, authoritative dependency management and setup flow. That causes onboarding friction and inconsistent runtime behaviour across contributors and users. This document centralizes dependency definitions, setup instructions, dev tooling, and CI checks so the project is reproducible and easy to contribute to.
🔍 Current State
python-scripts/(and other directories) use third-party libraries without documented requirements.requirements.txtexists atsql-injection-lab/requirements.txt(containsFlaskandpytest).requirements.txtorrequirements-dev.txt.📚 Dependencies Identified
Core Dependencies (used across scripts)
scapy— Network packet manipulationrequests— HTTP requestsbeautifulsoup4— HTML parsingcryptography— SSL/TLS analysisgeoip2— IP geolocationurllib3— HTTP client utilitiesparamiko— SSH connections (implied)Optional / Development Dependencies
pytest>=7.0— Testing frameworkFlask>=2.0— Web framework (sql injection lab)🎯 Proposed Solution (High-level)
requirements.txtwith pinned (minimum) versions for core runtime dependencies.requirements-dev.txtfor developer tools and testing libraries.README.mdadditions +SETUP.mdwith platform-specific notes.pyproject.tomlorsetup.pyfor packaging/distribution, and aDockerfilefor reproducible environments.📋 Tasks & Phases
Phase 1: Core Requirements
importstatements and map them to PyPI package names.requirements.txtat repository root with pinned minimum versions (usepackage>=min_version,<next_majorwhere appropriate).requirements.txtby creating a fresh virtual environment and installing.sql-injection-lab/requirements.txtto reference or include the root file (see examples).Deliverables:
requirements.txt(root), verification notes, updatedsql-injection-lab/requirements.txt.Phase 2: Documentation & Setup
sudo/capabilities for Scapy (Linux), macOS permissions.pipwheels vs. source builds.Deliverables:
SETUP.md, patches toREADME.md.Phase 3: Development Environment
requirements-dev.txt— containspytest, linters, pre-commit hooks,black,isort,mypy(optional).pre-commit-config.yamland example hooks.scripts/activate_venv.shandscripts/activate_venv.ps1.Deliverables:
requirements-dev.txt,.pre-commit-config.yaml,.github/workflows/ci.yml, helper scripts.Phase 4: Advanced (Optional)
pyproject.tomlwithbuild-systemmetadata and dependency groups.Dockerfileanddocker-compose.ymlfor development.scripts/bootstrap.sh/scripts/bootstrap.ps1.🎁 Benefits
Contributors
Users
Maintainers
🔧 Technical Considerations
requests>=2.28.0,<3.0.0).scapy, and Npcap installer for Windows.pip-auditorsafetyinrequirements-dev.txt.⚙️ Example Files & Snippets
Example:
requirements.txt(root)Example:
requirements-dev.txtExample:
sql-injection-lab/requirements.txt(wrapper)🧭 README / SETUP.md — Key Sections to Add
🛠️ Example
SETUP.mdOutline (detailed)Prerequisites
pipup-to-date:python -m pip install --upgrade pipLinux / macOS
python -m venv .venv source .venv/bin/activate pip install -r requirements-dev.txtFor
scapyraw sockets: either run scripts as root or set capabilities (Linux):sudo setcap cap_net_raw,cap_net_admin=eip $(which python3)Windows (PowerShell)
Virtual Environment Activation Shortcuts
scripts/activate_venv.shandscripts/activate_venv.ps1provided.Troubleshooting
sudoor capabilities.build-essential/python3-dev).pipcache issues:pip cache purgethen reinstall.