Class: PassiveDNS::CERTEE
- Inherits:
-
Object
- Object
- PassiveDNS::CERTEE
- Defined in:
- lib/pdns/certeepdns.rb
Constant Summary collapse
- @@host =
"sim.cert.ee"
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
-
#initialize ⇒ CERTEE
constructor
A new instance of CERTEE.
- #lookup(label) ⇒ Object
Constructor Details
#initialize ⇒ CERTEE
Returns a new instance of CERTEE.
7 8 |
# File 'lib/pdns/certeepdns.rb', line 7 def initialize end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
6 7 8 |
# File 'lib/pdns/certeepdns.rb', line 6 def debug @debug end |
Instance Method Details
#lookup(label) ⇒ Object
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 |
# File 'lib/pdns/certeepdns.rb', line 9 def lookup(label) $stderr.puts "DEBUG: CERTEE.lookup(#{label})" if @debug recs = [] begin t1 = Time.now s = TCPSocket.new(@@host,43) s.puts(label) s.each_line do |l| (lbl,ans,fs,ls) = l.chomp.split(/\t/) rrtype = 'A' if ans =~ /^\d+\.\d+\.\d+\.\d+$/ rrtype = 'A' elsif ans =~ /^ns/ rrtype = 'NS' else rrtype = 'CNAME' end t2 = Time.now recs << PDNSResult.new('CERTEE',t2-t1,lbl,ans,rrtype,0,Time.parse(fs).utc.strftime("%Y-%m-%dT%H:%M:%SZ"),Time.parse(ls).utc.strftime("%Y-%m-%dT%H:%M:%SZ")) end rescue SocketError => e $stderr.puts e end return nil unless recs.length > 0 recs end |