refactor: Refactor storage queries and filters.

- Update local storage query constant and function calls
- Remove null and control characters from UTF-8 split function
pull/224/head
moonD4rk 2 years ago
parent 5376184c7e
commit 6c1f653b4f
  1. 4
      browingdata/localstorage/localstorage.go
  2. 12
      browingdata/sessionstorage/sessionstorage.go
  3. 4
      utils/byteutil/byteutil.go

@ -101,7 +101,7 @@ func (s *storage) fillValue(b []byte) {
type FirefoxLocalStorage []storage
const (
queryFirefoxHistory = `SELECT originKey, key, value FROM webappsstore2`
queryLocalStorage = `SELECT originKey, key, value FROM webappsstore2`
closeJournalMode = `PRAGMA journal_mode=off`
)
@ -117,7 +117,7 @@ func (f *FirefoxLocalStorage) Parse(_ []byte) error {
if err != nil {
log.Error(err)
}
rows, err := db.Query(queryFirefoxHistory)
rows, err := db.Query(queryLocalStorage)
if err != nil {
return err
}

@ -82,8 +82,6 @@ func (s *session) fillKey(b []byte) {
s.URL = string(keys[2])
s.Key = string(keys[1])
}
}
}
@ -111,23 +109,23 @@ func (s *session) fillValue(b []byte) {
type FirefoxSessionStorage []session
const (
queryFirefoxHistory = `SELECT originKey, key, value FROM webappsstore2`
querySessionStorage = `SELECT originKey, key, value FROM webappsstore2`
closeJournalMode = `PRAGMA journal_mode=off`
)
func (f *FirefoxSessionStorage) Parse(_ []byte) error {
db, err := sql.Open("sqlite3", item.TempFirefoxLocalStorage)
db, err := sql.Open("sqlite3", item.TempFirefoxSessionStorage)
if err != nil {
return err
}
defer os.Remove(item.TempFirefoxLocalStorage)
defer os.Remove(item.TempFirefoxSessionStorage)
defer db.Close()
_, err = db.Exec(closeJournalMode)
if err != nil {
log.Error(err)
}
rows, err := db.Query(queryFirefoxHistory)
rows, err := db.Query(querySessionStorage)
if err != nil {
return err
}
@ -159,7 +157,7 @@ func (s *session) fillFirefox(originKey, key, value string) {
}
func (f *FirefoxSessionStorage) Name() string {
return "localStorage"
return "sessionStorage"
}
func (f *FirefoxSessionStorage) Len() int {

@ -1,10 +1,8 @@
package byteutil
var (
OnSplitUTF8Func = func(r rune) rune {
var OnSplitUTF8Func = func(r rune) rune {
if r == 0x00 || r == 0x01 {
return -1
}
return r
}
)

Loading…
Cancel
Save