dnstraverse 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/dnstraverse CHANGED
@@ -56,7 +56,7 @@ def progress_main(args)
56
56
  stage = args[:stage]
57
57
  return if r.refid.empty?
58
58
  case stage
59
- when :answer then
59
+ when :answer then
60
60
  if o[:verbose] then
61
61
  for warning in r.warnings do
62
62
  puts "#{r.refid} WARNING: #{warning}"
@@ -65,15 +65,15 @@ def progress_main(args)
65
65
  if o[:allstats] then
66
66
  r.stats_display(:prefix => "#{r.refid} Results:", :results => false)
67
67
  end
68
- when :start then
68
+ when :start then
69
69
  print o[:verbose] ? referral_txt_verbose(r) : referral_txt_normal(r)
70
70
  if r.serverips.nil? then
71
71
  print " -- resolving"
72
72
  end
73
73
  print "\n"
74
- when :answer_fast then
74
+ when :answer_fast then
75
75
  print o[:verbose] ? referral_txt_verbose(r) : referral_txt_normal(r)
76
- puts " -- completed earlier"
76
+ puts " -- completed earlier (#{r.replaced_by.refid})"
77
77
  end
78
78
  end
79
79
 
@@ -82,10 +82,10 @@ def progress_resolves(args)
82
82
  r = args[:referral]
83
83
  stage = args[:stage]
84
84
  case stage
85
- when :start then
85
+ when :start then
86
86
  print o[:verbose] ? referral_txt_verbose(r) : referral_txt_normal(r)
87
87
  print "\n"
88
- when :answer_fast then
88
+ when :answer_fast then
89
89
  print o[:verbose] ? referral_txt_verbose(r) : referral_txt_normal(r)
90
90
  puts " -- completed earlier"
91
91
  end
@@ -55,18 +55,24 @@ module DNSTraverse
55
55
  next unless id =~ /#{rule[:fingerprint]}/
56
56
  if rule.has_key?(:result) then
57
57
  result = rule[:result]
58
+ if result.is_a? String
59
+ ref[:state] = rule[:result]
60
+ ref[:error] = rule[:result]
61
+ ref[:id] = id
62
+ return ret
63
+ end
58
64
  for k in [:vendor, :product, :option] do
59
65
  ret[k] = result[k] if result.has_key?(k) and result[k].length > 0
60
66
  end
61
67
  case @version_style
62
- when :none
68
+ when :none
63
69
  ret[:version] = result[:version]
64
- when :append
70
+ when :append
65
71
  ver = query_version(ip, result[:qv])
66
72
  ver = query_version(ip, "version.bind") unless ver
67
73
  ret[:version] = result[:version]
68
74
  ret[:version]+= " (#{ver})" if ver
69
- when :override
75
+ when :override
70
76
  ver = query_version(ip, result[:qv])
71
77
  ver = query_version(ip, "version.bind") unless ver
72
78
  ret[:version] = ver ? ver : result[:version]
@@ -31,6 +31,7 @@ module DNSTraverse
31
31
  attr_reader :decoded_query_cache
32
32
  attr_reader :responses
33
33
  attr_reader :stats
34
+ attr_accessor :replaced_by
34
35
 
35
36
  EMPTY_ARRAY = [].freeze
36
37
 
@@ -437,6 +438,7 @@ module DNSTraverse
437
438
  end
438
439
 
439
440
  def replace_child(before, after)
441
+ before.replaced_by = after
440
442
  @children.each_key do | ip |
441
443
  @children[ip].map! { |c| c.equal?(before) ? after : c }
442
444
  end
@@ -195,9 +195,12 @@ module DNSTraverse
195
195
  stack.push(*referrals.reverse)
196
196
  next
197
197
  end
198
- # get Referral objects, place on stack with placeholder
198
+ # put a placeholder on the stack
199
199
  stack << r << :calc_answer
200
+ # get the children
200
201
  children = r.process({})
202
+ # now report progress. we already can tell whether this will be
203
+ # completed in fast mode or not, so we report this information
201
204
  children.each do |c|
202
205
  if @fast
203
206
  key = "#{c.qname}:#{c.qclass}:#{c.qtype}:#{c.server}:#{c.txt_ips_verbose}".downcase!
@@ -207,6 +210,7 @@ module DNSTraverse
207
210
  end
208
211
  report_progress c, :stage => stage
209
212
  end
213
+ # push the children on the stack
210
214
  stack.push(*children.reverse)
211
215
  end
212
216
  end
@@ -2,7 +2,7 @@ module DNSTraverse
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 1
5
+ PATCH = 2
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: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
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-06-10 00:00:00 +01:00
18
+ date: 2011-07-31 00:00:00 +01:00
19
19
  default_executable: dnstraverse
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency