mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-21 07:25:26 +00:00
* Check if the variables are override by other means - you can override the template variable value using command line flags * Update lazy eval logic - previously, we were checking any function/expression in variable - now, update the logic, lazy eval only if variable contains any protocol variable(global) * add integration tests * Add test to check the dsl function working in variable * gather all generate variables logic in utils * go mod update * Refactor the generate variables function * go mod update+ fix typo --------- Co-authored-by: Sandeep Singh <sandeep@projectdiscovery.io> Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com> Co-authored-by: Tarun Koyalwar <tarun@projectdiscovery.io>
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package dns
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/model"
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/model/types/severity"
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/testutils"
|
|
)
|
|
|
|
func TestDNSCompileMake(t *testing.T) {
|
|
options := testutils.DefaultOptions
|
|
|
|
recursion := false
|
|
testutils.Init(options)
|
|
const templateID = "testing-dns"
|
|
request := &Request{
|
|
RequestType: DNSRequestTypeHolder{DNSRequestType: A},
|
|
Class: "INET",
|
|
Retries: 5,
|
|
ID: templateID,
|
|
Recursion: &recursion,
|
|
Name: "{{FQDN}}",
|
|
}
|
|
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
|
|
ID: templateID,
|
|
Info: model.Info{SeverityHolder: severity.Holder{Severity: 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", map[string]interface{}{"FQDN": "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")
|
|
}
|