diff --git a/v2/cmd/cve-annotate/main.go b/v2/cmd/cve-annotate/main.go index 1d0730c3..127cd5c6 100644 --- a/v2/cmd/cve-annotate/main.go +++ b/v2/cmd/cve-annotate/main.go @@ -109,8 +109,8 @@ func process() error { defer os.RemoveAll(tempDir) client := nvd.NewClientV2() - catalog := disk.NewCatalog(filepath.Dir(*input)) - paths, err := catalog.GetTemplatePath(*input) + templateCatalog := disk.NewCatalog(filepath.Dir(*input)) + paths, err := templateCatalog.GetTemplatePath(*input) if err != nil { return err } @@ -121,7 +121,7 @@ func process() error { } dataString := string(data) // try to fill max-requests - dataString, err = parseAndAddMaxRequests(catalog, path, dataString) + dataString, err = parseAndAddMaxRequests(templateCatalog, path, dataString) if err != nil { gologger.Error().Msgf("Could not compile max request %s: %s\n", path, err) } @@ -291,7 +291,7 @@ func getCVEData(client *nvd.ClientV2, filePath, data string) { changed = true node := config.Nodes[0] for _, match := range node.CpeMatch { - cpeSet[extractVersionlessCpe((match.Criteria))] = true + cpeSet[extractVersionlessCpe(match.Criteria)] = true } } } @@ -538,7 +538,7 @@ func suggestTagsBasedOnReference(references, currentTags []string) []string { return newTags } -// Cloning struct from nuclei as we don't want any validation +// InfoBlock Cloning struct from nuclei as we don't want any validation type InfoBlock struct { Info TemplateInfo `yaml:"info"` } @@ -618,15 +618,15 @@ func parseAndAddMaxRequests(catalog catalog.Catalog, path, data string) (string, // parseTemplate parses a template and returns the template object func parseTemplate(catalog catalog.Catalog, templatePath string) (*templates.Template, error) { - executerOpts := protocols.ExecuterOptions{ + executorOpts := protocols.ExecutorOptions{ Catalog: catalog, Options: defaultOpts, } - reader, err := executerOpts.Catalog.OpenFile(templatePath) + reader, err := executorOpts.Catalog.OpenFile(templatePath) if err != nil { return nil, err } - template, err := templates.ParseTemplateFromReader(reader, nil, executerOpts) + template, err := templates.ParseTemplateFromReader(reader, nil, executorOpts) if err != nil { return nil, err } @@ -638,7 +638,7 @@ func getInfoStartEnd(data string) (int, int) { info := strings.Index(data, "info:") var indices []int for _, re := range allTagsRegex { - // find the first occurance of the label + // find the first occurrence of the label match := re.FindStringIndex(data) if match != nil { indices = append(indices, match[0]) diff --git a/v2/cmd/integration-test/code.go b/v2/cmd/integration-test/code.go index 408ccbf5..6835f86b 100644 --- a/v2/cmd/integration-test/code.go +++ b/v2/cmd/integration-test/code.go @@ -99,7 +99,7 @@ func executeNucleiAsCode(templatePath, templateURL string) ([]string, error) { catalog := disk.NewCatalog(path.Join(home, "nuclei-templates")) ratelimiter := ratelimit.New(context.Background(), 150, time.Second) defer ratelimiter.Stop() - executerOpts := protocols.ExecuterOptions{ + executerOpts := protocols.ExecutorOptions{ Output: outputWriter, Options: defaultOpts, Progress: mockProgress, diff --git a/v2/examples/simple.go b/v2/examples/simple.go index 1550fbbc..ea7fe130 100644 --- a/v2/examples/simple.go +++ b/v2/examples/simple.go @@ -59,7 +59,7 @@ func main() { home, _ := os.UserHomeDir() catalog := disk.NewCatalog(path.Join(home, "nuclei-templates")) - executerOpts := protocols.ExecuterOptions{ + executerOpts := protocols.ExecutorOptions{ Output: outputWriter, Options: defaultOpts, Progress: mockProgress, diff --git a/v2/internal/runner/enumerate.go b/v2/internal/runner/enumerate.go index 9002cb6a..e0a00ddc 100644 --- a/v2/internal/runner/enumerate.go +++ b/v2/internal/runner/enumerate.go @@ -27,7 +27,7 @@ import ( ) // runStandardEnumeration runs standard enumeration -func (r *Runner) runStandardEnumeration(executerOpts protocols.ExecuterOptions, store *loader.Store, engine *core.Engine) (*atomic.Bool, error) { +func (r *Runner) runStandardEnumeration(executerOpts protocols.ExecutorOptions, store *loader.Store, engine *core.Engine) (*atomic.Bool, error) { if r.options.AutomaticScan { return r.executeSmartWorkflowInput(executerOpts, store, engine) } diff --git a/v2/internal/runner/runner.go b/v2/internal/runner/runner.go index 6d090cd4..8581288e 100644 --- a/v2/internal/runner/runner.go +++ b/v2/internal/runner/runner.go @@ -46,7 +46,7 @@ import ( "github.com/projectdiscovery/nuclei/v2/pkg/protocols/headless/engine" "github.com/projectdiscovery/nuclei/v2/pkg/protocols/http/httpclientpool" "github.com/projectdiscovery/nuclei/v2/pkg/reporting" - json_exporter "github.com/projectdiscovery/nuclei/v2/pkg/reporting/exporters/jsonexporter" + "github.com/projectdiscovery/nuclei/v2/pkg/reporting/exporters/jsonexporter" "github.com/projectdiscovery/nuclei/v2/pkg/reporting/exporters/jsonl" "github.com/projectdiscovery/nuclei/v2/pkg/reporting/exporters/markdown" "github.com/projectdiscovery/nuclei/v2/pkg/reporting/exporters/sarif" @@ -70,7 +70,7 @@ type Runner struct { issuesClient reporting.Client hmapInputProvider *hybrid.Input browser *engine.Browser - ratelimiter *ratelimit.Limiter + rateLimiter *ratelimit.Limiter hostErrors hosterrorscache.CacheInterface resumeCfg *types.ResumeCfg pprofServer *http.Server @@ -80,7 +80,7 @@ type Runner struct { const pprofServerAddress = "127.0.0.1:8086" -// New creates a new client for running enumeration process. +// New creates a new client for running the enumeration process. func New(options *types.Options) (*Runner, error) { runner := &Runner{ options: options, @@ -109,8 +109,8 @@ func New(options *types.Options) (*Runner, error) { gologger.Error().Label("custom-templates").Msgf("Failed to create custom templates manager: %s\n", err) } - // Check for template updates and update if available - // if custom templates manager is not nil, we will install custom templates if there is fresh installation + // Check for template updates and update if available. + // If the custom templates manager is not nil, we will install custom templates if there is a fresh installation tm := &installer.TemplateManager{CustomTemplates: ctm} if err := tm.FreshInstallIfNotExists(); err != nil { gologger.Warning().Msgf("failed to install nuclei templates: %s\n", err) @@ -278,7 +278,7 @@ func New(options *types.Options) (*Runner, error) { if err != nil { return nil, err } - err = json.Unmarshal([]byte(file), &resumeCfg) + err = json.Unmarshal(file, &resumeCfg) if err != nil { return nil, err } @@ -313,11 +313,11 @@ func New(options *types.Options) (*Runner, error) { } if options.RateLimitMinute > 0 { - runner.ratelimiter = ratelimit.New(context.Background(), uint(options.RateLimitMinute), time.Minute) + runner.rateLimiter = ratelimit.New(context.Background(), uint(options.RateLimitMinute), time.Minute) } else if options.RateLimit > 0 { - runner.ratelimiter = ratelimit.New(context.Background(), uint(options.RateLimit), time.Second) + runner.rateLimiter = ratelimit.New(context.Background(), uint(options.RateLimit), time.Second) } else { - runner.ratelimiter = ratelimit.NewUnlimited(context.Background()) + runner.rateLimiter = ratelimit.NewUnlimited(context.Background()) } return runner, nil } @@ -329,14 +329,12 @@ func createReportingOptions(options *types.Options) (*reporting.Options, error) if err != nil { return nil, errors.Wrap(err, "could not open reporting config file") } + defer file.Close() reportingOptions = &reporting.Options{} if err := yaml.DecodeAndValidate(file, reportingOptions); err != nil { - file.Close() return nil, errors.Wrap(err, "could not parse reporting config file") } - file.Close() - Walk(reportingOptions, expandEndVars) } if options.MarkdownExportDirectory != "" { @@ -357,10 +355,10 @@ func createReportingOptions(options *types.Options) (*reporting.Options, error) } if options.JSONExport != "" { if reportingOptions != nil { - reportingOptions.JSONExporter = &json_exporter.Options{File: options.JSONExport} + reportingOptions.JSONExporter = &jsonexporter.Options{File: options.JSONExport} } else { reportingOptions = &reporting.Options{} - reportingOptions.JSONExporter = &json_exporter.Options{File: options.JSONExport} + reportingOptions.JSONExporter = &jsonexporter.Options{File: options.JSONExport} } } if options.JSONLExport != "" { @@ -388,8 +386,8 @@ func (r *Runner) Close() { if r.pprofServer != nil { _ = r.pprofServer.Shutdown(context.Background()) } - if r.ratelimiter != nil { - r.ratelimiter.Stop() + if r.rateLimiter != nil { + r.rateLimiter.Stop() } } @@ -414,15 +412,15 @@ func (r *Runner) RunEnumeration() error { r.options.ExcludedTemplates = append(r.options.ExcludedTemplates, ignoreFile.Files...) } - // Create the executer options which will be used throughout the execution + // Create the executor options which will be used throughout the execution // stage by the nuclei engine modules. - executerOpts := protocols.ExecuterOptions{ + executorOpts := protocols.ExecutorOptions{ Output: r.output, Options: r.options, Progress: r.progress, Catalog: r.catalog, IssuesClient: r.issuesClient, - RateLimiter: r.ratelimiter, + RateLimiter: r.rateLimiter, Interactsh: r.interactsh, ProjectFile: r.projectFile, Browser: r.browser, @@ -436,19 +434,19 @@ func (r *Runner) RunEnumeration() error { cache := hosterrorscache.New(r.options.MaxHostError, hosterrorscache.DefaultMaxHostsCount, r.options.TrackError) cache.SetVerbose(r.options.Verbose) r.hostErrors = cache - executerOpts.HostErrorsCache = cache + executorOpts.HostErrorsCache = cache } - engine := core.New(r.options) - engine.SetExecuterOptions(executerOpts) + executorEngine := core.New(r.options) + executorEngine.SetExecuterOptions(executorOpts) - workflowLoader, err := parsers.NewLoader(&executerOpts) + workflowLoader, err := parsers.NewLoader(&executorOpts) if err != nil { return errors.Wrap(err, "Could not create loader.") } - executerOpts.WorkflowLoader = workflowLoader + executorOpts.WorkflowLoader = workflowLoader - store, err := loader.New(loader.NewConfig(r.options, r.catalog, executerOpts)) + store, err := loader.New(loader.NewConfig(r.options, r.catalog, executorOpts)) if err != nil { return errors.Wrap(err, "could not load templates from config") } @@ -512,14 +510,14 @@ func (r *Runner) RunEnumeration() error { r.displayExecutionInfo(store) // If not explicitly disabled, check if http based protocols - // are used and if inputs are non-http to pre-perform probing + // are used, and if inputs are non-http to pre-perform probing // of urls and storing them for execution. if !r.options.DisableHTTPProbe && loader.IsHTTPBasedProtocolUsed(store) && r.isInputNonHTTP() { inputHelpers, err := r.initializeTemplatesHTTPInput() if err != nil { return errors.Wrap(err, "could not probe http input") } - executerOpts.InputHelper.InputsHTTP = inputHelpers + executorOpts.InputHelper.InputsHTTP = inputHelpers } enumeration := false @@ -570,7 +568,7 @@ func (r *Runner) RunEnumeration() error { enumeration = true } } else { - results, err = r.runStandardEnumeration(executerOpts, store, engine) + results, err = r.runStandardEnumeration(executorOpts, store, executorEngine) enumeration = true } @@ -586,8 +584,8 @@ func (r *Runner) RunEnumeration() error { } r.progress.Stop() - if executerOpts.InputHelper != nil { - _ = executerOpts.InputHelper.Close() + if executorOpts.InputHelper != nil { + _ = executorOpts.InputHelper.Close() } if r.issuesClient != nil { r.issuesClient.Close() @@ -599,7 +597,7 @@ func (r *Runner) RunEnumeration() error { if r.browser != nil { r.browser.Close() } - // check if passive scan was requested but no target was provided + // check if a passive scan was requested but no target was provided if r.options.OfflineHTTP && len(r.options.Targets) == 0 && r.options.TargetsFilePath == "" { return errors.Wrap(err, "missing required input (http response) to run passive templates") } @@ -619,11 +617,11 @@ func (r *Runner) isInputNonHTTP() bool { return nonURLInput } -func (r *Runner) executeSmartWorkflowInput(executerOpts protocols.ExecuterOptions, store *loader.Store, engine *core.Engine) (*atomic.Bool, error) { +func (r *Runner) executeSmartWorkflowInput(executorOpts protocols.ExecutorOptions, store *loader.Store, engine *core.Engine) (*atomic.Bool, error) { r.progress.Init(r.hmapInputProvider.Count(), 0, 0) service, err := automaticscan.New(automaticscan.Options{ - ExecuterOpts: executerOpts, + ExecuterOpts: executorOpts, Store: store, Engine: engine, Target: r.hmapInputProvider, @@ -676,7 +674,7 @@ func (r *Runner) executeTemplatesInput(store *loader.Store, engine *core.Engine) workflowCount := len(store.Workflows()) templateCount := originalTemplatesCount + workflowCount - // 0 matches means no templates were found in directory + // 0 matches means no templates were found in the directory if templateCount == 0 { return &atomic.Bool{}, errors.New("no valid templates were found") } @@ -726,7 +724,7 @@ type WalkFunc func(reflect.Value, reflect.StructField) // Walk traverses a struct and executes a callback function on each value in the struct. // The interface{} passed to the function should be a pointer to a struct or a struct. // WalkFunc is the callback function used for each value in the struct. It is passed the -// reflect.Value and reflect.Type of the value in the struct. +// reflect.Value and reflect.Type properties of the value in the struct. func Walk(s interface{}, callback WalkFunc) { structValue := reflect.ValueOf(s) if structValue.Kind() == reflect.Ptr { diff --git a/v2/pkg/catalog/loader/loader.go b/v2/pkg/catalog/loader/loader.go index 3c4a7a27..f3b84f4c 100644 --- a/v2/pkg/catalog/loader/loader.go +++ b/v2/pkg/catalog/loader/loader.go @@ -42,7 +42,7 @@ type Config struct { IncludeConditions []string Catalog catalog.Catalog - ExecutorOptions protocols.ExecuterOptions + ExecutorOptions protocols.ExecutorOptions } // Store is a storage for loaded nuclei templates @@ -64,7 +64,7 @@ type Store struct { } // NewConfig returns a new loader config -func NewConfig(options *types.Options, catalog catalog.Catalog, executerOpts protocols.ExecuterOptions) *Config { +func NewConfig(options *types.Options, catalog catalog.Catalog, executerOpts protocols.ExecutorOptions) *Config { loaderConfig := Config{ Templates: options.Templates, Workflows: options.Workflows, diff --git a/v2/pkg/core/engine.go b/v2/pkg/core/engine.go index bc2678d1..aaa26482 100644 --- a/v2/pkg/core/engine.go +++ b/v2/pkg/core/engine.go @@ -18,7 +18,7 @@ import ( type Engine struct { workPool *WorkPool options *types.Options - executerOpts protocols.ExecuterOptions + executerOpts protocols.ExecutorOptions Callback func(*output.ResultEvent) // Executed on results } @@ -58,12 +58,12 @@ func (e *Engine) GetWorkPool() *WorkPool { // SetExecuterOptions sets the executer options for the engine. This is required // before using the engine to perform any execution. -func (e *Engine) SetExecuterOptions(options protocols.ExecuterOptions) { +func (e *Engine) SetExecuterOptions(options protocols.ExecutorOptions) { e.executerOpts = options } -// ExecuterOptions returns protocols.ExecuterOptions for nuclei engine. -func (e *Engine) ExecuterOptions() protocols.ExecuterOptions { +// ExecuterOptions returns protocols.ExecutorOptions for nuclei engine. +func (e *Engine) ExecuterOptions() protocols.ExecutorOptions { return e.executerOpts } diff --git a/v2/pkg/core/workflow_execute_test.go b/v2/pkg/core/workflow_execute_test.go index 1a9c9223..fc617c57 100644 --- a/v2/pkg/core/workflow_execute_test.go +++ b/v2/pkg/core/workflow_execute_test.go @@ -17,9 +17,9 @@ import ( func TestWorkflowsSimple(t *testing.T) { progressBar, _ := progress.NewStatsTicker(0, false, false, false, false, 0) - workflow := &workflows.Workflow{Options: &protocols.ExecuterOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ + workflow := &workflows.Workflow{Options: &protocols.ExecutorOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ {Executers: []*workflows.ProtocolExecuterPair{{ - Executer: &mockExecuter{result: true}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + Executer: &mockExecuter{result: true}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }}, }} @@ -32,16 +32,16 @@ func TestWorkflowsSimpleMultiple(t *testing.T) { progressBar, _ := progress.NewStatsTicker(0, false, false, false, false, 0) var firstInput, secondInput string - workflow := &workflows.Workflow{Options: &protocols.ExecuterOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ + workflow := &workflows.Workflow{Options: &protocols.ExecutorOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ {Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { firstInput = input.Input - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }}, {Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { secondInput = input.Input - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }}, }} @@ -57,17 +57,17 @@ func TestWorkflowsSubtemplates(t *testing.T) { progressBar, _ := progress.NewStatsTicker(0, false, false, false, false, 0) var firstInput, secondInput string - workflow := &workflows.Workflow{Options: &protocols.ExecuterOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ + workflow := &workflows.Workflow{Options: &protocols.ExecutorOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ {Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { firstInput = input.Input }, outputs: []*output.InternalWrappedEvent{ {OperatorsResult: &operators.Result{}, Results: []*output.ResultEvent{{}}}, - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }, Subtemplates: []*workflows.WorkflowTemplate{{Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { secondInput = input.Input - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }}}}, }} @@ -83,15 +83,15 @@ func TestWorkflowsSubtemplatesNoMatch(t *testing.T) { progressBar, _ := progress.NewStatsTicker(0, false, false, false, false, 0) var firstInput, secondInput string - workflow := &workflows.Workflow{Options: &protocols.ExecuterOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ + workflow := &workflows.Workflow{Options: &protocols.ExecutorOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ {Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: false, executeHook: func(input *contextargs.MetaInput) { firstInput = input.Input - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }, Subtemplates: []*workflows.WorkflowTemplate{{Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { secondInput = input.Input - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }}}}, }} @@ -107,7 +107,7 @@ func TestWorkflowsSubtemplatesWithMatcher(t *testing.T) { progressBar, _ := progress.NewStatsTicker(0, false, false, false, false, 0) var firstInput, secondInput string - workflow := &workflows.Workflow{Options: &protocols.ExecuterOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ + workflow := &workflows.Workflow{Options: &protocols.ExecutorOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ {Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { firstInput = input.Input @@ -116,11 +116,11 @@ func TestWorkflowsSubtemplatesWithMatcher(t *testing.T) { Matches: map[string][]string{"tomcat": {}}, Extracts: map[string][]string{}, }}, - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }, Matchers: []*workflows.Matcher{{Name: stringslice.StringSlice{Value: "tomcat"}, Subtemplates: []*workflows.WorkflowTemplate{{Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { secondInput = input.Input - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }}}}}}, }} @@ -136,7 +136,7 @@ func TestWorkflowsSubtemplatesWithMatcherNoMatch(t *testing.T) { progressBar, _ := progress.NewStatsTicker(0, false, false, false, false, 0) var firstInput, secondInput string - workflow := &workflows.Workflow{Options: &protocols.ExecuterOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ + workflow := &workflows.Workflow{Options: &protocols.ExecutorOptions{Options: &types.Options{TemplateThreads: 10}}, Workflows: []*workflows.WorkflowTemplate{ {Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { firstInput = input.Input @@ -145,11 +145,11 @@ func TestWorkflowsSubtemplatesWithMatcherNoMatch(t *testing.T) { Matches: map[string][]string{"tomcat": {}}, Extracts: map[string][]string{}, }}, - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }, Matchers: []*workflows.Matcher{{Name: stringslice.StringSlice{Value: "apache"}, Subtemplates: []*workflows.WorkflowTemplate{{Executers: []*workflows.ProtocolExecuterPair{{ Executer: &mockExecuter{result: true, executeHook: func(input *contextargs.MetaInput) { secondInput = input.Input - }}, Options: &protocols.ExecuterOptions{Progress: progressBar}}, + }}, Options: &protocols.ExecutorOptions{Progress: progressBar}}, }}}}}}, }} diff --git a/v2/pkg/parsers/workflow_loader.go b/v2/pkg/parsers/workflow_loader.go index 4b11a767..719c1c63 100644 --- a/v2/pkg/parsers/workflow_loader.go +++ b/v2/pkg/parsers/workflow_loader.go @@ -11,11 +11,11 @@ import ( type workflowLoader struct { pathFilter *filter.PathFilter tagFilter *filter.TagFilter - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions } // NewLoader returns a new workflow loader structure -func NewLoader(options *protocols.ExecuterOptions) (model.WorkflowLoader, error) { +func NewLoader(options *protocols.ExecutorOptions) (model.WorkflowLoader, error) { tagFilter, err := filter.New(&filter.Config{ Authors: options.Options.Authors, Tags: options.Options.Tags, diff --git a/v2/pkg/protocols/common/automaticscan/automaticscan.go b/v2/pkg/protocols/common/automaticscan/automaticscan.go index 780314ed..c2ddcbce 100644 --- a/v2/pkg/protocols/common/automaticscan/automaticscan.go +++ b/v2/pkg/protocols/common/automaticscan/automaticscan.go @@ -26,7 +26,7 @@ import ( // Service is a service for automatic scan execution type Service struct { - opts protocols.ExecuterOptions + opts protocols.ExecutorOptions store *loader.Store engine *core.Engine target core.InputProvider @@ -41,7 +41,7 @@ type Service struct { // Options contains configuration options for automatic scan service type Options struct { - ExecuterOpts protocols.ExecuterOptions + ExecuterOpts protocols.ExecutorOptions Store *loader.Store Engine *core.Engine Target core.InputProvider diff --git a/v2/pkg/protocols/common/executer/executer.go b/v2/pkg/protocols/common/executer/executer.go index ff5836b3..f9bae959 100644 --- a/v2/pkg/protocols/common/executer/executer.go +++ b/v2/pkg/protocols/common/executer/executer.go @@ -18,13 +18,13 @@ import ( // Executer executes a group of requests for a protocol type Executer struct { requests []protocols.Request - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions } var _ protocols.Executer = &Executer{} // NewExecuter creates a new request executer for list of requests -func NewExecuter(requests []protocols.Request, options *protocols.ExecuterOptions) *Executer { +func NewExecuter(requests []protocols.Request, options *protocols.ExecutorOptions) *Executer { return &Executer{requests: requests, options: options} } diff --git a/v2/pkg/protocols/dns/dns.go b/v2/pkg/protocols/dns/dns.go index 4ce665c5..dad2ef75 100644 --- a/v2/pkg/protocols/dns/dns.go +++ b/v2/pkg/protocols/dns/dns.go @@ -79,7 +79,7 @@ type Request struct { CompiledOperators *operators.Operators `yaml:"-"` dnsClient *retryabledns.Client - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions // cache any variables that may be needed for operation. class uint16 @@ -122,12 +122,12 @@ func (request *Request) GetID() string { } // Options returns executer options for http request -func (r *Request) Options() *protocols.ExecuterOptions { +func (r *Request) Options() *protocols.ExecutorOptions { return r.options } // Compile compiles the protocol request for further execution. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { if request.Retries == 0 { request.Retries = 3 } @@ -180,7 +180,7 @@ func (request *Request) Compile(options *protocols.ExecuterOptions) error { return nil } -func (request *Request) getDnsClient(options *protocols.ExecuterOptions, metadata map[string]interface{}) (*retryabledns.Client, error) { +func (request *Request) getDnsClient(options *protocols.ExecutorOptions, metadata map[string]interface{}) (*retryabledns.Client, error) { dnsClientOptions := &dnsclientpool.Configuration{ Retries: request.Retries, } diff --git a/v2/pkg/protocols/dns/request.go b/v2/pkg/protocols/dns/request.go index cc666daf..37cec212 100644 --- a/v2/pkg/protocols/dns/request.go +++ b/v2/pkg/protocols/dns/request.go @@ -184,7 +184,7 @@ func (request *Request) parseDNSInput(host string) (string, error) { return host, nil } -func dumpResponse(event *output.InternalWrappedEvent, request *Request, requestOptions *protocols.ExecuterOptions, response, domain string) { +func dumpResponse(event *output.InternalWrappedEvent, request *Request, requestOptions *protocols.ExecutorOptions, response, domain string) { cliOptions := request.options.Options if cliOptions.Debug || cliOptions.DebugResponse || cliOptions.StoreResponse { hexDump := false @@ -203,7 +203,7 @@ func dumpResponse(event *output.InternalWrappedEvent, request *Request, requestO } } -func dumpTraceData(event *output.InternalWrappedEvent, requestOptions *protocols.ExecuterOptions, traceData, domain string) { +func dumpTraceData(event *output.InternalWrappedEvent, requestOptions *protocols.ExecutorOptions, traceData, domain string) { cliOptions := requestOptions.Options if cliOptions.Debug || cliOptions.DebugResponse { hexDump := false diff --git a/v2/pkg/protocols/file/file.go b/v2/pkg/protocols/file/file.go index 93928f0d..f9c23579 100644 --- a/v2/pkg/protocols/file/file.go +++ b/v2/pkg/protocols/file/file.go @@ -60,7 +60,7 @@ type Request struct { CompiledOperators *operators.Operators `yaml:"-" json:"-"` // cache any variables that may be needed for operation. - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions mimeTypesChecks []string extensions map[string]struct{} denyList map[string]struct{} @@ -98,7 +98,7 @@ func (request *Request) GetID() string { } // Compile compiles the protocol request for further execution. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { // if there are no matchers/extractors, we trigger an error as no operation would be performed on the template if request.Operators.IsEmpty() { return errors.New("empty operators") diff --git a/v2/pkg/protocols/file/request.go b/v2/pkg/protocols/file/request.go index 1838d2fc..b1de46e2 100644 --- a/v2/pkg/protocols/file/request.go +++ b/v2/pkg/protocols/file/request.go @@ -323,7 +323,7 @@ func (request *Request) buildEvent(input, filePath string, fileMatches []FileMat return event } -func dumpResponse(event *output.InternalWrappedEvent, requestOptions *protocols.ExecuterOptions, filematches []FileMatch, filePath string) { +func dumpResponse(event *output.InternalWrappedEvent, requestOptions *protocols.ExecutorOptions, filematches []FileMatch, filePath string) { cliOptions := requestOptions.Options if cliOptions.Debug || cliOptions.DebugResponse { for _, fileMatch := range filematches { diff --git a/v2/pkg/protocols/headless/headless.go b/v2/pkg/protocols/headless/headless.go index 7056305e..869a028c 100644 --- a/v2/pkg/protocols/headless/headless.go +++ b/v2/pkg/protocols/headless/headless.go @@ -52,7 +52,7 @@ type Request struct { CompiledOperators *operators.Operators `yaml:"-" json:"-"` // cache any variables that may be needed for operation. - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions generator *generators.PayloadGenerator } @@ -82,7 +82,7 @@ func (request *Request) GetID() string { } // Compile compiles the protocol request for further execution. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { // TODO: logic similar to network + http => probably can be refactored // Resolve payload paths from vars if they exists for name, payload := range options.Options.Vars.AsMap() { diff --git a/v2/pkg/protocols/headless/request.go b/v2/pkg/protocols/headless/request.go index 7113f148..e8ee75a5 100644 --- a/v2/pkg/protocols/headless/request.go +++ b/v2/pkg/protocols/headless/request.go @@ -159,7 +159,7 @@ func (request *Request) executeRequestWithPayloads(inputURL string, payloads map return nil } -func dumpResponse(event *output.InternalWrappedEvent, requestOptions *protocols.ExecuterOptions, responseBody string, input string) { +func dumpResponse(event *output.InternalWrappedEvent, requestOptions *protocols.ExecutorOptions, responseBody string, input string) { cliOptions := requestOptions.Options if cliOptions.Debug || cliOptions.DebugResponse { highlightedResponse := responsehighlighter.Highlight(event.OperatorsResult, responseBody, cliOptions.NoColor, false) diff --git a/v2/pkg/protocols/http/fuzz/execute.go b/v2/pkg/protocols/http/fuzz/execute.go index 3f07f75b..3c7173b9 100644 --- a/v2/pkg/protocols/http/fuzz/execute.go +++ b/v2/pkg/protocols/http/fuzz/execute.go @@ -87,7 +87,7 @@ func (rule *Rule) executeRuleValues(input *ExecuteRuleInput) error { } // Compile compiles a fuzzing rule and initializes it for operation -func (rule *Rule) Compile(generator *generators.PayloadGenerator, options *protocols.ExecuterOptions) error { +func (rule *Rule) Compile(generator *generators.PayloadGenerator, options *protocols.ExecutorOptions) error { // If a payload generator is specified from base request, use it // for payload values. if generator != nil { diff --git a/v2/pkg/protocols/http/fuzz/fuzz.go b/v2/pkg/protocols/http/fuzz/fuzz.go index 63cecaec..7f872e81 100644 --- a/v2/pkg/protocols/http/fuzz/fuzz.go +++ b/v2/pkg/protocols/http/fuzz/fuzz.go @@ -73,7 +73,7 @@ type Rule struct { // []string{"{{ssrf}}", "{{interactsh-url}}", "example-value"} Fuzz []string `yaml:"fuzz,omitempty" json:"fuzz,omitempty" jsonschema:"title=payloads of fuzz rule,description=Payloads to perform fuzzing substitutions with"` - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions generator *generators.PayloadGenerator } diff --git a/v2/pkg/protocols/http/fuzz/parts_test.go b/v2/pkg/protocols/http/fuzz/parts_test.go index 6199ca04..e4402c94 100644 --- a/v2/pkg/protocols/http/fuzz/parts_test.go +++ b/v2/pkg/protocols/http/fuzz/parts_test.go @@ -11,7 +11,7 @@ import ( func TestExecuteQueryPartRule(t *testing.T) { parsed, _ := urlutil.Parse("http://localhost:8080/?url=localhost&mode=multiple&file=passwdfile") - options := &protocols.ExecuterOptions{ + options := &protocols.ExecutorOptions{ Interactsh: &interactsh.Client{}, } t.Run("single", func(t *testing.T) { diff --git a/v2/pkg/protocols/http/http.go b/v2/pkg/protocols/http/http.go index 7cfe74aa..cca76f51 100644 --- a/v2/pkg/protocols/http/http.go +++ b/v2/pkg/protocols/http/http.go @@ -124,7 +124,7 @@ type Request struct { CompiledOperators *operators.Operators `yaml:"-" json:"-"` - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions connConfiguration *httpclientpool.Configuration totalRequests int customHeaders map[string]string @@ -200,7 +200,7 @@ type Request struct { } // Options returns executer options for http request -func (r *Request) Options() *protocols.ExecuterOptions { +func (r *Request) Options() *protocols.ExecutorOptions { return r.options } @@ -236,7 +236,7 @@ func (request *Request) isRaw() bool { } // Compile compiles the protocol request for further execution. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { if err := request.validate(); err != nil { return errors.Wrap(err, "validation error") } diff --git a/v2/pkg/protocols/http/request_generator.go b/v2/pkg/protocols/http/request_generator.go index 606b9f77..eb3ebfb7 100644 --- a/v2/pkg/protocols/http/request_generator.go +++ b/v2/pkg/protocols/http/request_generator.go @@ -16,7 +16,7 @@ type requestGenerator struct { currentPayloads map[string]interface{} okCurrentPayload bool request *Request - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions payloadIterator *generators.Iterator interactshURLs []string onceFlow map[string]struct{} diff --git a/v2/pkg/protocols/network/network.go b/v2/pkg/protocols/network/network.go index 0d8995b5..86292a16 100644 --- a/v2/pkg/protocols/network/network.go +++ b/v2/pkg/protocols/network/network.go @@ -73,7 +73,7 @@ type Request struct { generator *generators.PayloadGenerator // cache any variables that may be needed for operation. dialer *fastdialer.Dialer - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions } // RequestPartDefinitions contains a mapping of request part definitions and their @@ -138,7 +138,7 @@ func (request *Request) GetID() string { } // Compile compiles the protocol request for further execution. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { var shouldUseTLS bool var err error diff --git a/v2/pkg/protocols/offlinehttp/offlinehttp.go b/v2/pkg/protocols/offlinehttp/offlinehttp.go index ba503b3c..ccfc84db 100644 --- a/v2/pkg/protocols/offlinehttp/offlinehttp.go +++ b/v2/pkg/protocols/offlinehttp/offlinehttp.go @@ -9,7 +9,7 @@ import ( // Request is a offline http response processing request type Request struct { - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions compiledOperators []*operators.Operators } @@ -41,7 +41,7 @@ func (request *Request) GetID() string { } // Compile compiles the protocol request for further execution. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { for _, operator := range options.Operators { if err := operator.Compile(); err != nil { return errors.Wrap(err, "could not compile operators") diff --git a/v2/pkg/protocols/protocols.go b/v2/pkg/protocols/protocols.go index 68a018f0..4b89af1b 100644 --- a/v2/pkg/protocols/protocols.go +++ b/v2/pkg/protocols/protocols.go @@ -37,8 +37,8 @@ type Executer interface { ExecuteWithResults(input *contextargs.Context, callback OutputEventCallback) error } -// ExecuterOptions contains the configuration options for executer clients -type ExecuterOptions struct { +// ExecutorOptions contains the configuration options for executer clients +type ExecutorOptions struct { // TemplateID is the ID of the template for the request TemplateID string // TemplatePath is the path of the template for the request @@ -88,7 +88,7 @@ type ExecuterOptions struct { } // Copy returns a copy of the executeroptions structure -func (e ExecuterOptions) Copy() ExecuterOptions { +func (e ExecutorOptions) Copy() ExecutorOptions { copy := e return copy } @@ -96,7 +96,7 @@ func (e ExecuterOptions) Copy() ExecuterOptions { // Request is an interface implemented any protocol based request generator. type Request interface { // Compile compiles the request generators preparing any requests possible. - Compile(options *ExecuterOptions) error + Compile(options *ExecutorOptions) error // Requests returns the total number of requests the rule will perform Requests() int // GetID returns the ID for the request if any. IDs are used for multi-request diff --git a/v2/pkg/protocols/ssl/ssl.go b/v2/pkg/protocols/ssl/ssl.go index 88572467..fe84fc14 100644 --- a/v2/pkg/protocols/ssl/ssl.go +++ b/v2/pkg/protocols/ssl/ssl.go @@ -78,7 +78,7 @@ type Request struct { // cache any variables that may be needed for operation. dialer *fastdialer.Dialer tlsx *tlsx.Service - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions } // CanCluster returns true if the request can be clustered. @@ -93,7 +93,7 @@ func (request *Request) CanCluster(other *Request) bool { } // Compile compiles the request generators preparing any requests possible. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { request.options = options client, err := networkclientpool.Get(options.Options, &networkclientpool.Configuration{}) @@ -155,7 +155,7 @@ func (request *Request) Compile(options *protocols.ExecuterOptions) error { } // Options returns executer options for http request -func (r *Request) Options() *protocols.ExecuterOptions { +func (r *Request) Options() *protocols.ExecutorOptions { return r.options } diff --git a/v2/pkg/protocols/websocket/websocket.go b/v2/pkg/protocols/websocket/websocket.go index a81c6383..e5f03696 100644 --- a/v2/pkg/protocols/websocket/websocket.go +++ b/v2/pkg/protocols/websocket/websocket.go @@ -70,7 +70,7 @@ type Request struct { // cache any variables that may be needed for operation. dialer *fastdialer.Dialer - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions } // Input is an input for the websocket protocol @@ -96,7 +96,7 @@ const ( ) // Compile compiles the request generators preparing any requests possible. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { request.options = options client, err := networkclientpool.Get(options.Options, &networkclientpool.Configuration{}) diff --git a/v2/pkg/protocols/whois/whois.go b/v2/pkg/protocols/whois/whois.go index bc3ef83f..18c5b409 100644 --- a/v2/pkg/protocols/whois/whois.go +++ b/v2/pkg/protocols/whois/whois.go @@ -46,12 +46,12 @@ type Request struct { Server string `yaml:"server,omitempty" json:"server,omitempty" jsonschema:"title=server url to execute the WHOIS request on,description=Server contains the server url to execute the WHOIS request on"` // cache any variables that may be needed for operation. client *rdap.Client - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions parsedServerURL *url.URL } // Compile compiles the request generators preparing any requests possible. -func (request *Request) Compile(options *protocols.ExecuterOptions) error { +func (request *Request) Compile(options *protocols.ExecutorOptions) error { var err error if request.Server != "" { request.parsedServerURL, err = url.Parse(request.Server) diff --git a/v2/pkg/templates/cluster.go b/v2/pkg/templates/cluster.go index b7d7be70..301d66a0 100644 --- a/v2/pkg/templates/cluster.go +++ b/v2/pkg/templates/cluster.go @@ -113,7 +113,7 @@ func ClusterID(templates []*Template) string { return cryptoutil.SHA256Sum(ids) } -func ClusterTemplates(templatesList []*Template, options protocols.ExecuterOptions) ([]*Template, int) { +func ClusterTemplates(templatesList []*Template, options protocols.ExecutorOptions) ([]*Template, int) { if options.Options.OfflineHTTP || options.Options.DisableClustering { return templatesList, 0 } @@ -164,7 +164,7 @@ type ClusterExecuter struct { requests protocols.Request operators []*clusteredOperator templateType types.ProtocolType - options *protocols.ExecuterOptions + options *protocols.ExecutorOptions } type clusteredOperator struct { @@ -177,7 +177,7 @@ type clusteredOperator struct { var _ protocols.Executer = &ClusterExecuter{} // NewClusterExecuter creates a new request executer for list of requests -func NewClusterExecuter(requests []*Template, options *protocols.ExecuterOptions) *ClusterExecuter { +func NewClusterExecuter(requests []*Template, options *protocols.ExecutorOptions) *ClusterExecuter { executer := &ClusterExecuter{options: options} if len(requests[0].RequestsDNS) == 1 { executer.templateType = types.DNSProtocol diff --git a/v2/pkg/templates/compile.go b/v2/pkg/templates/compile.go index c16bd223..f984e80b 100644 --- a/v2/pkg/templates/compile.go +++ b/v2/pkg/templates/compile.go @@ -33,7 +33,7 @@ func init() { // TODO make sure reading from the disk the template parsing happens once: see parsers.ParseTemplate vs templates.Parse // //nolint:gocritic // this cannot be passed by pointer -func Parse(filePath string, preprocessor Preprocessor, options protocols.ExecuterOptions) (*Template, error) { +func Parse(filePath string, preprocessor Preprocessor, options protocols.ExecutorOptions) (*Template, error) { if !options.DoNotCache { if value, err := parsedTemplatesCache.Has(filePath); value != nil { return value.(*Template), err @@ -109,7 +109,7 @@ func (template *Template) Requests() int { } // compileProtocolRequests compiles all the protocol requests for the template -func (template *Template) compileProtocolRequests(options protocols.ExecuterOptions) error { +func (template *Template) compileProtocolRequests(options protocols.ExecutorOptions) error { templateRequests := template.Requests() if templateRequests == 0 { @@ -172,7 +172,7 @@ func (template *Template) convertRequestToProtocolsRequest(requests interface{}) // compileOfflineHTTPRequest iterates all requests if offline http mode is // specified and collects all matchers for all the base request templates // (those with URL {{BaseURL}} and it's slash variation.) -func (template *Template) compileOfflineHTTPRequest(options protocols.ExecuterOptions) error { +func (template *Template) compileOfflineHTTPRequest(options protocols.ExecutorOptions) error { operatorsList := []*operators.Operators{} mainLoop: @@ -200,7 +200,7 @@ mainLoop: // ParseTemplateFromReader reads the template from reader // returns the parsed template -func ParseTemplateFromReader(reader io.Reader, preprocessor Preprocessor, options protocols.ExecuterOptions) (*Template, error) { +func ParseTemplateFromReader(reader io.Reader, preprocessor Preprocessor, options protocols.ExecutorOptions) (*Template, error) { template := &Template{} data, err := io.ReadAll(reader) if err != nil { diff --git a/v2/pkg/templates/compile_test.go b/v2/pkg/templates/compile_test.go index 575d0393..037b2670 100644 --- a/v2/pkg/templates/compile_test.go +++ b/v2/pkg/templates/compile_test.go @@ -31,14 +31,14 @@ import ( "github.com/stretchr/testify/require" ) -var executerOpts protocols.ExecuterOptions +var executerOpts protocols.ExecutorOptions func setup() { options := testutils.DefaultOptions testutils.Init(options) progressImpl, _ := progress.NewStatsTicker(0, false, false, false, false, 0) - executerOpts = protocols.ExecuterOptions{ + executerOpts = protocols.ExecutorOptions{ Output: testutils.NewMockOutputWriter(), Options: options, Progress: progressImpl, @@ -162,7 +162,7 @@ func Test_ParseWorkflow(t *testing.T) { }, Workflow: workflows.Workflow{ Workflows: []*workflows.WorkflowTemplate{{Template: "tests/match-1.yaml"}, {Template: "tests/match-1.yaml"}}, - Options: &protocols.ExecuterOptions{}, + Options: &protocols.ExecutorOptions{}, }, CompiledWorkflow: &workflows.Workflow{}, SelfContained: false, diff --git a/v2/pkg/templates/workflows.go b/v2/pkg/templates/workflows.go index 0677ac90..36326632 100644 --- a/v2/pkg/templates/workflows.go +++ b/v2/pkg/templates/workflows.go @@ -10,7 +10,7 @@ import ( ) // compileWorkflow compiles the workflow for execution -func compileWorkflow(path string, preprocessor Preprocessor, options *protocols.ExecuterOptions, workflow *workflows.Workflow, loader model.WorkflowLoader) { +func compileWorkflow(path string, preprocessor Preprocessor, options *protocols.ExecutorOptions, workflow *workflows.Workflow, loader model.WorkflowLoader) { for _, workflow := range workflow.Workflows { if err := parseWorkflow(preprocessor, workflow, options, loader); err != nil { gologger.Warning().Msgf("Could not parse workflow %s: %v\n", path, err) @@ -20,7 +20,7 @@ func compileWorkflow(path string, preprocessor Preprocessor, options *protocols. } // parseWorkflow parses and compiles all templates in a workflow recursively -func parseWorkflow(preprocessor Preprocessor, workflow *workflows.WorkflowTemplate, options *protocols.ExecuterOptions, loader model.WorkflowLoader) error { +func parseWorkflow(preprocessor Preprocessor, workflow *workflows.WorkflowTemplate, options *protocols.ExecutorOptions, loader model.WorkflowLoader) error { shouldNotValidate := false if workflow.Template == "" && workflow.Tags.IsEmpty() { @@ -55,7 +55,7 @@ func parseWorkflow(preprocessor Preprocessor, workflow *workflows.WorkflowTempla } // parseWorkflowTemplate parses a workflow template creating an executer -func parseWorkflowTemplate(workflow *workflows.WorkflowTemplate, preprocessor Preprocessor, options *protocols.ExecuterOptions, loader model.WorkflowLoader, noValidate bool) error { +func parseWorkflowTemplate(workflow *workflows.WorkflowTemplate, preprocessor Preprocessor, options *protocols.ExecutorOptions, loader model.WorkflowLoader, noValidate bool) error { var paths []string subTemplateTags := workflow.Tags diff --git a/v2/pkg/testutils/testutils.go b/v2/pkg/testutils/testutils.go index 5d08d06d..93a2e4c7 100644 --- a/v2/pkg/testutils/testutils.go +++ b/v2/pkg/testutils/testutils.go @@ -76,9 +76,9 @@ type TemplateInfo struct { } // NewMockExecuterOptions creates a new mock executeroptions struct -func NewMockExecuterOptions(options *types.Options, info *TemplateInfo) *protocols.ExecuterOptions { +func NewMockExecuterOptions(options *types.Options, info *TemplateInfo) *protocols.ExecutorOptions { progressImpl, _ := progress.NewStatsTicker(0, false, false, false, false, 0) - executerOpts := &protocols.ExecuterOptions{ + executerOpts := &protocols.ExecutorOptions{ TemplateID: info.ID, TemplateInfo: info.Info, TemplatePath: info.Path, diff --git a/v2/pkg/workflows/workflows.go b/v2/pkg/workflows/workflows.go index b9d5f7c3..32d76f46 100644 --- a/v2/pkg/workflows/workflows.go +++ b/v2/pkg/workflows/workflows.go @@ -15,7 +15,7 @@ type Workflow struct { // Workflows is a list of workflows to execute for a template. Workflows []*WorkflowTemplate `yaml:"workflows,omitempty" json:"workflows,omitempty" jsonschema:"title=list of workflows to execute,description=List of workflows to execute for template"` - Options *protocols.ExecuterOptions `yaml:"-" json:"-"` + Options *protocols.ExecutorOptions `yaml:"-" json:"-"` } // WorkflowTemplate is a template to be run as part of a workflow @@ -44,7 +44,7 @@ type WorkflowTemplate struct { // ProtocolExecuterPair is a pair of protocol executer and its options type ProtocolExecuterPair struct { Executer protocols.Executer - Options *protocols.ExecuterOptions + Options *protocols.ExecutorOptions TemplateType templateTypes.ProtocolType }