mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
feat: support extension for chromium
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"hack-browser-data/internal/browingdata/cookie"
|
||||
"hack-browser-data/internal/browingdata/creditcard"
|
||||
"hack-browser-data/internal/browingdata/download"
|
||||
"hack-browser-data/internal/browingdata/extension"
|
||||
"hack-browser-data/internal/browingdata/history"
|
||||
"hack-browser-data/internal/browingdata/localstorage"
|
||||
"hack-browser-data/internal/browingdata/password"
|
||||
@@ -78,6 +79,8 @@ func (d *Data) addSource(Sources []item.Item) {
|
||||
d.sources[source] = &creditcard.ChromiumCreditCard{}
|
||||
case item.ChromiumLocalStorage:
|
||||
d.sources[source] = &localstorage.ChromiumLocalStorage{}
|
||||
case item.ChromiumExtension:
|
||||
d.sources[source] = &extension.ChromiumExtension{}
|
||||
case item.YandexPassword:
|
||||
d.sources[source] = &password.YandexPassword{}
|
||||
case item.YandexCreditCard:
|
||||
|
||||
@@ -69,7 +69,6 @@ func (c *ChromiumCookie) Parse(masterKey []byte) error {
|
||||
CreateDate: typeutil.TimeEpoch(createDate),
|
||||
ExpireDate: typeutil.TimeEpoch(expireDate),
|
||||
}
|
||||
// TODO: replace DPAPI
|
||||
if len(encryptValue) > 0 {
|
||||
var err error
|
||||
if masterKey == nil {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package extension
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
)
|
||||
|
||||
type ChromiumExtension []*extension
|
||||
|
||||
type extension struct {
|
||||
Name string
|
||||
Description string
|
||||
Version string
|
||||
HomepageURL string
|
||||
}
|
||||
|
||||
const (
|
||||
manifest = "manifest.json"
|
||||
)
|
||||
|
||||
func (c *ChromiumExtension) Parse(masterKey []byte) error {
|
||||
files, err := fileutil.FilesInFolder(item.TempChromiumExtension, manifest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.RemoveAll(item.TempChromiumExtension)
|
||||
for _, f := range files {
|
||||
file, err := fileutil.ReadFile(f)
|
||||
if err != nil {
|
||||
log.Error("Failed to read file: %s", err)
|
||||
continue
|
||||
}
|
||||
b := gjson.Parse(file)
|
||||
*c = append(*c, &extension{
|
||||
Name: b.Get("name").String(),
|
||||
Description: b.Get("description").String(),
|
||||
Version: b.Get("version").String(),
|
||||
HomepageURL: b.Get("homepage_url").String(),
|
||||
})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ChromiumExtension) Name() string {
|
||||
return "extension"
|
||||
}
|
||||
@@ -44,7 +44,6 @@ func (c *ChromiumHistory) Parse(masterKey []byte) error {
|
||||
visitCount int
|
||||
lastVisitTime int64
|
||||
)
|
||||
// TODO: handle rows error
|
||||
if err := rows.Scan(&url, &title, &visitCount, &lastVisitTime); err != nil {
|
||||
log.Warn(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user