Module: Ronin::Listener::DNS

Defined in:
lib/ronin/listener/dns.rb,
lib/ronin/listener/dns/query.rb,
lib/ronin/listener/dns/server.rb,
lib/ronin/listener/dns/version.rb

Overview

Top-level methods for DNS.

Defined Under Namespace

Classes: Query, Server

Constant Summary collapse

VERSION =

ronin-listener-dns version

'0.1.0'

Class Method Summary collapse

Class Method Details

.listen(domain, **kwargs) {|query_type, query_name| ... } ⇒ Object

Starts the DNS listener server.

Examples:

Ronin::Listener::DNS.listen('0.0.0.0',53) do |query_type,query_name|
  puts "Received query #{query_type} #{query_name}"
end

Parameters:

Options Hash (**kwargs):

  • :host (String) — default: '0.0.0.0'

    The interface to listen on.

  • :port (Integer) — default: 53

    The local port to listen on.

Yields:

  • (query_type, query_name)

    The given block will be passed each received query.

Yield Parameters:

  • query_type (:A, :AAAA, :ANY, :CNAME, :HINFO, :LOC, :MINFO, :MX, :NS, :PTR, :SOA, :SRV, :TXT, :WKS)

    The type of the query.

  • query_name (String)

    The hostname being queried.

Raises:

  • (ArgumentError)

    No callback block was given.



61
62
63
64
# File 'lib/ronin/listener/dns.rb', line 61

def self.listen(domain,**kwargs,&callback)
  server = Server.new(domain,**kwargs,&callback)
  server.run
end