feat: support extension for firefox

pull/129/head
ᴍᴏᴏɴD4ʀᴋ 3 years ago
parent 26de1075ee
commit 353503f90f
  1. 2
      cmd/hack-browser-data/main.go
  2. 2
      internal/browingdata/browsingdata.go
  3. 24
      internal/browingdata/extension/extension.go
  4. 3
      internal/item/filename.go
  5. 6
      internal/item/item.go

@ -29,7 +29,7 @@ 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]\nExport all browingdata(password/cookie/history/bookmark) from browser\nGithub Link: https://github.com/moonD4rk/HackBrowserData",
Version: "0.4.1",
Version: "0.4.2",
Flags: []cli.Flag{
&cli.BoolFlag{Name: "verbose", Aliases: []string{"vv"}, Destination: &verbose, Value: false, Usage: "verbose"},
&cli.BoolFlag{Name: "compress", Aliases: []string{"zip"}, Destination: &compress, Value: false, Usage: "compress result to zip"},

@ -97,6 +97,8 @@ func (d *Data) addSource(Sources []item.Item) {
d.sources[source] = &download.FirefoxDownload{}
case item.FirefoxLocalStorage:
d.sources[source] = &localstorage.FirefoxLocalStorage{}
case item.FirefoxExtension:
d.sources[source] = &extension.FirefoxExtension{}
}
}
}

@ -49,3 +49,27 @@ func (c *ChromiumExtension) Parse(masterKey []byte) error {
func (c *ChromiumExtension) Name() string {
return "extension"
}
type FirefoxExtension []*extension
func (f *FirefoxExtension) Parse(masterKey []byte) error {
s, err := fileutil.ReadFile(item.TempFirefoxExtension)
if err != nil {
return err
}
defer os.Remove(item.TempFirefoxExtension)
j := gjson.Parse(s)
for _, v := range j.Get("addons").Array() {
*f = append(*f, &extension{
Name: v.Get("defaultLocale.name").String(),
Description: v.Get("defaultLocale.description").String(),
Version: v.Get("version").String(),
HomepageURL: v.Get("defaultLocale.homepageURL").String(),
})
}
return nil
}
func (f *FirefoxExtension) Name() string {
return "extension"
}

@ -20,6 +20,7 @@ const (
fileFirefoxPassword = "logins.json"
fileFirefoxData = "places.sqlite"
fileFirefoxLocalStorage = "webappsstore.sqlite"
fileFirefoxExtension = "extensions.json"
)
const (
@ -49,5 +50,5 @@ const (
TempFirefoxDownload = "firefoxDownload"
TempFirefoxLocalStorage = "firefoxLocalStorage"
TempFirefoxCreditCard = ""
TempFirefoxExtension = ""
TempFirefoxExtension = "firefoxExtension"
)

@ -63,11 +63,11 @@ func (i Item) FileName() string {
return fileFirefoxData
case FirefoxLocalStorage:
return fileFirefoxLocalStorage
case FirefoxCreditCard:
return UnsupportedItem
case FirefoxHistory:
return fileFirefoxData
case FirefoxExtension:
return fileFirefoxExtension
case FirefoxCreditCard:
return UnsupportedItem
default:
return UnknownItem
@ -115,7 +115,7 @@ func (i Item) String() string {
case FirefoxCreditCard:
return UnsupportedItem
case FirefoxExtension:
return UnsupportedItem
return TempFirefoxExtension
default:
return UnknownItem
}

Loading…
Cancel
Save