Skip to content

Commit 508fd4d

Browse files
committed
enabled the wildcard detection
1 parent c396502 commit 508fd4d

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

engine/plugins/support/resolvers.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ var baselineResolvers = []baseline{
8585

8686
var trusted *pool.Pool
8787

88-
//var detector *wildcards.Detector
88+
var detector *wildcards.Detector
8989

9090
func PerformQuery(name string, qtype uint16) ([]dns.RR, error) {
9191
msg := utils.QueryMsg(name, qtype)
@@ -95,9 +95,9 @@ func PerformQuery(name string, qtype uint16) ([]dns.RR, error) {
9595

9696
resp, err := dnsQuery(msg, trusted, 10)
9797
if err == nil && resp != nil {
98-
/*if wildcardDetected(resp, detector) {
98+
if wildcardDetected(resp, detector) {
9999
return nil, errors.New("wildcard detected")
100-
}*/
100+
}
101101
if len(resp.Answer) > 0 {
102102
if rr := utils.AnswersByType(resp, qtype); len(rr) > 0 {
103103
return rr, nil
@@ -136,10 +136,14 @@ func dnsQuery(msg *dns.Msg, r *pool.Pool, attempts int) (*dns.Msg, error) {
136136
}
137137

138138
func trustedResolvers() *pool.Pool {
139-
timeout := 3 * time.Second
139+
timeout := time.Second
140+
cpus := runtime.NumCPU()
141+
// wildcard detector
142+
serv := servers.NewNameserver("8.8.8.8", timeout)
143+
wconns := conn.New(cpus, selectors.NewSingle(serv))
144+
detector = wildcards.NewDetector(serv, wconns, nil)
145+
// the server pool
140146
sel := selectors.NewAuthoritative(timeout, servers.NewNameserver)
141-
conns := conn.New(runtime.NumCPU(), sel)
142-
//serv := servers.NewNameserver("8.8.8.8", timeout)
143-
//detector = wildcards.NewDetector(serv, conns, nil)
147+
conns := conn.New(cpus, sel)
144148
return pool.New(0, sel, conns, nil)
145149
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/openrdap/rdap v0.9.1
2828
github.com/owasp-amass/asset-db v0.19.2
2929
github.com/owasp-amass/open-asset-model v0.14.0
30-
github.com/owasp-amass/resolve v0.9.7-0.20250319054635-4385de887f74
30+
github.com/owasp-amass/resolve v0.9.7-0.20250319234251-34c12575c661
3131
github.com/samber/slog-common v0.18.1
3232
github.com/samber/slog-syslog/v2 v2.5.2
3333
github.com/stretchr/testify v1.10.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,8 @@ github.com/owasp-amass/open-asset-model v0.14.0 h1:ycTSBJLgNviN7tnTki4XPqk3G5QoZ
11581158
github.com/owasp-amass/open-asset-model v0.14.0/go.mod h1:DOX+SiD6PZBroSMnsILAmpf0SHi6TVpqjV4uNfBeg7g=
11591159
github.com/owasp-amass/resolve v0.9.7-0.20250319054635-4385de887f74 h1:JEGnytmvK9I1LuhuxmlLbxZxJf407XmO1RxhjeCApbU=
11601160
github.com/owasp-amass/resolve v0.9.7-0.20250319054635-4385de887f74/go.mod h1:hCEHzM1Ugo2b/i+0mHrT05syKHdkmQIEAOCKmh6TSPs=
1161+
github.com/owasp-amass/resolve v0.9.7-0.20250319234251-34c12575c661 h1:B8rgrYFketO3yJjvyxEbRvFgY9pKr7bscNn2LnickDQ=
1162+
github.com/owasp-amass/resolve v0.9.7-0.20250319234251-34c12575c661/go.mod h1:hCEHzM1Ugo2b/i+0mHrT05syKHdkmQIEAOCKmh6TSPs=
11611163
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
11621164
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
11631165
github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM=

0 commit comments

Comments
 (0)