mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 17:05:29 +00:00
Bug fixes
This commit is contained in:
parent
c42536f5e8
commit
7933a9c70c
@ -14,6 +14,8 @@ import (
|
|||||||
"github.com/projectdiscovery/nuclei/v2/pkg/catalogue"
|
"github.com/projectdiscovery/nuclei/v2/pkg/catalogue"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/output"
|
"github.com/projectdiscovery/nuclei/v2/pkg/output"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/projectfile"
|
"github.com/projectdiscovery/nuclei/v2/pkg/projectfile"
|
||||||
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/dns/dnsclientpool"
|
||||||
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/http/httpclientpool"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/templates"
|
"github.com/projectdiscovery/nuclei/v2/pkg/templates"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
||||||
"github.com/remeh/sizedwaitgroup"
|
"github.com/remeh/sizedwaitgroup"
|
||||||
@ -126,13 +128,11 @@ func New(options *types.Options) (*Runner, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the output file if asked
|
// Create the output file if asked
|
||||||
if options.Output != "" {
|
output, err := output.NewStandardWriter(!options.NoColor, options.NoMeta, options.JSON, options.Output, options.TraceLogFile)
|
||||||
output, errWriter := output.NewStandardWriter(!options.NoColor, options.NoMeta, options.JSON, options.Output, options.TraceLogFile)
|
if err != nil {
|
||||||
if errWriter != nil {
|
gologger.Fatal().Msgf("Could not create output file '%s': %s\n", options.Output, err)
|
||||||
gologger.Fatal().Msgf("Could not create output file '%s': %s\n", options.Output, errWriter)
|
|
||||||
}
|
|
||||||
runner.output = output
|
|
||||||
}
|
}
|
||||||
|
runner.output = output
|
||||||
|
|
||||||
// Creates the progress tracking object
|
// Creates the progress tracking object
|
||||||
var progressErr error
|
var progressErr error
|
||||||
@ -177,6 +177,11 @@ func (r *Runner) Close() {
|
|||||||
// RunEnumeration sets up the input layer for giving input nuclei.
|
// RunEnumeration sets up the input layer for giving input nuclei.
|
||||||
// binary and runs the actual enumeration
|
// binary and runs the actual enumeration
|
||||||
func (r *Runner) RunEnumeration() {
|
func (r *Runner) RunEnumeration() {
|
||||||
|
err := r.initializeProtocols()
|
||||||
|
if err != nil {
|
||||||
|
gologger.Fatal().Msgf("Could not initialize protocols: %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
// resolves input templates definitions and any optional exclusion
|
// resolves input templates definitions and any optional exclusion
|
||||||
includedTemplates := r.catalogue.GetTemplatesPath(r.options.Templates)
|
includedTemplates := r.catalogue.GetTemplatesPath(r.options.Templates)
|
||||||
excludedTemplates := r.catalogue.GetTemplatesPath(r.options.ExcludedTemplates)
|
excludedTemplates := r.catalogue.GetTemplatesPath(r.options.ExcludedTemplates)
|
||||||
@ -261,3 +266,14 @@ func (r *Runner) RunEnumeration() {
|
|||||||
gologger.Info().Msgf("No results found. Happy hacking!")
|
gologger.Info().Msgf("No results found. Happy hacking!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initializeProtocols initializes all the protocols and their caches
|
||||||
|
func (r *Runner) initializeProtocols() error {
|
||||||
|
if err := dnsclientpool.Init(r.options); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := httpclientpool.Init(r.options); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@ -37,7 +37,7 @@ func Parse(file string, options *protocols.ExecuterOptions) (*Template, error) {
|
|||||||
return nil, fmt.Errorf("both http and dns requests for %s", template.ID)
|
return nil, fmt.Errorf("both http and dns requests for %s", template.ID)
|
||||||
}
|
}
|
||||||
// If no requests, and it is also not a workflow, return error.
|
// If no requests, and it is also not a workflow, return error.
|
||||||
if len(template.RequestsDNS)+len(template.RequestsDNS)+len(template.Workflow.Workflows) == 0 {
|
if len(template.RequestsDNS)+len(template.RequestsHTTP) == 0 && template.Workflow == nil {
|
||||||
return nil, fmt.Errorf("no requests defined for %s", template.ID)
|
return nil, fmt.Errorf("no requests defined for %s", template.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user