style: fix typo and grammar

pull/83/head
moond4rk 4 years ago committed by ᴍᴏᴏɴD4ʀᴋ
parent f3d58cd14f
commit 65b413e8e1
  1. 14
      core/browser.go
  2. 2
      core/browser_windows.go
  3. 6
      core/decrypt/decrypt.go

@ -35,10 +35,10 @@ type Browser interface {
// GetSecretKey return browser secret key // GetSecretKey return browser secret key
GetSecretKey() []byte GetSecretKey() []byte
// GetAllItems return all of items (password|bookmark|cookie|history) // GetAllItems return all items (password|bookmark|cookie|history)
GetAllItems() ([]data.Item, error) 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) GetItem(itemName string) (data.Item, error)
} }
@ -125,7 +125,7 @@ type Chromium struct {
secretKey []byte secretKey []byte
} }
// NewChromium return chromium browser interface // NewChromium return Chromium browser interface
func NewChromium(profile, key, name, storage string) (Browser, error) { func NewChromium(profile, key, name, storage string) (Browser, error) {
return &Chromium{profilePath: profile, keyPath: key, name: name, storage: storage}, nil 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 // 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) { func (c *Chromium) GetAllItems() ([]data.Item, error) {
var items []data.Item var items []data.Item
for item, choice := range chromiumItems { for item, choice := range chromiumItems {
@ -238,13 +238,13 @@ func (f *Firefox) GetName() string {
} }
// GetSecretKey for firefox is always nil // 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 { func (f *Firefox) GetSecretKey() []byte {
return nil return nil
} }
// InitSecretKey for firefox is always 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 { func (f *Firefox) InitSecretKey() error {
return nil return nil
} }
@ -316,7 +316,7 @@ func getItemPath(profilePath, file string) (string, error) {
return "", fmt.Errorf("find %s failed", file) 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] // default key file path is in the parent directory of the profile dir, and name is [Local State]
func getKeyPath(profilePath string) (string, error) { func getKeyPath(profilePath string) (string, error) {
if _, err := os.Stat(filepath.Clean(profilePath)); os.IsNotExist(err) { if _, err := os.Stat(filepath.Clean(profilePath)); os.IsNotExist(err) {

@ -112,7 +112,7 @@ var (
errBase64DecodeFailed = errors.New("decode base64 failed") errBase64DecodeFailed = errors.New("decode base64 failed")
) )
// InitSecretKey on Windows with win32 DPAPI // InitSecretKey with win32 DPAPI
// conference from @https://gist.github.com/akamajoris/ed2f14d817d5514e7548 // conference from @https://gist.github.com/akamajoris/ed2f14d817d5514e7548
func (c *Chromium) InitSecretKey() error { func (c *Chromium) InitSecretKey() error {
if c.keyPath == "" { if c.keyPath == "" {

@ -176,7 +176,7 @@ func PKCS5UnPadding(src []byte) []byte {
return src[:(length - unpad)] 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) { func des3Decrypt(key, iv []byte, src []byte) ([]byte, error) {
block, err := des.NewTripleDESCipher(key) block, err := des.NewTripleDESCipher(key)
if err != nil { if err != nil {
@ -201,11 +201,11 @@ func PaddingZero(s []byte, l int) []byte {
} }
} }
/* /* Login Struct
SEQUENCE (3 elem) SEQUENCE (3 elem)
OCTET STRING (16 byte) OCTET STRING (16 byte)
SEQUENCE (2 elem) SEQUENCE (2 elem)
OBJECT IDENTIFIER 1.2.840.113549.3.7 des-EDE3-CBC (RSADSI encryptionAlgorithm) OBJECT IDENTIFIER
OCTET STRING (8 byte) OCTET STRING (8 byte)
OCTET STRING (16 byte) OCTET STRING (16 byte)
*/ */

Loading…
Cancel
Save