Skip to content

Commit 8059c59

Browse files
committed
Land rapid7#2452 - Ignore unexpected DNS answers
2 parents c87e7b3 + 1fe0c50 commit 8059c59

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/auxiliary/gather/dns_info.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def get_ip(host)
124124
query = @res.search(host, "A")
125125
if query
126126
query.answer.each do |rr|
127+
next unless rr.type == "A"
127128
record = {}
128129
record[:host] = host
129130
record[:type] = "A"
@@ -134,6 +135,7 @@ def get_ip(host)
134135
query1 = @res.search(host, "AAAA")
135136
if query1
136137
query1.answer.each do |rr|
138+
next unless rr.type == "AAAA"
137139
record = {}
138140
record[:host] = host
139141
record[:type] = "AAAA"
@@ -189,6 +191,7 @@ def get_txt(target)
189191
query = @res.query(target, "TXT")
190192
return results if not query
191193
query.answer.each do |rr|
194+
next unless rr.type == "TXT"
192195
record = {}
193196
record[:host] = target
194197
record[:text] = rr.txt

0 commit comments

Comments
 (0)