mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
refactoring code with interface, Close #22
This commit is contained in:
+39
-10
@@ -23,13 +23,13 @@ func Execute() {
|
||||
Name: "hack-browser-data",
|
||||
Usage: "Export passwords/cookies/history/bookmarks from browser",
|
||||
UsageText: "[hack-browser-data -b chrome -f json -dir results -e all]\n Get all data(password/cookie/history/bookmark) from chrome",
|
||||
Version: "0.1.8",
|
||||
Version: "0.1.9",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{Name: "verbose", Aliases: []string{"vv"}, Destination: &verbose, Value: false, Usage: "Verbose"},
|
||||
&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"},
|
||||
&cli.StringFlag{Name: "export-data", Aliases: []string{"e"}, Destination: &exportData, Value: "all", Usage: "all|password|cookie|history|bookmark"},
|
||||
&cli.StringFlag{Name: "export-data", Aliases: []string{"e"}, Destination: &exportData, Value: "all", Usage: "all|" + strings.Join(core.ListItem(), "|")},
|
||||
},
|
||||
HideHelpCommand: true,
|
||||
HideVersion: true,
|
||||
@@ -40,28 +40,57 @@ func Execute() {
|
||||
log.InitLog("error")
|
||||
}
|
||||
// default select all browsers
|
||||
browsers, err := core.PickBrowsers(browser)
|
||||
browsers, err := core.PickBrowser(browser)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
utils.MakeDir(exportDir)
|
||||
for _, v := range browsers {
|
||||
err := v.InitSecretKey()
|
||||
err = utils.MakeDir(exportDir)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
for _, browser := range browsers {
|
||||
err := browser.InitSecretKey()
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
err = v.GetProfilePath(exportData)
|
||||
items, err := browser.GetAllItems(exportData)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
v.ParseDB()
|
||||
v.OutPut(exportDir, outputFormat)
|
||||
name := browser.GetName()
|
||||
key := browser.GetSecretKey()
|
||||
for _, item := range items {
|
||||
err := item.CopyItem()
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
switch browser.(type) {
|
||||
case *core.Chromium:
|
||||
err := item.ChromeParse(key)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
case *core.Firefox:
|
||||
err := item.FirefoxParse()
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
err = item.Release()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = item.OutPut(outputFormat, name, exportDir)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
err := app.Run(os.Args)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user