mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-10-13 03:37:12 +02:00
refactor: extract master-key code into masterkey package (#604)
This commit is contained in:
1 parent
b901f7dff0
commit
c444314832
50 files changed
+449
-580
No files matched your search
@@ -6,8 +6,8 @@ import (
|
||||
"sort"
|
||||
|
||||
"github.com/moond4rk/hackbrowserdata/crypto"
|
||||
"github.com/moond4rk/hackbrowserdata/crypto/keyretriever"
|
||||
"github.com/moond4rk/hackbrowserdata/log"
|
||||
"github.com/moond4rk/hackbrowserdata/masterkey"
|
||||
"github.com/moond4rk/hackbrowserdata/types"
|
||||
"github.com/moond4rk/hackbrowserdata/utils/sqliteutil"
|
||||
)
|
||||
@@ -20,11 +20,11 @@ const (
|
||||
password_element, password_value, signon_realm, date_created FROM logins`
|
||||
)
|
||||
|
||||
func extractPasswords(keys keyretriever.MasterKeys, path string) ([]types.LoginEntry, error) {
|
||||
return extractPasswordsWithQuery(keys, path, defaultLoginQuery)
|
||||
func extractPasswords(masterKeys masterkey.MasterKeys, path string) ([]types.LoginEntry, error) {
|
||||
return extractPasswordsWithQuery(masterKeys, path, defaultLoginQuery)
|
||||
}
|
||||
|
||||
func extractPasswordsWithQuery(keys keyretriever.MasterKeys, path, query string) ([]types.LoginEntry, error) {
|
||||
func extractPasswordsWithQuery(masterKeys masterkey.MasterKeys, path, query string) ([]types.LoginEntry, error) {
|
||||
logins, err := sqliteutil.QueryRows(path, false, query,
|
||||
func(rows *sql.Rows) (types.LoginEntry, error) {
|
||||
var url, username string
|
||||
@@ -33,7 +33,7 @@ func extractPasswordsWithQuery(keys keyretriever.MasterKeys, path, query string)
|
||||
if err := rows.Scan(&url, &username, &pwd, &created); err != nil {
|
||||
return types.LoginEntry{}, err
|
||||
}
|
||||
password, _ := decryptValue(keys, pwd)
|
||||
password, _ := decryptValue(masterKeys, pwd)
|
||||
return types.LoginEntry{
|
||||
URL: url,
|
||||
Username: username,
|
||||
@@ -53,8 +53,8 @@ func extractPasswordsWithQuery(keys keyretriever.MasterKeys, path, query string)
|
||||
|
||||
// extractYandexPasswords walks Ya Passman Data; protocol in RFC-012 §4.
|
||||
// Note: URL column is origin_url — it's what the per-row AAD is computed over (not action_url).
|
||||
func extractYandexPasswords(keys keyretriever.MasterKeys, path string) ([]types.LoginEntry, error) {
|
||||
dataKey, err := loadYandexDataKey(path, keys.V10)
|
||||
func extractYandexPasswords(masterKeys masterkey.MasterKeys, path string) ([]types.LoginEntry, error) {
|
||||
dataKey, err := loadYandexDataKey(path, masterKeys.V10)
|
||||
if err != nil {
|
||||
if errors.Is(err, errYandexMasterPasswordSet) {
|
||||
log.Warnf("%s: %v", path, err)
|
||||
|
||||
Reference in new issue
Block a user