restructure of dirs, huge docs update
This commit is contained in:
@@ -8,12 +8,13 @@
|
||||
4. [Configuration](#configuration)
|
||||
5. [First-Time Setup](#first-time-setup)
|
||||
6. [Running the Application](#running-the-application)
|
||||
7. [Volume Management](#volume-management)
|
||||
8. [Health Monitoring](#health-monitoring)
|
||||
9. [Troubleshooting](#troubleshooting)
|
||||
10. [Security Considerations](#security-considerations)
|
||||
11. [Upgrading](#upgrading)
|
||||
12. [Backup and Restore](#backup-and-restore)
|
||||
7. [Using the Web Interface](#using-the-web-interface)
|
||||
8. [Volume Management](#volume-management)
|
||||
9. [Health Monitoring](#health-monitoring)
|
||||
10. [Troubleshooting](#troubleshooting)
|
||||
11. [Security Considerations](#security-considerations)
|
||||
12. [Upgrading](#upgrading)
|
||||
13. [Backup and Restore](#backup-and-restore)
|
||||
|
||||
---
|
||||
|
||||
@@ -22,10 +23,12 @@
|
||||
SneakyScanner is deployed as a Docker container running a Flask web application with an integrated network scanner. The application requires privileged mode and host networking to perform network scans using masscan and nmap.
|
||||
|
||||
**Architecture:**
|
||||
- **Web Application**: Flask app on port 5000
|
||||
- **Web Application**: Flask app on port 5000 with modern web UI
|
||||
- **Database**: SQLite (persisted to volume)
|
||||
- **Background Jobs**: APScheduler for async scan execution
|
||||
- **Scanner**: masscan, nmap, sslyze, Playwright
|
||||
- **Config Creator**: Web-based CIDR-to-YAML configuration builder
|
||||
- **Scheduling**: Cron-based scheduled scans with dashboard management
|
||||
|
||||
---
|
||||
|
||||
@@ -69,7 +72,7 @@ docker compose version
|
||||
|
||||
## Quick Start
|
||||
|
||||
For users who want to get started immediately:
|
||||
For users who want to get started immediately with the web application:
|
||||
|
||||
```bash
|
||||
# 1. Clone the repository
|
||||
@@ -82,18 +85,32 @@ cp .env.example .env
|
||||
nano .env
|
||||
|
||||
# 3. Build the Docker image
|
||||
docker compose -f docker-compose-web.yml build
|
||||
docker compose build
|
||||
|
||||
# 4. Initialize the database and set password
|
||||
docker compose -f docker-compose-web.yml run --rm init-db --password "YourSecurePassword"
|
||||
docker compose run --rm init-db --password "YourSecurePassword"
|
||||
|
||||
# 5. Start the application
|
||||
docker compose -f docker-compose-web.yml up -d
|
||||
docker compose up -d
|
||||
|
||||
# 6. Access the web interface
|
||||
# Open browser to: http://localhost:5000
|
||||
```
|
||||
|
||||
**Alternative: Standalone CLI Scanner**
|
||||
|
||||
For quick one-off scans without the web interface:
|
||||
|
||||
```bash
|
||||
# Build and run with standalone compose file
|
||||
docker compose -f docker-compose-standalone.yml build
|
||||
docker compose -f docker-compose-standalone.yml up
|
||||
|
||||
# Results saved to ./output/ directory
|
||||
```
|
||||
|
||||
**Note**: `docker-compose.yml` (web application) is now the default. Use `docker-compose-standalone.yml` for CLI-only scans.
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
@@ -153,7 +170,23 @@ mkdir -p configs data output logs
|
||||
|
||||
### Step 2: Configure Scan Targets
|
||||
|
||||
Create YAML configuration files for your scan targets:
|
||||
You can create scan configurations in two ways:
|
||||
|
||||
**Option A: Using the Web UI (Recommended - Phase 4 Feature)**
|
||||
|
||||
1. Navigate to **Configs** in the web interface
|
||||
2. Click **"Create New Config"**
|
||||
3. Use the CIDR-based config creator for quick setup:
|
||||
- Enter site name
|
||||
- Enter CIDR range (e.g., `192.168.1.0/24`)
|
||||
- Select expected ports from dropdowns
|
||||
- Click **"Generate Config"**
|
||||
4. Or use the **YAML Editor** for advanced configurations
|
||||
5. Save and use immediately in scans or schedules
|
||||
|
||||
**Option B: Manual YAML Files**
|
||||
|
||||
Create YAML configuration files manually in the `configs/` directory:
|
||||
|
||||
```bash
|
||||
# Example configuration
|
||||
@@ -161,21 +194,28 @@ cat > configs/my-network.yaml <<EOF
|
||||
title: "My Network Infrastructure"
|
||||
sites:
|
||||
- name: "Web Servers"
|
||||
ips:
|
||||
- address: "192.168.1.10"
|
||||
expected:
|
||||
ping: true
|
||||
tcp_ports: [80, 443]
|
||||
udp_ports: []
|
||||
services: ["http", "https"]
|
||||
cidr: "192.168.1.0/24" # Scan entire subnet
|
||||
expected_ports:
|
||||
- port: 80
|
||||
protocol: tcp
|
||||
service: "http"
|
||||
- port: 443
|
||||
protocol: tcp
|
||||
service: "https"
|
||||
- port: 22
|
||||
protocol: tcp
|
||||
service: "ssh"
|
||||
ping_expected: true
|
||||
EOF
|
||||
```
|
||||
|
||||
**Note**: Phase 4 introduced a powerful config creator in the web UI that makes it easy to generate configs from CIDR ranges without manually editing YAML.
|
||||
|
||||
### Step 3: Build Docker Image
|
||||
|
||||
```bash
|
||||
# Build the image (takes 5-10 minutes on first run)
|
||||
docker compose -f docker-compose-web.yml build
|
||||
docker compose -f docker-compose.yml build
|
||||
|
||||
# Verify image was created
|
||||
docker images | grep sneakyscanner
|
||||
@@ -183,17 +223,20 @@ docker images | grep sneakyscanner
|
||||
|
||||
### Step 4: Initialize Database
|
||||
|
||||
The database must be initialized before first use:
|
||||
The database must be initialized before first use. The init-db service uses a profile, so you need to explicitly run it:
|
||||
|
||||
```bash
|
||||
# Initialize database and set application password
|
||||
docker compose -f docker-compose-web.yml run --rm init-db --password "YourSecurePassword"
|
||||
docker compose -f docker-compose.yml run --rm init-db --password "YourSecurePassword"
|
||||
|
||||
# The init-db command will:
|
||||
# - Create database schema
|
||||
# - Run all Alembic migrations
|
||||
# - Set the application password
|
||||
# - Create default settings
|
||||
# - Set the application password (bcrypt hashed)
|
||||
# - Create default settings with encryption
|
||||
|
||||
# Verify database was created
|
||||
ls -lh data/sneakyscanner.db
|
||||
```
|
||||
|
||||
**Password Requirements:**
|
||||
@@ -201,6 +244,8 @@ docker compose -f docker-compose-web.yml run --rm init-db --password "YourSecure
|
||||
- Use a strong, unique password
|
||||
- Store securely (password manager)
|
||||
|
||||
**Note**: The init-db service is defined with `profiles: [tools]` in docker-compose.yml, which means it won't start automatically with `docker compose up`.
|
||||
|
||||
### Step 5: Verify Configuration
|
||||
|
||||
```bash
|
||||
@@ -208,7 +253,7 @@ docker compose -f docker-compose-web.yml run --rm init-db --password "YourSecure
|
||||
ls -lh data/sneakyscanner.db
|
||||
|
||||
# Verify Docker Compose configuration
|
||||
docker compose -f docker-compose-web.yml config
|
||||
docker compose -f docker-compose.yml config
|
||||
```
|
||||
|
||||
---
|
||||
@@ -219,10 +264,10 @@ docker compose -f docker-compose-web.yml config
|
||||
|
||||
```bash
|
||||
# Start in detached mode (background)
|
||||
docker compose -f docker-compose-web.yml up -d
|
||||
docker compose -f docker-compose.yml up -d
|
||||
|
||||
# View logs during startup
|
||||
docker compose -f docker-compose-web.yml logs -f web
|
||||
docker compose -f docker-compose.yml logs -f web
|
||||
|
||||
# Expected output:
|
||||
# web_1 | INFO:werkzeug: * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
|
||||
@@ -231,47 +276,143 @@ docker compose -f docker-compose-web.yml logs -f web
|
||||
### Accessing the Web Interface
|
||||
|
||||
1. Open browser to: **http://localhost:5000**
|
||||
2. Login with the password you set during database initialization
|
||||
3. Dashboard will display recent scans and statistics
|
||||
2. Login with the password you set during database initialization (username is not required - single-user mode)
|
||||
3. Dashboard will display:
|
||||
- Recent scans with status indicators
|
||||
- Summary statistics (total scans, IPs, ports, services)
|
||||
- Trend charts showing infrastructure changes over time
|
||||
- Quick actions (run scan, create config, view schedules)
|
||||
|
||||
### Stopping the Application
|
||||
|
||||
```bash
|
||||
# Stop containers (preserves data)
|
||||
docker compose -f docker-compose-web.yml down
|
||||
docker compose -f docker-compose.yml down
|
||||
|
||||
# Stop and remove volumes (WARNING: deletes all data!)
|
||||
docker compose -f docker-compose-web.yml down -v
|
||||
docker compose -f docker-compose.yml down -v
|
||||
```
|
||||
|
||||
### Restarting the Application
|
||||
|
||||
```bash
|
||||
# Restart all services
|
||||
docker compose -f docker-compose-web.yml restart
|
||||
docker compose -f docker-compose.yml restart
|
||||
|
||||
# Restart only the web service
|
||||
docker compose -f docker-compose-web.yml restart web
|
||||
docker compose -f docker-compose.yml restart web
|
||||
```
|
||||
|
||||
### Viewing Logs
|
||||
|
||||
```bash
|
||||
# View all logs
|
||||
docker compose -f docker-compose-web.yml logs
|
||||
docker compose -f docker-compose.yml logs
|
||||
|
||||
# Follow logs in real-time
|
||||
docker compose -f docker-compose-web.yml logs -f
|
||||
docker compose -f docker-compose.yml logs -f
|
||||
|
||||
# View last 100 lines
|
||||
docker compose -f docker-compose-web.yml logs --tail=100
|
||||
docker compose -f docker-compose.yml logs --tail=100
|
||||
|
||||
# View logs for specific service
|
||||
docker compose -f docker-compose-web.yml logs web
|
||||
docker compose -f docker-compose.yml logs web
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Using the Web Interface
|
||||
|
||||
### Dashboard Overview
|
||||
|
||||
The dashboard provides a central view of your scanning activity:
|
||||
|
||||
**Key Sections:**
|
||||
- **Summary Statistics**: Total scans, IPs discovered, open ports, services detected
|
||||
- **Recent Scans**: Last 10 scans with status, timestamp, and quick actions
|
||||
- **Trend Charts**: Port count trends over time using Chart.js
|
||||
- **Quick Actions**: Buttons to run scans, create configs, manage schedules
|
||||
|
||||
### Managing Scan Configurations (Phase 4)
|
||||
|
||||
**Creating Configs:**
|
||||
1. Navigate to **Configs** → **Create New Config**
|
||||
2. **CIDR Creator Mode**:
|
||||
- Enter site name (e.g., "Production Servers")
|
||||
- Enter CIDR range (e.g., `192.168.1.0/24`)
|
||||
- Select expected TCP/UDP ports from dropdowns
|
||||
- Click **"Generate Config"** to create YAML
|
||||
3. **YAML Editor Mode**:
|
||||
- Switch to editor tab for advanced configurations
|
||||
- Syntax highlighting with line numbers
|
||||
- Validate YAML before saving
|
||||
|
||||
**Editing Configs:**
|
||||
1. Navigate to **Configs** → Select config
|
||||
2. Click **"Edit"** button
|
||||
3. Make changes in YAML editor
|
||||
4. Save changes (validates YAML automatically)
|
||||
|
||||
**Uploading Configs:**
|
||||
1. Navigate to **Configs** → **Upload**
|
||||
2. Select YAML file from your computer
|
||||
3. File is validated and saved to `configs/` directory
|
||||
|
||||
**Downloading Configs:**
|
||||
- Click **"Download"** button next to any config
|
||||
- Saves YAML file to your local machine
|
||||
|
||||
**Deleting Configs:**
|
||||
- Click **"Delete"** button
|
||||
- **Warning**: Cannot delete configs used by active schedules
|
||||
|
||||
### Running Scans
|
||||
|
||||
**Manual Scans:**
|
||||
1. Navigate to **Dashboard** or **Scans**
|
||||
2. Click **"Run Scan Now"**
|
||||
3. Select configuration file from dropdown
|
||||
4. Click **"Start Scan"**
|
||||
5. Scan executes in background (APScheduler)
|
||||
6. Monitor progress on **Scans** page
|
||||
|
||||
**Scheduled Scans:**
|
||||
1. Navigate to **Schedules** → **Create Schedule**
|
||||
2. Enter schedule name (e.g., "Daily production scan")
|
||||
3. Select config file
|
||||
4. Enter cron expression (e.g., `0 2 * * *` for 2 AM daily)
|
||||
5. Enable schedule
|
||||
6. Scans run automatically in background
|
||||
|
||||
**Cron Expression Examples:**
|
||||
- `0 2 * * *` - Daily at 2 AM
|
||||
- `0 */6 * * *` - Every 6 hours
|
||||
- `0 0 * * 0` - Weekly on Sunday at midnight
|
||||
- `0 0 1 * *` - Monthly on 1st at midnight
|
||||
|
||||
### Viewing Scan Results
|
||||
|
||||
**Scan List:**
|
||||
- Navigate to **Scans** page
|
||||
- View all historical scans with filters
|
||||
- Click scan ID to view details
|
||||
|
||||
**Scan Details:**
|
||||
- Full scan results organized by site
|
||||
- Discovered IPs, ports, services
|
||||
- SSL/TLS certificate information
|
||||
- TLS version support and cipher suites
|
||||
- Service version detection
|
||||
- Screenshots of web services
|
||||
- Download buttons (JSON, HTML, ZIP)
|
||||
|
||||
**Trend Analysis:**
|
||||
- Charts showing port count changes over time
|
||||
- Identify infrastructure drift
|
||||
- Track service version updates
|
||||
|
||||
---
|
||||
|
||||
## Volume Management
|
||||
|
||||
### Understanding Volumes
|
||||
@@ -280,10 +421,12 @@ SneakyScanner uses several mounted volumes for data persistence:
|
||||
|
||||
| Volume | Container Path | Purpose | Important? |
|
||||
|--------|----------------|---------|------------|
|
||||
| `./configs` | `/app/configs` | Scan configuration files (read-only) | Yes |
|
||||
| `./data` | `/app/data` | SQLite database | **Critical** |
|
||||
| `./output` | `/app/output` | Scan results (JSON, HTML, ZIP) | Yes |
|
||||
| `./logs` | `/app/logs` | Application logs | No |
|
||||
| `./configs` | `/app/configs` | Scan configuration files (managed via web UI) | Yes |
|
||||
| `./data` | `/app/data` | SQLite database (contains all scan history) | **Critical** |
|
||||
| `./output` | `/app/output` | Scan results (JSON, HTML, ZIP, screenshots) | Yes |
|
||||
| `./logs` | `/app/logs` | Application logs (rotating file handler) | No |
|
||||
|
||||
**Note**: As of Phase 4, the `./configs` volume is read-write to support the web-based config creator and editor. The web UI can now create, edit, and delete configuration files directly.
|
||||
|
||||
### Backing Up Data
|
||||
|
||||
@@ -305,7 +448,7 @@ tar -czf backups/$(date +%Y%m%d)/configs.tar.gz configs/
|
||||
|
||||
```bash
|
||||
# Stop application
|
||||
docker compose -f docker-compose-web.yml down
|
||||
docker compose -f docker-compose.yml down
|
||||
|
||||
# Restore database
|
||||
cp backups/YYYYMMDD/sneakyscanner.db data/
|
||||
@@ -314,35 +457,216 @@ cp backups/YYYYMMDD/sneakyscanner.db data/
|
||||
tar -xzf backups/YYYYMMDD/output.tar.gz
|
||||
|
||||
# Restart application
|
||||
docker compose -f docker-compose-web.yml up -d
|
||||
docker compose -f docker-compose.yml up -d
|
||||
```
|
||||
|
||||
### Cleaning Up Old Scan Results
|
||||
|
||||
**Option A: Using the Web UI (Recommended)**
|
||||
1. Navigate to **Scans** page
|
||||
2. Select scans you want to delete
|
||||
3. Click **"Delete"** button
|
||||
4. Confirm deletion (removes database records and all associated files)
|
||||
|
||||
**Option B: Manual Cleanup**
|
||||
```bash
|
||||
# Find old scan results (older than 30 days)
|
||||
find output/ -type f -name "scan_report_*.json" -mtime +30
|
||||
|
||||
# Delete old scan results
|
||||
find output/ -type f -name "scan_report_*" -mtime +30 -delete
|
||||
# Delete old scan results and screenshots
|
||||
find output/ -type f -mtime +30 -delete
|
||||
find output/ -type d -empty -delete
|
||||
|
||||
# Or use the API to delete scans from UI/API
|
||||
# Note: Manual deletion doesn't remove database records
|
||||
# Use the web UI or API for complete cleanup
|
||||
```
|
||||
|
||||
**Option C: Using the API**
|
||||
```bash
|
||||
# Delete a specific scan (removes DB records + files)
|
||||
curl -X DELETE http://localhost:5000/api/scans/{scan_id} \
|
||||
-b cookies.txt
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## API Usage Examples
|
||||
|
||||
SneakyScanner provides a comprehensive REST API for automation and integration. All API endpoints require authentication via session cookies.
|
||||
|
||||
### Authentication
|
||||
|
||||
```bash
|
||||
# Login and save session cookie
|
||||
curl -X POST http://localhost:5000/api/auth/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"password": "YourPassword"}' \
|
||||
-c cookies.txt
|
||||
|
||||
# Logout
|
||||
curl -X POST http://localhost:5000/api/auth/logout \
|
||||
-b cookies.txt
|
||||
```
|
||||
|
||||
### Config Management (Phase 4)
|
||||
|
||||
```bash
|
||||
# List all configs
|
||||
curl http://localhost:5000/api/configs \
|
||||
-b cookies.txt
|
||||
|
||||
# Get specific config
|
||||
curl http://localhost:5000/api/configs/prod-network.yaml \
|
||||
-b cookies.txt
|
||||
|
||||
# Create new config
|
||||
curl -X POST http://localhost:5000/api/configs \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"filename": "test-network.yaml",
|
||||
"content": "title: Test Network\nsites:\n - name: Test\n cidr: 10.0.0.0/24"
|
||||
}' \
|
||||
-b cookies.txt
|
||||
|
||||
# Update config
|
||||
curl -X PUT http://localhost:5000/api/configs/test-network.yaml \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"content": "title: Updated Test Network\nsites:\n - name: Test Site\n cidr: 10.0.0.0/24"
|
||||
}' \
|
||||
-b cookies.txt
|
||||
|
||||
# Download config
|
||||
curl http://localhost:5000/api/configs/test-network.yaml/download \
|
||||
-b cookies.txt -o test-network.yaml
|
||||
|
||||
# Delete config
|
||||
curl -X DELETE http://localhost:5000/api/configs/test-network.yaml \
|
||||
-b cookies.txt
|
||||
```
|
||||
|
||||
### Scan Management
|
||||
|
||||
```bash
|
||||
# Trigger a scan
|
||||
curl -X POST http://localhost:5000/api/scans \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"config_file": "/app/configs/prod-network.yaml"}' \
|
||||
-b cookies.txt
|
||||
|
||||
# List all scans
|
||||
curl http://localhost:5000/api/scans?page=1&per_page=20 \
|
||||
-b cookies.txt
|
||||
|
||||
# Get scan details
|
||||
curl http://localhost:5000/api/scans/123 \
|
||||
-b cookies.txt
|
||||
|
||||
# Check scan status
|
||||
curl http://localhost:5000/api/scans/123/status \
|
||||
-b cookies.txt
|
||||
|
||||
# Delete scan
|
||||
curl -X DELETE http://localhost:5000/api/scans/123 \
|
||||
-b cookies.txt
|
||||
```
|
||||
|
||||
### Schedule Management
|
||||
|
||||
```bash
|
||||
# List schedules
|
||||
curl http://localhost:5000/api/schedules \
|
||||
-b cookies.txt
|
||||
|
||||
# Create schedule
|
||||
curl -X POST http://localhost:5000/api/schedules \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"name": "Daily Production Scan",
|
||||
"config_file": "/app/configs/prod-network.yaml",
|
||||
"cron_expression": "0 2 * * *",
|
||||
"enabled": true
|
||||
}' \
|
||||
-b cookies.txt
|
||||
|
||||
# Update schedule
|
||||
curl -X PUT http://localhost:5000/api/schedules/1 \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"enabled": false}' \
|
||||
-b cookies.txt
|
||||
|
||||
# Manually trigger scheduled scan
|
||||
curl -X POST http://localhost:5000/api/schedules/1/trigger \
|
||||
-b cookies.txt
|
||||
|
||||
# Delete schedule
|
||||
curl -X DELETE http://localhost:5000/api/schedules/1 \
|
||||
-b cookies.txt
|
||||
```
|
||||
|
||||
### Settings Management
|
||||
|
||||
```bash
|
||||
# Get all settings (sanitized - passwords hidden)
|
||||
curl http://localhost:5000/api/settings \
|
||||
-b cookies.txt
|
||||
|
||||
# Update settings
|
||||
curl -X PUT http://localhost:5000/api/settings \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"retention_days": 90,
|
||||
"smtp_server": "smtp.gmail.com"
|
||||
}' \
|
||||
-b cookies.txt
|
||||
|
||||
# Test email configuration
|
||||
curl -X POST http://localhost:5000/api/settings/test-email \
|
||||
-b cookies.txt
|
||||
|
||||
# Health check (no auth required)
|
||||
curl http://localhost:5000/api/settings/health
|
||||
```
|
||||
|
||||
### Statistics
|
||||
|
||||
```bash
|
||||
# Get dashboard summary
|
||||
curl http://localhost:5000/api/stats/summary \
|
||||
-b cookies.txt
|
||||
|
||||
# Get trend data
|
||||
curl http://localhost:5000/api/stats/trends?days=30&metric=port_count \
|
||||
-b cookies.txt
|
||||
|
||||
# Get certificate expiry overview
|
||||
curl http://localhost:5000/api/stats/certificates \
|
||||
-b cookies.txt
|
||||
```
|
||||
|
||||
For complete API documentation, see `docs/API_REFERENCE.md`.
|
||||
|
||||
---
|
||||
|
||||
## Health Monitoring
|
||||
|
||||
### Health Check Endpoint
|
||||
|
||||
SneakyScanner includes a built-in health check endpoint:
|
||||
SneakyScanner includes a built-in health check endpoint used by Docker's healthcheck:
|
||||
|
||||
```bash
|
||||
# Check application health
|
||||
curl http://localhost:5000/api/settings/health
|
||||
|
||||
# Expected response:
|
||||
# Expected response (200 OK):
|
||||
# {"status": "healthy"}
|
||||
|
||||
# This endpoint is also used by Docker Compose healthcheck
|
||||
# Defined in docker-compose.yml:
|
||||
# - Interval: 60s (check every minute)
|
||||
# - Timeout: 10s
|
||||
# - Retries: 3
|
||||
# - Start period: 40s (grace period for app startup)
|
||||
```
|
||||
|
||||
### Docker Health Status
|
||||
@@ -359,7 +683,7 @@ docker inspect sneakyscanner-web | grep -A 10 Health
|
||||
|
||||
```bash
|
||||
# Watch for errors in logs
|
||||
docker compose -f docker-compose-web.yml logs -f | grep ERROR
|
||||
docker compose -f docker-compose.yml logs -f | grep ERROR
|
||||
|
||||
# Check application log file
|
||||
tail -f logs/sneakyscanner.log
|
||||
@@ -375,7 +699,7 @@ tail -f logs/sneakyscanner.log
|
||||
|
||||
```bash
|
||||
# Check logs for errors
|
||||
docker compose -f docker-compose-web.yml logs web
|
||||
docker compose -f docker-compose.yml logs web
|
||||
|
||||
# Common issues:
|
||||
# 1. Database not initialized - run init-db first
|
||||
@@ -399,7 +723,7 @@ sqlite3 data/sneakyscanner.db "SELECT 1;" 2>&1
|
||||
|
||||
# Remove corrupted database and reinitialize
|
||||
rm data/sneakyscanner.db
|
||||
docker compose -f docker-compose-web.yml run --rm init-db --password "YourPassword"
|
||||
docker compose -f docker-compose.yml run --rm init-db --password "YourPassword"
|
||||
```
|
||||
|
||||
### Scans Fail with "Permission Denied"
|
||||
@@ -415,7 +739,7 @@ docker inspect sneakyscanner-web | grep Privileged
|
||||
docker inspect sneakyscanner-web | grep NetworkMode
|
||||
# Should show: "NetworkMode": "host"
|
||||
|
||||
# If not, verify docker-compose-web.yml has:
|
||||
# If not, verify docker-compose.yml has:
|
||||
# privileged: true
|
||||
# network_mode: host
|
||||
```
|
||||
@@ -429,7 +753,7 @@ docker inspect sneakyscanner-web | grep NetworkMode
|
||||
docker ps | grep sneakyscanner-web
|
||||
|
||||
# Check if Flask is listening
|
||||
docker compose -f docker-compose-web.yml exec web netstat -tlnp | grep 5000
|
||||
docker compose -f docker-compose.yml exec web netstat -tlnp | grep 5000
|
||||
|
||||
# Check firewall rules
|
||||
sudo ufw status | grep 5000
|
||||
@@ -438,7 +762,7 @@ sudo ufw status | grep 5000
|
||||
curl http://localhost:5000/api/settings/health
|
||||
|
||||
# Check logs for binding errors
|
||||
docker compose -f docker-compose-web.yml logs web | grep -i bind
|
||||
docker compose -f docker-compose.yml logs web | grep -i bind
|
||||
```
|
||||
|
||||
### Background Scans Not Running
|
||||
@@ -447,13 +771,39 @@ docker compose -f docker-compose-web.yml logs web | grep -i bind
|
||||
|
||||
```bash
|
||||
# Check scheduler is initialized
|
||||
docker compose -f docker-compose-web.yml logs web | grep -i scheduler
|
||||
docker compose -f docker-compose.yml logs web | grep -i scheduler
|
||||
|
||||
# Check for job execution errors
|
||||
docker compose -f docker-compose-web.yml logs web | grep -i "execute_scan"
|
||||
docker compose -f docker-compose.yml logs web | grep -i "execute_scan"
|
||||
|
||||
# Verify APScheduler environment variables
|
||||
docker compose -f docker-compose-web.yml exec web env | grep SCHEDULER
|
||||
docker compose -f docker-compose.yml exec web env | grep SCHEDULER
|
||||
|
||||
# Check for scan job errors
|
||||
docker compose -f docker-compose.yml logs web | grep -E "(ERROR|Exception|Traceback)"
|
||||
|
||||
# Verify scanner executables are available
|
||||
docker compose -f docker-compose.yml exec web which masscan nmap
|
||||
```
|
||||
|
||||
### Config Files Not Appearing in Web UI
|
||||
|
||||
**Problem**: Manually created configs don't show up in web interface
|
||||
|
||||
```bash
|
||||
# Check file permissions (must be readable by web container)
|
||||
ls -la configs/
|
||||
|
||||
# Fix permissions if needed
|
||||
sudo chown -R 1000:1000 configs/
|
||||
chmod 644 configs/*.yaml
|
||||
|
||||
# Verify YAML syntax is valid
|
||||
docker compose -f docker-compose.yml exec web python3 -c \
|
||||
"import yaml; yaml.safe_load(open('/app/configs/your-config.yaml'))"
|
||||
|
||||
# Check web logs for parsing errors
|
||||
docker compose -f docker-compose.yml logs web | grep -i "config"
|
||||
```
|
||||
|
||||
### Health Check Failing
|
||||
@@ -462,7 +812,7 @@ docker compose -f docker-compose-web.yml exec web env | grep SCHEDULER
|
||||
|
||||
```bash
|
||||
# Run health check manually
|
||||
docker compose -f docker-compose-web.yml exec web \
|
||||
docker compose -f docker-compose.yml exec web \
|
||||
python3 -c "import urllib.request; print(urllib.request.urlopen('http://localhost:5000/api/settings/health').read())"
|
||||
|
||||
# Check if health endpoint exists
|
||||
@@ -480,16 +830,19 @@ curl -v http://localhost:5000/api/settings/health
|
||||
|
||||
### Production Deployment Checklist
|
||||
|
||||
- [ ] Changed `SECRET_KEY` to random value
|
||||
- [ ] Changed `SNEAKYSCANNER_ENCRYPTION_KEY` to random value
|
||||
- [ ] Set strong application password
|
||||
- [ ] Changed `SECRET_KEY` to random value (64+ character hex string)
|
||||
- [ ] Changed `SNEAKYSCANNER_ENCRYPTION_KEY` to random Fernet key
|
||||
- [ ] Set strong application password via init-db
|
||||
- [ ] Set `FLASK_ENV=production`
|
||||
- [ ] Set `FLASK_DEBUG=false`
|
||||
- [ ] Configured proper `CORS_ORIGINS` (not `*`)
|
||||
- [ ] Using HTTPS/TLS (reverse proxy recommended)
|
||||
- [ ] Restricted network access (firewall rules)
|
||||
- [ ] Regular backups configured
|
||||
- [ ] Regular backups configured (database + configs)
|
||||
- [ ] Log monitoring enabled
|
||||
- [ ] Scheduled scans configured with appropriate frequency
|
||||
- [ ] Alert rules configured (Phase 5 - coming soon)
|
||||
- [ ] Webhook/email notifications configured (Phase 5 - coming soon)
|
||||
|
||||
### Network Security
|
||||
|
||||
@@ -552,7 +905,7 @@ chmod 444 configs/*.yaml
|
||||
|
||||
```bash
|
||||
# 1. Stop the application
|
||||
docker compose -f docker-compose-web.yml down
|
||||
docker compose -f docker-compose.yml down
|
||||
|
||||
# 2. Backup database
|
||||
cp data/sneakyscanner.db data/sneakyscanner.db.backup
|
||||
@@ -561,16 +914,16 @@ cp data/sneakyscanner.db data/sneakyscanner.db.backup
|
||||
git pull origin master
|
||||
|
||||
# 4. Rebuild Docker image
|
||||
docker compose -f docker-compose-web.yml build
|
||||
docker compose -f docker-compose.yml build
|
||||
|
||||
# 5. Run database migrations
|
||||
docker compose -f docker-compose-web.yml run --rm web alembic upgrade head
|
||||
docker compose -f docker-compose.yml run --rm web alembic upgrade head
|
||||
|
||||
# 6. Start application
|
||||
docker compose -f docker-compose-web.yml up -d
|
||||
docker compose -f docker-compose.yml up -d
|
||||
|
||||
# 7. Verify upgrade
|
||||
docker compose -f docker-compose-web.yml logs -f
|
||||
docker compose -f docker-compose.yml logs -f
|
||||
curl http://localhost:5000/api/settings/health
|
||||
```
|
||||
|
||||
@@ -580,7 +933,7 @@ If upgrade fails:
|
||||
|
||||
```bash
|
||||
# Stop new version
|
||||
docker compose -f docker-compose-web.yml down
|
||||
docker compose -f docker-compose.yml down
|
||||
|
||||
# Restore database backup
|
||||
cp data/sneakyscanner.db.backup data/sneakyscanner.db
|
||||
@@ -589,8 +942,8 @@ cp data/sneakyscanner.db.backup data/sneakyscanner.db
|
||||
git checkout <previous-version-tag>
|
||||
|
||||
# Rebuild and start
|
||||
docker compose -f docker-compose-web.yml build
|
||||
docker compose -f docker-compose-web.yml up -d
|
||||
docker compose -f docker-compose.yml build
|
||||
docker compose -f docker-compose.yml up -d
|
||||
```
|
||||
|
||||
---
|
||||
@@ -607,7 +960,7 @@ BACKUP_DIR="backups/$(date +%Y%m%d_%H%M%S)"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
# Stop application for consistent backup
|
||||
docker compose -f docker-compose-web.yml stop web
|
||||
docker compose -f docker-compose.yml stop web
|
||||
|
||||
# Backup database
|
||||
cp data/sneakyscanner.db "$BACKUP_DIR/"
|
||||
@@ -619,7 +972,7 @@ find output/ -type f -mtime -30 -exec cp --parents {} "$BACKUP_DIR/" \;
|
||||
cp -r configs/ "$BACKUP_DIR/"
|
||||
|
||||
# Restart application
|
||||
docker compose -f docker-compose-web.yml start web
|
||||
docker compose -f docker-compose.yml start web
|
||||
|
||||
echo "Backup complete: $BACKUP_DIR"
|
||||
```
|
||||
@@ -639,7 +992,7 @@ crontab -e
|
||||
|
||||
```bash
|
||||
# Stop application
|
||||
docker compose -f docker-compose-web.yml down
|
||||
docker compose -f docker-compose.yml down
|
||||
|
||||
# Restore files
|
||||
cp backups/YYYYMMDD_HHMMSS/sneakyscanner.db data/
|
||||
@@ -647,7 +1000,7 @@ cp -r backups/YYYYMMDD_HHMMSS/configs/* configs/
|
||||
cp -r backups/YYYYMMDD_HHMMSS/output/* output/
|
||||
|
||||
# Start application
|
||||
docker compose -f docker-compose-web.yml up -d
|
||||
docker compose -f docker-compose.yml up -d
|
||||
```
|
||||
|
||||
---
|
||||
@@ -655,12 +1008,41 @@ docker compose -f docker-compose-web.yml up -d
|
||||
## Support and Further Reading
|
||||
|
||||
- **Project README**: `README.md` - General project information
|
||||
- **API Documentation**: `docs/ai/API_REFERENCE.md` - REST API reference
|
||||
- **Developer Guide**: `docs/ai/DEVELOPMENT.md` - Development setup and architecture
|
||||
- **Phase 2 Documentation**: `docs/ai/PHASE2.md` - Implementation details
|
||||
- **API Documentation**: `docs/API_REFERENCE.md` - Complete REST API reference
|
||||
- **Roadmap**: `docs/ROADMAP.md` - Project roadmap, feature plans, and architecture
|
||||
- **Issue Tracker**: File bugs and feature requests on GitHub
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-11-14
|
||||
**Version**: Phase 2 - Web Application Complete
|
||||
## What's New
|
||||
|
||||
### Phase 4 (2025-11-17) - Config Creator ✅
|
||||
- **CIDR-based Config Creator**: Web UI for generating scan configs from CIDR ranges
|
||||
- **YAML Editor**: Built-in editor with syntax highlighting (CodeMirror)
|
||||
- **Config Management UI**: List, view, edit, download, and delete configs via web interface
|
||||
- **Config Upload**: Direct YAML file upload for advanced users
|
||||
- **REST API**: 7 new config management endpoints
|
||||
- **Schedule Protection**: Prevents deleting configs used by active schedules
|
||||
|
||||
### Phase 3 (2025-11-14) - Dashboard & Scheduling ✅
|
||||
- **Dashboard**: Summary stats, recent scans, trend charts
|
||||
- **Scheduled Scans**: Cron-based scheduling with web UI management
|
||||
- **Scan History**: Detailed scan results with full data display
|
||||
- **Chart.js Integration**: Port count trends over time
|
||||
|
||||
### Phase 2 (2025-11-14) - Web Application Core ✅
|
||||
- **REST API**: Complete API for scan management
|
||||
- **Background Jobs**: APScheduler-based async execution
|
||||
- **Authentication**: Session-based login system
|
||||
- **Database Integration**: SQLite with SQLAlchemy ORM
|
||||
|
||||
### Coming Soon: Phase 5 - Email, Webhooks & Comparisons
|
||||
- Email notifications for infrastructure changes
|
||||
- Webhook integrations (Slack, PagerDuty, custom)
|
||||
- Scan comparison reports
|
||||
- Alert rule configuration
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-11-17
|
||||
**Version**: Phase 4 - Config Creator Complete
|
||||
|
||||
Reference in New Issue
Block a user