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

60 lines
1.3 KiB
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{},
2022-02-02 06:54:15 +00:00
"dns/caa.yaml": &dnsCAA{},
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
2022-01-18 12:49:23 +00:00
func (h *dnsPtr) Execute(filePath string) error {
2022-01-18 12:47:15 +00:00
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)
}
2022-02-02 06:54:15 +00:00
type dnsCAA struct{}
// Execute executes a test case and returns an error if occurred
func (h *dnsCAA) Execute(filePath string) error {
var routerErr error
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "google.com", debug)
if err != nil {
return err
}
if routerErr != nil {
return routerErr
}
return expectResultsCount(results, 1)
}