2020-06-26 10:23:54 +02:00
|
|
|
package workflows
|
|
|
|
|
|
2020-12-26 02:08:48 +05:30
|
|
|
import "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 {
|
2020-11-12 23:28:24 +05:30
|
|
|
// Workflows is a yaml based workflow declaration code.
|
2021-02-21 16:31:34 +05:30
|
|
|
Workflows []*WorkflowTemplate `yaml:"workflows,omitempty"`
|
2021-02-22 17:49:02 +05:30
|
|
|
|
|
|
|
|
options *protocols.ExecuterOptions
|
2020-11-12 23:28:24 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WorkflowTemplate is a template to be ran as part of a workflow
|
|
|
|
|
type WorkflowTemplate struct {
|
2020-12-26 02:08:48 +05:30
|
|
|
// Template is the template to run
|
|
|
|
|
Template string `yaml:"template"`
|
|
|
|
|
// 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 23:28:24 +05:30
|
|
|
Subtemplates []*WorkflowTemplate `yaml:"subtemplates"`
|
2021-01-17 12:56:29 +05:30
|
|
|
// 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 18:02:45 +05:30
|
|
|
Executer protocols.Executer
|
2021-01-17 12:56:29 +05:30
|
|
|
Options *protocols.ExecuterOptions
|
2020-11-12 23:28:24 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Matcher performs conditional matching on the workflow template results.
|
|
|
|
|
type Matcher struct {
|
2020-12-26 02:08:48 +05:30
|
|
|
// 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 23:28:24 +05:30
|
|
|
Subtemplates []*WorkflowTemplate `yaml:"subtemplates"`
|
2020-07-26 20:14:05 +02:00
|
|
|
}
|