Documentation
¶
Overview ¶
Package scan finds WeChat database master keys by walking the WeChat process's RW memory regions, looking for the SQL literal pattern `x'<hex>'` that WCDB uses when it forwards keys to sqlite3_key_v2, and verifying each candidate against page 1 of every collected DB.
Algorithm (after Thearas, adapted for SQLCipher 4 + WCDB v4 KDF):
- enumerate RW non-executable regions of the WeChat task
- read each region in chunks; regex-match `x'[0-9a-fA-F]{64,192}'`
- for each match, take first 64 hex as candidate key, last 32 hex (when present) as embedded salt
- if embedded salt matches a DB salt, verify against that DB only; otherwise, try every DB whose salt is still unmatched
- verification = SQLCipher 4 password-or-enc_key MAC check
Index ¶
Constants ¶
const MaxRegionSize = 500 * 1024 * 1024
MaxRegionSize skips any single region larger than this (typically shared caches or the dyld closure mapped at full virtual size).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// IncludeBareHex enables a slower auxiliary pass that scans for bare
// 64-hex strings (no x'...' wrapper) and tries each as the master
// password. This recovers the master password when WCDB only ever held
// it as a plain std::string, but each candidate costs one 256000-round
// PBKDF2 to verify. Only enable when needed (e.g. Plan-C investigation).
IncludeBareHex bool
}
Options tunes Run.
type ProgressFn ¶
type ProgressFn func(s Stats)
ProgressFn is called periodically with cumulative stats so the CLI can print a status line. May be nil.
type Result ¶
type Result struct {
DBRel string `json:"db_rel"` // db path relative to scan root
DBPath string `json:"db_path"` // absolute db path
SaltHex string `json:"salt_hex"` // 32-hex db salt
KeyHex string `json:"key_hex"` // 64-hex master key
VerifyAs string `json:"verify_as"` // "password" or "enc_key"
}
Result describes one matched (db, key) pair.
type Stats ¶
type Stats struct {
Regions int `json:"regions"`
BytesScanned uint64 `json:"bytes_scanned"`
HexMatches int `json:"hex_matches"`
BareHexMatches int `json:"bare_hex_matches,omitempty"`
Verifications int `json:"verifications"` // PBKDF2 calls actually made
Found int `json:"found"`
Elapsed time.Duration `json:"elapsed_ns"`
}
Stats summarizes a scan run.