mirror of
https://github.com/moonD4rk/HackBrowserData
synced 2024-12-25 15:22:10 +00:00
chore: update project layout
This commit is contained in:
parent
9850624d45
commit
b65d3186c4
5
.gitignore
vendored
5
.gitignore
vendored
@ -190,4 +190,7 @@ result/
|
||||
results/
|
||||
|
||||
hack-browser-data
|
||||
!/cmd/hack-browser-data
|
||||
!/cmd/hack-browser-data
|
||||
!/browingdata/history
|
||||
!/browingdata/history/history.go
|
||||
!/browingdata/history/history_test.go
|
||||
|
@ -30,7 +30,7 @@ linters:
|
||||
- 'unconvert'
|
||||
- 'whitespace'
|
||||
disable:
|
||||
# unsupported lint with golang 1.18+ ref: https://github.com/golangci/golangci-lint/issues/2649
|
||||
# unsupported lint with golang 1.18+ ref: https://github.com/golangci/golangci-lint/issues/2649
|
||||
- 'bodyclose'
|
||||
- 'gosimple'
|
||||
- 'noctx'
|
||||
@ -60,7 +60,7 @@ issues:
|
||||
- G502
|
||||
- G505
|
||||
exclude-rules:
|
||||
- path: internal/provider/provider\.go
|
||||
- path: browser/browser\.go
|
||||
linters:
|
||||
- 'unused'
|
||||
max-issues-per-linter: 0
|
||||
|
@ -6,14 +6,14 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
|
||||
// import sqlite3 driver
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/fileutil"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
type ChromiumBookmark []bookmark
|
@ -3,17 +3,17 @@ package browingdata
|
||||
import (
|
||||
"path"
|
||||
|
||||
"hack-browser-data/internal/browingdata/bookmark"
|
||||
"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"
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata/bookmark"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata/cookie"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata/creditcard"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata/download"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata/extension"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata/history"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata/localstorage"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata/password"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/fileutil"
|
||||
)
|
||||
|
||||
type Data struct {
|
@ -6,13 +6,13 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"hack-browser-data/internal/decrypter"
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
|
||||
// import sqlite3 driver
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/crypto"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
type ChromiumCookie []cookie
|
||||
@ -73,9 +73,9 @@ func (c *ChromiumCookie) Parse(masterKey []byte) error {
|
||||
if len(encryptValue) > 0 {
|
||||
var err error
|
||||
if masterKey == nil {
|
||||
value, err = decrypter.DPAPI(encryptValue)
|
||||
value, err = crypto.DPAPI(encryptValue)
|
||||
} else {
|
||||
value, err = decrypter.Chromium(masterKey, encryptValue)
|
||||
value, err = crypto.Chromium(masterKey, encryptValue)
|
||||
}
|
||||
if err != nil {
|
||||
log.Error(err)
|
@ -4,12 +4,12 @@ import (
|
||||
"database/sql"
|
||||
"os"
|
||||
|
||||
"hack-browser-data/internal/decrypter"
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
|
||||
// import sqlite3 driver
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/crypto"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
)
|
||||
|
||||
type ChromiumCreditCard []card
|
||||
@ -57,12 +57,12 @@ func (c *ChromiumCreditCard) Parse(masterKey []byte) error {
|
||||
NickName: nickname,
|
||||
}
|
||||
if masterKey == nil {
|
||||
value, err = decrypter.DPAPI(encryptValue)
|
||||
value, err = crypto.DPAPI(encryptValue)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
value, err = decrypter.Chromium(masterKey, encryptValue)
|
||||
value, err = crypto.Chromium(masterKey, encryptValue)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -113,12 +113,12 @@ func (c *YandexCreditCard) Parse(masterKey []byte) error {
|
||||
NickName: nickname,
|
||||
}
|
||||
if masterKey == nil {
|
||||
value, err = decrypter.DPAPI(encryptValue)
|
||||
value, err = crypto.DPAPI(encryptValue)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
value, err = decrypter.Chromium(masterKey, encryptValue)
|
||||
value, err = crypto.Chromium(masterKey, encryptValue)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
@ -7,13 +7,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
|
||||
// import sqlite3 driver
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
type ChromiumDownload []download
|
@ -3,11 +3,11 @@ package extension
|
||||
import (
|
||||
"os"
|
||||
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/fileutil"
|
||||
)
|
||||
|
||||
type ChromiumExtension []*extension
|
@ -6,12 +6,12 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
|
||||
// import sqlite3 driver
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
type ChromiumHistory []history
|
@ -7,11 +7,11 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
|
||||
"github.com/syndtr/goleveldb/leveldb"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
type ChromiumLocalStorage []storage
|
@ -8,14 +8,14 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"hack-browser-data/internal/decrypter"
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
|
||||
// import sqlite3 driver
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/crypto"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
type ChromiumPassword []loginData
|
||||
@ -63,9 +63,9 @@ func (c *ChromiumPassword) Parse(masterKey []byte) error {
|
||||
if len(pwd) > 0 {
|
||||
var err error
|
||||
if masterKey == nil {
|
||||
password, err = decrypter.DPAPI(pwd)
|
||||
password, err = crypto.DPAPI(pwd)
|
||||
} else {
|
||||
password, err = decrypter.Chromium(masterKey, pwd)
|
||||
password, err = crypto.Chromium(masterKey, pwd)
|
||||
}
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
@ -131,9 +131,9 @@ func (c *YandexPassword) Parse(masterKey []byte) error {
|
||||
if len(pwd) > 0 {
|
||||
var err error
|
||||
if masterKey == nil {
|
||||
password, err = decrypter.DPAPI(pwd)
|
||||
password, err = crypto.DPAPI(pwd)
|
||||
} else {
|
||||
password, err = decrypter.Chromium(masterKey, pwd)
|
||||
password, err = crypto.Chromium(masterKey, pwd)
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("decrypt yandex password error %s", err)
|
||||
@ -174,7 +174,7 @@ func (f *FirefoxPassword) Parse(masterKey []byte) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
metaPBE, err := decrypter.NewASN1PBE(metaBytes)
|
||||
metaPBE, err := crypto.NewASN1PBE(metaBytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -187,7 +187,7 @@ func (f *FirefoxPassword) Parse(masterKey []byte) error {
|
||||
if bytes.Contains(k, []byte("password-check")) {
|
||||
m := bytes.Compare(nssA102, keyLin)
|
||||
if m == 0 {
|
||||
nssPBE, err := decrypter.NewASN1PBE(nssA11)
|
||||
nssPBE, err := crypto.NewASN1PBE(nssA11)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -201,11 +201,11 @@ func (f *FirefoxPassword) Parse(masterKey []byte) error {
|
||||
return err
|
||||
}
|
||||
for _, v := range allLogin {
|
||||
userPBE, err := decrypter.NewASN1PBE(v.encryptUser)
|
||||
userPBE, err := crypto.NewASN1PBE(v.encryptUser)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pwdPBE, err := decrypter.NewASN1PBE(v.encryptPass)
|
||||
pwdPBE, err := crypto.NewASN1PBE(v.encryptPass)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
@ -1,21 +1,27 @@
|
||||
package provider
|
||||
package browser
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"hack-browser-data/internal/browser"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/provider/chromium"
|
||||
"hack-browser-data/internal/provider/firefox"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata"
|
||||
"github.com/moond4rk/HackBrowserData/browser/chromium"
|
||||
"github.com/moond4rk/HackBrowserData/browser/firefox"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/fileutil"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
func PickBrowsers(name, profile string) ([]browser.Browser, error) {
|
||||
var browsers []browser.Browser
|
||||
type Browser interface {
|
||||
// Name is browser's name
|
||||
Name() string
|
||||
// BrowsingData returns all browsing data in the browser.
|
||||
BrowsingData() (*browingdata.Data, error)
|
||||
}
|
||||
|
||||
func PickBrowsers(name, profile string) ([]Browser, error) {
|
||||
var browsers []Browser
|
||||
clist := pickChromium(name, profile)
|
||||
for _, b := range clist {
|
||||
if b != nil {
|
||||
@ -31,8 +37,8 @@ func PickBrowsers(name, profile string) ([]browser.Browser, error) {
|
||||
return browsers, nil
|
||||
}
|
||||
|
||||
func pickChromium(name, profile string) []browser.Browser {
|
||||
var browsers []browser.Browser
|
||||
func pickChromium(name, profile string) []Browser {
|
||||
var browsers []Browser
|
||||
name = strings.ToLower(name)
|
||||
if name == "all" {
|
||||
for _, v := range chromiumList {
|
||||
@ -70,8 +76,8 @@ func pickChromium(name, profile string) []browser.Browser {
|
||||
return browsers
|
||||
}
|
||||
|
||||
func pickFirefox(name, profile string) []browser.Browser {
|
||||
var browsers []browser.Browser
|
||||
func pickFirefox(name, profile string) []Browser {
|
||||
var browsers []Browser
|
||||
name = strings.ToLower(name)
|
||||
if name == "all" || name == "firefox" {
|
||||
for _, v := range firefoxList {
|
||||
@ -106,23 +112,6 @@ func ListBrowsers() []string {
|
||||
return l
|
||||
}
|
||||
|
||||
// home dir path for all platforms
|
||||
var homeDir, _ = os.UserHomeDir()
|
||||
|
||||
const (
|
||||
chromeName = "Chrome"
|
||||
chromeBetaName = "Chrome Beta"
|
||||
chromiumName = "Chromium"
|
||||
edgeName = "Microsoft Edge"
|
||||
braveName = "Brave"
|
||||
operaName = "Opera"
|
||||
operaGXName = "OperaGX"
|
||||
vivaldiName = "Vivaldi"
|
||||
coccocName = "CocCoc"
|
||||
yandexName = "Yandex"
|
||||
firefoxName = "Firefox"
|
||||
speed360Name = "360speed"
|
||||
qqBrowserName = "QQ"
|
||||
dcbrowserName = "dcbrowser"
|
||||
sougouName = "Sougou"
|
||||
)
|
||||
func Names() string {
|
||||
return strings.Join(ListBrowsers(), "|")
|
||||
}
|
@ -5,14 +5,13 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"hack-browser-data/internal/browingdata"
|
||||
"hack-browser-data/internal/browser"
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/utils/fileutil"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
type chromium struct {
|
||||
type Chromium struct {
|
||||
name string
|
||||
storage string
|
||||
profilePath string
|
||||
@ -21,9 +20,9 @@ type chromium struct {
|
||||
itemPaths map[item.Item]string
|
||||
}
|
||||
|
||||
// New create instance of chromium browser, fill item's path if item is existed.
|
||||
func New(name, storage, profilePath string, items []item.Item) ([]browser.Browser, error) {
|
||||
c := &chromium{
|
||||
// New create instance of Chromium browser, fill item's path if item is existed.
|
||||
func New(name, storage, profilePath string, items []item.Item) ([]*Chromium, error) {
|
||||
c := &Chromium{
|
||||
name: name,
|
||||
storage: storage,
|
||||
profilePath: profilePath,
|
||||
@ -33,9 +32,9 @@ func New(name, storage, profilePath string, items []item.Item) ([]browser.Browse
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
chromiumList := make([]browser.Browser, 0, len(multiItemPaths))
|
||||
chromiumList := make([]*Chromium, 0, len(multiItemPaths))
|
||||
for user, itemPaths := range multiItemPaths {
|
||||
chromiumList = append(chromiumList, &chromium{
|
||||
chromiumList = append(chromiumList, &Chromium{
|
||||
name: fileutil.BrowserName(name, user),
|
||||
items: typeutil.Keys(itemPaths),
|
||||
itemPaths: itemPaths,
|
||||
@ -45,11 +44,11 @@ func New(name, storage, profilePath string, items []item.Item) ([]browser.Browse
|
||||
return chromiumList, nil
|
||||
}
|
||||
|
||||
func (c *chromium) Name() string {
|
||||
func (c *Chromium) Name() string {
|
||||
return c.name
|
||||
}
|
||||
|
||||
func (c *chromium) BrowsingData() (*browingdata.Data, error) {
|
||||
func (c *Chromium) BrowsingData() (*browingdata.Data, error) {
|
||||
b := browingdata.New(c.items)
|
||||
|
||||
if err := c.copyItemToLocal(); err != nil {
|
||||
@ -68,7 +67,7 @@ func (c *chromium) BrowsingData() (*browingdata.Data, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (c *chromium) copyItemToLocal() error {
|
||||
func (c *Chromium) copyItemToLocal() error {
|
||||
for i, path := range c.itemPaths {
|
||||
filename := i.String()
|
||||
var err error
|
||||
@ -90,7 +89,7 @@ func (c *chromium) copyItemToLocal() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *chromium) getMultiItemPath(profilePath string, items []item.Item) (map[string]map[item.Item]string, error) {
|
||||
func (c *Chromium) getMultiItemPath(profilePath string, items []item.Item) (map[string]map[item.Item]string, error) {
|
||||
// multiItemPaths is a map of user to item path, map[profile 1][item's name & path key pair]
|
||||
multiItemPaths := make(map[string]map[item.Item]string)
|
||||
parentDir := fileutil.ParentDir(profilePath)
|
@ -12,8 +12,8 @@ import (
|
||||
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -21,7 +21,7 @@ var (
|
||||
errCouldNotFindInKeychain = errors.New("could not be find in keychain")
|
||||
)
|
||||
|
||||
func (c *chromium) GetMasterKey() ([]byte, error) {
|
||||
func (c *Chromium) GetMasterKey() ([]byte, error) {
|
||||
var (
|
||||
cmd *exec.Cmd
|
||||
stdout, stderr bytes.Buffer
|
@ -11,11 +11,11 @@ import (
|
||||
keyring "github.com/ppacher/go-dbus-keyring"
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
)
|
||||
|
||||
func (c *chromium) GetMasterKey() ([]byte, error) {
|
||||
func (c *Chromium) GetMasterKey() ([]byte, error) {
|
||||
// what is d-bus @https://dbus.freedesktop.org/
|
||||
var chromiumSecret []byte
|
||||
conn, err := dbus.SessionBus()
|
@ -9,15 +9,14 @@ import (
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"hack-browser-data/internal/decrypter"
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/fileutil"
|
||||
)
|
||||
|
||||
var errDecodeMasterKeyFailed = errors.New("decode master key failed")
|
||||
|
||||
func (c *chromium) GetMasterKey() ([]byte, error) {
|
||||
func (c *Chromium) GetMasterKey() ([]byte, error) {
|
||||
keyFile, err := fileutil.ReadFile(item.TempChromiumKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -31,7 +30,7 @@ func (c *chromium) GetMasterKey() ([]byte, error) {
|
||||
if err != nil {
|
||||
return nil, errDecodeMasterKeyFailed
|
||||
}
|
||||
c.masterKey, err = decrypter.DPAPI(pureKey[5:])
|
||||
c.masterKey, err = crypto.DPAPI(pureKey[5:])
|
||||
log.Infof("%s initialized master key success", c.name)
|
||||
return c.masterKey, err
|
||||
}
|
26
browser/consts.go
Normal file
26
browser/consts.go
Normal file
@ -0,0 +1,26 @@
|
||||
package browser
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// home dir path for all platforms
|
||||
var homeDir, _ = os.UserHomeDir()
|
||||
|
||||
const (
|
||||
chromeName = "Chrome"
|
||||
chromeBetaName = "Chrome Beta"
|
||||
chromiumName = "Chromium"
|
||||
edgeName = "Microsoft Edge"
|
||||
braveName = "Brave"
|
||||
operaName = "Opera"
|
||||
operaGXName = "OperaGX"
|
||||
vivaldiName = "Vivaldi"
|
||||
coccocName = "CocCoc"
|
||||
yandexName = "Yandex"
|
||||
firefoxName = "Firefox"
|
||||
speed360Name = "360speed"
|
||||
qqBrowserName = "QQ"
|
||||
dcBrowserName = "DC"
|
||||
sogouName = "Sogou"
|
||||
)
|
@ -6,14 +6,13 @@ import (
|
||||
"io/fs"
|
||||
"path/filepath"
|
||||
|
||||
"hack-browser-data/internal/browingdata"
|
||||
"hack-browser-data/internal/browser"
|
||||
"hack-browser-data/internal/item"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
"hack-browser-data/internal/utils/typeutil"
|
||||
"github.com/moond4rk/HackBrowserData/browingdata"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
"github.com/moond4rk/HackBrowserData/utils/fileutil"
|
||||
"github.com/moond4rk/HackBrowserData/utils/typeutil"
|
||||
)
|
||||
|
||||
type firefox struct {
|
||||
type Firefox struct {
|
||||
name string
|
||||
storage string
|
||||
profilePath string
|
||||
@ -24,9 +23,9 @@ type firefox struct {
|
||||
|
||||
var ErrProfilePathNotFound = errors.New("profile path not found")
|
||||
|
||||
// New returns a new firefox instance.
|
||||
func New(name, storage, profilePath string, items []item.Item) ([]browser.Browser, error) {
|
||||
f := &firefox{
|
||||
// New returns a new Firefox instance.
|
||||
func New(name, storage, profilePath string, items []item.Item) ([]*Firefox, error) {
|
||||
f := &Firefox{
|
||||
name: name,
|
||||
storage: storage,
|
||||
profilePath: profilePath,
|
||||
@ -37,10 +36,10 @@ func New(name, storage, profilePath string, items []item.Item) ([]browser.Browse
|
||||
return nil, err
|
||||
}
|
||||
|
||||
firefoxList := make([]browser.Browser, 0, len(multiItemPaths))
|
||||
firefoxList := make([]*Firefox, 0, len(multiItemPaths))
|
||||
for name, itemPaths := range multiItemPaths {
|
||||
firefoxList = append(firefoxList, &firefox{
|
||||
name: fmt.Sprintf("firefox-%s", name),
|
||||
firefoxList = append(firefoxList, &Firefox{
|
||||
name: fmt.Sprintf("Firefox-%s", name),
|
||||
items: typeutil.Keys(itemPaths),
|
||||
itemPaths: itemPaths,
|
||||
})
|
||||
@ -48,13 +47,13 @@ func New(name, storage, profilePath string, items []item.Item) ([]browser.Browse
|
||||
return firefoxList, nil
|
||||
}
|
||||
|
||||
func (f *firefox) getMultiItemPath(profilePath string, items []item.Item) (map[string]map[item.Item]string, error) {
|
||||
func (f *Firefox) getMultiItemPath(profilePath string, items []item.Item) (map[string]map[item.Item]string, error) {
|
||||
multiItemPaths := make(map[string]map[item.Item]string)
|
||||
err := filepath.Walk(profilePath, firefoxWalkFunc(items, multiItemPaths))
|
||||
return multiItemPaths, err
|
||||
}
|
||||
|
||||
func (f *firefox) copyItemToLocal() error {
|
||||
func (f *Firefox) copyItemToLocal() error {
|
||||
for i, path := range f.itemPaths {
|
||||
filename := i.String()
|
||||
if err := fileutil.CopyFile(path, filename); err != nil {
|
||||
@ -80,15 +79,15 @@ func firefoxWalkFunc(items []item.Item, multiItemPaths map[string]map[item.Item]
|
||||
}
|
||||
}
|
||||
|
||||
func (f *firefox) GetMasterKey() ([]byte, error) {
|
||||
func (f *Firefox) GetMasterKey() ([]byte, error) {
|
||||
return f.masterKey, nil
|
||||
}
|
||||
|
||||
func (f *firefox) Name() string {
|
||||
func (f *Firefox) Name() string {
|
||||
return f.name
|
||||
}
|
||||
|
||||
func (f *firefox) BrowsingData() (*browingdata.Data, error) {
|
||||
func (f *Firefox) BrowsingData() (*browingdata.Data, error) {
|
||||
b := browingdata.New(f.items)
|
||||
|
||||
if err := f.copyItemToLocal(); err != nil {
|
@ -1,9 +1,9 @@
|
||||
//go:build darwin
|
||||
|
||||
package provider
|
||||
package browser
|
||||
|
||||
import (
|
||||
"hack-browser-data/internal/item"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
)
|
||||
|
||||
var (
|
@ -1,9 +1,9 @@
|
||||
//go:build linux
|
||||
|
||||
package provider
|
||||
package browser
|
||||
|
||||
import (
|
||||
"hack-browser-data/internal/item"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
)
|
||||
|
||||
var (
|
@ -1,9 +1,9 @@
|
||||
//go:build windows
|
||||
|
||||
package provider
|
||||
package browser
|
||||
|
||||
import (
|
||||
"hack-browser-data/internal/item"
|
||||
"github.com/moond4rk/HackBrowserData/item"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -73,14 +73,14 @@ var (
|
||||
profilePath: qqBrowserProfilePath,
|
||||
items: item.DefaultChromium,
|
||||
},
|
||||
"dcbrowser": {
|
||||
name: dcbrowserName,
|
||||
profilePath: dcbrowserUserDataPath,
|
||||
"dc": {
|
||||
name: dcBrowserName,
|
||||
profilePath: dcBrowserProfilePath,
|
||||
items: item.DefaultChromium,
|
||||
},
|
||||
"sougou": {
|
||||
name: sougouName,
|
||||
profilePath: dcbrowserUserDataPath,
|
||||
"sogou": {
|
||||
name: sogouName,
|
||||
profilePath: sogouProfilePath,
|
||||
items: item.DefaultChromium,
|
||||
},
|
||||
}
|
||||
@ -111,8 +111,8 @@ var (
|
||||
vivaldiProfilePath = homeDir + "/AppData/Local/Vivaldi/User Data/Default/"
|
||||
coccocProfilePath = homeDir + "/AppData/Local/CocCoc/Browser/User Data/Default/"
|
||||
yandexProfilePath = homeDir + "/AppData/Local/Yandex/YandexBrowser/User Data/Default/"
|
||||
dcbrowserUserDataPath = homeDir + "/AppData/Local/DCBrowser/User Data/Default/"
|
||||
sougouUserDataPath = homeDir + "/AppData/Roaming/SogouExplorer/Webkit/Default/"
|
||||
dcBrowserProfilePath = homeDir + "/AppData/Local/DCBrowser/User Data/Default/"
|
||||
sogouProfilePath = homeDir + "/AppData/Roaming/SogouExplorer/Webkit/Default/"
|
||||
|
||||
firefoxProfilePath = homeDir + "/AppData/Roaming/Mozilla/Firefox/Profiles/"
|
||||
)
|
@ -2,13 +2,12 @@ package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"hack-browser-data/internal/log"
|
||||
"hack-browser-data/internal/provider"
|
||||
"hack-browser-data/internal/utils/fileutil"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/moond4rk/HackBrowserData/browser"
|
||||
"github.com/moond4rk/HackBrowserData/log"
|
||||
"github.com/moond4rk/HackBrowserData/utils/fileutil"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -33,7 +32,7 @@ func Execute() {
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{Name: "verbose", Aliases: []string{"vv"}, Destination: &verbose, Value: false, Usage: "verbose"},
|
||||
&cli.BoolFlag{Name: "compress", Aliases: []string{"zip"}, Destination: &compress, Value: false, Usage: "compress result to zip"},
|
||||
&cli.StringFlag{Name: "browser", Aliases: []string{"b"}, Destination: &browserName, Value: "all", Usage: "available browsers: all|" + strings.Join(provider.ListBrowsers(), "|")},
|
||||
&cli.StringFlag{Name: "browser", Aliases: []string{"b"}, Destination: &browserName, Value: "all", Usage: "available browsers: all|" + browser.Names()},
|
||||
&cli.StringFlag{Name: "results-dir", Aliases: []string{"dir"}, Destination: &outputDir, Value: "results", Usage: "export dir"},
|
||||
&cli.StringFlag{Name: "format", Aliases: []string{"f"}, Destination: &outputFormat, Value: "csv", Usage: "file name csv|json"},
|
||||
&cli.StringFlag{Name: "profile-path", Aliases: []string{"p"}, Destination: &profilePath, Value: "", Usage: "custom profile dir path, get with chrome://version"},
|
||||
@ -46,7 +45,7 @@ func Execute() {
|
||||
log.Init("notice")
|
||||
}
|
||||
|
||||
browsers, err := provider.PickBrowsers(browserName, profilePath)
|
||||
browsers, err := browser.PickBrowsers(browserName, profilePath)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package decrypter
|
||||
package crypto
|
||||
|
||||
import (
|
||||
"crypto/aes"
|
@ -1,6 +1,6 @@
|
||||
//go:build darwin
|
||||
|
||||
package decrypter
|
||||
package crypto
|
||||
|
||||
func Chromium(key, encryptPass []byte) ([]byte, error) {
|
||||
if len(encryptPass) <= 3 {
|
@ -1,6 +1,6 @@
|
||||
//go:build linux
|
||||
|
||||
package decrypter
|
||||
package crypto
|
||||
|
||||
func Chromium(key, encryptPass []byte) ([]byte, error) {
|
||||
if len(encryptPass) < 3 {
|
@ -1,6 +1,6 @@
|
||||
//go:build windows
|
||||
|
||||
package decrypter
|
||||
package crypto
|
||||
|
||||
import (
|
||||
"crypto/aes"
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module hack-browser-data
|
||||
module github.com/moond4rk/HackBrowserData
|
||||
|
||||
go 1.19
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
package browser
|
||||
|
||||
import (
|
||||
"hack-browser-data/internal/browingdata"
|
||||
)
|
||||
|
||||
type Browser interface {
|
||||
// Name is browser's name
|
||||
Name() string
|
||||
// BrowsingData returns all browsing data in the browser.
|
||||
BrowsingData() (*browingdata.Data, error)
|
||||
}
|
Loading…
Reference in New Issue
Block a user