diff --git a/browser/chromium/chromium_darwin.go b/browser/chromium/chromium_darwin.go index 549b4be..f2e8a3e 100644 --- a/browser/chromium/chromium_darwin.go +++ b/browser/chromium/chromium_darwin.go @@ -24,7 +24,7 @@ var ( func (c *Chromium) GetMasterKey() ([]byte, error) { // don't need chromium key file for macOS - defer os.Remove(item.TempChromiumKey) + _ = os.Remove(item.TempChromiumKey) // Get the master key from the keychain // $ security find-generic-password -wa 'Chrome' var ( diff --git a/browser/chromium/chromium_linux.go b/browser/chromium/chromium_linux.go index da23500..af0310c 100644 --- a/browser/chromium/chromium_linux.go +++ b/browser/chromium/chromium_linux.go @@ -18,7 +18,7 @@ import ( func (c *Chromium) GetMasterKey() ([]byte, error) { // what is d-bus @https://dbus.freedesktop.org/ // don't need chromium key file for Linux - defer os.Remove(item.TempChromiumKey) + _ = os.Remove(item.TempChromiumKey) conn, err := dbus.SessionBus() if err != nil { diff --git a/browser/chromium/chromium_windows.go b/browser/chromium/chromium_windows.go index cee9a0b..dda77ed 100644 --- a/browser/chromium/chromium_windows.go +++ b/browser/chromium/chromium_windows.go @@ -22,7 +22,7 @@ func (c *Chromium) GetMasterKey() ([]byte, error) { if err != nil { return nil, err } - defer os.Remove(item.TempChromiumKey) + _ = os.Remove(item.TempChromiumKey) encryptedKey := gjson.Get(b, "os_crypt.encrypted_key") if !encryptedKey.Exists() { diff --git a/browsingdata/bookmark/bookmark.go b/browsingdata/bookmark/bookmark.go index 364359b..17ab42f 100644 --- a/browsingdata/bookmark/bookmark.go +++ b/browsingdata/bookmark/bookmark.go @@ -31,7 +31,7 @@ func (c *ChromiumBookmark) Parse(_ []byte) error { if err != nil { return err } - defer os.Remove(item.TempChromiumBookmark) + _ = os.Remove(item.TempChromiumBookmark) r := gjson.Parse(bookmarks) if r.Exists() { roots := r.Get("roots") @@ -94,11 +94,11 @@ const ( ) func (f *FirefoxBookmark) Parse(_ []byte) error { + defer os.Remove(item.TempFirefoxBookmark) db, err := sql.Open("sqlite3", item.TempFirefoxBookmark) if err != nil { return err } - defer os.Remove(item.TempFirefoxBookmark) defer db.Close() _, err = db.Exec(closeJournalMode) if err != nil { diff --git a/browsingdata/cookie/cookie.go b/browsingdata/cookie/cookie.go index 505a4fd..f13bec5 100644 --- a/browsingdata/cookie/cookie.go +++ b/browsingdata/cookie/cookie.go @@ -36,11 +36,11 @@ const ( ) func (c *ChromiumCookie) Parse(masterKey []byte) error { + defer os.Remove(item.TempChromiumCookie) db, err := sql.Open("sqlite3", item.TempChromiumCookie) if err != nil { return err } - defer os.Remove(item.TempChromiumCookie) defer db.Close() rows, err := db.Query(queryChromiumCookie) if err != nil { @@ -104,11 +104,11 @@ const ( ) func (f *FirefoxCookie) Parse(_ []byte) error { + defer os.Remove(item.TempFirefoxCookie) db, err := sql.Open("sqlite3", item.TempFirefoxCookie) if err != nil { return err } - defer os.Remove(item.TempFirefoxCookie) defer db.Close() rows, err := db.Query(queryFirefoxCookie) diff --git a/browsingdata/creditcard/creditcard.go b/browsingdata/creditcard/creditcard.go index e48f2ea..cc55cd1 100644 --- a/browsingdata/creditcard/creditcard.go +++ b/browsingdata/creditcard/creditcard.go @@ -29,11 +29,11 @@ const ( ) func (c *ChromiumCreditCard) Parse(masterKey []byte) error { + defer os.Remove(item.TempChromiumCreditCard) db, err := sql.Open("sqlite3", item.TempChromiumCreditCard) if err != nil { return err } - defer os.Remove(item.TempChromiumCreditCard) defer db.Close() rows, err := db.Query(queryChromiumCredit) @@ -85,11 +85,11 @@ func (c *ChromiumCreditCard) Len() int { type YandexCreditCard []card func (c *YandexCreditCard) Parse(masterKey []byte) error { + defer os.Remove(item.TempYandexCreditCard) db, err := sql.Open("sqlite3", item.TempYandexCreditCard) if err != nil { return err } - defer os.Remove(item.TempYandexCreditCard) defer db.Close() rows, err := db.Query(queryChromiumCredit) if err != nil { diff --git a/browsingdata/download/download.go b/browsingdata/download/download.go index b9b24c2..aaa5bfa 100644 --- a/browsingdata/download/download.go +++ b/browsingdata/download/download.go @@ -32,11 +32,11 @@ const ( ) func (c *ChromiumDownload) Parse(_ []byte) error { + defer os.Remove(item.TempChromiumDownload) db, err := sql.Open("sqlite3", item.TempChromiumDownload) if err != nil { return err } - defer os.Remove(item.TempChromiumDownload) defer db.Close() rows, err := db.Query(queryChromiumDownload) if err != nil { @@ -83,11 +83,11 @@ const ( ) func (f *FirefoxDownload) Parse(_ []byte) error { + defer os.Remove(item.TempFirefoxDownload) db, err := sql.Open("sqlite3", item.TempFirefoxDownload) if err != nil { return err } - defer os.Remove(item.TempFirefoxDownload) defer db.Close() _, err = db.Exec(closeJournalMode) diff --git a/browsingdata/history/history.go b/browsingdata/history/history.go index eafc8bf..a106ff3 100644 --- a/browsingdata/history/history.go +++ b/browsingdata/history/history.go @@ -28,11 +28,11 @@ const ( ) func (c *ChromiumHistory) Parse(_ []byte) error { + defer os.Remove(item.TempChromiumHistory) db, err := sql.Open("sqlite3", item.TempChromiumHistory) if err != nil { return err } - defer os.Remove(item.TempChromiumHistory) defer db.Close() rows, err := db.Query(queryChromiumHistory) @@ -79,18 +79,17 @@ const ( ) func (f *FirefoxHistory) Parse(_ []byte) error { + defer os.Remove(item.TempFirefoxHistory) db, err := sql.Open("sqlite3", item.TempFirefoxHistory) if err != nil { return err } - defer os.Remove(item.TempFirefoxHistory) defer db.Close() _, err = db.Exec(closeJournalMode) if err != nil { return err } - defer db.Close() rows, err := db.Query(queryFirefoxHistory) if err != nil { return err diff --git a/browsingdata/localstorage/localstorage.go b/browsingdata/localstorage/localstorage.go index 37cf7fe..6ade3e2 100644 --- a/browsingdata/localstorage/localstorage.go +++ b/browsingdata/localstorage/localstorage.go @@ -29,11 +29,11 @@ type storage struct { const maxLocalStorageValueLength = 1024 * 2 func (c *ChromiumLocalStorage) Parse(_ []byte) error { + defer os.RemoveAll(item.TempChromiumLocalStorage) db, err := leveldb.OpenFile(item.TempChromiumLocalStorage, nil) if err != nil { return err } - defer os.RemoveAll(item.TempChromiumLocalStorage) defer db.Close() iter := db.NewIterator(nil, nil) @@ -106,11 +106,11 @@ const ( ) func (f *FirefoxLocalStorage) Parse(_ []byte) error { + defer os.Remove(item.TempFirefoxLocalStorage) db, err := sql.Open("sqlite3", item.TempFirefoxLocalStorage) if err != nil { return err } - defer os.Remove(item.TempFirefoxLocalStorage) defer db.Close() _, err = db.Exec(closeJournalMode) diff --git a/browsingdata/password/password.go b/browsingdata/password/password.go index 837e4ad..11735e4 100644 --- a/browsingdata/password/password.go +++ b/browsingdata/password/password.go @@ -34,11 +34,11 @@ const ( ) func (c *ChromiumPassword) Parse(masterKey []byte) error { + defer os.Remove(item.TempChromiumPassword) db, err := sql.Open("sqlite3", item.TempChromiumPassword) if err != nil { return err } - defer os.Remove(item.TempChromiumPassword) defer db.Close() rows, err := db.Query(queryChromiumLogin) @@ -101,11 +101,11 @@ const ( ) func (c *YandexPassword) Parse(masterKey []byte) error { + defer os.Remove(item.TempYandexPassword) db, err := sql.Open("sqlite3", item.TempYandexPassword) if err != nil { return err } - defer os.Remove(item.TempYandexPassword) defer db.Close() rows, err := db.Query(queryYandexLogin) @@ -171,6 +171,7 @@ const ( func (f *FirefoxPassword) Parse(masterKey []byte) error { globalSalt, metaBytes, nssA11, nssA102, err := getFirefoxDecryptKey(item.TempFirefoxKey4) + _ = os.Remove(item.TempFirefoxKey4) if err != nil { return err } @@ -238,7 +239,6 @@ func getFirefoxDecryptKey(key4file string) (item1, item2, a11, a102 []byte, err if err != nil { return nil, nil, nil, nil, err } - defer os.Remove(key4file) defer keyDB.Close() if err = keyDB.QueryRow(queryMetaData).Scan(&item1, &item2); err != nil { @@ -256,7 +256,7 @@ func getFirefoxLoginData() ([]loginData, error) { if err != nil { return nil, err } - defer os.Remove(item.TempFirefoxPassword) + _ = os.Remove(item.TempFirefoxPassword) loginsJSON := gjson.GetBytes(s, "logins") var logins []loginData if loginsJSON.Exists() { diff --git a/browsingdata/sessionstorage/sessionstorage.go b/browsingdata/sessionstorage/sessionstorage.go index adaa7d2..28d26f9 100644 --- a/browsingdata/sessionstorage/sessionstorage.go +++ b/browsingdata/sessionstorage/sessionstorage.go @@ -29,11 +29,11 @@ type session struct { const maxLocalStorageValueLength = 1024 * 2 func (c *ChromiumSessionStorage) Parse(_ []byte) error { + defer os.RemoveAll(item.TempChromiumSessionStorage) db, err := leveldb.OpenFile(item.TempChromiumSessionStorage, nil) if err != nil { return err } - defer os.RemoveAll(item.TempChromiumSessionStorage) defer db.Close() iter := db.NewIterator(nil, nil) @@ -114,11 +114,11 @@ const ( ) func (f *FirefoxSessionStorage) Parse(_ []byte) error { + defer os.Remove(item.TempFirefoxSessionStorage) db, err := sql.Open("sqlite3", item.TempFirefoxSessionStorage) if err != nil { return err } - defer os.Remove(item.TempFirefoxSessionStorage) defer db.Close() _, err = db.Exec(closeJournalMode)