feat: sort output by timestamp

This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ
2020-06-26 04:33:23 +08:00
parent 31419dc003
commit ebeef65f81
10 changed files with 251 additions and 204 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ import (
)
var (
passwordIsEmpty = errors.New("decrypt fail, password is empty")
passwordIsEmpty = errors.New("decrypt fail, password is empty")
)
type DecryptError struct {
+15 -17
View File
@@ -6,7 +6,6 @@ import (
"crypto/cipher"
"crypto/sha1"
"errors"
"fmt"
"hack-browser-data/log"
"os/exec"
"path/filepath"
@@ -25,21 +24,6 @@ var (
chromeKey []byte
)
func GetDBPath(dbName ...string) (dbFile []string) {
for _, v := range dbName {
s, err := filepath.Glob(macChromeDir + v)
if err != nil && len(s) == 0 {
continue
}
if len(s) > 0 {
log.Debugf("Find %s File Success", v)
log.Debugf("%s file location is %s", v, s[0])
dbFile = append(dbFile, s[0])
}
}
return dbFile
}
func InitChromeKey() error {
var (
cmd *exec.Cmd
@@ -63,6 +47,21 @@ func InitChromeKey() error {
return err
}
func GetDBPath(dbName ...string) (dbFile []string) {
for _, v := range dbName {
s, err := filepath.Glob(macChromeDir + v)
if err != nil && len(s) == 0 {
continue
}
if len(s) > 0 {
log.Debugf("Find %s File Success", v)
log.Debugf("%s file location is %s", v, s[0])
dbFile = append(dbFile, s[0])
}
}
return dbFile
}
func decryptChromeKey(chromePass []byte) {
chromeKey = pbkdf2.Key(chromePass, chromeSalt, 1003, 16, sha1.New)
}
@@ -73,7 +72,6 @@ func DecryptChromePass(encryptPass []byte) (string, error) {
} else {
return "", &DecryptError{
err: passwordIsEmpty,
msg: fmt.Sprintf("password is %s", string(encryptPass)),
}
}
}
+3 -3
View File
@@ -34,7 +34,7 @@ func InitChromeKey() error {
if err != nil {
return err
}
chromeKey, err = decryptStringWithDPAPI(masterKey[5:])
chromeKey, err = DecryptStringWithDPAPI(masterKey[5:])
return err
}
@@ -73,7 +73,7 @@ func aesGCMDecrypt(crypted, key, nounce []byte) (string, error) {
if err != nil {
return "", err
}
blockMode, _ := cipher.NewGCM(block)
blockMode, err := cipher.NewGCM(block)
origData, err := blockMode.Open(nil, nounce, crypted, nil)
if err != nil {
return "", err
@@ -103,7 +103,7 @@ func (b *DataBlob) ToByteArray() []byte {
}
// chrome < 80 https://chromium.googlesource.com/chromium/src/+/76f496a7235c3432983421402951d73905c8be96/components/os_crypt/os_crypt_win.cc#82
func decryptStringWithDPAPI(data []byte) ([]byte, error) {
func DecryptStringWithDPAPI(data []byte) ([]byte, error) {
dllCrypt := syscall.NewLazyDLL("Crypt32.dll")
dllKernel := syscall.NewLazyDLL("Kernel32.dll")
procDecryptData := dllCrypt.NewProc("CryptUnprotectData")