2020-04-03 18:47:57 +00:00
|
|
|
package templates
|
|
|
|
|
|
|
|
import (
|
2020-12-29 10:08:14 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/dns"
|
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/http"
|
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/workflows"
|
2020-04-03 18:47:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Template is a request template parsed from a yaml file
|
|
|
|
type Template struct {
|
|
|
|
// ID is the unique id for the template
|
|
|
|
ID string `yaml:"id"`
|
|
|
|
// Info contains information about the template
|
2020-10-19 06:07:58 +00:00
|
|
|
Info map[string]string `yaml:"info"`
|
2020-12-29 10:08:14 +00:00
|
|
|
// RequestsHTTP contains the http request to make in the template
|
|
|
|
RequestsHTTP []*http.Request `yaml:"requests,omitempty"`
|
2020-07-18 19:42:23 +00:00
|
|
|
// RequestsDNS contains the dns request to make in the template
|
2020-12-29 10:08:14 +00:00
|
|
|
RequestsDNS []*dns.Request `yaml:"dns,omitempty"`
|
|
|
|
|
|
|
|
// Workflows is a yaml based workflow declaration code.
|
|
|
|
*workflows.Workflow
|
|
|
|
|
|
|
|
path string
|
|
|
|
totalRequests int
|
2020-07-31 15:13:51 +00:00
|
|
|
}
|
|
|
|
|
2020-12-29 10:08:14 +00:00
|
|
|
// GetPath returns the path of the template.
|
2020-07-31 15:13:51 +00:00
|
|
|
func (t *Template) GetPath() string {
|
|
|
|
return t.path
|
2020-04-03 18:47:57 +00:00
|
|
|
}
|
|
|
|
|
2020-12-29 10:08:14 +00:00
|
|
|
// Requests returns the number of requests for the template
|
|
|
|
func (t *Template) Requests() int {
|
|
|
|
return t.totalRequests
|
2020-07-31 15:13:51 +00:00
|
|
|
}
|