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 CHANGED
@@ -247,7 +247,6 @@ begin
247
247
  if options[:summary_results] then
248
248
  puts "Summary Results:"
249
249
  print result.summary_stats.text
250
- puts
251
250
  end
252
251
  rescue Interrupt => e
253
252
  $stderr.puts "Interrupted by user"
@@ -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
@@ -484,20 +484,21 @@ module DNSTraverse
484
484
  referral = data[:referral]
485
485
  where = "#{referral.server} (#{response.ip})"
486
486
  case response.status
487
- when :exception
487
+ when :exception
488
488
  puts "#{response.exception_message} at #{where}"
489
- when :noglue
489
+ when :noglue
490
490
  puts "No glue at #{referral.parent.server} " +
491
491
  "(#{response.ip}) for #{referral.server}"
492
- when :referral_lame
493
- puts "Lame referral from #{where}"
494
- when :loop
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
- when :error
497
+ when :error
497
498
  puts "#{response.error_message} at #{where}"
498
- when :nodata
499
+ when :nodata
499
500
  puts "NODATA (for this type) at #{where}"
500
- when :answered
501
+ when :answered
501
502
  puts "Answer from #{where}"
502
503
  if results then
503
504
  for rr in data[:response].answers do
@@ -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}:#{@status}:#{r.qname}:#{r.qclass}:#{r.qtype}"
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
- when :restart
90
+ when :restart
82
91
  @starters, @starters_bailiwick = @infocache.get_startservers(@decoded_query.endname)
83
- when :referral
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
- @status = :referral_lame
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 :lame_referral
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"
@@ -2,7 +2,7 @@ module DNSTraverse
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 7
5
+ PATCH = 8
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
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: 21
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
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-17 00:00:00 +01:00
18
+ date: 2011-08-20 00:00:00 +01:00
19
19
  default_executable: dnstraverse
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency