|
|
@ -2,7 +2,6 @@ package core |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
"bytes" |
|
|
|
"encoding/csv" |
|
|
|
|
|
|
|
"encoding/json" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"hack-browser-data/log" |
|
|
|
"hack-browser-data/log" |
|
|
@ -24,15 +23,8 @@ func (b BrowserData) OutPutCsv(dir, browser, format string) error { |
|
|
|
log.Errorf("create file %s fail %s", filename, err) |
|
|
|
log.Errorf("create file %s fail %s", filename, err) |
|
|
|
} |
|
|
|
} |
|
|
|
file.Write(utf8Bom) |
|
|
|
file.Write(utf8Bom) |
|
|
|
w := csv.NewWriter(file) |
|
|
|
data, err := csvutil.Marshal(b.BookmarkSlice) |
|
|
|
w.Comma = ';' |
|
|
|
file.Write(data) |
|
|
|
enc := csvutil.NewEncoder(w) |
|
|
|
|
|
|
|
for _, u := range b.BookmarkSlice { |
|
|
|
|
|
|
|
if err := enc.Encode(u); err != nil { |
|
|
|
|
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
w.Flush() |
|
|
|
|
|
|
|
fmt.Printf("%s Get %d bookmarks, filename is %s \n", log.Prefix, len(b.BookmarkSlice), filename) |
|
|
|
fmt.Printf("%s Get %d bookmarks, filename is %s \n", log.Prefix, len(b.BookmarkSlice), filename) |
|
|
|
fallthrough |
|
|
|
fallthrough |
|
|
|
case len(b.LoginDataSlice) != 0: |
|
|
|
case len(b.LoginDataSlice) != 0: |
|
|
@ -43,15 +35,8 @@ func (b BrowserData) OutPutCsv(dir, browser, format string) error { |
|
|
|
log.Errorf("create file %s fail", filename) |
|
|
|
log.Errorf("create file %s fail", filename) |
|
|
|
} |
|
|
|
} |
|
|
|
file.Write(utf8Bom) |
|
|
|
file.Write(utf8Bom) |
|
|
|
w := csv.NewWriter(file) |
|
|
|
data, err := csvutil.Marshal(b.LoginDataSlice) |
|
|
|
w.Comma = ';' |
|
|
|
file.Write(data) |
|
|
|
enc := csvutil.NewEncoder(w) |
|
|
|
|
|
|
|
for _, u := range b.LoginDataSlice { |
|
|
|
|
|
|
|
if err := enc.Encode(u); err != nil { |
|
|
|
|
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
w.Flush() |
|
|
|
|
|
|
|
fmt.Printf("%s Get %d login data, filename is %s \n", log.Prefix, len(b.LoginDataSlice), filename) |
|
|
|
fmt.Printf("%s Get %d login data, filename is %s \n", log.Prefix, len(b.LoginDataSlice), filename) |
|
|
|
fallthrough |
|
|
|
fallthrough |
|
|
|
case len(b.CookieMap) != 0: |
|
|
|
case len(b.CookieMap) != 0: |
|
|
@ -66,15 +51,8 @@ func (b BrowserData) OutPutCsv(dir, browser, format string) error { |
|
|
|
tempSlice = append(tempSlice, v...) |
|
|
|
tempSlice = append(tempSlice, v...) |
|
|
|
} |
|
|
|
} |
|
|
|
file.Write(utf8Bom) |
|
|
|
file.Write(utf8Bom) |
|
|
|
w := csv.NewWriter(file) |
|
|
|
data, err := csvutil.Marshal(tempSlice) |
|
|
|
w.Comma = ';' |
|
|
|
file.Write(data) |
|
|
|
enc := csvutil.NewEncoder(w) |
|
|
|
|
|
|
|
for _, u := range tempSlice { |
|
|
|
|
|
|
|
if err := enc.Encode(u); err != nil { |
|
|
|
|
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
w.Flush() |
|
|
|
|
|
|
|
fmt.Printf("%s Get %d cookies, filename is %s \n", log.Prefix, len(b.CookieMap), filename) |
|
|
|
fmt.Printf("%s Get %d cookies, filename is %s \n", log.Prefix, len(b.CookieMap), filename) |
|
|
|
fallthrough |
|
|
|
fallthrough |
|
|
|
case len(b.HistorySlice) != 0: |
|
|
|
case len(b.HistorySlice) != 0: |
|
|
@ -85,15 +63,8 @@ func (b BrowserData) OutPutCsv(dir, browser, format string) error { |
|
|
|
log.Errorf("create file %s fail", filename) |
|
|
|
log.Errorf("create file %s fail", filename) |
|
|
|
} |
|
|
|
} |
|
|
|
file.Write(utf8Bom) |
|
|
|
file.Write(utf8Bom) |
|
|
|
w := csv.NewWriter(file) |
|
|
|
data, err := csvutil.Marshal(b.HistorySlice) |
|
|
|
w.Comma = ';' |
|
|
|
file.Write(data) |
|
|
|
enc := csvutil.NewEncoder(w) |
|
|
|
|
|
|
|
for _, u := range b.HistorySlice { |
|
|
|
|
|
|
|
if err := enc.Encode(u); err != nil { |
|
|
|
|
|
|
|
log.Error(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
w.Flush() |
|
|
|
|
|
|
|
fmt.Printf("%s Get %d login data, filename is %s \n", log.Prefix, len(b.HistorySlice), filename) |
|
|
|
fmt.Printf("%s Get %d login data, filename is %s \n", log.Prefix, len(b.HistorySlice), filename) |
|
|
|
} |
|
|
|
} |
|
|
|
return nil |
|
|
|
return nil |
|
|
|