mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 04:25:31 +00:00
removing err
This commit is contained in:
parent
d988de45f6
commit
2dd8c8c5ae
@ -100,8 +100,6 @@ func executeNucleiAsLibrary(templatePath, templateURL string) ([]string, error)
|
||||
ratelimiter := ratelimit.New(context.Background(), 150, time.Second)
|
||||
defer ratelimiter.Stop()
|
||||
|
||||
parser, _ := templates.NewParser()
|
||||
|
||||
executerOpts := protocols.ExecutorOptions{
|
||||
Output: outputWriter,
|
||||
Options: defaultOpts,
|
||||
@ -113,7 +111,7 @@ func executeNucleiAsLibrary(templatePath, templateURL string) ([]string, error)
|
||||
HostErrorsCache: cache,
|
||||
Colorizer: aurora.NewAurora(true),
|
||||
ResumeCfg: types.NewResumeCfg(),
|
||||
Parser: parser,
|
||||
Parser: templates.NewParser(),
|
||||
}
|
||||
engine := core.New(defaultOpts)
|
||||
engine.SetExecuterOptions(executerOpts)
|
||||
|
||||
@ -150,10 +150,7 @@ func New(options *types.Options) (*Runner, error) {
|
||||
}
|
||||
}
|
||||
|
||||
parser, err := templates.NewParser()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
parser := templates.NewParser()
|
||||
|
||||
if options.Validate {
|
||||
parser.ShouldValidate = true
|
||||
|
||||
@ -114,11 +114,7 @@ func (e *NucleiEngine) init() error {
|
||||
e.httpClient = httpclient
|
||||
}
|
||||
|
||||
if parser, err := templates.NewParser(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
e.parser = parser
|
||||
}
|
||||
e.parser = templates.NewParser()
|
||||
|
||||
_ = protocolstate.Init(e.opts)
|
||||
_ = protocolinit.Init(e.opts)
|
||||
|
||||
@ -31,7 +31,6 @@ func setup() {
|
||||
options := testutils.DefaultOptions
|
||||
testutils.Init(options)
|
||||
progressImpl, _ := progress.NewStatsTicker(0, false, false, false, 0)
|
||||
parser, _ = templates.NewParser()
|
||||
|
||||
executerOpts = protocols.ExecutorOptions{
|
||||
Output: testutils.NewMockOutputWriter(options.OmitTemplate),
|
||||
@ -42,7 +41,7 @@ func setup() {
|
||||
Browser: nil,
|
||||
Catalog: disk.NewCatalog(config.DefaultConfig.TemplatesDirectory),
|
||||
RateLimiter: ratelimit.New(context.Background(), uint(options.RateLimit), time.Second),
|
||||
Parser: parser,
|
||||
Parser: templates.NewParser(),
|
||||
}
|
||||
workflowLoader, err := workflow.NewLoader(&executerOpts)
|
||||
if err != nil {
|
||||
|
||||
@ -37,7 +37,6 @@ func setup() {
|
||||
options := testutils.DefaultOptions
|
||||
testutils.Init(options)
|
||||
progressImpl, _ := progress.NewStatsTicker(0, false, false, false, 0)
|
||||
parser, _ := templates.NewParser()
|
||||
|
||||
executerOpts = protocols.ExecutorOptions{
|
||||
Output: testutils.NewMockOutputWriter(options.OmitTemplate),
|
||||
@ -48,7 +47,7 @@ func setup() {
|
||||
Browser: nil,
|
||||
Catalog: disk.NewCatalog(config.DefaultConfig.TemplatesDirectory),
|
||||
RateLimiter: ratelimit.New(context.Background(), uint(options.RateLimit), time.Second),
|
||||
Parser: parser,
|
||||
Parser: templates.NewParser(),
|
||||
}
|
||||
workflowLoader, err := workflow.NewLoader(&executerOpts)
|
||||
if err != nil {
|
||||
|
||||
@ -24,13 +24,13 @@ type Parser struct {
|
||||
compiledTemplatesCache *Cache
|
||||
}
|
||||
|
||||
func NewParser() (*Parser, error) {
|
||||
func NewParser() *Parser {
|
||||
p := &Parser{
|
||||
parsedTemplatesCache: NewCache(),
|
||||
compiledTemplatesCache: NewCache(),
|
||||
}
|
||||
|
||||
return p, nil
|
||||
return p
|
||||
}
|
||||
|
||||
// LoadTemplate returns true if the template is valid and matches the filtering criteria.
|
||||
|
||||
@ -14,8 +14,7 @@ import (
|
||||
|
||||
func TestLoadTemplate(t *testing.T) {
|
||||
catalog := disk.NewCatalog("")
|
||||
p, err := NewParser()
|
||||
require.Nil(t, err)
|
||||
p := NewParser()
|
||||
|
||||
tt := []struct {
|
||||
name string
|
||||
|
||||
@ -25,7 +25,6 @@ func setup() {
|
||||
options := testutils.DefaultOptions
|
||||
testutils.Init(options)
|
||||
progressImpl, _ := progress.NewStatsTicker(0, false, false, false, 0)
|
||||
parser, _ := templates.NewParser()
|
||||
|
||||
executerOpts = protocols.ExecutorOptions{
|
||||
Output: testutils.NewMockOutputWriter(options.OmitTemplate),
|
||||
@ -36,7 +35,7 @@ func setup() {
|
||||
Browser: nil,
|
||||
Catalog: disk.NewCatalog(config.DefaultConfig.TemplatesDirectory),
|
||||
RateLimiter: ratelimit.New(context.Background(), uint(options.RateLimit), time.Second),
|
||||
Parser: parser,
|
||||
Parser: templates.NewParser(),
|
||||
}
|
||||
workflowLoader, err := workflow.NewLoader(&executerOpts)
|
||||
if err != nil {
|
||||
|
||||
@ -25,7 +25,6 @@ func setup() {
|
||||
options := testutils.DefaultOptions
|
||||
testutils.Init(options)
|
||||
progressImpl, _ := progress.NewStatsTicker(0, false, false, false, 0)
|
||||
parser, _ := templates.NewParser()
|
||||
|
||||
executerOpts = protocols.ExecutorOptions{
|
||||
Output: testutils.NewMockOutputWriter(options.OmitTemplate),
|
||||
@ -36,7 +35,7 @@ func setup() {
|
||||
Browser: nil,
|
||||
Catalog: disk.NewCatalog(config.DefaultConfig.TemplatesDirectory),
|
||||
RateLimiter: ratelimit.New(context.Background(), uint(options.RateLimit), time.Second),
|
||||
Parser: parser,
|
||||
Parser: templates.NewParser(),
|
||||
}
|
||||
workflowLoader, err := workflow.NewLoader(&executerOpts)
|
||||
if err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user