File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 55package assoc
66
77import (
8+ "bufio"
89 "bytes"
910 "encoding/json"
1011 "flag"
1112 "io"
1213 "os"
14+ "strings"
1315
1416 "github.com/fatih/color"
1517 "github.com/owasp-amass/amass/v5/config"
@@ -102,7 +104,7 @@ func CLIWorkflow(cmdName string, clArgs []string) {
102104 color .Error = io .Discard
103105 }
104106 if args .Filepaths .TripleFile != "" {
105- list , err := config . GetListFromFile (args .Filepaths .TripleFile )
107+ list , err := readTriplesTextFromFile (args .Filepaths .TripleFile )
106108 if err != nil {
107109 _ , _ = afmt .R .Fprintf (color .Error , "Failed to parse the triple file: %v\n " , err )
108110 os .Exit (1 )
@@ -172,3 +174,25 @@ func CLIWorkflow(cmdName string, clArgs []string) {
172174
173175 _ , _ = afmt .G .Fprintln (color .Output , string (prettyJSON ))
174176}
177+
178+ func readTriplesTextFromFile (filePath string ) ([]string , error ) {
179+ var triples []string
180+ file , err := os .Open (filePath )
181+ if err != nil {
182+ return nil , err
183+ }
184+ defer file .Close ()
185+
186+ scanner := bufio .NewScanner (file )
187+ for scanner .Scan () {
188+ line := strings .TrimSpace (scanner .Text ())
189+ if line != "" {
190+ triples = append (triples , line )
191+ }
192+ }
193+
194+ if err := scanner .Err (); err != nil {
195+ return nil , err
196+ }
197+ return triples , nil
198+ }
You can’t perform that action at this time.
0 commit comments