Skip to content

Commit

Permalink
test(dns): update input, requires, and enable recursion (#6014)
Browse files Browse the repository at this point in the history
* test(dns): update input, requires, and enable recursion

Signed-off-by: Dwi Siswanto <git@dw1.io>

* Update go.mod

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
  • Loading branch information
dwisiswant0 and ehsandeep authored Jan 30, 2025
1 parent d699c27 commit 58ae87c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module github.com/projectdiscovery/nuclei/v3

go 1.21.0
toolchain go1.22.5
go 1.22.0

require (
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible
Expand Down
11 changes: 6 additions & 5 deletions pkg/protocols/dns/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
func TestDNSExecuteWithResults(t *testing.T) {
options := testutils.DefaultOptions

recursion := false
recursion := true
testutils.Init(options)
templateID := "testing-dns"
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
Expand All @@ -38,7 +38,7 @@ func TestDNSExecuteWithResults(t *testing.T) {
Name: "test",
Part: "raw",
Type: matchers.MatcherTypeHolder{MatcherType: matchers.WordsMatcher},
Words: []string{"93.184.215.14"},
Words: []string{"8.8.8.8"},
}},
Extractors: []*extractors.Extractor{{
Part: "raw",
Expand All @@ -55,7 +55,7 @@ func TestDNSExecuteWithResults(t *testing.T) {
t.Run("domain-valid", func(t *testing.T) {
metadata := make(output.InternalEvent)
previous := make(output.InternalEvent)
ctxArgs := contextargs.NewWithInput(context.Background(), "example.com")
ctxArgs := contextargs.NewWithInput(context.Background(), "dns.google")
err := request.ExecuteWithResults(ctxArgs, metadata, previous, func(event *output.InternalWrappedEvent) {
finalEvent = event
})
Expand All @@ -64,8 +64,9 @@ func TestDNSExecuteWithResults(t *testing.T) {
require.NotNil(t, finalEvent, "could not get event output from request")
require.Equal(t, 1, len(finalEvent.Results), "could not get correct number of results")
require.Equal(t, "test", finalEvent.Results[0].MatcherName, "could not get correct matcher name of results")
require.Equal(t, 1, len(finalEvent.Results[0].ExtractedResults), "could not get correct number of extracted results")
require.Equal(t, "93.184.215.14", finalEvent.Results[0].ExtractedResults[0], "could not get correct extracted results")
require.GreaterOrEqual(t, 2, len(finalEvent.Results[0].ExtractedResults), "could not get correct number of extracted results")
require.Contains(t, finalEvent.Results[0].ExtractedResults, "8.8.8.8", "could not get correct extracted results")
require.Contains(t, finalEvent.Results[0].ExtractedResults, "8.8.4.4", "could not get correct extracted results")
finalEvent = nil
// Note: changing url to domain is responsible at tmplexec package and is implemented there
}

0 comments on commit 58ae87c

Please sign in to comment.