Misc + cmd + final

dev
Ice3man543 2020-04-04 17:24:31 +05:30
parent 2db1ad6ce9
commit b1cd18b99d
4 changed files with 29 additions and 5 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
cmd/nuclei/nuclei

19
cmd/nuclei/main.go Normal file
View File

@ -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()
}

View File

@ -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()

View File

@ -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)