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:id- Unique scan identifiertarget- IP address or hostnamescan_date- Timestamp of scan executionos_detection- Detected operating systemscan_duration- Time in secondsstatus-in_progressorcompleted
Ports Table
Stores discovered open ports and services:scans table via scan_id
Vulnerabilities Table
Records identified vulnerabilities:Exploits Table
Tracks exploitation attempts (safe mode):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
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
- Regular Backups: Back up database before major scans
- Indexing: Add indexes for frequently queried columns
- Maintenance: Periodically vacuum database:
VACUUM; - Security: Restrict database file permissions:
chmod 600 - Archival: Export old scans to CSV for long-term storage
Troubleshooting
Database locked error
Database locked error
Cause: Another process is accessing the databaseSolution:
Table doesn't exist
Table doesn't exist
Cause: Database tables weren’t createdSolution:
Disk space issues
Disk space issues
Cause: Large number of scans consuming storageSolution:
Related Resources
- PDF Reports - Generate reports from database data
- Log Files - Debugging database operations
- Risk Assessment - Understanding risk_score calculations