mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-07-08 21:37:49 +02:00
refactor(keys): extract master-key package to top-level keys/
Master-key acquisition and the cross-host dump format are a concern distinct from the raw crypto primitives, so crypto/keyretriever moves to an importable top-level keys/. KeyRetriever→Retriever drops the keys.KeyRetriever stutter.
This commit is contained in:
@@ -3,8 +3,8 @@ package chromium
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/moond4rk/hackbrowserdata/crypto/keyretriever"
|
||||
"github.com/moond4rk/hackbrowserdata/filemanager"
|
||||
"github.com/moond4rk/hackbrowserdata/keys"
|
||||
"github.com/moond4rk/hackbrowserdata/log"
|
||||
"github.com/moond4rk/hackbrowserdata/types"
|
||||
)
|
||||
@@ -30,7 +30,7 @@ func (p *profile) label() string { return p.browserName + "/" + p.name() }
|
||||
|
||||
// extract copies the profile's source files to a temp directory and extracts the
|
||||
// requested categories, decrypting with the installation's master keys.
|
||||
func (p *profile) extract(keys keyretriever.MasterKeys, categories []types.Category) *types.BrowserData {
|
||||
func (p *profile) extract(masterKeys keys.MasterKeys, categories []types.Category) *types.BrowserData {
|
||||
session, err := filemanager.NewSession()
|
||||
if err != nil {
|
||||
log.Debugf("new session for %s: %v", p.label(), err)
|
||||
@@ -45,7 +45,7 @@ func (p *profile) extract(keys keyretriever.MasterKeys, categories []types.Categ
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
p.extractCategory(data, cat, keys, path)
|
||||
p.extractCategory(data, cat, masterKeys, path)
|
||||
}
|
||||
return data
|
||||
}
|
||||
@@ -91,9 +91,9 @@ func (p *profile) acquireFiles(session *filemanager.Session, categories []types.
|
||||
|
||||
// extractCategory calls the appropriate extract function for a category. A custom
|
||||
// extractor (registered via extractorsForKind) takes precedence over the switch.
|
||||
func (p *profile) extractCategory(data *types.BrowserData, cat types.Category, keys keyretriever.MasterKeys, path string) {
|
||||
func (p *profile) extractCategory(data *types.BrowserData, cat types.Category, masterKeys keys.MasterKeys, path string) {
|
||||
if ext, ok := p.extractors[cat]; ok {
|
||||
if err := ext.extract(keys, path, data); err != nil {
|
||||
if err := ext.extract(masterKeys, path, data); err != nil {
|
||||
log.Debugf("extract %s for %s: %v", cat, p.label(), err)
|
||||
}
|
||||
return
|
||||
@@ -102,9 +102,9 @@ func (p *profile) extractCategory(data *types.BrowserData, cat types.Category, k
|
||||
var err error
|
||||
switch cat {
|
||||
case types.Password:
|
||||
data.Passwords, err = extractPasswords(keys, path)
|
||||
data.Passwords, err = extractPasswords(masterKeys, path)
|
||||
case types.Cookie:
|
||||
data.Cookies, err = extractCookies(keys, path)
|
||||
data.Cookies, err = extractCookies(masterKeys, path)
|
||||
case types.History:
|
||||
data.Histories, err = extractHistories(path)
|
||||
case types.Download:
|
||||
@@ -112,7 +112,7 @@ func (p *profile) extractCategory(data *types.BrowserData, cat types.Category, k
|
||||
case types.Bookmark:
|
||||
data.Bookmarks, err = extractBookmarks(path)
|
||||
case types.CreditCard:
|
||||
data.CreditCards, err = extractCreditCards(keys, path)
|
||||
data.CreditCards, err = extractCreditCards(masterKeys, path)
|
||||
case types.Extension:
|
||||
data.Extensions, err = extractExtensions(path)
|
||||
case types.LocalStorage:
|
||||
|
||||
Reference in New Issue
Block a user