|
|
@ -59,7 +59,6 @@ func NewBookmarks(main, sub string) Item { |
|
|
|
func (b *bookmarks) ChromeParse(key []byte) error { |
|
|
|
func (b *bookmarks) ChromeParse(key []byte) error { |
|
|
|
bookmarks, err := utils.ReadFile(ChromeBookmarkFile) |
|
|
|
bookmarks, err := utils.ReadFile(ChromeBookmarkFile) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
r := gjson.Parse(bookmarks) |
|
|
|
r := gjson.Parse(bookmarks) |
|
|
@ -104,16 +103,12 @@ func (b *bookmarks) FirefoxParse() error { |
|
|
|
) |
|
|
|
) |
|
|
|
keyDB, err = sql.Open("sqlite3", FirefoxDataFile) |
|
|
|
keyDB, err = sql.Open("sqlite3", FirefoxDataFile) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
|
if err := keyDB.Close(); err != nil { |
|
|
|
if err := keyDB.Close(); err != nil { |
|
|
|
log.Error(err) |
|
|
|
log.Error(err) |
|
|
|
} |
|
|
|
} |
|
|
|
if err := bookmarkRows.Close(); err != nil { |
|
|
|
|
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}() |
|
|
|
}() |
|
|
|
_, err = keyDB.Exec(closeJournalMode) |
|
|
|
_, err = keyDB.Exec(closeJournalMode) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -121,7 +116,7 @@ func (b *bookmarks) FirefoxParse() error { |
|
|
|
} |
|
|
|
} |
|
|
|
bookmarkRows, err = keyDB.Query(queryFirefoxBookMarks) |
|
|
|
bookmarkRows, err = keyDB.Query(queryFirefoxBookMarks) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
for bookmarkRows.Next() { |
|
|
|
for bookmarkRows.Next() { |
|
|
|
var ( |
|
|
|
var ( |
|
|
@ -181,7 +176,6 @@ func (c *cookies) ChromeParse(secretKey []byte) error { |
|
|
|
c.cookies = make(map[string][]cookie) |
|
|
|
c.cookies = make(map[string][]cookie) |
|
|
|
cookieDB, err := sql.Open("sqlite3", ChromeCookieFile) |
|
|
|
cookieDB, err := sql.Open("sqlite3", ChromeCookieFile) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Debug(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
@ -215,7 +209,7 @@ func (c *cookies) ChromeParse(secretKey []byte) error { |
|
|
|
CreateDate: utils.TimeEpochFormat(createDate), |
|
|
|
CreateDate: utils.TimeEpochFormat(createDate), |
|
|
|
ExpireDate: utils.TimeEpochFormat(expireDate), |
|
|
|
ExpireDate: utils.TimeEpochFormat(expireDate), |
|
|
|
} |
|
|
|
} |
|
|
|
// remove prefix 'v10'
|
|
|
|
// remove utils.Prefix 'v10'
|
|
|
|
if secretKey == nil { |
|
|
|
if secretKey == nil { |
|
|
|
value, err = decrypt.DPApi(encryptValue) |
|
|
|
value, err = decrypt.DPApi(encryptValue) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -232,7 +226,6 @@ func (c *cookies) FirefoxParse() error { |
|
|
|
c.cookies = make(map[string][]cookie) |
|
|
|
c.cookies = make(map[string][]cookie) |
|
|
|
cookieDB, err := sql.Open("sqlite3", FirefoxCookieFile) |
|
|
|
cookieDB, err := sql.Open("sqlite3", FirefoxCookieFile) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Debug(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
@ -242,7 +235,6 @@ func (c *cookies) FirefoxParse() error { |
|
|
|
}() |
|
|
|
}() |
|
|
|
rows, err := cookieDB.Query(queryFirefoxCookie) |
|
|
|
rows, err := cookieDB.Query(queryFirefoxCookie) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
@ -257,6 +249,9 @@ func (c *cookies) FirefoxParse() error { |
|
|
|
creationTime, expiry int64 |
|
|
|
creationTime, expiry int64 |
|
|
|
) |
|
|
|
) |
|
|
|
err = rows.Scan(&name, &value, &host, &path, &creationTime, &expiry, &isSecure, &isHttpOnly) |
|
|
|
err = rows.Scan(&name, &value, &host, &path, &creationTime, &expiry, &isSecure, &isHttpOnly) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
} |
|
|
|
c.cookies[host] = append(c.cookies[host], cookie{ |
|
|
|
c.cookies[host] = append(c.cookies[host], cookie{ |
|
|
|
KeyName: name, |
|
|
|
KeyName: name, |
|
|
|
Host: host, |
|
|
|
Host: host, |
|
|
@ -305,7 +300,6 @@ func NewHistoryData(main, sub string) Item { |
|
|
|
func (h *historyData) ChromeParse(key []byte) error { |
|
|
|
func (h *historyData) ChromeParse(key []byte) error { |
|
|
|
historyDB, err := sql.Open("sqlite3", ChromeHistoryFile) |
|
|
|
historyDB, err := sql.Open("sqlite3", ChromeHistoryFile) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
@ -334,7 +328,6 @@ func (h *historyData) ChromeParse(key []byte) error { |
|
|
|
} |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
log.Error(err) |
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
h.history = append(h.history, data) |
|
|
|
h.history = append(h.history, data) |
|
|
|
} |
|
|
|
} |
|
|
@ -351,7 +344,6 @@ func (h *historyData) FirefoxParse() error { |
|
|
|
tempMap = make(map[int64]string) |
|
|
|
tempMap = make(map[int64]string) |
|
|
|
keyDB, err = sql.Open("sqlite3", FirefoxDataFile) |
|
|
|
keyDB, err = sql.Open("sqlite3", FirefoxDataFile) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
_, err = keyDB.Exec(closeJournalMode) |
|
|
|
_, err = keyDB.Exec(closeJournalMode) |
|
|
@ -433,7 +425,6 @@ func NewCPasswords(main, sub string) Item { |
|
|
|
func (p *passwords) ChromeParse(key []byte) error { |
|
|
|
func (p *passwords) ChromeParse(key []byte) error { |
|
|
|
loginDB, err := sql.Open("sqlite3", ChromePasswordFile) |
|
|
|
loginDB, err := sql.Open("sqlite3", ChromePasswordFile) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
@ -484,7 +475,6 @@ func (p *passwords) ChromeParse(key []byte) error { |
|
|
|
func (p *passwords) FirefoxParse() error { |
|
|
|
func (p *passwords) FirefoxParse() error { |
|
|
|
globalSalt, metaBytes, nssA11, nssA102, err := getDecryptKey() |
|
|
|
globalSalt, metaBytes, nssA11, nssA102, err := getDecryptKey() |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
keyLin := []byte{248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} |
|
|
|
keyLin := []byte{248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} |
|
|
@ -505,14 +495,12 @@ func (p *passwords) FirefoxParse() error { |
|
|
|
if m == 0 { |
|
|
|
if m == 0 { |
|
|
|
nss, err := decrypt.DecodeNss(nssA11) |
|
|
|
nss, err := decrypt.DecodeNss(nssA11) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
log.Debug("decrypt asn1 pbe success") |
|
|
|
log.Debug("decrypt asn1 pbe success") |
|
|
|
finallyKey, err := decrypt.Nss(globalSalt, masterPwd, nss) |
|
|
|
finallyKey, err := decrypt.Nss(globalSalt, masterPwd, nss) |
|
|
|
finallyKey = finallyKey[:24] |
|
|
|
finallyKey = finallyKey[:24] |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
log.Debug("get firefox finally key success") |
|
|
|
log.Debug("get firefox finally key success") |
|
|
@ -526,12 +514,10 @@ func (p *passwords) FirefoxParse() error { |
|
|
|
user, err := decrypt.Des3Decrypt(finallyKey, userPBE.Iv, userPBE.Encrypted) |
|
|
|
user, err := decrypt.Des3Decrypt(finallyKey, userPBE.Iv, userPBE.Encrypted) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
log.Error(err) |
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
pwd, err := decrypt.Des3Decrypt(finallyKey, pwdPBE.Iv, pwdPBE.Encrypted) |
|
|
|
pwd, err := decrypt.Des3Decrypt(finallyKey, pwdPBE.Iv, pwdPBE.Encrypted) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error(err) |
|
|
|
log.Error(err) |
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
log.Debug("decrypt firefox success") |
|
|
|
log.Debug("decrypt firefox success") |
|
|
|
p.logins = append(p.logins, loginData{ |
|
|
|
p.logins = append(p.logins, loginData{ |
|
|
|