mirror of https://github.com/daffainfo/nuclei.git
34 lines
882 B
Go
34 lines
882 B
Go
package dns
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/projectdiscovery/nuclei/v2/internal/testutils"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestDNSCompileMake(t *testing.T) {
|
|
options := testutils.DefaultOptions
|
|
|
|
testutils.Init(options)
|
|
templateID := "testing-dns"
|
|
request := &Request{
|
|
Type: "A",
|
|
Class: "INET",
|
|
Retries: 5,
|
|
ID: templateID,
|
|
Recursion: false,
|
|
Name: "{{FQDN}}",
|
|
}
|
|
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
|
|
ID: templateID,
|
|
Info: map[string]interface{}{"severity": "low", "name": "test"},
|
|
})
|
|
err := request.Compile(executerOpts)
|
|
require.Nil(t, err, "could not compile dns request")
|
|
|
|
req, err := request.Make("one.one.one.one")
|
|
require.Nil(t, err, "could not make dns request")
|
|
require.Equal(t, "one.one.one.one.", req.Question[0].Name, "could not get correct dns question")
|
|
}
|