diff --git a/core/browser.go b/core/browser.go index 7c25505..fae0d93 100644 --- a/core/browser.go +++ b/core/browser.go @@ -35,10 +35,10 @@ type Browser interface { // GetSecretKey return browser secret key GetSecretKey() []byte - // GetAllItems return all of items (password|bookmark|cookie|history) + // GetAllItems return all items (password|bookmark|cookie|history) GetAllItems() ([]data.Item, error) - // GetItem return single one from password|bookmark|cookie|history + // GetItem return single one from the password|bookmark|cookie|history GetItem(itemName string) (data.Item, error) } @@ -125,7 +125,7 @@ type Chromium struct { secretKey []byte } -// NewChromium return chromium browser interface +// NewChromium return Chromium browser interface func NewChromium(profile, key, name, storage string) (Browser, error) { return &Chromium{profilePath: profile, keyPath: key, name: name, storage: storage}, nil } @@ -139,7 +139,7 @@ func (c *Chromium) GetSecretKey() []byte { } // GetAllItems return all chromium items from browser -// if can't find item path, log error then continue +// if can't find the item path, log error then continue func (c *Chromium) GetAllItems() ([]data.Item, error) { var items []data.Item for item, choice := range chromiumItems { @@ -238,13 +238,13 @@ func (f *Firefox) GetName() string { } // GetSecretKey for firefox is always nil -// this method use to implement Browser interface +// this method used to implement Browser interface func (f *Firefox) GetSecretKey() []byte { return nil } // InitSecretKey for firefox is always nil -// this method use to implement Browser interface +// this method used to implement Browser interface func (f *Firefox) InitSecretKey() error { return nil } @@ -316,7 +316,7 @@ func getItemPath(profilePath, file string) (string, error) { return "", fmt.Errorf("find %s failed", file) } -// getKeyPath try get key file path with browser's profile path +// getKeyPath try to get key file path with the browser's profile path // default key file path is in the parent directory of the profile dir, and name is [Local State] func getKeyPath(profilePath string) (string, error) { if _, err := os.Stat(filepath.Clean(profilePath)); os.IsNotExist(err) { diff --git a/core/browser_windows.go b/core/browser_windows.go index 5be9bec..eef748c 100644 --- a/core/browser_windows.go +++ b/core/browser_windows.go @@ -112,7 +112,7 @@ var ( errBase64DecodeFailed = errors.New("decode base64 failed") ) -// InitSecretKey on Windows with win32 DPAPI +// InitSecretKey with win32 DPAPI // conference from @https://gist.github.com/akamajoris/ed2f14d817d5514e7548 func (c *Chromium) InitSecretKey() error { if c.keyPath == "" { diff --git a/core/decrypt/decrypt.go b/core/decrypt/decrypt.go index c8407ab..9304c0e 100644 --- a/core/decrypt/decrypt.go +++ b/core/decrypt/decrypt.go @@ -100,21 +100,21 @@ func (n NssPBE) Decrypt(globalSalt, masterPwd []byte) (key []byte, err error) { /* META Struct SEQUENCE (2 elem) - SEQUENCE (2 elem) - OBJECT IDENTIFIER - SEQUENCE (2 elem) - SEQUENCE (2 elem) - OBJECT IDENTIFIER - SEQUENCE (4 elem) - OCTET STRING (32 byte) - INTEGER 1 - INTEGER 32 - SEQUENCE (1 elem) - OBJECT IDENTIFIER - SEQUENCE (2 elem) - OBJECT IDENTIFIER - OCTET STRING (14 byte) - OCTET STRING (16 byte) + SEQUENCE (2 elem) + OBJECT IDENTIFIER + SEQUENCE (2 elem) + SEQUENCE (2 elem) + OBJECT IDENTIFIER + SEQUENCE (4 elem) + OCTET STRING (32 byte) + INTEGER 1 + INTEGER 32 + SEQUENCE (1 elem) + OBJECT IDENTIFIER + SEQUENCE (2 elem) + OBJECT IDENTIFIER + OCTET STRING (14 byte) + OCTET STRING (16 byte) */ type MetaPBE struct { MetaSequenceA @@ -176,7 +176,7 @@ func PKCS5UnPadding(src []byte) []byte { return src[:(length - unpad)] } -// Des3Decrypt use for decrypt firefox PBE +// des3Decrypt use for decrypt firefox PBE func des3Decrypt(key, iv []byte, src []byte) ([]byte, error) { block, err := des.NewTripleDESCipher(key) if err != nil { @@ -201,11 +201,11 @@ func PaddingZero(s []byte, l int) []byte { } } -/* +/* Login Struct SEQUENCE (3 elem) OCTET STRING (16 byte) SEQUENCE (2 elem) - OBJECT IDENTIFIER 1.2.840.113549.3.7 des-EDE3-CBC (RSADSI encryptionAlgorithm) + OBJECT IDENTIFIER OCTET STRING (8 byte) OCTET STRING (16 byte) */