mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
Safari's keychain now reaches extractors through the same Input as Chromium's keys, so every base's tables are static and share one signature; restore reads a fork this build lacks under its own name.
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/moond4rk/hackbrowserdata/internal/app"
|
|
"github.com/moond4rk/hackbrowserdata/internal/log"
|
|
)
|
|
|
|
func newDumpKeysCommand() *cobra.Command {
|
|
var (
|
|
flags app.DumpKeysFlags
|
|
keychain keychainFlags
|
|
outputPath string
|
|
)
|
|
|
|
command := &cobra.Command{
|
|
Use: "dumpkeys",
|
|
Short: "Export Chromium master keys as JSON for cross-host decryption",
|
|
Example: ` hack-browser-data dumpkeys -o keys.json
|
|
hack-browser-data dumpkeys -b chrome`,
|
|
RunE: func(command *cobra.Command, args []string) error {
|
|
options, err := app.ValidateDumpKeys(flags, keychainPasswordFunc(keychain, os.Stdin))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
discovery := app.Discover(command.Context(), options.Target)
|
|
vaultCount, err := app.DumpKeys(command.Context(), discovery, options.Keychain, command.OutOrStdout(), outputPath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
log.Infof("Exported keys for %d vault(s)", vaultCount)
|
|
return nil
|
|
},
|
|
}
|
|
|
|
command.Flags().StringVarP(&flags.Browser, "browser", "b", "all", "target browser: all|"+browserNames())
|
|
command.Flags().StringVarP(&outputPath, "output", "o", "", "output file (default: stdout)")
|
|
addKeychainPasswordFlags(command, &keychain)
|
|
|
|
return command
|
|
}
|