mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
feat: support edge-dev for linux
This commit is contained in:
+6
-5
@@ -99,11 +99,12 @@ type Chromium struct {
|
||||
name string
|
||||
profilePath string
|
||||
keyPath string
|
||||
storage string // use for linux browser
|
||||
secretKey []byte
|
||||
}
|
||||
|
||||
func NewChromium(profile, key, name string) (Browser, error) {
|
||||
return &Chromium{profilePath: profile, keyPath: key, name: name}, nil
|
||||
func NewChromium(profile, key, name, storage string) (Browser, error) {
|
||||
return &Chromium{profilePath: profile, keyPath: key, name: name, storage: storage}, nil
|
||||
}
|
||||
|
||||
func (c *Chromium) GetName() string {
|
||||
@@ -149,7 +150,7 @@ type Firefox struct {
|
||||
keyPath string
|
||||
}
|
||||
|
||||
func NewFirefox(profile, key, name string) (Browser, error) {
|
||||
func NewFirefox(profile, key, name, storage string) (Browser, error) {
|
||||
return &Firefox{profilePath: profile, keyPath: key, name: name}, nil
|
||||
}
|
||||
|
||||
@@ -221,7 +222,7 @@ func PickBrowser(name string) ([]Browser, error) {
|
||||
name = strings.ToLower(name)
|
||||
if name == "all" {
|
||||
for _, v := range browserList {
|
||||
b, err := v.New(v.ProfilePath, v.KeyPath, v.Name)
|
||||
b, err := v.New(v.ProfilePath, v.KeyPath, v.Name, v.Storage)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
@@ -229,7 +230,7 @@ func PickBrowser(name string) ([]Browser, error) {
|
||||
}
|
||||
return browsers, nil
|
||||
} else if choice, ok := browserList[name]; ok {
|
||||
b, err := choice.New(choice.ProfilePath, choice.KeyPath, choice.Name)
|
||||
b, err := choice.New(choice.ProfilePath, choice.KeyPath, choice.Name, choice.Storage)
|
||||
browsers = append(browsers, b)
|
||||
return browsers, err
|
||||
}
|
||||
|
||||
@@ -20,8 +20,14 @@ var (
|
||||
ProfilePath string
|
||||
Name string
|
||||
KeyPath string
|
||||
New func(profile, key, name string) (Browser, error)
|
||||
Storage string
|
||||
New func(profile, key, name, storage string) (Browser, error)
|
||||
}{
|
||||
"firefox": {
|
||||
ProfilePath: fireFoxProfilePath,
|
||||
Name: firefoxName,
|
||||
New: NewFirefox,
|
||||
},
|
||||
"chrome": {
|
||||
ProfilePath: chromeProfilePath,
|
||||
Name: chromeName,
|
||||
@@ -32,11 +38,6 @@ var (
|
||||
Name: edgeName,
|
||||
New: NewChromium,
|
||||
},
|
||||
"firefox": {
|
||||
ProfilePath: fireFoxProfilePath,
|
||||
Name: firefoxName,
|
||||
New: NewFirefox,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
+19
-4
@@ -12,6 +12,12 @@ import (
|
||||
const (
|
||||
fireFoxProfilePath = "/home/*/.mozilla/firefox/*.default-release/"
|
||||
chromeProfilePath = "/home/*/.config/google-chrome/*/"
|
||||
edgeProfilePath = "/home/*/.config/microsoft-edge*/*/"
|
||||
)
|
||||
|
||||
const (
|
||||
chromeStorageName = "Chrome Safe Storage"
|
||||
edgeStorageName = "Chromium Safe Storage"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -19,7 +25,8 @@ var (
|
||||
ProfilePath string
|
||||
Name string
|
||||
KeyPath string
|
||||
New func(profile, key, name string) (Browser, error)
|
||||
Storage string
|
||||
New func(profile, key, name, storage string) (Browser, error)
|
||||
}{
|
||||
"firefox": {
|
||||
ProfilePath: fireFoxProfilePath,
|
||||
@@ -29,6 +36,13 @@ var (
|
||||
"chrome": {
|
||||
ProfilePath: chromeProfilePath,
|
||||
Name: chromeName,
|
||||
Storage: chromeStorageName,
|
||||
New: NewChromium,
|
||||
},
|
||||
"edge": {
|
||||
ProfilePath: edgeProfilePath,
|
||||
Name: edgeName,
|
||||
Storage: edgeStorageName,
|
||||
New: NewChromium,
|
||||
},
|
||||
}
|
||||
@@ -62,24 +76,25 @@ func (c *Chromium) InitSecretKey() error {
|
||||
return err
|
||||
}
|
||||
for _, item := range items {
|
||||
i, err := item.GetLabel()
|
||||
label, err := item.GetLabel()
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
continue
|
||||
}
|
||||
if i == "Chrome Safe Storage" {
|
||||
if label == c.storage {
|
||||
se, err := item.GetSecret(session.Path())
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return err
|
||||
}
|
||||
chromeSecret = se.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
var chromeSalt = []byte("saltysalt")
|
||||
if chromeSecret == nil {
|
||||
return errDbusSecretIsEmpty
|
||||
}
|
||||
var chromeSalt = []byte("saltysalt")
|
||||
// @https://source.chromium.org/chromium/chromium/src/+/master:components/os_crypt/os_crypt_linux.cc
|
||||
key := pbkdf2.Key(chromeSecret, chromeSalt, 1, 16, sha1.New)
|
||||
c.secretKey = key
|
||||
|
||||
@@ -28,7 +28,8 @@ var (
|
||||
ProfilePath string
|
||||
Name string
|
||||
KeyPath string
|
||||
New func(profile, key, name string) (Browser, error)
|
||||
Storage string
|
||||
New func(profile, key, name, storage string) (Browser, error)
|
||||
}{
|
||||
"chrome": {
|
||||
ProfilePath: os.Getenv("USERPROFILE") + chromeProfilePath,
|
||||
|
||||
@@ -62,20 +62,6 @@ func (b *dataBlob) ToByteArray() []byte {
|
||||
}
|
||||
|
||||
// chrome < 80 https://chromium.googlesource.com/chromium/src/+/76f496a7235c3432983421402951d73905c8be96/components/os_crypt/os_crypt_win.cc#82
|
||||
func decryptStringWithDPAPI(data []byte) ([]byte, error) {
|
||||
dllCrypt := syscall.NewLazyDLL("Crypt32.dll")
|
||||
dllKernel := syscall.NewLazyDLL("Kernel32.dll")
|
||||
procDecryptData := dllCrypt.NewProc("CryptUnprotectData")
|
||||
procLocalFree := dllKernel.NewProc("LocalFree")
|
||||
var outBlob dataBlob
|
||||
r, _, err := procDecryptData.Call(uintptr(unsafe.Pointer(NewBlob(data))), 0, 0, 0, 0, 0, uintptr(unsafe.Pointer(&outBlob)))
|
||||
if r == 0 {
|
||||
return nil, err
|
||||
}
|
||||
defer procLocalFree.Call(uintptr(unsafe.Pointer(outBlob.pbData)))
|
||||
return outBlob.ToByteArray(), nil
|
||||
}
|
||||
|
||||
func DPApi(data []byte) ([]byte, error) {
|
||||
dllCrypt := syscall.NewLazyDLL("Crypt32.dll")
|
||||
dllKernel := syscall.NewLazyDLL("Kernel32.dll")
|
||||
|
||||
Reference in New Issue
Block a user