mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
refactor: Optimize traversal browser data logic (#311)
* refactor: Refactor package names and imports for better code organization. * refactor: Package imports and variable types for consistency * chore: Disable unused-parameter rule in revive. * refactor: Refactor and organize data extraction and browserdata parse. * fix: rename wrong error message info
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@ func (n nssPBE) Decrypt(globalSalt []byte) ([]byte, error) {
|
||||
return DES3Decrypt(key, iv, n.Encrypted)
|
||||
}
|
||||
|
||||
func (n nssPBE) Encrypt(globalSalt []byte, plaintext []byte) ([]byte, error) {
|
||||
func (n nssPBE) Encrypt(globalSalt, plaintext []byte) ([]byte, error) {
|
||||
key, iv := n.deriveKeyAndIV(globalSalt)
|
||||
|
||||
return DES3Encrypt(key, iv, plaintext)
|
||||
|
||||
+3
-5
@@ -9,9 +9,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrCiphertextLengthIsInvalid = errors.New("ciphertext length is invalid")
|
||||
)
|
||||
var ErrCiphertextLengthIsInvalid = errors.New("ciphertext length is invalid")
|
||||
|
||||
func AES128CBCDecrypt(key, iv, ciphertext []byte) ([]byte, error) {
|
||||
block, err := aes.NewCipher(key)
|
||||
@@ -57,7 +55,7 @@ func AES128CBCEncrypt(key, iv, plaintext []byte) ([]byte, error) {
|
||||
return encryptedData, nil
|
||||
}
|
||||
|
||||
func DES3Decrypt(key, iv []byte, ciphertext []byte) ([]byte, error) {
|
||||
func DES3Decrypt(key, iv, ciphertext []byte) ([]byte, error) {
|
||||
block, err := des.NewTripleDESCipher(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -76,7 +74,7 @@ func DES3Decrypt(key, iv []byte, ciphertext []byte) ([]byte, error) {
|
||||
return pkcs5UnPadding(sq)
|
||||
}
|
||||
|
||||
func DES3Encrypt(key, iv []byte, plaintext []byte) ([]byte, error) {
|
||||
func DES3Encrypt(key, iv, plaintext []byte) ([]byte, error) {
|
||||
block, err := des.NewTripleDESCipher(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -6,7 +6,7 @@ func DecryptWithChromium(key, password []byte) ([]byte, error) {
|
||||
if len(password) <= 3 {
|
||||
return nil, ErrCiphertextLengthIsInvalid
|
||||
}
|
||||
var iv = []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32}
|
||||
iv := []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32}
|
||||
return AES128CBCDecrypt(key, iv, password[3:])
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ func DecryptWithChromium(key, encryptPass []byte) ([]byte, error) {
|
||||
if len(encryptPass) < 3 {
|
||||
return nil, ErrCiphertextLengthIsInvalid
|
||||
}
|
||||
var iv = []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32}
|
||||
iv := []byte{32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32}
|
||||
return AES128CBCDecrypt(key, iv, encryptPass[3:])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user