Skip to main content
QtRecon uses an in-memory SQLite database to store reconnaissance data. The database is initialized with the following schema:

Tables

hosts

Stores information about discovered hosts.
ColumnTypeConstraintsDescription
idINTEGERPRIMARY KEY AUTOINCREMENT NOT NULLUnique host identifier
osTEXTOperating system information
ipTEXTUNIQUEIP address of the host
hostnameTEXTHostname
macTEXTMAC address
highlightTEXTHighlight color for the host
pwnedINTEGERNOT NULL DEFAULT 0 CHECK(pwned IN (0,1))Flag indicating if host is compromised
nmapTEXTNmap scan results
notesTEXTUser notes

hosts_ports

Stores port information for each host.
ColumnTypeDescription
host_idINTEGERForeign key to hosts table
protoTEXTProtocol (TCP/UDP)
portTEXTPort number
statusTEXTPort status (open, closed, filtered)
descriptionTEXTService description

hosts_tabs

Stores terminal/command output tabs for each host.
ColumnTypeConstraintsDescription
idINTEGERPRIMARY KEY AUTOINCREMENT NOT NULLUnique tab identifier
host_idINTEGERForeign key to hosts table
job_idINTEGERForeign key to jobs table
cmdlineTEXTCommand line executed
titleTEXTTab title
textTEXTTab content/output

hosts_creds

Stores credentials associated with hosts.
ColumnTypeConstraintsDefaultDescription
idINTEGERPRIMARY KEY AUTOINCREMENT NOT NULLUnique credential identifier
host_idINTEGERForeign key to hosts table
typeTEXT’password’Credential type
domainTEXTDomain
usernameTEXTUsername
passwordTEXTPassword

logs

Stores application log entries.
ColumnTypeConstraintsDescription
idINTEGERPRIMARY KEY AUTOINCREMENT NOT NULLUnique log identifier
dateTEXTTimestamp of log entry
typeTEXTLog type (INFO, ERROR, RUNTIME)
logTEXTLog message

jobs

Stores information about running and completed jobs.
ColumnTypeConstraintsDescription
idINTEGERPRIMARY KEY AUTOINCREMENT NOT NULLUnique job identifier
host_idINTEGERForeign key to hosts table
typeTEXTJob type
timestampTEXTJob start timestamp
stateTEXTJob state (running, completed, failed)
commandTEXTCommand being executed

Database operations

In-memory database

By default, QtRecon uses an in-memory SQLite database:
Database.init_DB()
This creates a fresh database instance with all tables initialized.

Import and export

QtRecon can import and export database files:
  • Import: Database.import_DB(filename) - Loads a database from disk
  • Export: Database.export_DB(filename) - Saves the current database to disk
When exporting, jobs are always deleted and RUNTIME logs are excluded. If delete_logs_on_save is enabled, all logs are deleted.

Compatibility migrations

QtRecon includes automatic database migrations for backward compatibility:

hosts_creds table (QtRecon < 1.2)

If the hosts_creds table doesn’t exist, it will be created automatically on import:
CREATE TABLE hosts_creds(
  id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
  host_id INTEGER,
  type TEXT DEFAULT 'password',
  domain TEXT DEFAULT '',
  username TEXT DEFAULT '',
  password TEXT DEFAULT ''
)

UNIQUE constraint on hosts.ip (QtRecon < 1.6)

For databases without the UNIQUE constraint on the ip column, a unique index is created:
CREATE UNIQUE INDEX host_ip ON hosts(ip)

cmdline field in hosts_tabs (QtRecon < 1.7)

If the cmdline field is missing from hosts_tabs, the table is recreated with the field:
-- Rename old table
ALTER TABLE hosts_tabs RENAME TO hosts_tabs_temp;

-- Create new table with cmdline field
CREATE TABLE hosts_tabs(
  id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
  host_id INTEGER,
  job_id INTEGER,
  cmdline TEXT,
  title TEXT,
  text
);

-- Copy data from old table
INSERT INTO hosts_tabs(id, host_id, job_id, title, text)
SELECT id, host_id, job_id, title, text FROM hosts_tabs_temp;

-- Drop old table
DROP TABLE hosts_tabs_temp;

Unsaved data tracking

QtRecon tracks whether the database has unsaved changes using the Database.has_unsaved_data flag. This flag is set to True whenever INSERT, UPDATE, or DELETE operations are performed (excluding RUNTIME operations). The current save file is tracked in Database.current_savefile.