Skip to content

Commit 2835cad

Browse files
author
Jeff Foley
committed
bug fix related to the assoc -tf flag
Committer: caffix <caffix@users.noreply.github.com>
1 parent e545f7b commit 2835cad

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

internal/assoc/cli.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
package assoc
66

77
import (
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+
}

0 commit comments

Comments
 (0)