From 21c414da70cfd6c78fc10385fab6b105f4a2a67c Mon Sep 17 00:00:00 2001 From: Cyrus <50967051+Not-Cyrus@users.noreply.github.com> Date: Thu, 3 Dec 2020 03:00:22 -0500 Subject: [PATCH] Update output.go --- core/data/output.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/core/data/output.go b/core/data/output.go index dae6fda..4c8bb5a 100644 --- a/core/data/output.go +++ b/core/data/output.go @@ -62,6 +62,16 @@ func (c *cookies) outPutJson(browser, dir string) error { return nil } +func (credit *creditcards) outPutJson(browser, dir string) error { + filename := utils.FormatFileName(dir, browser, "credit", "json") + err := writeToJson(filename, credit.cards) + if err != nil { + return err + } + fmt.Printf("%s Get %d cards, filename is %s \n", utils.Prefix, len(credit.cards), filename) + return nil +} + func writeToJson(filename string, data interface{}) error { f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_APPEND, 0644) if err != nil { @@ -123,6 +133,19 @@ func (c *cookies) outPutCsv(browser, dir string) error { return nil } +func (credit *creditcards) outPutCsv(browser, dir string) error { + filename := utils.FormatFileName(dir, browser, "credit", "csv") + var tempSlice []card + for _, v := range credit.cards { + tempSlice = append(tempSlice, v...) + } + if err := writeToCsv(filename, tempSlice); err != nil { + return err + } + fmt.Printf("%s Get %d cards, filename is %s \n", utils.Prefix, len(credit.cards), filename) + return nil +} + func writeToCsv(filename string, data interface{}) error { var d []byte f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_APPEND, 0644) @@ -168,3 +191,9 @@ func (p *passwords) outPutConsole() { fmt.Printf("%+v\n", v) } } + +func (credit *creditcards) outPutConsole() { + for _, v := range credit.cards { + fmt.Printf("%+v\n", v) + } +}