Skip to content

Commit 2395015

Browse files
moonD4rklearnerLj
andauthored
fix: cookie and password decryption for macOS (#465) (#501)
Co-authored-by: Michael L <[email protected]>
1 parent 47ae497 commit 2395015

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

browserdata/cookie/cookie.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ func (c *ChromiumCookie) Extract(masterKey []byte) error {
8787
value, err = crypto.DecryptWithChromium(masterKey, encryptValue)
8888
if err != nil {
8989
log.Debugf("decrypt chromium cookie error: %v", err)
90+
} else if len(value) > 32 {
91+
// https://gist.github.com/kosh04/36cf6023fb75b516451ce933b9db2207?permalink_comment_id=5291243#gistcomment-5291243
92+
value = value[32:]
9093
}
9194
}
9295
}
93-
9496
cookie.Value = string(value)
9597
*c = append(*c, cookie)
9698
}

crypto/crypto_darwin.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
package crypto
44

5+
import "errors"
6+
7+
var ErrDarwinNotSupportDPAPI = errors.New("darwin not support dpapi")
8+
59
func DecryptWithChromium(key, password []byte) ([]byte, error) {
610
if len(password) <= 3 {
711
return nil, ErrCiphertextLengthIsInvalid
@@ -11,5 +15,5 @@ func DecryptWithChromium(key, password []byte) ([]byte, error) {
1115
}
1216

1317
func DecryptWithDPAPI(_ []byte) ([]byte, error) {
14-
return nil, nil
18+
return nil, ErrDarwinNotSupportDPAPI
1519
}

0 commit comments

Comments
 (0)