dnstraverse 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/dnstraverse +0 -1
- data/lib/dnstraverse/info_cache.rb +1 -0
- data/lib/dnstraverse/referral.rb +9 -8
- data/lib/dnstraverse/response.rb +16 -4
- data/lib/dnstraverse/summary_stats.rb +1 -1
- data/lib/dnstraverse/version.rb +1 -1
- metadata +4 -4
data/bin/dnstraverse
CHANGED
@@ -99,6 +99,7 @@ module DNSTraverse
|
|
99
99
|
starters.push({ :name => nameserver, :ips => ips })
|
100
100
|
end
|
101
101
|
newbailiwick = ns[0].name.to_s
|
102
|
+
newbailiwick = nil if newbailiwick == '' # back to root
|
102
103
|
Log.debug { "For domain #{domain} using start servers: " +
|
103
104
|
starters.map { |x| x[:name] }.join(', ') }
|
104
105
|
return starters, newbailiwick
|
data/lib/dnstraverse/referral.rb
CHANGED
@@ -484,20 +484,21 @@ module DNSTraverse
|
|
484
484
|
referral = data[:referral]
|
485
485
|
where = "#{referral.server} (#{response.ip})"
|
486
486
|
case response.status
|
487
|
-
|
487
|
+
when :exception
|
488
488
|
puts "#{response.exception_message} at #{where}"
|
489
|
-
|
489
|
+
when :noglue
|
490
490
|
puts "No glue at #{referral.parent.server} " +
|
491
491
|
"(#{response.ip}) for #{referral.server}"
|
492
|
-
|
493
|
-
puts "Lame referral from #{
|
494
|
-
|
492
|
+
when :referral_lame
|
493
|
+
puts "Lame referral from #{referral.parent.server} " +
|
494
|
+
"(#{referral.parent_ip}) to #{where}"
|
495
|
+
when :loop
|
495
496
|
puts "Loop encountered at #{response.server} "
|
496
|
-
|
497
|
+
when :error
|
497
498
|
puts "#{response.error_message} at #{where}"
|
498
|
-
|
499
|
+
when :nodata
|
499
500
|
puts "NODATA (for this type) at #{where}"
|
500
|
-
|
501
|
+
when :answered
|
501
502
|
puts "Answer from #{where}"
|
502
503
|
if results then
|
503
504
|
for rr in data[:response].answers do
|
data/lib/dnstraverse/response.rb
CHANGED
@@ -55,7 +55,7 @@ module DNSTraverse
|
|
55
55
|
# this is why exception name/message is added for exception types
|
56
56
|
def update_stats_key
|
57
57
|
r = @decoded_query
|
58
|
-
@stats_key = "key:#{r.ip}:#{@server}:#{
|
58
|
+
@stats_key = "key:#{@status}:#{r.ip}:#{@server}:#{r.qname}:#{r.qclass}:#{r.qtype}"
|
59
59
|
if @stats == :exception and r.message.is_a? Exception then
|
60
60
|
@stats_key+= ":#{r.message}"
|
61
61
|
end
|
@@ -69,6 +69,15 @@ module DNSTraverse
|
|
69
69
|
###@auth_ns = @auth_soa = @auth_other = nil
|
70
70
|
end
|
71
71
|
|
72
|
+
def inside_bailiwick?(name)
|
73
|
+
return true if @bailiwick.nil?
|
74
|
+
bwend = ".#{@bailiwick}"
|
75
|
+
namestr = name.to_s
|
76
|
+
return true if namestr.casecmp(@bailiwick) == 0
|
77
|
+
return true if namestr =~ /#{bwend}$/i
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
|
72
81
|
# enrich the decoded_query to do the cache, lame checking and get starters
|
73
82
|
def evaluate
|
74
83
|
@status = @decoded_query.status # use this as a base
|
@@ -78,13 +87,16 @@ module DNSTraverse
|
|
78
87
|
@infocache.add(@decoded_query.cacheable_good)
|
79
88
|
end
|
80
89
|
case @decoded_query.status
|
81
|
-
|
90
|
+
when :restart
|
82
91
|
@starters, @starters_bailiwick = @infocache.get_startservers(@decoded_query.endname)
|
83
|
-
|
92
|
+
when :referral
|
84
93
|
@starters, @starters_bailiwick = @infocache.get_startservers(@decoded_query.endname)
|
94
|
+
unless @decoded_query.bailiwick.nil? or @starters_bailiwick =~ /\.#{@decoded_query.bailiwick}$/
|
95
|
+
@status = :referral_lame
|
96
|
+
end
|
85
97
|
starternames = @starters.map { |x| x[:name].to_s.downcase }
|
86
98
|
if starternames.sort != @decoded_query.authoritynames.sort
|
87
|
-
@
|
99
|
+
@decoded_query.warnings_add "Referred authority names do not match query cache expectations"
|
88
100
|
end
|
89
101
|
end
|
90
102
|
end
|
@@ -85,7 +85,7 @@ module DNSTraverse
|
|
85
85
|
case type
|
86
86
|
when :nodata
|
87
87
|
o << "#{prefix}#{txt_prob sinfo[:prob]} found no such record"
|
88
|
-
when :
|
88
|
+
when :referral_lame
|
89
89
|
o << "#{prefix}#{txt_prob sinfo[:prob]} resulted in a lame referral"
|
90
90
|
when :exception
|
91
91
|
o << "#{prefix}#{txt_prob sinfo[:prob]} resulted in an exception"
|
data/lib/dnstraverse/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dnstraverse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Ponder
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-20 00:00:00 +01:00
|
19
19
|
default_executable: dnstraverse
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|