Skip to main content

Database

R4t uses a dual-storage system: a Badger KV store for fast configuration and session state, and a SQLite relational database for persistent findings, credentials, and enumeration results.

Storage Locations

Local DB mode: Run r4t set --local-db true to create r4t.sqlite in the current working directory instead. Useful for per-engagement database isolation.

Badger KV Store

Badger is an embedded key-value store used for fast access to global configuration and the current session state.

Characteristics

  • Encrypted with AES-256 using a hardware-derived ID as the key
  • ZSTD compression enabled
  • Daily encryption key rotation
  • Keeps only 1 version of each key (no history)
  • 10 GB index cache, 512 MB memtable size

Keys Stored in Badger

These values are read at startup and populated into the global App struct. Changes made via r4t set are immediately persisted to Badger.

SQLite Database

SQLite is the primary long-term store for all findings, targets, credentials, and enumeration data. It is accessed via GORM with a pure-Go SQLite driver.

Schema Management

  • AutoMigrate runs on every startup β€” safe and additive only (never drops columns or tables)
  • Composite unique indexes are created with IF NOT EXISTS to avoid duplicate enforcement errors
  • --migrate-db forces an explicit migration pass
  • --purge-db drops all tables and remigrates from scratch (requires interactive confirmation β€” destructive)

Tables

The schema contains 60+ tables organized by functional area.

Domain & Forest


AD Objects


Credentials & Sessions


Vulnerabilities


ADCS (Active Directory Certificate Services)


Group Policy


Networking & Protocols


Operations


Payload System (future)


Credential Model (Full Schema)

The credentials table stores all supported authentication types in a single unified model:

Target Model (Full Schema)


Direct Database Queries

The dbquery command lets you run raw SQL against the SQLite database:
Results are printed as a table to stdout.