Skip to content

TomekPieniazek/ScanPanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ScanPanel

A local-first web application for automating authorized security scans on networks and hosts with intelligent result analysis.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         ScanPanel System                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   Next.js    │◄─────►│   FastAPI    │◄─────►│   Worker     β”‚ β”‚
β”‚  β”‚   Frontend   β”‚ HTTP  β”‚     API      β”‚       β”‚   Service    β”‚ β”‚
β”‚  β”‚  (Port 3000) β”‚       β”‚  (Port 8000) β”‚       β”‚              β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚         β”‚                      β”‚                       β”‚         β”‚
β”‚         β”‚                      β”‚                       β”‚         β”‚
β”‚         β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚         β”‚              β”‚  PostgreSQL   β”‚      β”‚     Redis     β”‚ β”‚
β”‚         β”‚              β”‚   Database    β”‚      β”‚   (Cache)     β”‚ β”‚
β”‚         β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚         β”‚                                                       β”‚
β”‚         β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                      β”‚
β”‚         └──────────────►│  WebSocket     β”‚                      β”‚
β”‚                         β”‚  (Live Updates)β”‚                      β”‚
β”‚                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚
β”‚                                                                   β”‚
β”‚  External Services:                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   Nmap       β”‚      β”‚   Nuclei     β”‚      β”‚    Nikto     β”‚ β”‚
β”‚  β”‚  (Scanner)   β”‚      β”‚  (Scanner)   β”‚      β”‚  (Scanner)   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚  β”‚ Local LLM    β”‚      β”‚  Telegram    β”‚                         β”‚
β”‚  β”‚ (gpt-oss 20b)β”‚      β”‚   Bot API    β”‚                         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚
β”‚                                                                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Component Overview

  • /apps/web - Next.js frontend (App Router, TypeScript, Tailwind, shadcn/ui)
  • /apps/api - FastAPI backend (REST API, SQLAlchemy, Pydantic)
  • /apps/worker - Job runner for scheduled scans (APScheduler)
  • /packages/shared - Shared types, constants, and utilities
  • /infra - Docker Compose configuration and environment templates

✨ Features

  • πŸ” Multiple scanning tools: Nmap, Nuclei, Nikto (extensible adapter pattern)
  • πŸ’Ύ Store raw outputs and parsed findings with deduplication
  • ⏰ Cyclical scans with scheduling (cron or interval-based)
  • πŸ“± Telegram hooks for alerts and summaries
  • 🎯 Simple "Add target/device" flow with safety validations
  • πŸ€– Automatic result analysis using local LLM (gpt-oss 20b)
  • πŸ—„οΈ PostgreSQL database with optimized indexes
  • πŸ”Œ REST API + WebSocket for live scan progress
  • πŸ”’ Safety guardrails to prevent misuse

πŸš€ Quick Start

TL;DR:

make dev          # Start everything
make migrate      # Setup database
make seed         # Load demo data
# Open http://localhost:3000

Detailed Steps

  1. Start all services:

    make dev

    Or: cd infra && docker-compose up -d

  2. Initialize database:

    make migrate
    make seed
  3. Open in browser:

  4. Optional - Generate demo scan:

    make demo

That's it! See QUICK_START.md for more details.

Environment Configuration (Optional)

For basic usage, default configs work. To customize:

cp infra/.env.example infra/.env
# Edit infra/.env if needed (LLM endpoint, Telegram, etc.)

Default ports:

  • Frontend: 3000
  • API: 8000
  • PostgreSQL: 5432
  • Redis: 6379

🎯 Quick Tour

1. Dashboard

The dashboard provides an overview of your security posture:

  • Stat cards: Total targets, scans in last 24h, open findings by severity
  • Recent scans: Latest scan activity with status and duration
  • New findings: Critical and high severity findings that need attention

2. Targets

Manage your scanning targets:

  • Add target: Click "Add Target" β†’ Enter name, IP/hostname/URL, select type
  • Public IP warning: System detects public IPs and requires confirmation
  • Target detail: View scan timeline and open findings for each target
  • Run scan: Click "Run Scan" button on any target

3. Scan Profiles

Configure scan settings:

  • Create profile: Select tools (nmap/nuclei/nikto), configure arguments
  • Schedule: Set up recurring scans (cron or interval)
  • Auto-analyze: Enable automatic LLM analysis after scan completes
  • Telegram thresholds: Configure notification triggers

4. Scans

Monitor scan execution:

  • Scan list: Filter by target, status, date range
  • Live progress: Real-time updates via WebSocket
  • Scan detail: View tasks, artifacts, LLM summary, findings
  • Artifacts: Download raw scanner outputs

5. Findings

Review and triage security findings:

  • Global view: Filter by severity, status, tool, CVE/CWE
  • Bulk triage: Update status for multiple findings
  • Finding detail: View evidence, instances over time, LLM analysis
  • Status workflow: open β†’ triaged β†’ accepted_risk / false_positive / fixed

πŸ› οΈ Development

Using Makefile

make help          # Show all available commands
make dev           # Start all services
make test          # Run all tests
make lint          # Run linters
make format        # Format code
make clean         # Clean build artifacts

Running Services Locally

Backend API

make dev-api
# Or manually:
cd apps/api
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

Frontend

make dev-web
# Or manually:
cd apps/web
npm install
npm run dev

Worker

make dev-worker
# Or manually:
cd apps/worker
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python -m app.main

Database Migrations

make migrate                    # Run migrations
make migrate-create NAME=xyz   # Create new migration

Testing

make test           # Run all tests
make test-api       # Run API tests only
make test-worker    # Run worker tests only

πŸ“š Documentation

βš™οΈ Configuration

LLM Configuration

The application expects a local LLM endpoint compatible with OpenAI's API format. See LLM Setup Guide for details.

LLM_BASE_URL=http://localhost:8001
LLM_API_KEY=
LLM_MODEL=gpt-oss-20b
LLM_MAX_REQUESTS_PER_MINUTE=10

Telegram Integration

To enable Telegram notifications:

TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_id

See Telegram Implementation for details.

πŸ—οΈ Project Structure

ScanningPanel/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/              # Next.js frontend
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ app/      # App Router pages
β”‚   β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   └── lib/
β”‚   β”‚   └── package.json
β”‚   β”œβ”€β”€ api/              # FastAPI backend
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   β”œβ”€β”€ api/v1/   # API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ db/       # Database models
β”‚   β”‚   β”‚   └── schemas/  # Pydantic schemas
β”‚   β”‚   β”œβ”€β”€ alembic/      # Database migrations
β”‚   β”‚   └── scripts/      # Utility scripts
β”‚   └── worker/           # Job scheduler and scanner workers
β”‚       β”œβ”€β”€ app/
β”‚       β”‚   β”œβ”€β”€ scanners/ # Scanner adapters
β”‚       β”‚   β”œβ”€β”€ workers/  # Scan execution
β”‚       β”‚   β”œβ”€β”€ parsers/  # Finding parsers
β”‚       β”‚   └── llm/      # LLM integration
β”‚       └── tests/
β”œβ”€β”€ packages/
β”‚   └── shared/           # Shared types and utilities
β”œβ”€β”€ infra/                # Docker Compose and infrastructure
β”œβ”€β”€ scripts/              # Development scripts
β”œβ”€β”€ docs/                 # Documentation
└── Makefile              # Development commands

πŸ”’ Safety Features

ScanPanel includes comprehensive safety guardrails:

  • Input validation: IP, CIDR, hostname validation with public IP warnings
  • Command safety: Strict argument allowlists, no shell injection
  • Secret redaction: Automatic redaction of secrets in logs
  • UI disclaimers: One-time modal and public IP confirmation
  • Auth structure: Ready for future authentication

See Safety Implementation for details.

πŸ§ͺ Demo Mode

Generate demo scans without running real tools:

make demo

This creates:

  • Demo targets and scan profiles
  • Sample scan with fixtures
  • Example findings for UI testing

πŸ“Š Performance

  • Database indexes: Optimized for common query patterns
  • Eager loading: Prevents N+1 queries
  • Pagination: All list endpoints support pagination
  • Caching: Redis for future caching layer

🀝 Contributing

  1. Add a new scanner: See Adding a New Scanner
  2. Run tests: make test
  3. Format code: make format
  4. Check linting: make lint

πŸ“ License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published