From 6217ca3bed0e2ec565b8debecce704f9ef876f45 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, 18 Apr 2022 02:07:31 +0800 Subject: [PATCH] docs: update readme to v0.4.0 --- README.md | 101 ++++++++---------- README_ZH.md | 74 ++++++------- .../browingdata/{ => bookmark}/bookmark.go | 0 internal/browingdata/{ => cookie}/cookie.go | 0 .../{ => creditcard}/creditcard.go | 0 .../browingdata/{ => download}/download.go | 0 .../outputter_test.go | 0 .../browingdata/{ => password}/password.go | 0 internal/outputter/outputter.go | 78 -------------- 9 files changed, 78 insertions(+), 175 deletions(-) rename internal/browingdata/{ => bookmark}/bookmark.go (100%) rename internal/browingdata/{ => cookie}/cookie.go (100%) rename internal/browingdata/{ => creditcard}/creditcard.go (100%) rename internal/browingdata/{ => download}/download.go (100%) rename internal/{outputter => browingdata}/outputter_test.go (100%) rename internal/browingdata/{ => password}/password.go (100%) delete mode 100644 internal/outputter/outputter.go diff --git a/README.md b/README.md index 41a8028..172c05b 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,13 @@ Based on Apple's security policy, some browsers **require a current user passwor | Opera | ✅ | ✅ | ✅ | ✅ | | OperaGX | ✅ | ✅ | ✅ | ✅ | | Vivaldi | ✅ | ✅ | ✅ | ✅ | -| Yandex | ✅ | ✅ | ✅ | ✅ | | CocCoc | ✅ | ✅ | ✅ | ✅ | | Firefox | ✅ | ✅ | ✅ | ✅ | | Firefox Beta | ✅ | ✅ | ✅ | ✅ | | Firefox Dev | ✅ | ✅ | ✅ | ✅ | | Firefox ESR | ✅ | ✅ | ✅ | ✅ | | Firefox Nightly | ✅ | ✅ | ✅ | ✅ | +| Yandex | ✅ | ✅ | ✅ | ✅ | | Safari | ❌ | ❌ | ❌ | ❌ | ### Linux @@ -84,14 +84,14 @@ Installation of `HackBrowserData` is dead-simple, just download [the release for ### Building from source -support `go 1.14+` +only support `go 1.18+` with go generics ```bash -git clone https://github.com/moonD4rk/HackBrowserData +$ git clone https://github.com/moonD4rk/HackBrowserData -cd HackBrowserData +$ cd HackBrowserData/cmd/hack-browser-data -go build +$ CGO_ENABLED=1 go build ``` ### Cross compile @@ -125,70 +125,57 @@ NAME: USAGE: [hack-browser-data -b chrome -f json -dir results -cc] - Get all data(password/cookie/history/bookmark) from chrome + Export all browingdata(password/cookie/history/bookmark) from browser + Github Link: https://github.com/moonD4rk/HackBrowserData VERSION: - 0.3.7 + 0.4.0 + GLOBAL OPTIONS: - --verbose, --vv verbose (default: false) - --compress, --cc compress result to zip (default: false) - --browser value, -b value available browsers: all|opera|firefox|chrome|edge (default: "all") - --results-dir value, --dir value export dir (default: "results") - --format value, -f value format, csv|json|console (default: "csv") - --profile-dir-path value, -p value custom profile dir path, get with chrome://version - --key-file-path value, -k value custom key file path - --help, -h show help (default: false) - --version, -v print the version (default: false) - -PS C:\test> .\hack-browser-data.exe -b all -f json --dir results -cc -[x]: Get 44 cookies, filename is results/microsoft_edge_cookie.json -[x]: Get 54 history, filename is results/microsoft_edge_history.json -[x]: Get 1 passwords, filename is results/microsoft_edge_password.json -[x]: Get 4 bookmarks, filename is results/microsoft_edge_bookmark.json -[x]: Get 6 bookmarks, filename is results/360speed_bookmark.json -[x]: Get 19 cookies, filename is results/360speed_cookie.json -[x]: Get 18 history, filename is results/360speed_history.json -[x]: Get 1 passwords, filename is results/360speed_password.json -[x]: Get 12 history, filename is results/qq_history.json -[x]: Get 1 passwords, filename is results/qq_password.json -[x]: Get 12 bookmarks, filename is results/qq_bookmark.json -[x]: Get 14 cookies, filename is results/qq_cookie.json -[x]: Get 28 bookmarks, filename is results/firefox_bookmark.json -[x]: Get 10 cookies, filename is results/firefox_cookie.json -[x]: Get 33 history, filename is results/firefox_history.json -[x]: Get 1 passwords, filename is results/firefox_password.json -[x]: Get 1 passwords, filename is results/chrome_password.json -[x]: Get 4 bookmarks, filename is results/chrome_bookmark.json -[x]: Get 6 cookies, filename is results/chrome_cookie.json -[x]: Get 6 history, filename is results/chrome_history.json -[x]: Compress success, zip filename is results/archive.zip -``` -### Run with custom browser profile path + --verbose, --vv verbose (default: false) + --compress, --zip compress result to zip (default: false) + --browser value, -b value available browsers: all|chrome|opera-gx|vivaldi|coccoc|brave|edge|chromium|chrome-beta|opera|yandex|firefox (default: "all") + --results-dir value, --dir value export dir (default: "results") + --format value, -f value file name csv|json (default: "csv") + --profile-path value, -p value custom profile dir path, get with chrome://version + --help, -h show help (default: false) + --version, -v print the version (default: false) + + +PS C:\test> .\hack-browser-data.exe -b all -f json --dir results -zip +[NOTICE] [browser.go:46,pickChromium] find browser Chrome success +[NOTICE] [browser.go:46,pickChromium] find browser Microsoft Edge success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_download.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_password.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_creditcard.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_bookmark.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_cookie.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_history.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_history.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_download.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_password.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_creditcard.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_bookmark.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_cookie.json success ``` -PS C:\Users\User\Desktop> .\hack-browser-data.exe -b edge -p 'C:\Users\User\AppData\Local\Microsoft\Edge\User Data\Default' -k 'C:\Users\User\AppData\Local\Microsoft\Edge\User Data\Local State' +### Run with custom browser profile folder -[x]: Get 29 history, filename is results/microsoft_edge_history.csv -[x]: Get 0 passwords, filename is results/microsoft_edge_password.csv -[x]: Get 1 credit cards, filename is results/microsoft_edge_credit.csv -[x]: Get 4 bookmarks, filename is results/microsoft_edge_bookmark.csv -[x]: Get 54 cookies, filename is results/microsoft_edge_cookie.csv - - -PS C:\Users\User\Desktop> .\hack-browser-data.exe -b edge -p 'C:\Users\User\AppData\Local\Microsoft\Edge\User Data\Default' - -[x]: Get 1 credit cards, filename is results/microsoft_edge_credit.csv -[x]: Get 4 bookmarks, filename is results/microsoft_edge_bookmark.csv -[x]: Get 54 cookies, filename is results/microsoft_edge_cookie.csv -[x]: Get 29 history, filename is results/microsoft_edge_history.csv -[x]: Get 0 passwords, filename is results/microsoft_edge_password.csv +``` +PS C:\Users\User\Desktop> .\hack-browser-data.exe -b chrome -p 'C:\Users\User\AppData\Local\Microsoft\Edge\User Data\Default' + +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_creditcard.csv success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_bookmark.csv success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_cookie.csv success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_history.csv success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_download.csv success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_password.csv success ``` ### Some other projects based on HackBrowserData [Sharp-HackBrowserData](https://github.com/S3cur3Th1sSh1t/Sharp-HackBrowserData) [Reflective-HackBrowserData](https://github.com/idiotc4t/Reflective-HackBrowserData) -... ## Contributors diff --git a/README_ZH.md b/README_ZH.md index c12362b..1863d44 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -80,16 +80,14 @@ ### 从源码编译 -支持版本 `go 1.14+` +仅支持 `go 1.18+` 以后版本,一些函数使用到了泛型 ``` bash -git clone https://github.com/moonD4rk/HackBrowserData +$ git clone https://github.com/moonD4rk/HackBrowserData -cd HackBrowserData +$ cd HackBrowserData/cmd/hack-browser-data -go get -v -t -d ./... - -go build +$ CGO_ENABLED=1 go build ``` ### 跨平台编译 @@ -122,43 +120,39 @@ NAME: USAGE: [hack-browser-data -b chrome -f json -dir results -cc] - Get all data(password/cookie/history/bookmark) from chrome + Export all browingdata(password/cookie/history/bookmark) from browser + Github Link: https://github.com/moonD4rk/HackBrowserData VERSION: - 0.3.7 + 0.4.0 + GLOBAL OPTIONS: - --verbose, --vv verbose (default: false) - --compress, --cc compress result to zip (default: false) - --browser value, -b value available browsers: all|opera|firefox|chrome|edge (default: "all") - --results-dir value, --dir value export dir (default: "results") - --format value, -f value format, csv|json|console (default: "csv") - --profile-dir-path value, -p value custom profile dir path, get with chrome://version - --key-file-path value, -k value custom key file path - --help, -h show help (default: false) - --version, -v print the version (default: false) - -PS C:\test> .\hack-browser-data.exe -b all -f json --dir results --cc -[x]: Get 44 cookies, filename is results/microsoft_edge_cookie.json -[x]: Get 54 history, filename is results/microsoft_edge_history.json -[x]: Get 1 passwords, filename is results/microsoft_edge_password.json -[x]: Get 4 bookmarks, filename is results/microsoft_edge_bookmark.json -[x]: Get 6 bookmarks, filename is results/360speed_bookmark.json -[x]: Get 19 cookies, filename is results/360speed_cookie.json -[x]: Get 18 history, filename is results/360speed_history.json -[x]: Get 1 passwords, filename is results/360speed_password.json -[x]: Get 12 history, filename is results/qq_history.json -[x]: Get 1 passwords, filename is results/qq_password.json -[x]: Get 12 bookmarks, filename is results/qq_bookmark.json -[x]: Get 14 cookies, filename is results/qq_cookie.json -[x]: Get 28 bookmarks, filename is results/firefox_bookmark.json -[x]: Get 10 cookies, filename is results/firefox_cookie.json -[x]: Get 33 history, filename is results/firefox_history.json -[x]: Get 1 passwords, filename is results/firefox_password.json -[x]: Get 1 passwords, filename is results/chrome_password.json -[x]: Get 4 bookmarks, filename is results/chrome_bookmark.json -[x]: Get 6 cookies, filename is results/chrome_cookie.json -[x]: Get 6 history, filename is results/chrome_history.json -[x]: Compress success, zip filename is results/archive.zip + --verbose, --vv verbose (default: false) + --compress, --zip compress result to zip (default: false) + --browser value, -b value available browsers: all|chrome|opera-gx|vivaldi|coccoc|brave|edge|chromium|chrome-beta|opera|yandex|firefox (default: "all") + --results-dir value, --dir value export dir (default: "results") + --format value, -f value file name csv|json (default: "csv") + --profile-path value, -p value custom profile dir path, get with chrome://version + --help, -h show help (default: false) + --version, -v print the version (default: false) + + +PS C:\test> .\hack-browser-data.exe -b all -f json --dir results -zip +[NOTICE] [browser.go:46,pickChromium] find browser Chrome success +[NOTICE] [browser.go:46,pickChromium] find browser Microsoft Edge success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_download.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_password.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_creditcard.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_bookmark.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_cookie.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/microsoft_edge_history.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_history.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_download.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_password.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_creditcard.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_bookmark.json success +[NOTICE] [browsingdata.go:59,Output] output to file results/chrome_cookie.json success + ``` ### 基于此工具的一些其他项目 diff --git a/internal/browingdata/bookmark.go b/internal/browingdata/bookmark/bookmark.go similarity index 100% rename from internal/browingdata/bookmark.go rename to internal/browingdata/bookmark/bookmark.go diff --git a/internal/browingdata/cookie.go b/internal/browingdata/cookie/cookie.go similarity index 100% rename from internal/browingdata/cookie.go rename to internal/browingdata/cookie/cookie.go diff --git a/internal/browingdata/creditcard.go b/internal/browingdata/creditcard/creditcard.go similarity index 100% rename from internal/browingdata/creditcard.go rename to internal/browingdata/creditcard/creditcard.go diff --git a/internal/browingdata/download.go b/internal/browingdata/download/download.go similarity index 100% rename from internal/browingdata/download.go rename to internal/browingdata/download/download.go diff --git a/internal/outputter/outputter_test.go b/internal/browingdata/outputter_test.go similarity index 100% rename from internal/outputter/outputter_test.go rename to internal/browingdata/outputter_test.go diff --git a/internal/browingdata/password.go b/internal/browingdata/password/password.go similarity index 100% rename from internal/browingdata/password.go rename to internal/browingdata/password/password.go diff --git a/internal/outputter/outputter.go b/internal/outputter/outputter.go deleted file mode 100644 index f74418b..0000000 --- a/internal/outputter/outputter.go +++ /dev/null @@ -1,78 +0,0 @@ -package outputter - -import ( - "encoding/csv" - "errors" - "io" - "os" - "path/filepath" - - "github.com/gocarina/gocsv" - jsoniter "github.com/json-iterator/go" - - "hack-browser-data/internal/browingdata" -) - -type OutPutter struct { - json bool - csv bool -} - -func New(flag string) *OutPutter { - o := &OutPutter{} - if flag == "json" { - o.json = true - } else { - o.csv = true - } - return o -} - -func (o *OutPutter) Write(data browingdata.Source, writer io.Writer) error { - switch o.json { - case true: - encoder := jsoniter.NewEncoder(writer) - encoder.SetIndent(" ", " ") - encoder.SetEscapeHTML(false) - return encoder.Encode(data) - default: - gocsv.SetCSVWriter(func(w io.Writer) *gocsv.SafeCSVWriter { - writer := csv.NewWriter(w) - writer.Comma = ',' - return gocsv.NewSafeCSVWriter(writer) - }) - return gocsv.Marshal(data, writer) - } -} - -func (o *OutPutter) CreateFile(dir, filename string) (*os.File, error) { - if filename == "" { - return nil, errors.New("empty filename") - } - - if dir != "" { - if _, err := os.Stat(dir); os.IsNotExist(err) { - err := os.MkdirAll(dir, 0777) - if err != nil { - return nil, err - } - } - } - - var file *os.File - var err error - p := filepath.Join(dir, filename) - file, err = os.OpenFile(p, os.O_TRUNC|os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) - if err != nil { - return nil, err - } - return file, nil -} - -func (o *OutPutter) Ext() string { - if o.json { - return ".json" - } else { - return ".csv" - } -}