Class: Ronin::Listener::CLI::Commands::Dns Private

Inherits:
Ronin::Listener::CLI::Command show all
Includes:
Core::CLI::Logging
Defined in:
lib/ronin/listener/cli/commands/dns.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Starts a DNS server for receiving exfiltrated data.

Usage

ronin-listener dns [options] DOMAIN

Options

-o, --output FILE                The output file to write DNS queries to
-F, --output-format txt|csv|json|ndjson
                                 The output format
-H, --host IP                    The interface to listen on (Default: 0.0.0.0)
-p, --port PORT                  The port to listen on (Default: 53)
-h, --help                       Print help information

Arguments

DOMAIN                           The domain to receive queries for

Examples

ronin-listener dns -H 127.0.0.1 -p 5553 example.com

Instance Method Summary collapse

Instance Method Details

#run(domain) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the ronin-listener dns command.

Parameters:

  • domain (String)

    The DOMAIN argument.



110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/ronin/listener/cli/commands/dns.rb', line 110

def run(domain)
  output_file = if options[:output]
                  options[:output_format].open(options[:output])
                end

  log_info "Listening on #{options[:host]}:#{options[:port]} ..."

  Ronin::Listener::DNS.listen(domain,**server_kwargs) do |query|
    log_info "Received DNS query: #{query.type} #{query.label} from #{query.source}"
    output_file << query if output_file
  end
end

#server_kwargsHash{Symbol => Object}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Maps options to keyword arguments for Ronin::Listener::DNS.listen.

Returns:

  • (Hash{Symbol => Object})


128
129
130
131
132
133
# File 'lib/ronin/listener/cli/commands/dns.rb', line 128

def server_kwargs
  {
    host: options[:host],
    port: options[:port]
  }
end