Class: PassiveDNS::Provider::BFK
- Inherits:
-
PassiveDNS::PassiveDB
- Object
- PassiveDNS::PassiveDB
- PassiveDNS::Provider::BFK
- Defined in:
- lib/passivedns/client/provider/bfk.rb
Overview
Queries BFK.de’s passive DNS database
Instance Attribute Summary collapse
-
#debug ⇒ Object
:debug enables verbose logging to standard output.
Class Method Summary collapse
-
.config_section_name ⇒ Object
Sets the configuration section name to “bfk”.
-
.name ⇒ Object
Sets the modules self-reported name to “BFK.de”.
-
.option_letter ⇒ Object
Sets the command line database argument to “b”.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ BFK
constructor
Options * :debug Sets the debug flag for the module * “URL” Alternate url for testing.
-
#lookup(label, limit = nil) ⇒ Object
Takes a label (either a domain or an IP address) and returns an array of PassiveDNS::PDNSResult instances with the answers to the query.
Constructor Details
#initialize(options = {}) ⇒ BFK
Options
-
:debug Sets the debug flag for the module
-
“URL” Alternate url for testing. Defaults to “www.bfk.de/bfk_dnslogger.html?query=”
Example Instantiation
= {
:debug => true,
"URL" => "http://www.bfk.de/bfk_dnslogger.html?query="
}
PassiveDNS::Provider::BFK.new()
37 38 39 40 41 42 |
# File 'lib/passivedns/client/provider/bfk.rb', line 37 def initialize(={}) @debug = [:debug] || false @timeout = [:timeout] || 20 @base = ["URL"] || "http://www.bfk.de/bfk_dnslogger.html?query=" raise "Due to the EU GDPR policy, this service has been shut down until further notice." end |
Instance Attribute Details
#debug ⇒ Object
:debug enables verbose logging to standard output
23 24 25 |
# File 'lib/passivedns/client/provider/bfk.rb', line 23 def debug @debug end |
Class Method Details
.config_section_name ⇒ Object
Sets the configuration section name to “bfk”
14 15 16 |
# File 'lib/passivedns/client/provider/bfk.rb', line 14 def self.config_section_name "bfk" end |
.name ⇒ Object
Sets the modules self-reported name to “BFK.de”
10 11 12 |
# File 'lib/passivedns/client/provider/bfk.rb', line 10 def self.name "BFK.de" end |
.option_letter ⇒ Object
Sets the command line database argument to “b”
18 19 20 |
# File 'lib/passivedns/client/provider/bfk.rb', line 18 def self.option_letter "b" end |
Instance Method Details
#lookup(label, limit = nil) ⇒ Object
Takes a label (either a domain or an IP address) and returns an array of PassiveDNS::PDNSResult instances with the answers to the query
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/passivedns/client/provider/bfk.rb', line 46 def lookup(label, limit=nil) $stderr.puts "DEBUG: #{self.class.name}.lookup(#{label})" if @debug Timeout::timeout(@timeout) { t1 = Time.now open( @base+label, "User-Agent" => "Ruby/#{RUBY_VERSION} passivedns-client rubygem v#{PassiveDNS::Client::VERSION}" ) do |f| t2 = Time.now recs = parse(f.read,t2-t1) if limit recs[0,limit] else recs end end } rescue Timeout::Error => e $stderr.puts "#{self.class.name} lookup timed out: #{label}" end |