nuclei/v2/pkg/workflows/workflows.go

55 lines
1.8 KiB
Go
Raw Normal View History

2020-06-26 08:23:54 +00:00
package workflows
import (
"github.com/projectdiscovery/nuclei/v2/pkg/model"
"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 {
2021-07-27 10:33:56 +00:00
// description: |
// Workflows is a list of workflows to execute for a template.
Workflows []*WorkflowTemplate `yaml:"workflows,omitempty"`
2021-02-22 12:19:02 +00:00
2021-02-23 17:25:29 +00:00
Options *protocols.ExecuterOptions
}
// WorkflowTemplate is a template to be ran as part of a workflow
type WorkflowTemplate struct {
2021-07-27 10:33:56 +00:00
// 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 08:50:48 +00:00
Template string `yaml:"template,omitempty"`
2021-07-27 10:33:56 +00:00
// description: |
// Tags to run templates based on.
2021-08-19 11:21:02 +00:00
Tags model.StringSlice `yaml:"tags,omitempty"`
2021-07-27 10:33:56 +00:00
// description: |
// Matchers perform name based matching to run subtemplates for a workflow.
2021-08-04 08:50:48 +00:00
Matchers []*Matcher `yaml:"matchers,omitempty"`
2021-07-27 10:33:56 +00:00
// description: |
// Subtemplates are ran if the `template` field Template matches.
2021-08-04 08:50:48 +00:00
Subtemplates []*WorkflowTemplate `yaml:"subtemplates,omitempty"`
2021-01-17 07:26:29 +00:00
// Executers perform the actual execution for the workflow template
2021-08-19 11:21:02 +00:00
Executers []*ProtocolExecuterPair `yaml:"-"`
2021-01-17 07:26:29 +00:00
}
// ProtocolExecuterPair is a pair of protocol executer and its options
type ProtocolExecuterPair struct {
Executer protocols.Executer
2021-01-17 07:26:29 +00:00
Options *protocols.ExecuterOptions
}
// Matcher performs conditional matching on the workflow template results.
type Matcher struct {
2021-07-27 10:33:56 +00:00
// description: |
// Name is the name of the item to match.
2021-08-04 08:50:48 +00:00
Name string `yaml:"name,omitempty"`
2021-07-27 10:33:56 +00:00
// description: |
// Subtemplates are ran if the name of matcher matches.
2021-08-04 08:50:48 +00:00
Subtemplates []*WorkflowTemplate `yaml:"subtemplates,omitempty"`
}