Module: Rex::Proto::DNS

Defined in:
lib/rex/proto/dns.rb,
lib/rex/proto/dns/packet.rb,
lib/rex/proto/dns/server.rb,
lib/rex/proto/dns/resolver.rb

Defined Under Namespace

Modules: Constants, Packet Classes: Resolver, Server

Instance Method Summary collapse

Instance Method Details

#query(name, type = Dnsruby::Types::A, cls = Dnsruby::Classes::IN) ⇒ Object

Perform query with default domain validation

Parameters:

  • name
  • type (Fixnum) (defaults to: Dnsruby::Types::A)

    Type of record to look up

  • cls (Fixnum) (defaults to: Dnsruby::Classes::IN)

    Class of question to look up


362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/rex/proto/dns/resolver.rb', line 362

def query(name, type = Dnsruby::Types::A, cls = Dnsruby::Classes::IN)

  return send(name,type,cls) if name.class == IPAddr

  # If the name doesn't contain any dots then append the default domain.
  if name !~ /\./ and name !~ /:/ and @config[:defname]
    name += "." + @config[:domain]
  end

  @logger.debug "Query(#{name},#{Dnsruby::Types.new(type)},#{Dnsruby::Classes.new(cls)})"

  return send(name,type,cls)

end