add output to console Close #14

This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ
2020-08-01 19:34:50 +08:00
parent 4869454a78
commit 2c0eca9d40
5 changed files with 57 additions and 26 deletions
+24
View File
@@ -145,3 +145,27 @@ func writeToCsv(filename string, data interface{}) error {
}
return nil
}
func (b *bookmarks) outPutConsole() {
for _, v := range b.bookmarks {
fmt.Printf("%+v\n", v)
}
}
func (c *cookies) outPutConsole() {
for host, value := range c.cookies {
fmt.Printf("%s\n%+v\n", host, value)
}
}
func (h *historyData) outPutConsole() {
for _, v := range h.history {
fmt.Printf("%+v\n", v)
}
}
func (p *passwords) outPutConsole() {
for _, v := range p.logins {
fmt.Printf("%+v\n", v)
}
}
+24 -16
View File
@@ -156,14 +156,16 @@ func (b *bookmarks) OutPut(format, browser, dir string) error {
return b.bookmarks[i].ID < b.bookmarks[j].ID
})
switch format {
case "json":
err := b.outPutJson(browser, dir)
return err
case "csv":
err := b.outPutCsv(browser, dir)
return err
case "console":
b.outPutConsole()
return nil
default:
err := b.outPutJson(browser, dir)
return err
}
return nil
}
type cookies struct {
@@ -279,14 +281,16 @@ func (c *cookies) Release() error {
func (c *cookies) OutPut(format, browser, dir string) error {
switch format {
case "json":
err := c.outPutJson(browser, dir)
return err
case "csv":
err := c.outPutCsv(browser, dir)
return err
case "console":
c.outPutConsole()
return nil
default:
err := c.outPutJson(browser, dir)
return err
}
return nil
}
type historyData struct {
@@ -400,14 +404,16 @@ func (h *historyData) OutPut(format, browser, dir string) error {
return h.history[i].VisitCount > h.history[j].VisitCount
})
switch format {
case "json":
err := h.outPutJson(browser, dir)
return err
case "csv":
err := h.outPutCsv(browser, dir)
return err
case "console":
h.outPutConsole()
return nil
default:
err := h.outPutJson(browser, dir)
return err
}
return nil
}
type passwords struct {
@@ -566,14 +572,16 @@ func (p *passwords) Release() error {
func (p *passwords) OutPut(format, browser, dir string) error {
sort.Sort(p)
switch format {
case "json":
err := p.outPutJson(browser, dir)
return err
case "csv":
err := p.outPutCsv(browser, dir)
return err
case "console":
p.outPutConsole()
return nil
default:
err := p.outPutJson(browser, dir)
return err
}
return nil
}
func getDecryptKey() (item1, item2, a11, a102 []byte, err error) {