diff --git a/core/options.go b/core/options.go index 3fc4c10..5175aaa 100644 --- a/core/options.go +++ b/core/options.go @@ -23,6 +23,8 @@ type Options struct { Silent *bool Debug *bool Version *bool + Similarity *float64 + InputFile *string } func ParseOptions() (Options, error) { @@ -43,6 +45,8 @@ func ParseOptions() (Options, error) { Silent: flag.Bool("silent", false, "Suppress all output except for errors"), Debug: flag.Bool("debug", false, "Print debugging information"), Version: flag.Bool("version", false, "Print current Aquatone version"), + Similarity: flag.Float64("similarity",0.80,"Cluster Similarity Float for Screenshots. Default 0.80"), + InputFile: flag.String("inputfile","","Input file to parse hosts (Nmap or Raw) rather than STDIN"), } flag.Parse() diff --git a/main.go b/main.go index 649aaf0..4bb23fa 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "os" "strings" "time" + "io" "github.com/google/uuid" "github.com/michenriksen/aquatone/agents" @@ -121,9 +122,22 @@ func main() { agents.NewURLTechnologyFingerprinter().Register(sess) agents.NewURLTakeoverDetector().Register(sess) - reader := bufio.NewReader(os.Stdin) - var targets []string + var reader io.Reader + if *sess.Options.InputFile != "" { + //Read from File + file, err := os.Open(*sess.Options.InputFile) + if err != nil { + sess.Out.Fatal("Unable to open input file: %s\n", *sess.Options.InputFile) + os.Exit(1) + } + defer file.Close() + reader = bufio.NewReader(file) + } else { + reader = bufio.NewReader(os.Stdin) + } + + var targets []string if *sess.Options.Nmap { parser := parsers.NewNmapParser() targets, err = parser.Parse(reader) @@ -193,7 +207,7 @@ func main() { addToCluster := true for _, pageURL := range cluster { page2 := sess.GetPage(pageURL) - if page2 != nil && core.GetSimilarity(page.PageStructure, page2.PageStructure) < 0.80 { + if page2 != nil && core.GetSimilarity(page.PageStructure, page2.PageStructure) < *sess.Options.Similarity { addToCluster = false break }