dev-feat: format old code

pull/116/head
ᴍᴏᴏɴD4ʀᴋ 3 years ago
parent 9129c2a0c7
commit 174a4e1959
  1. 2
      cmd/cmd.go
  2. 1
      cmd/hackbrowserdata/main.go
  3. 2
      core/browser.go
  4. 4
      core/browser_linux.go
  5. 8
      core/data/parse.go
  6. 4
      core/decrypt/decrypt.go

@ -5,7 +5,7 @@ import (
"strings"
"hack-browser-data/core"
"hack-browser-data/log"
"hack-browser-data/pkg/log"
"hack-browser-data/utils"
"github.com/urfave/cli/v2"

@ -0,0 +1 @@
package hackbrowserdata

@ -8,7 +8,7 @@ import (
"strings"
"hack-browser-data/core/data"
"hack-browser-data/log"
"hack-browser-data/pkg/log"
)
const (

@ -3,11 +3,11 @@ package core
import (
"crypto/sha1"
"hack-browser-data/log"
"github.com/godbus/dbus/v5"
keyring "github.com/ppacher/go-dbus-keyring"
"golang.org/x/crypto/pbkdf2"
"hack-browser-data/pkg/log"
)
const (

@ -12,7 +12,7 @@ import (
"time"
"hack-browser-data/core/decrypt"
"hack-browser-data/log"
"hack-browser-data/pkg/log"
"hack-browser-data/utils"
_ "github.com/mattn/go-sqlite3"
@ -657,14 +657,14 @@ func (p *passwords) FirefoxParse() error {
keyLin := []byte{248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
metaPBE, err := decrypt.NewASN1PBE(metaBytes)
if err != nil {
log.Error("decrypt meta data failed", err)
log.Error("decrypter meta data failed", err)
return err
}
// default master password is empty
var masterPwd []byte
k, err := metaPBE.Decrypt(globalSalt, masterPwd)
if err != nil {
log.Error("decrypt firefox meta bytes failed", err)
log.Error("decrypter firefox meta bytes failed", err)
return err
}
if bytes.Contains(k, []byte("password-check")) {
@ -703,7 +703,7 @@ func (p *passwords) FirefoxParse() error {
if err != nil {
log.Error(err)
}
log.Debug("decrypt firefox success")
log.Debug("decrypter firefox success")
p.logins = append(p.logins, loginData{
LoginUrl: v.LoginUrl,
UserName: string(decrypt.PKCS5UnPadding(user)),

@ -16,7 +16,7 @@ import (
var (
errSecurityKeyIsEmpty = errors.New("input [security find-generic-password -wa 'Chrome'] in terminal")
errPasswordIsEmpty = errors.New("password is empty")
errDecryptFailed = errors.New("decrypt encrypt value failed")
errDecryptFailed = errors.New("decrypter encrypt value failed")
errDecodeASN1Failed = errors.New("decode ASN1 data failed")
errEncryptedLength = errors.New("length of encrypted password less than block size")
)
@ -189,7 +189,7 @@ func PKCS5UnPadding(src []byte) []byte {
return src[:(length - unpad)]
}
// des3Decrypt use for decrypt firefox PBE
// des3Decrypt use for decrypter firefox PBE
func des3Decrypt(key, iv []byte, src []byte) ([]byte, error) {
block, err := des.NewTripleDESCipher(key)
if err != nil {

Loading…
Cancel
Save