mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-07-04 21:37:47 +02:00
feat: add CountEntries to skip decryption for list --detail (#562)
* feat: add CountEntries to skip decryption for list --detail (#549) * test: add CountEntries and countCategory tests at browser level * fix: address review feedback on CountRows and countLocalStorage * test: add CountRows unit tests
This commit is contained in:
@@ -11,9 +11,12 @@ import (
|
||||
"github.com/moond4rk/hackbrowserdata/utils/sqliteutil"
|
||||
)
|
||||
|
||||
const defaultCookieQuery = `SELECT name, encrypted_value, host_key, path,
|
||||
creation_utc, expires_utc, is_secure, is_httponly,
|
||||
has_expires, is_persistent FROM cookies`
|
||||
const (
|
||||
defaultCookieQuery = `SELECT name, encrypted_value, host_key, path,
|
||||
creation_utc, expires_utc, is_secure, is_httponly,
|
||||
has_expires, is_persistent FROM cookies`
|
||||
countCookieQuery = `SELECT COUNT(*) FROM cookies`
|
||||
)
|
||||
|
||||
func extractCookies(masterKey []byte, path string) ([]types.CookieEntry, error) {
|
||||
var decryptFails int
|
||||
@@ -65,6 +68,10 @@ func extractCookies(masterKey []byte, path string) ([]types.CookieEntry, error)
|
||||
return cookies, nil
|
||||
}
|
||||
|
||||
func countCookies(path string) (int, error) {
|
||||
return sqliteutil.CountRows(path, false, countCookieQuery)
|
||||
}
|
||||
|
||||
// stripCookieHash removes the SHA256(host_key) prefix from a decrypted cookie value.
|
||||
// Chrome 130+ (Cookie DB schema version 24) prepends SHA256(domain) to the cookie
|
||||
// value before encryption to prevent cross-domain cookie replay attacks.
|
||||
|
||||
Reference in New Issue
Block a user