diff options
author | Emile <hanemile@protonmail.com> | 2019-11-02 21:14:12 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2019-11-02 21:14:12 +0100 |
commit | baeb1bdf40905854460848536866d2054a746dae (patch) | |
tree | 65dec6f888dcd9f9ee0e80e4988f219ab7b0bb51 | |
parent | 73e99546b88860f3797fdff4c3cb4ada430c8c2a (diff) |
comments + logging
-rw-r--r-- | src/wordlist.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wordlist.go b/src/wordlist.go index adfda9a..9ad5e58 100644 --- a/src/wordlist.go +++ b/src/wordlist.go @@ -6,22 +6,32 @@ import ( "os" ) +// readWordlist reads the lines in the file located at the given path +// (wordlistPath) into an array returning the array and an error, if an error +// occurs func readWordlist(wordlistPath string) ([]string, error) { + log.Printf("%s Reading the wordlist", green("[i]")) + + // open the given wordlist file file, err := os.Open(wordlistPath) if err != nil { return nil, err } defer file.Close() + // read the file content line by line scanner := bufio.NewScanner(file) scanner.Split(bufio.ScanLines) + // append the lines to the lines array var lines []string for scanner.Scan() { lines = append(lines, scanner.Text()) } + log.Printf("%s Done reading the wordlist", boldGreen("[+]")) + // return the lines, the line count and no error return lines, nil } |