fix: Resolve decryption failures of password value in some browser (#452)

* fix: skip chromium-based browser 'def' dir
* fix: fixed the issue that 360speed, QQ Browser and other Chinese browsers had errors in decrypting passwords and cookies
* misc: modify some log level
* fix: fix the wrong function

---------

Co-authored-by: Aquilao <Aquilao@outlook>
This commit is contained in:
Aquilao Official
2024-11-14 10:13:46 +08:00
committed by ᴍᴏᴏɴD4ʀᴋ
parent 0761fc39f2
commit b66ca7b3d8
9 changed files with 35 additions and 33 deletions
+9 -8
View File
@@ -65,7 +65,7 @@ func (c *ChromiumCookie) Extract(masterKey []byte) error {
value, encryptValue []byte
)
if err = rows.Scan(&key, &encryptValue, &host, &path, &createDate, &expireDate, &isSecure, &isHTTPOnly, &hasExpire, &isPersistent); err != nil {
log.Errorf("scan chromium cookie error: %v", err)
log.Debugf("scan chromium cookie error: %v", err)
}
cookie := cookie{
@@ -80,16 +80,17 @@ func (c *ChromiumCookie) Extract(masterKey []byte) error {
CreateDate: typeutil.TimeEpoch(createDate),
ExpireDate: typeutil.TimeEpoch(expireDate),
}
if len(encryptValue) > 0 {
if len(masterKey) == 0 {
value, err = crypto.DecryptWithDPAPI(encryptValue)
} else {
value, err = crypto.DecryptWithChromium(masterKey, encryptValue)
}
value, err = crypto.DecryptWithDPAPI(encryptValue)
if err != nil {
log.Errorf("decrypt chromium cookie error: %v", err)
value, err = crypto.DecryptWithChromium(masterKey, encryptValue)
if err != nil {
log.Debugf("decrypt chromium cookie error: %v", err)
}
}
}
cookie.Value = string(value)
*c = append(*c, cookie)
}
@@ -133,7 +134,7 @@ func (f *FirefoxCookie) Extract(_ []byte) error {
creationTime, expiry int64
)
if err = rows.Scan(&name, &value, &host, &path, &creationTime, &expiry, &isSecure, &isHTTPOnly); err != nil {
log.Errorf("scan firefox cookie error: %v", err)
log.Debugf("scan firefox cookie error: %v", err)
}
*f = append(*f, cookie{
KeyName: name,