nuclei/v2/pkg/workflows/workflows.go

55 lines
1.8 KiB
Go
Raw Normal View History

2020-06-26 10:23:54 +02:00
package workflows
import (
"github.com/projectdiscovery/nuclei/v2/pkg/model"
"github.com/projectdiscovery/nuclei/v2/pkg/protocols"
)
2020-06-29 17:43:08 +05:30
// Workflow is a workflow to execute with chained requests, etc.
2020-06-26 10:23:54 +02:00
type Workflow struct {
2021-07-27 16:03:56 +05:30
// description: |
// Workflows is a list of workflows to execute for a template.
Workflows []*WorkflowTemplate `yaml:"workflows,omitempty"`
2021-02-22 17:49:02 +05:30
2021-02-23 22:55:29 +05:30
Options *protocols.ExecuterOptions
}
// WorkflowTemplate is a template to be ran as part of a workflow
type WorkflowTemplate struct {
2021-07-27 16:03:56 +05:30
// description: |
// Template is a single template or directory to execute as part of workflow.
// examples:
// - name: A single template
// value: "\"dns/worksites-detection.yaml\""
// - name: A template directory
// value: "\"misconfigurations/aem\""
2021-08-04 14:20:48 +05:30
Template string `yaml:"template,omitempty"`
2021-07-27 16:03:56 +05:30
// description: |
// Tags to run templates based on.
2021-08-19 16:51:02 +05:30
Tags model.StringSlice `yaml:"tags,omitempty"`
2021-07-27 16:03:56 +05:30
// description: |
// Matchers perform name based matching to run subtemplates for a workflow.
2021-08-04 14:20:48 +05:30
Matchers []*Matcher `yaml:"matchers,omitempty"`
2021-07-27 16:03:56 +05:30
// description: |
// Subtemplates are ran if the `template` field Template matches.
2021-08-04 14:20:48 +05:30
Subtemplates []*WorkflowTemplate `yaml:"subtemplates,omitempty"`
2021-01-17 12:56:29 +05:30
// Executers perform the actual execution for the workflow template
2021-08-19 16:51:02 +05:30
Executers []*ProtocolExecuterPair `yaml:"-"`
2021-01-17 12:56:29 +05:30
}
// ProtocolExecuterPair is a pair of protocol executer and its options
type ProtocolExecuterPair struct {
Executer protocols.Executer
2021-01-17 12:56:29 +05:30
Options *protocols.ExecuterOptions
}
// Matcher performs conditional matching on the workflow template results.
type Matcher struct {
2021-07-27 16:03:56 +05:30
// description: |
// Name is the name of the item to match.
2021-08-04 14:20:48 +05:30
Name string `yaml:"name,omitempty"`
2021-07-27 16:03:56 +05:30
// description: |
// Subtemplates are ran if the name of matcher matches.
2021-08-04 14:20:48 +05:30
Subtemplates []*WorkflowTemplate `yaml:"subtemplates,omitempty"`
}