nuclei/v2/pkg/templates/templates.go

42 lines
1.0 KiB
Go
Raw Normal View History

package templates
import (
2020-07-01 16:17:24 +05:30
"github.com/projectdiscovery/nuclei/v2/pkg/requests"
)
// 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
Info map[string]string `yaml:"info"`
2020-07-18 21:42:23 +02:00
// BulkRequestsHTTP contains the http request to make in the template
BulkRequestsHTTP []*requests.BulkHTTPRequest `yaml:"requests,omitempty"`
// RequestsDNS contains the dns request to make in the template
2020-06-29 17:43:08 +05:30
RequestsDNS []*requests.DNSRequest `yaml:"dns,omitempty"`
2020-07-31 17:13:51 +02:00
path string
}
// GetPath of the workflow
func (t *Template) GetPath() string {
return t.path
}
2020-07-31 17:13:51 +02:00
func (t *Template) GetHTTPRequestCount() int64 {
var count int64 = 0
2020-07-23 20:19:19 +02:00
for _, request := range t.BulkRequestsHTTP {
count += request.GetRequestCount()
}
return count
2020-07-26 16:36:01 +02:00
}
func (t *Template) GetDNSRequestCount() int64 {
var count int64 = 0
for _, request := range t.RequestsDNS {
count += request.GetRequestCount()
}
2020-07-26 16:36:01 +02:00
return count
2020-07-31 17:13:51 +02:00
}