|
|
|
@ -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 { |
|
|
|
|