nuclei/v2/cmd/integration-test/dns.go

43 lines
938 B
Go
Raw Normal View History

2021-02-27 07:03:27 +00:00
package main
import (
"github.com/projectdiscovery/nuclei/v2/pkg/testutils"
2021-02-27 07:03:27 +00:00
)
var dnsTestCases = map[string]testutils.TestCase{
"dns/basic.yaml": &dnsBasic{},
2022-01-18 12:47:15 +00:00
"dns/ptr.yaml": &dnsPtr{},
2021-02-27 07:03:27 +00:00
}
type dnsBasic struct{}
2021-09-03 14:25:50 +00:00
// Execute executes a test case and returns an error if occurred
2021-02-27 07:03:27 +00:00
func (h *dnsBasic) Execute(filePath string) error {
var routerErr error
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "one.one.one.one", debug)
2021-02-27 07:03:27 +00:00
if err != nil {
return err
}
if routerErr != nil {
return routerErr
}
return expectResultsCount(results, 1)
2021-02-27 07:03:27 +00:00
}
2022-01-18 12:47:15 +00:00
type dnsPtr struct{}
// Execute executes a test case and returns an error if occurred
func (h *dnsBasic) dnsPtr(filePath string) error {
var routerErr error
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "1.1.1.1", debug)
if err != nil {
return err
}
if routerErr != nil {
return routerErr
}
return expectResultsCount(results, 1)
}