2021-08-03 22:33:50 +05:30
//go:generate dstdocgen -path "" -structure Template -output templates_doc.go -package templates
2020-04-04 00:17:57 +05:30
package templates
import (
2021-07-12 17:20:01 +03:00
"github.com/projectdiscovery/nuclei/v2/pkg/model"
2020-12-29 16:33:25 +05:30
"github.com/projectdiscovery/nuclei/v2/pkg/protocols"
2020-12-29 15:38:14 +05:30
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/dns"
2021-01-01 15:28:28 +05:30
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/file"
2021-02-21 16:31:34 +05:30
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/headless"
2020-12-29 15:38:14 +05:30
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/http"
2020-12-30 14:54:20 +05:30
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/network"
2020-12-29 15:38:14 +05:30
"github.com/projectdiscovery/nuclei/v2/pkg/workflows"
2020-04-04 00:17:57 +05:30
)
2021-08-04 14:20:48 +05:30
// Template is a YAML input file which defines all the requests and
// other metadata for a template.
2020-04-04 00:17:57 +05:30
type Template struct {
2021-07-27 16:03:56 +05:30
// description: |
2021-09-01 15:48:01 +05:30
// ID is the unique id for the template.
2021-07-27 16:03:56 +05:30
//
// #### Good IDs
//
2021-08-03 20:36:26 +05:30
// A good ID uniquely identifies what the requests in the template
2021-07-27 16:03:56 +05:30
// 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
2021-09-01 15:53:30 +05:30
// value: "\"CVE-2021-19520\""
2021-08-23 23:50:45 +05:30
ID string ` yaml:"id" jsonschema:"title=id of the template,description=The Unique ID for the template,example=cve-2021-19520" `
2021-07-27 16:03:56 +05:30
// description: |
2021-08-19 16:51:02 +05:30
// Info contains metadata information about the template.
2021-08-04 14:20:48 +05:30
// examples:
// - value: exampleInfoStructure
2021-08-24 20:02:55 +05:30
Info model . Info ` yaml:"info" jsonschema:"title=info for the template,description=Info contains metadata for the template" `
2021-07-27 16:03:56 +05:30
// description: |
2021-08-04 14:20:48 +05:30
// Requests contains the http request to make in the template.
// examples:
// - value: exampleNormalHTTPRequest
2021-08-23 23:50:45 +05:30
RequestsHTTP [ ] * http . Request ` yaml:"requests,omitempty" json:"requests,omitempty" jsonschema:"title=http requests to make,description=HTTP requests to make for the template" `
2021-07-27 16:03:56 +05:30
// description: |
// DNS contains the dns request to make in the template
2021-08-04 14:20:48 +05:30
// examples:
// - value: exampleNormalDNSRequest
2021-08-23 23:50:45 +05:30
RequestsDNS [ ] * dns . Request ` yaml:"dns,omitempty" json:"dns,omitempty" jsonschema:"title=dns requests to make,description=DNS requests to make for the template" `
2021-07-27 16:03:56 +05:30
// description: |
// File contains the file request to make in the template
2021-08-04 14:20:48 +05:30
// examples:
// - value: exampleNormalFileRequest
2021-08-23 23:50:45 +05:30
RequestsFile [ ] * file . Request ` yaml:"file,omitempty" json:"file,omitempty" jsonschema:"title=file requests to make,description=File requests to make for the template" `
2021-07-27 16:03:56 +05:30
// description: |
// Network contains the network request to make in the template
2021-08-04 14:20:48 +05:30
// examples:
// - value: exampleNormalNetworkRequest
2021-08-23 23:50:45 +05:30
RequestsNetwork [ ] * network . Request ` yaml:"network,omitempty" json:"network,omitempty" jsonschema:"title=network requests to make,description=Network requests to make for the template" `
2021-07-27 16:03:56 +05:30
// description: |
// Headless contains the headless request to make in the template.
2021-08-23 23:50:45 +05:30
RequestsHeadless [ ] * headless . Request ` yaml:"headless,omitempty" json:"headless,omitempty" jsonschema:"title=headless requests to make,description=Headless requests to make for the template" `
2021-02-04 01:09:29 +05:30
2021-07-27 16:03:56 +05:30
// description: |
// Workflows is a yaml based workflow declaration code.
2021-08-23 23:50:45 +05:30
workflows . Workflow ` yaml:",inline,omitempty" jsonschema:"title=workflows to run,description=Workflows to run for the template" `
2021-05-01 18:28:24 +05:30
CompiledWorkflow * workflows . Workflow ` yaml:"-" json:"-" jsonschema:"-" `
2020-12-30 13:26:55 +05:30
2020-12-29 18:02:45 +05:30
// TotalRequests is the total number of requests for the template.
2021-05-01 18:28:24 +05:30
TotalRequests int ` yaml:"-" json:"-" `
2020-12-29 18:02:45 +05:30
// Executer is the actual template executor for running template requests
2021-05-01 18:28:24 +05:30
Executer protocols . Executer ` yaml:"-" json:"-" `
2021-06-05 23:00:59 +05:30
Path string ` yaml:"-" json:"-" `
2020-07-31 17:13:51 +02:00
}