2020-06-26 10:23:54 +02:00
package workflows
2021-07-15 13:41:41 +03:00
import (
2021-09-03 16:48:39 +03:00
"github.com/projectdiscovery/nuclei/v2/pkg/model/types/stringslice"
2021-07-15 13:41:41 +03:00
"github.com/projectdiscovery/nuclei/v2/pkg/protocols"
)
2020-12-26 02:08:48 +05:30
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.
2021-08-23 23:50:45 +05:30
Workflows [ ] * WorkflowTemplate ` yaml:"workflows,omitempty" jsonschema:"title=list of workflows to execute,description=List of workflows to execute for template" `
2021-02-22 17:49:02 +05:30
2021-08-23 23:50:45 +05:30
Options * protocols . ExecuterOptions ` yaml:"-" `
2020-11-12 23:28:24 +05:30
}
2021-09-07 17:31:46 +03:00
// WorkflowTemplate is a template to be run as part of a workflow
2020-11-12 23:28:24 +05:30
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-23 23:50:45 +05:30
Template string ` yaml:"template,omitempty" jsonschema:"title=template/directory to execute,description=Template or directory to execute as part of workflow" `
2021-07-27 16:03:56 +05:30
// description: |
// Tags to run templates based on.
2021-09-03 16:48:39 +03:00
Tags stringslice . StringSlice ` yaml:"tags,omitempty" jsonschema:"title=tags to execute,description=Tags to run template based on" `
2021-07-27 16:03:56 +05:30
// description: |
// Matchers perform name based matching to run subtemplates for a workflow.
2021-08-23 23:50:45 +05:30
Matchers [ ] * Matcher ` yaml:"matchers,omitempty" jsonschema:"title=name based template result matchers,description=Matchers perform name based matching to run subtemplates for a workflow" `
2021-07-27 16:03:56 +05:30
// description: |
2021-09-07 17:31:46 +03:00
// Subtemplates are run if the `template` field Template matches.
2021-08-23 23:50:45 +05:30
Subtemplates [ ] * WorkflowTemplate ` yaml:"subtemplates,omitempty" jsonschema:"title=subtemplate based result matchers,description=Subtemplates are ran if the template field Template matches" `
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 {
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 {
2021-07-27 16:03:56 +05:30
// description: |
// Name is the name of the item to match.
2021-08-23 23:50:45 +05:30
Name string ` yaml:"name,omitempty" jsonschema:"title=name of item to match,description=Name of item to match" `
2021-07-27 16:03:56 +05:30
// description: |
2021-09-07 17:31:46 +03:00
// Subtemplates are run if the name of matcher matches.
2021-08-23 23:50:45 +05:30
Subtemplates [ ] * WorkflowTemplate ` yaml:"subtemplates,omitempty" jsonschema:"title=templates to run after match,description=Templates to run after match" `
2020-07-26 20:14:05 +02:00
}