Skip to content

Latest commit

 

History

History
266 lines (186 loc) · 5.15 KB

File metadata and controls

266 lines (186 loc) · 5.15 KB

Setup Guide

Poetry Installation and Usage

Install Poetry

If you don't have Poetry installed, run:

curl -sSL https://install.python-poetry.org | python3 -

Or using pip:

pip install poetry

Project Setup

  1. Install dependencies:

    poetry install
  2. Activate the virtual environment:

    poetry shell
  3. Run tests:

    # Using poetry (from project root)
    poetry run python test/test_lambda.py
    
    # Or inside poetry shell
    python test/test_lambda.py
  4. Try the utilities:

    # Test credential combinations (educational/testing only)
    poetry run python src/utils/cred.py https://example.com/login
    
    # Test rate limiting
    poetry run python src/utils/ddos.py https://api.example.com 1.0

Managing Dependencies

Add a new dependency:

poetry add package-name

Add a development dependency:

poetry add --group dev package-name

Update dependencies:

poetry update

Show installed packages:

poetry show

Development Tools

The project includes these dev tools:

  • pytest: Test framework
  • pytest-cov: Coverage reporting
  • black: Code formatter
  • flake8: Linter
  • mypy: Type checker

Format code:

poetry run black src/ test/

Lint code:

poetry run flake8 src/ test/

Type check:

poetry run mypy src/ test/

Run all tests:

poetry run pytest test/ -v

Run tests with coverage:

poetry run pytest test/ --cov=src --cov-report=html

Project Structure

blue-yellow/
├── pyproject.toml          # Poetry configuration
├── poetry.toml             # Local Poetry settings
├── poetry.lock             # Locked dependencies (generated)
├── README.md               # Main project README
├── SETUP.md               # This file
├── LICENSE                # License information
├── .env                   # Environment variables (not tracked)
├── .env.sample            # Environment variable template
├── .gitignore             # Git ignore rules
├── src/
│   ├── lambda/
│   │   ├── entrypoint.py  # AWS Lambda function
│   │   └── README.md      # Lambda documentation
│   └── utils/
│       ├── ping.py        # URL ping utility
│       ├── cred.py        # Credential testing utility
│       ├── ddos.py        # Rate limit testing utility
│       └── clone.py       # Clone utility (placeholder)
└── test/
    └── test_lambda.py     # Lambda function tests

Quick Start

# Install Poetry if needed
curl -sSL https://install.python-poetry.org | python3 -

# Install project dependencies
cd /home/kali/labs/blue-yellow
poetry install --no-root

# Run Lambda tests
poetry run python test/test_lambda.py

# Test security utilities
poetry run python src/utils/cred.py https://example.com/login
poetry run python src/utils/ddos.py https://example.com 1.0

AWS Lambda Deployment

See src/lambda/README.md for Lambda-specific deployment instructions.

Quick Deployment Package

# Create deployment package
mkdir -p lambda-package/utils
cp src/lambda/entrypoint.py lambda-package/
cp src/utils/ping.py lambda-package/utils/
cd lambda-package
zip -r ../lambda-function.zip .
cd ..
rm -rf lambda-package

# Now upload lambda-function.zip to AWS Lambda

Security Utilities Usage

Credential Testing Tool

Tests login forms for rate limiting and security mechanisms:

poetry run python src/utils/cred.py <login_url>

# Example with verbose output
poetry run python src/utils/cred.py https://example.com/login

Important: Only use on systems you own or have permission to test.

Rate Limit Testing Tool

Tests API endpoints for rate limiting:

poetry run python src/utils/ddos.py <url> [period_seconds]

# Example: Test with 0.5 second intervals
poetry run python src/utils/ddos.py https://api.example.com 0.5

Environment Variables

Copy .env.sample to .env and configure as needed:

cp .env.sample .env
# Edit .env with your settings

Troubleshooting

Poetry Installation Issues

If Poetry installation fails:

# Try pip installation
pip install --user poetry

# Or use pipx (recommended)
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install poetry

Import Errors

If you get import errors when running scripts:

# Make sure you're in the project root
cd /home/kali/labs/blue-yellow

# Activate the virtual environment
poetry shell

# Or use poetry run
poetry run python test/test_lambda.py

Dependency Issues

If dependencies are out of sync:

# Remove lock file and reinstall
rm poetry.lock
poetry install

# Or update all dependencies
poetry update

Additional Resources