2021-08-03 17:03:50 +00:00
|
|
|
//go:generate dstdocgen -path "" -structure Template -output templates_doc.go -package templates
|
2020-04-03 18:47:57 +00:00
|
|
|
package templates
|
|
|
|
|
|
|
|
import (
|
2020-12-29 11:03:25 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols"
|
2020-12-29 10:08:14 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/dns"
|
2021-01-01 09:58:28 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/file"
|
2021-02-21 11:01:34 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/headless"
|
2020-12-29 10:08:14 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/http"
|
2020-12-30 09:24:20 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/network"
|
2020-12-29 10:08:14 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/workflows"
|
2020-04-03 18:47:57 +00:00
|
|
|
)
|
|
|
|
|
2021-07-27 10:33:56 +00:00
|
|
|
// Template is a YAML input file which defines the requests and
|
|
|
|
// others metadata for a scan template.
|
2020-04-03 18:47:57 +00:00
|
|
|
type Template struct {
|
2021-07-27 10:33:56 +00:00
|
|
|
// description: |
|
|
|
|
// ID is the unique id for the template. IDs must be lowercase
|
|
|
|
// and must not contain spaces in it.
|
|
|
|
//
|
|
|
|
// #### Good IDs
|
|
|
|
//
|
2021-08-03 15:06:26 +00:00
|
|
|
// A good ID uniquely identifies what the requests in the template
|
2021-07-27 10:33:56 +00:00
|
|
|
// are doing. Let's say you have a template that identifies a git-config
|
|
|
|
// file on the webservers, a good name would be `git-config-exposure`. Another
|
|
|
|
// example name is `azure-apps-nxdomain-takeover`.
|
|
|
|
// examples:
|
|
|
|
// - name: ID Example
|
|
|
|
// value: "\"cve-2021-19520\""
|
2020-04-03 18:47:57 +00:00
|
|
|
ID string `yaml:"id"`
|
2021-07-27 10:33:56 +00:00
|
|
|
// description: |
|
|
|
|
// Info contains metadata information about the template. At minimum, it
|
|
|
|
// should contain `name`, `author`, `severity`, `description`, `tags`. Optionally
|
|
|
|
// you can also specify a list of `references` for the template.
|
2021-02-03 19:39:29 +00:00
|
|
|
Info map[string]interface{} `yaml:"info"`
|
2021-07-27 10:33:56 +00:00
|
|
|
// description: |
|
|
|
|
// Requests contains the http request to make in the template
|
2021-05-01 12:58:24 +00:00
|
|
|
RequestsHTTP []*http.Request `yaml:"requests,omitempty" json:"requests"`
|
2021-07-27 10:33:56 +00:00
|
|
|
// description: |
|
|
|
|
// DNS contains the dns request to make in the template
|
2021-05-01 12:58:24 +00:00
|
|
|
RequestsDNS []*dns.Request `yaml:"dns,omitempty" json:"dns"`
|
2021-07-27 10:33:56 +00:00
|
|
|
// description: |
|
|
|
|
// File contains the file request to make in the template
|
2021-05-01 12:58:24 +00:00
|
|
|
RequestsFile []*file.Request `yaml:"file,omitempty" json:"file"`
|
2021-07-27 10:33:56 +00:00
|
|
|
// description: |
|
|
|
|
// Network contains the network request to make in the template
|
2021-05-01 12:58:24 +00:00
|
|
|
RequestsNetwork []*network.Request `yaml:"network,omitempty" json:"network"`
|
2021-07-27 10:33:56 +00:00
|
|
|
// description: |
|
|
|
|
// Headless contains the headless request to make in the template.
|
2021-05-01 12:58:24 +00:00
|
|
|
RequestsHeadless []*headless.Request `yaml:"headless,omitempty" json:"headless"`
|
2021-02-03 19:39:29 +00:00
|
|
|
|
2021-07-27 10:33:56 +00:00
|
|
|
// description: |
|
|
|
|
// Workflows is a yaml based workflow declaration code.
|
2021-02-21 11:01:34 +00:00
|
|
|
workflows.Workflow `yaml:",inline,omitempty"`
|
2021-05-01 12:58:24 +00:00
|
|
|
CompiledWorkflow *workflows.Workflow `yaml:"-" json:"-" jsonschema:"-"`
|
2020-12-30 07:56:55 +00:00
|
|
|
|
2020-12-29 12:32:45 +00:00
|
|
|
// TotalRequests is the total number of requests for the template.
|
2021-05-01 12:58:24 +00:00
|
|
|
TotalRequests int `yaml:"-" json:"-"`
|
2020-12-29 12:32:45 +00:00
|
|
|
// Executer is the actual template executor for running template requests
|
2021-05-01 12:58:24 +00:00
|
|
|
Executer protocols.Executer `yaml:"-" json:"-"`
|
2021-06-05 17:30:59 +00:00
|
|
|
|
|
|
|
Path string `yaml:"-" json:"-"`
|
2020-07-31 15:13:51 +00:00
|
|
|
}
|