diff --git a/internal/browingdata/browsingdata.go b/internal/browingdata/browsingdata.go index 6c14dea..5177eca 100644 --- a/internal/browingdata/browsingdata.go +++ b/internal/browingdata/browsingdata.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: diff --git a/internal/browingdata/creditcard.go b/internal/browingdata/creditcard.go index bd89c8d..8ac135e 100644 --- a/internal/browingdata/creditcard.go +++ b/internal/browingdata/creditcard.go @@ -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" +} diff --git a/internal/browingdata/password.go b/internal/browingdata/password.go index 168dd86..6c4823f 100644 --- a/internal/browingdata/password.go +++ b/internal/browingdata/password.go @@ -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 { diff --git a/internal/browser/browser_windows.go b/internal/browser/browser_windows.go index 6baa669..9ceacad 100644 --- a/internal/browser/browser_windows.go +++ b/internal/browser/browser_windows.go @@ -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/" )