2020-06-26 08:23:54 +00:00
|
|
|
package workflows
|
|
|
|
|
2020-12-25 20:38:48 +00:00
|
|
|
import "github.com/projectdiscovery/nuclei/v2/pkg/protocols"
|
|
|
|
|
2020-06-29 12:13:08 +00:00
|
|
|
// Workflow is a workflow to execute with chained requests, etc.
|
2020-06-26 08:23:54 +00:00
|
|
|
type Workflow struct {
|
2020-11-12 17:58:24 +00:00
|
|
|
// Workflows is a yaml based workflow declaration code.
|
2021-02-21 11:01:34 +00:00
|
|
|
Workflows []*WorkflowTemplate `yaml:"workflows,omitempty"`
|
2021-02-22 12:19:02 +00:00
|
|
|
|
2021-02-23 17:25:29 +00:00
|
|
|
Options *protocols.ExecuterOptions
|
2020-11-12 17:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// WorkflowTemplate is a template to be ran as part of a workflow
|
|
|
|
type WorkflowTemplate struct {
|
2020-12-25 20:38:48 +00:00
|
|
|
// Template is the template to run
|
|
|
|
Template string `yaml:"template"`
|
2021-07-04 23:05:53 +00:00
|
|
|
// Tags to perform filtering of supplied templates on
|
|
|
|
Tags []string `yaml:"tags"`
|
2020-12-25 20:38:48 +00:00
|
|
|
// Matchers perform name based matching to run subtemplates for a workflow.
|
|
|
|
Matchers []*Matcher `yaml:"matchers"`
|
|
|
|
// Subtemplates are ran if the template matches.
|
2020-11-12 17:58:24 +00:00
|
|
|
Subtemplates []*WorkflowTemplate `yaml:"subtemplates"`
|
2021-01-17 07:26:29 +00:00
|
|
|
// Executers perform the actual execution for the workflow template
|
|
|
|
Executers []*ProtocolExecuterPair
|
|
|
|
}
|
|
|
|
|
|
|
|
// ProtocolExecuterPair is a pair of protocol executer and its options
|
|
|
|
type ProtocolExecuterPair struct {
|
2020-12-29 12:32:45 +00:00
|
|
|
Executer protocols.Executer
|
2021-01-17 07:26:29 +00:00
|
|
|
Options *protocols.ExecuterOptions
|
2020-11-12 17:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Matcher performs conditional matching on the workflow template results.
|
|
|
|
type Matcher struct {
|
2020-12-25 20:38:48 +00:00
|
|
|
// Name is the name of the item to match.
|
|
|
|
Name string `yaml:"name"`
|
|
|
|
// Subtemplates are ran if the name of matcher matches.
|
2020-11-12 17:58:24 +00:00
|
|
|
Subtemplates []*WorkflowTemplate `yaml:"subtemplates"`
|
2020-07-26 18:14:05 +00:00
|
|
|
}
|