Skip to main content

Overview

AutoPentestX stores all scan results in a SQLite database (database/autopentestx.db) for persistent storage, historical analysis, and custom reporting. The database schema is automatically created on first run.

Database Schema

Scans Table

Primary table tracking all penetration test scans:
Key Fields:
  • id - Unique scan identifier
  • target - IP address or hostname
  • scan_date - Timestamp of scan execution
  • os_detection - Detected operating system
  • scan_duration - Time in seconds
  • status - in_progress or completed

Ports Table

Stores discovered open ports and services:
Relationships: Links to scans table via scan_id

Vulnerabilities Table

Records identified vulnerabilities:
Risk Levels: CRITICAL, HIGH, MEDIUM, LOW, UNKNOWN

Exploits Table

Tracks exploitation attempts (safe mode):
Status Values: SIMULATED, SKIPPED, SUCCESS, BLOCKED

Web Vulnerabilities Table

Stores web-specific vulnerabilities from Nikto/SQLMap:

Common Queries

View All Scans

Retrieve all completed scans ordered by date:

Find Scans by Target

View Vulnerabilities for Specific Scan

Get High-Risk Vulnerabilities Across All Scans

Open Ports by Scan

Web Vulnerabilities Summary

Exploitation Attempts

Advanced Queries

Most Vulnerable Services

Identify services with highest vulnerability counts:

Risk Trend Over Time

Track risk scores across multiple scans of same target:

Comprehensive Scan Report

Generate complete scan overview:

CVE Distribution

Analyze CVE coverage across scans:

Python API

Connecting to Database

Insert Scan Data

Insert Port Data

Insert Vulnerability

Insert Web Vulnerability

Insert Exploit Attempt

Retrieve Scan Data

List All Scans

Close Connection

Database Utilities

Export to CSV

Export scan results for external analysis:

Backup Database

Database Statistics

Interactive Database Access

Using SQLite CLI

Useful commands:

Using Python Interactive Shell

The database is automatically created at database/autopentestx.db on first run. Ensure the database/ directory has appropriate write permissions.

Best Practices

  1. Regular Backups: Back up database before major scans
  2. Indexing: Add indexes for frequently queried columns
  3. Maintenance: Periodically vacuum database: VACUUM;
  4. Security: Restrict database file permissions: chmod 600
  5. Archival: Export old scans to CSV for long-term storage

Troubleshooting

Cause: Another process is accessing the databaseSolution:
Cause: Database tables weren’t createdSolution:
Cause: Large number of scans consuming storageSolution: