6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/dert/methods/brt.rb', line 6
def self.query(domain, wordlist, dns_type)
results = []
default_ip = ''
wildcard = false
if self.wildcard?(domain)
wildcard = true
rendsub = rand(10000).to_s
ret = @res.query("#{rendsub}.#{domain}", dns_type)
default_ip = ret.answer[0].address.to_s
end
wordlist.each do |a|
begin
Timeout::timeout(5) {
ret = @res.query("#{a}.#{domain}", dns_type)
ret.answer.each do |x|
unless x.address.to_s == default_ip
results << {
address: x.address.to_s,
type: x.type.to_s,
hostname: x.name.to_s,
ttl: x.ttl.to_s,
klass: x.klass.to_s
}
end
end
}
rescue => e
end
end
if wildcard
results << {
address: default_ip,
type: 'A',
hostname: "*.#{domain}"
}
end
results
end
|