diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..0eed8620d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +cmd/nuclei/nuclei diff --git a/cmd/nuclei/main.go b/cmd/nuclei/main.go new file mode 100644 index 000000000..ad64b6213 --- /dev/null +++ b/cmd/nuclei/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "github.com/projectdiscovery/gologger" + "github.com/projectdiscovery/nuclei/internal/runner" +) + +func main() { + // Parse the command line flags and read config files + options := runner.ParseOptions() + + runner, err := runner.New(options) + if err != nil { + gologger.Fatalf("Could not create runner: %s\n", err) + } + + runner.RunEnumeration() + runner.Close() +} diff --git a/internal/runner/options.go b/internal/runner/options.go index 2c1240577..6cf2f8bc8 100644 --- a/internal/runner/options.go +++ b/internal/runner/options.go @@ -27,14 +27,14 @@ type Options struct { func ParseOptions() *Options { options := &Options{} - flag.StringVar(&options.Templates, "f", "", "Template/templates to use during enumeration") - flag.StringVar(&options.Targets, "l", "", "Targets to scan using templates during enumeration") + flag.StringVar(&options.Templates, "t", "", "Template input file/files to run on host") + flag.StringVar(&options.Targets, "l", "", "List of URLs to run templates on") flag.StringVar(&options.Output, "o", "", "File to write output to (optional)") - flag.BoolVar(&options.Silent, "silent", false, "Show only subdomains in output") - flag.BoolVar(&options.Version, "version", false, "Show version of shuffledns") + flag.BoolVar(&options.Silent, "silent", false, "Show only results in output") + flag.BoolVar(&options.Version, "version", false, "Show version of nuclei") flag.BoolVar(&options.Verbose, "v", false, "Show Verbose output") flag.BoolVar(&options.NoColor, "nC", false, "Don't Use colors in output") - flag.IntVar(&options.Threads, "t", 100, "Number of concurrent requests to make") + flag.IntVar(&options.Threads, "c", 100, "Number of concurrent requests to make") flag.IntVar(&options.Timeout, "timeout", 30, "Time to wait in seconds before timeout") flag.Parse() diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 355d65d47..91b95d0fe 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -59,6 +59,10 @@ func (r *Runner) Close() {} // RunEnumeration sets up the input layer for giving input to massdns // binary and runs the actual enumeration func (r *Runner) RunEnumeration() { + if !strings.HasSuffix(r.options.Templates, ".yaml") { + gologger.Fatalf("Could not run recognize template extension: %s\n", r.options.Templates) + } + // If the template path is a single template and not a glob, use that. if !strings.Contains(r.options.Templates, "*") { r.processTemplate(r.options.Templates)