feat: add yandex password and creditcard

pull/121/head
ᴍᴏᴏɴD4ʀᴋ 3 years ago
parent a499c3ca0f
commit d65c0ca068
  1. 4
      internal/browingdata/browsingdata.go
  2. 48
      internal/browingdata/creditcard.go
  3. 59
      internal/browingdata/password.go
  4. 6
      internal/browser/browser_windows.go

@ -50,6 +50,10 @@ func (d *Data) addSource(Sources []item.Item) {
d.Sources[source] = &ChromiumDownload{}
case item.ChromiumCreditCard:
d.Sources[source] = &ChromiumCreditCard{}
case item.YandexPassword:
d.Sources[source] = &YandexPassword{}
case item.YandexCreditCard:
d.Sources[source] = &YandexCreditCard{}
case item.FirefoxPassword:
d.Sources[source] = &FirefoxPassword{}
case item.FirefoxCookie:

@ -58,3 +58,51 @@ func (c *ChromiumCreditCard) Parse(masterKey []byte) error {
func (c *ChromiumCreditCard) Name() string {
return "creditcard"
}
type YandexCreditCard []card
func (c *YandexCreditCard) Parse(masterKey []byte) error {
creditDB, err := sql.Open("sqlite3", item.TempYandexCreditCard)
if err != nil {
return err
}
defer os.Remove(item.TempYandexCreditCard)
defer creditDB.Close()
rows, err := creditDB.Query(queryChromiumCredit)
if err != nil {
return err
}
defer rows.Close()
for rows.Next() {
var (
name, month, year, guid string
value, encryptValue []byte
)
if err := rows.Scan(&guid, &name, &month, &year, &encryptValue); err != nil {
log.Warn(err)
}
creditCardInfo := card{
GUID: guid,
Name: name,
ExpirationMonth: month,
ExpirationYear: year,
}
if masterKey == nil {
value, err = decrypter.DPApi(encryptValue)
if err != nil {
return err
}
} else {
value, err = decrypter.ChromePass(masterKey, encryptValue)
if err != nil {
return err
}
}
creditCardInfo.CardNumber = string(value)
*c = append(*c, creditCardInfo)
}
return nil
}
func (c *YandexCreditCard) Name() string {
return "creditcard"
}

@ -77,6 +77,65 @@ func (c *ChromiumPassword) Name() string {
return "password"
}
type YandexPassword []loginData
func (c *YandexPassword) Parse(masterKey []byte) error {
loginDB, err := sql.Open("sqlite3", item.TempYandexPassword)
if err != nil {
return err
}
defer os.Remove(item.TempYandexPassword)
defer loginDB.Close()
rows, err := loginDB.Query(queryChromiumLogin)
if err != nil {
return err
}
defer rows.Close()
for rows.Next() {
var (
url, username string
pwd, password []byte
create int64
)
if err := rows.Scan(&url, &username, &pwd, &create); err != nil {
log.Warn(err)
}
login := loginData{
UserName: username,
encryptPass: pwd,
LoginUrl: url,
}
if len(pwd) > 0 {
var err error
if masterKey == nil {
password, err = decrypter.DPApi(pwd)
} else {
password, err = decrypter.ChromePass(masterKey, pwd)
}
if err != nil {
log.Error(err)
}
}
if create > time.Now().Unix() {
login.CreateDate = utils.TimeEpochFormat(create)
} else {
login.CreateDate = utils.TimeStampFormat(create)
}
login.Password = string(password)
*c = append(*c, login)
}
// sort with create date
sort.Slice(*c, func(i, j int) bool {
return (*c)[i].CreateDate.After((*c)[j].CreateDate)
})
return nil
}
func (c *YandexPassword) Name() string {
return "password"
}
type FirefoxPassword []loginData
func (f *FirefoxPassword) Parse(masterKey []byte) error {

@ -98,9 +98,9 @@ var (
qqBrowserProfilePath = homeDir + "/AppData/Local/Tencent/QQBrowser/User Data/"
operaProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera Stable/"
operaGXProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera GX Stable/"
vivaldiProfilePath = homeDir + "/AppData/Local/Vivaldi/User Data/Default/"
coccocProfilePath = homeDir + "/AppData/Local/CocCoc/Browser/User Data/Default/"
yandexProfilePath = homeDir + "/AppData/Local/Yandex/YandexBrowser/User Data/Default"
vivaldiProfilePath = homeDir + "/AppData/Local/Vivaldi/User Data/"
coccocProfilePath = homeDir + "/AppData/Local/CocCoc/Browser/User Data/"
yandexProfilePath = homeDir + "/AppData/Local/Yandex/YandexBrowser/User Data/"
firefoxProfilePath = homeDir + "/AppData/Roaming/Mozilla/Firefox/Profiles/"
)

Loading…
Cancel
Save