mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
fix: filter result if exported data is empty
This commit is contained in:
@@ -76,10 +76,23 @@ func getBookmarkChildren(value gjson.Result, w *ChromiumBookmark) (children gjso
|
||||
return children
|
||||
}
|
||||
|
||||
func bookmarkType(a int64) string {
|
||||
switch a {
|
||||
case 1:
|
||||
return "url"
|
||||
default:
|
||||
return "folder"
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ChromiumBookmark) Name() string {
|
||||
return "bookmark"
|
||||
}
|
||||
|
||||
func (c *ChromiumBookmark) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
type FirefoxBookmark []bookmark
|
||||
|
||||
const (
|
||||
@@ -134,11 +147,6 @@ func (f *FirefoxBookmark) Name() string {
|
||||
return "bookmark"
|
||||
}
|
||||
|
||||
func bookmarkType(a int64) string {
|
||||
switch a {
|
||||
case 1:
|
||||
return "url"
|
||||
default:
|
||||
return "folder"
|
||||
}
|
||||
func (f *FirefoxBookmark) Length() int {
|
||||
return len(*f)
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ type Source interface {
|
||||
Parse(masterKey []byte) error
|
||||
|
||||
Name() string
|
||||
|
||||
Length() int
|
||||
}
|
||||
|
||||
func New(sources []item.Item) *Data {
|
||||
@@ -47,6 +49,10 @@ func (d *Data) Output(dir, browserName, flag string) {
|
||||
output := NewOutPutter(flag)
|
||||
|
||||
for _, source := range d.sources {
|
||||
if source.Length() == 0 {
|
||||
// if the length of the export data is 0, then it is not necessary to output
|
||||
continue
|
||||
}
|
||||
filename := fileutil.Filename(browserName, source.Name(), output.Ext())
|
||||
|
||||
f, err := output.CreateFile(dir, filename)
|
||||
|
||||
@@ -93,6 +93,10 @@ func (c *ChromiumCookie) Name() string {
|
||||
return "cookie"
|
||||
}
|
||||
|
||||
func (c *ChromiumCookie) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
type FirefoxCookie []cookie
|
||||
|
||||
const (
|
||||
@@ -137,3 +141,7 @@ func (f *FirefoxCookie) Parse(masterKey []byte) error {
|
||||
func (f *FirefoxCookie) Name() string {
|
||||
return "cookie"
|
||||
}
|
||||
|
||||
func (f *FirefoxCookie) Length() int {
|
||||
return len(*f)
|
||||
}
|
||||
|
||||
@@ -76,6 +76,10 @@ func (c *ChromiumCreditCard) Name() string {
|
||||
return "creditcard"
|
||||
}
|
||||
|
||||
func (c *ChromiumCreditCard) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
type YandexCreditCard []card
|
||||
|
||||
func (c *YandexCreditCard) Parse(masterKey []byte) error {
|
||||
@@ -127,3 +131,7 @@ func (c *YandexCreditCard) Parse(masterKey []byte) error {
|
||||
func (c *YandexCreditCard) Name() string {
|
||||
return "creditcard"
|
||||
}
|
||||
|
||||
func (c *YandexCreditCard) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
@@ -70,6 +70,10 @@ func (c *ChromiumDownload) Name() string {
|
||||
return "download"
|
||||
}
|
||||
|
||||
func (c *ChromiumDownload) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
type FirefoxDownload []download
|
||||
|
||||
const (
|
||||
@@ -131,3 +135,7 @@ func (f *FirefoxDownload) Parse(masterKey []byte) error {
|
||||
func (f *FirefoxDownload) Name() string {
|
||||
return "download"
|
||||
}
|
||||
|
||||
func (f *FirefoxDownload) Length() int {
|
||||
return len(*f)
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ func (c *ChromiumExtension) Name() string {
|
||||
return "extension"
|
||||
}
|
||||
|
||||
func (c *ChromiumExtension) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
type FirefoxExtension []*extension
|
||||
|
||||
func (f *FirefoxExtension) Parse(masterKey []byte) error {
|
||||
@@ -73,3 +77,7 @@ func (f *FirefoxExtension) Parse(masterKey []byte) error {
|
||||
func (f *FirefoxExtension) Name() string {
|
||||
return "extension"
|
||||
}
|
||||
|
||||
func (f *FirefoxExtension) Length() int {
|
||||
return len(*f)
|
||||
}
|
||||
|
||||
@@ -65,6 +65,10 @@ func (c *ChromiumHistory) Name() string {
|
||||
return "history"
|
||||
}
|
||||
|
||||
func (c *ChromiumHistory) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
type FirefoxHistory []history
|
||||
|
||||
const (
|
||||
@@ -119,3 +123,7 @@ func (f *FirefoxHistory) Parse(masterKey []byte) error {
|
||||
func (f *FirefoxHistory) Name() string {
|
||||
return "history"
|
||||
}
|
||||
|
||||
func (f *FirefoxHistory) Length() int {
|
||||
return len(*f)
|
||||
}
|
||||
|
||||
@@ -58,6 +58,10 @@ func (c *ChromiumLocalStorage) Name() string {
|
||||
return "localStorage"
|
||||
}
|
||||
|
||||
func (c *ChromiumLocalStorage) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
func (s *storage) fillKey(b []byte) {
|
||||
keys := bytes.Split(b, []byte("\x00"))
|
||||
if len(keys) == 1 && bytes.HasPrefix(keys[0], []byte("META:")) {
|
||||
@@ -142,3 +146,7 @@ func (s *storage) fillFirefox(originKey, key, value string) {
|
||||
func (f *FirefoxLocalStorage) Name() string {
|
||||
return "localStorage"
|
||||
}
|
||||
|
||||
func (f *FirefoxLocalStorage) Length() int {
|
||||
return len(*f)
|
||||
}
|
||||
|
||||
@@ -90,6 +90,10 @@ func (c *ChromiumPassword) Name() string {
|
||||
return "password"
|
||||
}
|
||||
|
||||
func (c *ChromiumPassword) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
type YandexPassword []loginData
|
||||
|
||||
const (
|
||||
@@ -154,6 +158,10 @@ func (c *YandexPassword) Name() string {
|
||||
return "password"
|
||||
}
|
||||
|
||||
func (c *YandexPassword) Length() int {
|
||||
return len(*c)
|
||||
}
|
||||
|
||||
type FirefoxPassword []loginData
|
||||
|
||||
const (
|
||||
@@ -224,10 +232,6 @@ func (f *FirefoxPassword) Parse(masterKey []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *FirefoxPassword) Name() string {
|
||||
return "password"
|
||||
}
|
||||
|
||||
func getFirefoxDecryptKey(key4file string) (item1, item2, a11, a102 []byte, err error) {
|
||||
var keyDB *sql.DB
|
||||
keyDB, err = sql.Open("sqlite3", key4file)
|
||||
@@ -278,3 +282,11 @@ func getFirefoxLoginData(loginJson string) (l []loginData, err error) {
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
func (f *FirefoxPassword) Name() string {
|
||||
return "password"
|
||||
}
|
||||
|
||||
func (f *FirefoxPassword) Length() int {
|
||||
return len(*f)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user