From 0d6642ead9b38c6b96f613f2bf3fb81db3e24f40 Mon Sep 17 00:00:00 2001 From: moonD4rk Date: Sun, 18 Jun 2023 23:27:45 +0800 Subject: [PATCH] fix: fix syntax errors and remove unused variables - Fix syntax error and remove unnecessary comments in crypto.go --- browingdata/password/password.go | 2 +- crypto/crypto.go | 20 ++++++++++---------- firefox.go | 1 + 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/browingdata/password/password.go b/browingdata/password/password.go index 48184d0..e4541ce 100644 --- a/browingdata/password/password.go +++ b/browingdata/password/password.go @@ -169,7 +169,7 @@ const ( queryNssPrivate = `SELECT a11, a102 from nssPrivate` ) -func (f *FirefoxPassword) Parse(masterKey []byte) error { +func (f *FirefoxPassword) Parse(_ []byte) error { globalSalt, metaBytes, nssA11, nssA102, err := getFirefoxDecryptKey(item.TempFirefoxKey4) if err != nil { return err diff --git a/crypto/crypto.go b/crypto/crypto.go index f0bfbc2..eb2e325 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -32,22 +32,22 @@ func NewASN1PBE(b []byte) (pbe ASN1PBE, err error) { l loginPBE errs []string ) - if _, err := asn1.Unmarshal(b, &n); err == nil { + if _, err = asn1.Unmarshal(b, &n); err == nil { return n, nil - } else { - errs = append(errs, err.Error()) } - if _, err := asn1.Unmarshal(b, &m); err == nil { + errs = append(errs, err.Error()) + + if _, err = asn1.Unmarshal(b, &m); err == nil { return m, nil - } else { - errs = append(errs, err.Error()) } - if _, err := asn1.Unmarshal(b, &l); err == nil { + errs = append(errs, err.Error()) + + if _, err = asn1.Unmarshal(b, &l); err == nil { return l, nil - } else { - errs = append(errs, err.Error()) } - return nil, fmt.Errorf("%w: %s", err, strings.Join(errs, "; ")) + errs = append(errs, err.Error()) + + return nil, fmt.Errorf("%w: %s", errDecodeASN1Failed, strings.Join(errs, "; ")) } // nssPBE Struct diff --git a/firefox.go b/firefox.go index 7e429db..c59a54e 100644 --- a/firefox.go +++ b/firefox.go @@ -9,6 +9,7 @@ import ( "path/filepath" "strings" + // import sqlite3 driver _ "github.com/mattn/go-sqlite3" "github.com/moond4rk/hackbrowserdata/crypto"