mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
feat: support custom browser profile path
This commit is contained in:
+30
-15
@@ -11,11 +11,13 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
browser string
|
||||
exportDir string
|
||||
outputFormat string
|
||||
verbose bool
|
||||
compress bool
|
||||
browserName string
|
||||
exportDir string
|
||||
outputFormat string
|
||||
verbose bool
|
||||
compress bool
|
||||
customProfilePath string
|
||||
customKeyPath string
|
||||
)
|
||||
|
||||
func Execute() {
|
||||
@@ -23,25 +25,38 @@ 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.3.0",
|
||||
Version: "0.3.1",
|
||||
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"},
|
||||
&cli.StringFlag{Name: "browser", Aliases: []string{"b"}, Destination: &browser, Value: "all", Usage: "Available browsers: all|" + strings.Join(core.ListBrowser(), "|")},
|
||||
&cli.StringFlag{Name: "results-dir", Aliases: []string{"dir"}, Destination: &exportDir, Value: "results", Usage: "Export dir"},
|
||||
&cli.StringFlag{Name: "format", Aliases: []string{"f"}, Destination: &outputFormat, Value: "csv", Usage: "Format, csv|json|console"},
|
||||
&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"},
|
||||
&cli.StringFlag{Name: "browser", Aliases: []string{"b"}, Destination: &browserName, Value: "all", Usage: "available browsers: all|" + strings.Join(core.ListBrowser(), "|")},
|
||||
&cli.StringFlag{Name: "results-dir", Aliases: []string{"dir"}, Destination: &exportDir, Value: "results", Usage: "export dir"},
|
||||
&cli.StringFlag{Name: "format", Aliases: []string{"f"}, Destination: &outputFormat, Value: "csv", Usage: "format, csv|json|console"},
|
||||
&cli.StringFlag{Name: "profile-dir-path", Aliases: []string{"p"}, Destination: &customProfilePath, Value: "", Usage: "custom profile dir path, get with chrome://version"},
|
||||
&cli.StringFlag{Name: "key-file-path", Aliases: []string{"k"}, Destination: &customKeyPath, Value: "", Usage: "custom key file path"},
|
||||
},
|
||||
HideHelpCommand: true,
|
||||
Action: func(c *cli.Context) error {
|
||||
var (
|
||||
browsers []core.Browser
|
||||
err error
|
||||
)
|
||||
if verbose {
|
||||
log.InitLog("debug")
|
||||
} else {
|
||||
log.InitLog("error")
|
||||
}
|
||||
// default select all browsers
|
||||
browsers, err := core.PickBrowser(browser)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
if customProfilePath != "" {
|
||||
browsers, err = core.PickCustomBrowser(browserName, customProfilePath, customKeyPath)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
} else {
|
||||
// default select all browsers
|
||||
browsers, err = core.PickBrowser(browserName)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
err = utils.MakeDir(exportDir)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user