|
|
|
@ -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) { |
|
|
|
|