filx: edit sqlite journal_mode to delete Close #20

pull/83/head
ᴍᴏᴏɴD4ʀᴋ 4 years ago
parent dabeaabc15
commit 52d610f1c1
  1. 31
      core/browser.go
  2. 47
      core/common/parse.go

@ -144,18 +144,30 @@ func (c *chromium) ParseDB() {
if err := chromeParse(c.SecretKey, &c.Data.Bookmarks); err != nil { if err := chromeParse(c.SecretKey, &c.Data.Bookmarks); err != nil {
log.Error(err) log.Error(err)
} }
if err := release(v.mainFile, &c.Data.Bookmarks); err != nil {
log.Error(err)
}
case history: case history:
if err := chromeParse(c.SecretKey, &c.Data.History); err != nil { if err := chromeParse(c.SecretKey, &c.Data.History); err != nil {
log.Error(err) log.Error(err)
} }
if err := release(v.mainFile, &c.Data.History); err != nil {
log.Error(err)
}
case password: case password:
if err := chromeParse(c.SecretKey, &c.Data.Logins); err != nil { if err := chromeParse(c.SecretKey, &c.Data.Logins); err != nil {
log.Error(err) log.Error(err)
} }
if err := release(v.mainFile, &c.Data.Logins); err != nil {
log.Error(err)
}
case cookie: case cookie:
if err := chromeParse(c.SecretKey, &c.Data.Cookies); err != nil { if err := chromeParse(c.SecretKey, &c.Data.Cookies); err != nil {
log.Error(err) log.Error(err)
} }
if err := release(v.mainFile, &c.Data.Cookies); err != nil {
log.Error(err)
}
} }
} }
} }
@ -229,18 +241,33 @@ func (f *firefox) ParseDB() {
if err := firefoxParse(&f.Data.Logins); err != nil { if err := firefoxParse(&f.Data.Logins); err != nil {
log.Error(err) log.Error(err)
} }
if err := release(v.mainFile, &f.Data.Logins); err != nil {
log.Error(err)
}
if err := release(v.subFile, &f.Data.Logins); err != nil {
log.Error(err)
}
case bookmark: case bookmark:
if err := firefoxParse(&f.Data.Bookmarks); err != nil { if err := firefoxParse(&f.Data.Bookmarks); err != nil {
log.Error(err) log.Error(err)
} }
if err := release(v.mainFile, &f.Data.Bookmarks); err != nil {
log.Error(err)
}
case history: case history:
if err := firefoxParse(&f.Data.History); err != nil { if err := firefoxParse(&f.Data.History); err != nil {
log.Error(err) log.Error(err)
} }
if err := release(v.mainFile, &f.Data.History); err != nil {
log.Error(err)
}
case cookie: case cookie:
if err := firefoxParse(&f.Data.Cookies); err != nil { if err := firefoxParse(&f.Data.Cookies); err != nil {
log.Error(err) log.Error(err)
} }
if err := release(v.mainFile, &f.Data.Cookies); err != nil {
log.Error(err)
}
} }
} }
} }
@ -384,6 +411,10 @@ func outPutCsv(name, dir string, f common.Formatter) error {
return f.OutPutCsv(name, dir) return f.OutPutCsv(name, dir)
} }
func release(filename string, f common.Formatter) error {
return f.Release(filename)
}
func ListBrowser() []string { func ListBrowser() []string {
var l []string var l []string
for k := range browserList { for k := range browserList {

@ -5,6 +5,7 @@ import (
"database/sql" "database/sql"
"encoding/base64" "encoding/base64"
"io/ioutil" "io/ioutil"
"os"
"sort" "sort"
"time" "time"
@ -28,6 +29,18 @@ const (
FirefoxKey3DB = "key3.db" FirefoxKey3DB = "key3.db"
) )
var (
queryChromiumLogin = `SELECT origin_url, username_value, password_value, date_created FROM logins`
queryChromiumHistory = `SELECT url, title, visit_count, last_visit_time FROM urls`
queryChromiumCookie = `SELECT name, encrypted_value, host_key, path, creation_utc, expires_utc, is_secure, is_httponly, has_expires, is_persistent FROM cookies`
queryFirefoxHistory = `SELECT id, url, title, last_visit_date, visit_count FROM moz_places`
queryFirefoxBookMarks = `SELECT id, fk, type, dateAdded, title FROM moz_bookmarks`
queryFirefoxCookie = `SELECT name, value, host, path, creationTime, expiry, isSecure, isHttpOnly FROM moz_cookies`
queryMetaData = `SELECT item1, item2 FROM metaData WHERE id = 'password'`
queryNssPrivate = `SELECT a11, a102 from nssPrivate`
closeJournalMode = `PRAGMA journal_mode=off`
)
type ( type (
BrowserData struct { BrowserData struct {
Logins Logins
@ -124,8 +137,7 @@ func (l *Logins) ChromeParse(key []byte) error {
} }
}() }()
err = loginDB.Ping() err = loginDB.Ping()
var queryLogin = `SELECT origin_url, username_value, password_value, date_created FROM logins` rows, err := loginDB.Query(queryChromiumLogin)
rows, err := loginDB.Query(queryLogin)
defer func() { defer func() {
if err := rows.Close(); err != nil { if err := rows.Close(); err != nil {
log.Debug(err) log.Debug(err)
@ -196,8 +208,7 @@ func (h *History) ChromeParse(key []byte) error {
} }
}() }()
err = historyDB.Ping() err = historyDB.Ping()
var queryHistory = `SELECT url, title, visit_count, last_visit_time FROM urls` rows, err := historyDB.Query(queryChromiumHistory)
rows, err := historyDB.Query(queryHistory)
defer func() { defer func() {
if err := rows.Close(); err != nil { if err := rows.Close(); err != nil {
log.Debug(err) log.Debug(err)
@ -238,8 +249,7 @@ func (c *Cookies) ChromeParse(secretKey []byte) error {
} }
}() }()
err = cookieDB.Ping() err = cookieDB.Ping()
var queryCookie = `SELECT name, encrypted_value, host_key, path, creation_utc, expires_utc, is_secure, is_httponly, has_expires, is_persistent FROM cookies` rows, err := cookieDB.Query(queryChromiumCookie)
rows, err := cookieDB.Query(queryCookie)
defer func() { defer func() {
if err := rows.Close(); err != nil { if err := rows.Close(); err != nil {
log.Debug(err) log.Debug(err)
@ -283,8 +293,6 @@ func (c *Cookies) ChromeParse(secretKey []byte) error {
} }
func (h *History) FirefoxParse() error { func (h *History) FirefoxParse() error {
var queryFirefoxHistory = `SELECT id, url, title, last_visit_date, visit_count FROM moz_places`
var closeJournalMode = `PRAGMA journal_mode=off`
var ( var (
err error err error
keyDB *sql.DB keyDB *sql.DB
@ -335,8 +343,6 @@ func (h *History) FirefoxParse() error {
} }
func (b *Bookmarks) FirefoxParse() error { func (b *Bookmarks) FirefoxParse() error {
var queryFirefoxBookMarks = `SELECT id, fk, type, dateAdded, title FROM moz_bookmarks`
var closeJournalMode = `PRAGMA journal_mode=off`
var ( var (
err error err error
keyDB *sql.DB keyDB *sql.DB
@ -379,7 +385,20 @@ func (b *Bookmarks) FirefoxParse() error {
return nil return nil
} }
var queryFirefoxCookie = `SELECT name, value, host, path, creationTime, expiry, isSecure, isHttpOnly FROM moz_cookies` func (b *Bookmarks) Release(filename string) error {
return os.Remove(filename)
}
func (c *Cookies) Release(filename string) error {
return os.Remove(filename)
}
func (h *History) Release(filename string) error {
return os.Remove(filename)
}
func (l *Logins) Release(filename string) error {
return os.Remove(filename)
}
func (c *Cookies) FirefoxParse() error { func (c *Cookies) FirefoxParse() error {
cookie := cookies{} cookie := cookies{}
@ -514,10 +533,9 @@ func getDecryptKey() (item1, item2, a11, a102 []byte, err error) {
log.Error(err) log.Error(err)
} }
}() }()
var queryPassword = `SELECT item1, item2 FROM metaData WHERE id = 'password'`
var queryNssPrivate = `SELECT a11, a102 from nssPrivate`
err = keyDB.Ping() err = keyDB.Ping()
pwdRows, err = keyDB.Query(queryPassword) pwdRows, err = keyDB.Query(queryMetaData)
defer func() { defer func() {
if err := pwdRows.Close(); err != nil { if err := pwdRows.Close(); err != nil {
log.Debug(err) log.Debug(err)
@ -601,4 +619,5 @@ type Formatter interface {
FirefoxParse() error FirefoxParse() error
OutPutJson(browser, dir string) error OutPutJson(browser, dir string) error
OutPutCsv(browser, dir string) error OutPutCsv(browser, dir string) error
Release(filename string) error
} }

Loading…
Cancel
Save