mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
refactor: run every command on the pipeline (#665)
dump, dumpkeys, archive, restore, and list now run on the app stages, so cmd's old path goes away. archive writes manifest.json and restore reads it, falling back to today's layout for older archives. Windows and macOS smoke matched today's output apart from the planned changes.
This commit is contained in:
1 parent
cebfa97ed6
commit
bbd353f314
45 files changed
+1516
-664
No files matched your search
@@ -3,15 +3,14 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/moond4rk/hackbrowserdata/browser"
|
||||
"github.com/moond4rk/hackbrowserdata/internal/app"
|
||||
"github.com/moond4rk/hackbrowserdata/internal/log"
|
||||
)
|
||||
|
||||
func archiveCmd() *cobra.Command {
|
||||
var (
|
||||
browserName string
|
||||
category string
|
||||
outputPath string
|
||||
f app.Flags
|
||||
outputPath string
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -20,19 +19,16 @@ func archiveCmd() *cobra.Command {
|
||||
Example: ` hack-browser-data archive
|
||||
hack-browser-data archive -b chrome -c cookie -o chrome-cookies.zip`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
browsers, err := browser.DiscoverBrowsers(browser.DiscoverOptions{Name: browserName})
|
||||
req, err := app.ValidateArchive(f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(browsers) == 0 {
|
||||
d := app.Discover(req)
|
||||
if len(d.Dirs) == 0 {
|
||||
log.Warnf("no browsers found")
|
||||
return nil
|
||||
}
|
||||
categories, err := parseCategories(category)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n, err := browser.WriteArchive(browsers, categories, outputPath)
|
||||
n, err := app.Archive(cmd.Context(), d, req, outputPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -41,8 +37,8 @@ func archiveCmd() *cobra.Command {
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&browserName, "browser", "b", "all", "target browser: all|"+browser.Names())
|
||||
cmd.Flags().StringVarP(&category, "category", "c", "all", "data categories (comma-separated): all|"+categoryNames())
|
||||
cmd.Flags().StringVarP(&f.Browser, "browser", "b", "all", "target browser: all|"+browserNames())
|
||||
cmd.Flags().StringVarP(&f.Categories, "category", "c", "all", "data categories (comma-separated): all|"+categoryNames())
|
||||
cmd.Flags().StringVarP(&outputPath, "output", "o", "browser-data.zip", "output archive of decryption-relevant browser files")
|
||||
|
||||
return cmd
|
||||
|
||||
Reference in new issue
Block a user