diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 84299cf..cfdb78b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,9 +11,6 @@ jobs: matrix: os: [windows-latest, macos-latest] arch: [amd64] - # We sometimes use different verbiage for things (e.g. "darwin" - # for the GOOS build flag and "osx" in the actual release ZIP). - # We need to specify those here. include: - os: windows-latest goos: windows @@ -23,16 +20,22 @@ jobs: goos: darwin bin: 'hack-browser-data' releaseos: osx + - os: ubuntu-latest + goos: linux + bin: 'hack-browser-data' + releaseos: linux exclude: - os: macos-latest arch: '386' + - os: windows-latest + arch: '386' steps: - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.14 - # - if: matrix.os == 'ubuntu-latest' - # run: sudo apt-get update && sudo apt-get install -y gcc-multilib + - if: matrix.os == 'ubuntu-latest' + run: sudo apt-get update && sudo apt-get install -y gcc-multilib - if: matrix.arch == '386' run: echo "::set-env name=RELEASE::hack-browser-data-${{ github.event.release.tag_name }}-${{ matrix.releaseos}}-32bit" - if: matrix.arch == 'amd64' @@ -49,7 +52,6 @@ jobs: with: name: ${{ env.RELEASE }} path: ${{ matrix.bin }} - package: name: Package Assets runs-on: ubuntu-latest @@ -91,8 +93,6 @@ jobs: with: name: releases path: releases/ - # I would love to use @actions/upload-release-asset, but they don't - # support wildcards in the asset path. Ref #9, #24, and #47 - name: Upload Archives to Release env: UPLOAD_URL: ${{ github.event.release.upload_url }} diff --git a/README.md b/README.md index 2ad1ac1..d6af8c1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HackBrowserData -hack-browser-data is an open-source tool that could help you export data from browser. It supports the most popular browsers on the market and runs on Windows and macOS. +hack-browser-data is an open-source tool that could help you export data from browser. It supports the most popular browsers on the market and runs on Windows, macOS and Linux. ### Supported Browser @@ -27,11 +27,9 @@ Because of the security policies, all those browsers require a password. #### Linux -These browsers will be supported in the future. - | Browser | Password | Cookie | Bookmark | History | | :---------------------------------- | :------: | :----: | :------: | :-----: | -| Firefox | ❌ | ❌ | ❌ | ❌ | +| Firefox | ✅ | ✅ | ✅ | ✅ | | Google Chrome | ❌ | ❌ | ❌ | ❌ | @@ -64,10 +62,10 @@ USAGE: Get all data(password/cookie/history/bookmark) from chrome GLOBAL OPTIONS: - --verbose, --vv verbose (default: false) - --browser value, -b value available browsers: chrome|edge|360speed|qq|firefox (default: "chrome") - --results-dir value, --dir value export dir (default: "results") - --format value, -f value result format, csv|json (default: "csv") + --verbose, --vv Verbose (default: false) + --browser value, -b value Available browsers: chrome|edge|360speed|qq|firefox (default: "chrome") + --results-dir value, --dir value Export dir (default: "results") + --format value, -f value Format, csv|json (default: "csv") --export-data value, -e value all|password|cookie|history|bookmark (default: "all") --help, -h show help (default: false) diff --git a/core/common.go b/core/common.go index b484d28..a1f9e2a 100644 --- a/core/common.go +++ b/core/common.go @@ -98,7 +98,11 @@ var bookmarkList BookmarkSlice func parseBookmarks() { bookmarks, err := utils.ReadFile(utils.Bookmarks) - defer os.Remove(utils.Bookmarks) + defer func() { + if err := os.Remove(utils.Bookmarks); err != nil { + log.Error(err) + } + }() if err != nil { log.Debug(err) } @@ -119,7 +123,11 @@ func parseLogin() { var loginItemList LoginDataSlice login := loginData{} loginDB, err := sql.Open("sqlite3", utils.LoginData) - defer os.Remove(utils.LoginData) + defer func() { + if err := os.Remove(utils.LoginData); err != nil { + log.Error(err) + } + }() defer func() { if err := loginDB.Close(); err != nil { log.Debug(err) @@ -173,7 +181,11 @@ func parseCookie() { cookie := cookies{} cookieMap := make(map[string][]cookies) cookieDB, err := sql.Open("sqlite3", utils.Cookies) - defer os.Remove(utils.Cookies) + defer func() { + if err := os.Remove(utils.Cookies); err != nil { + log.Error(err) + } + }() defer func() { if err := cookieDB.Close(); err != nil { log.Debug(err) @@ -232,7 +244,11 @@ func parseHistory() { var historyList HistorySlice h := history{} historyDB, err := sql.Open("sqlite3", utils.History) - defer os.Remove(utils.History) + defer func() { + if err := os.Remove(utils.History); err != nil { + log.Error(err) + } + }() defer func() { if err := historyDB.Close(); err != nil { log.Debug(err) @@ -305,7 +321,11 @@ func parseFirefoxData() { ) tempMap = make(map[int64]string) keyDB, err = sql.Open("sqlite3", utils.FirefoxData) - defer os.Remove(utils.FirefoxData) + defer func() { + if err := os.Remove(utils.FirefoxData); err != nil { + log.Error(err) + } + }() defer func() { err := keyDB.Close() if err != nil { @@ -378,11 +398,11 @@ func GetDecryptKey() (b [][]byte) { pwdRows *sql.Rows nssRows *sql.Rows ) - //defer func() { - // if err := os.Remove(utils.FirefoxKey4DB); err != nil { - // log.Error(err) - // } - //}() + defer func() { + if err := os.Remove(utils.FirefoxKey4DB); err != nil { + log.Error(err) + } + }() keyDB, err = sql.Open("sqlite3", utils.FirefoxKey4DB) defer func() { if err := keyDB.Close(); err != nil { @@ -499,7 +519,11 @@ func parseFirefoxCookie() { cookie := cookies{} cookieMap := make(map[string][]cookies) cookieDB, err := sql.Open("sqlite3", utils.FirefoxCookie) - defer os.Remove(utils.FirefoxCookie) + defer func() { + if err := os.Remove(utils.FirefoxCookie); err != nil { + log.Debug(err) + } + }() defer func() { if err := cookieDB.Close(); err != nil { log.Debug(err) @@ -548,7 +572,11 @@ func GetLoginData() (l []loginData) { if err != nil { log.Warn(err) } - //defer os.Remove(utils.FirefoxLoginData) + defer func() { + if err := os.Remove(utils.FirefoxLoginData); err != nil { + log.Error(err) + } + }() h := gjson.GetBytes(s, "logins") if h.Exists() { for _, v := range h.Array() { diff --git a/utils/utils_linux.go b/utils/utils_linux.go index 6c88305..8baca46 100644 --- a/utils/utils_linux.go +++ b/utils/utils_linux.go @@ -13,7 +13,7 @@ import ( ) const ( - fireFoxProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-release/" + fireFoxProfilePath = "/home/*/.mozilla/firefox/*.default-release/" fireFoxCommand = "" )