Skip to content

Commit

Permalink
fix cookie and password decryption for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
learnerLj committed Dec 27, 2024
1 parent 9121178 commit e529487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion browserdata/cookie/cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ func (c *ChromiumCookie) Extract(masterKey []byte) error {
value, err = crypto.DecryptWithChromium(masterKey, encryptValue)
if err != nil {
log.Debugf("decrypt chromium cookie error: %v", err)
} else if len(value) > 32 {
value = value[32:]
}
}
}

// https://gist.github.com/kosh04/36cf6023fb75b516451ce933b9db2207?permalink_comment_id=5291243#gistcomment-5291243
cookie.Value = string(value)
*c = append(*c, cookie)
}
Expand Down
6 changes: 5 additions & 1 deletion crypto/crypto_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

package crypto

import "errors"

var ErrDarwinNotSupportDPAPI = errors.New("darwin not support dpapi")

func DecryptWithChromium(key, password []byte) ([]byte, error) {
if len(password) <= 3 {
return nil, ErrCiphertextLengthIsInvalid
Expand All @@ -11,5 +15,5 @@ func DecryptWithChromium(key, password []byte) ([]byte, error) {
}

func DecryptWithDPAPI(_ []byte) ([]byte, error) {
return nil, nil
return nil, ErrDarwinNotSupportDPAPI
}

0 comments on commit e529487

Please sign in to comment.