Database Configuration
AutoPentestX uses SQLite to store scan results, vulnerabilities, exploits, and historical data. All scan data is persisted to enable reporting, analysis, and audit trails.Database Location
Default database path (configurable inconfig.json):
Configuration Options
string
default:"sqlite"
Database type (currently only SQLite is supported)
string
default:"database/autopentestx.db"
Path to SQLite database file (relative or absolute)
boolean
default:true
Enable automatic database backups before modifications
integer
default:90
Number of days to retain scan data (0 = keep forever)
Database Schema
AutoPentestX creates five main tables to store scan data:1. Scans Table
Stores high-level scan metadata and results.Column Descriptions
INTEGER
Unique scan identifier (auto-incremented)
TEXT
Target IP address or domain name
TIMESTAMP
Timestamp when scan was initiated
TEXT
Detected operating system from fingerprinting
REAL
Total scan duration in seconds
INTEGER
Total number of ports scanned
INTEGER
Number of open ports discovered
INTEGER
Total vulnerabilities identified
TEXT
Overall risk level: CRITICAL, HIGH, MEDIUM, LOW, or INFO
TEXT
Scan status:
completed, in_progress, interrupted, or failed2. Ports Table
Stores information about discovered ports and services.Column Descriptions
INTEGER
Foreign key reference to parent scan
INTEGER
Port number (1-65535)
TEXT
Protocol:
tcp or udpTEXT
Port state:
open, closed, or filteredTEXT
Detected service name (e.g.,
http, ssh, mysql)TEXT
Service version string if detected
3. Vulnerabilities Table
Stores vulnerability findings and CVE data.Column Descriptions
TEXT
Vulnerability name or title
TEXT
Detailed description of the vulnerability
TEXT
CVE identifier (e.g.,
CVE-2024-1234)REAL
CVSS score (0.0 - 10.0)
TEXT
Risk classification: CRITICAL, HIGH, MEDIUM, LOW, or UNKNOWN
BOOLEAN
Whether known exploits exist (1 = yes, 0 = no)
4. Web Vulnerabilities Table
Stores web-specific vulnerabilities from Nikto and SQLMap.Column Descriptions
TEXT
Full URL where vulnerability was discovered
TEXT
Vulnerability type (e.g.,
XSS, SQL Injection, Directory Listing)TEXT
Severity level: HIGH, MEDIUM, or LOW
5. Exploits Table
Stores exploitation attempts and results.Column Descriptions
INTEGER
Foreign key reference to vulnerability being exploited
TEXT
Name of exploit module or technique
TEXT
Status:
success, failed, or simulatedTEXT
JSON-encoded exploit result data
Database Operations
TheDatabase class in modules/database.py provides methods for all database operations:
Initialization
Creating a Scan
Updating Scan Results
Inserting Port Data
Inserting Vulnerabilities
Retrieving Scan Data
Listing All Scans
Querying the Database
You can query the database directly using SQLite tools:Useful SQL Queries
Find High-Risk Scans
Get All Vulnerabilities for a Target
Count Exploitable Vulnerabilities
View Open Ports Across All Scans
Backup and Maintenance
Manual Backup
Database Cleanup
The
retention_days setting automatically removes old scans. Set to 0 to keep all data indefinitely.Optimize Database
Data Export
Export to CSV
Export to JSON
Database Connection Management
The Database class automatically:- Creates the database file if it doesn’t exist
- Creates all tables on first connection
- Handles connection errors gracefully
- Commits transactions after each operation
Error Handling
Common database errors and solutions:Related Resources
- Configuration Settings - Configure database path and retention
- Scan Options - CLI flags that affect database storage
- Architecture Overview - How database fits into AutoPentestX