You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
546 B
27 lines
546 B
5 years ago
|
package utils
|
||
|
|
||
|
const (
|
||
|
winChromeDir = "/Users/*/Library/Application Support/Google/Chrome/*/"
|
||
|
)
|
||
|
|
||
|
func GetDBPath(dbName string) string {
|
||
|
s, err := filepath.Glob(winChromeDir + dbName)
|
||
|
if err != nil && len(s) == 0 {
|
||
|
panic(err)
|
||
|
}
|
||
|
return s[0]
|
||
|
}
|
||
|
|
||
|
func AesGCMDecrypt(crypted, key, nounce []byte) ([]byte, error) {
|
||
|
block, err := aes.NewCipher(key)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
blockMode, _ := cipher.NewGCM(block)
|
||
|
origData, err := blockMode.Open(nil, nounce, crypted, nil)
|
||
|
if err != nil{
|
||
|
return nil, err
|
||
|
}
|
||
|
return origData, nil
|
||
|
}
|