class Ronin::CLI::Commands::Host
Processes hostname(s) and performs DNS
queries.
## Usage
ronin host [options] {HOST ... | --file FILE}
## Options
-f, --file FILE Optional file to read values from --subdomain SUBNAME Converts the hostname to a sub-domain -d, --domain Converts the hostname to a domain -T, --tld Converts the hostname to it's TLD -s, --suffix Converts the hostname to it's suffix -S, --change-suffix SUFFIX Changes the suffix of each hostname --enum-tlds Enumerates over every TLD --enum-suffixes[={icann|private}] Enumerates over every domain suffix --enum-subdomains FILE Enumerates over every subdomain in the wordlist -N, --nameserver HOST|IP Send DNS queries to the nameserver -I, --ips Converts the hostname to it's IP addresses -r, --registered Filters hostnames that are registered -u, --unregistered Filters hostnames that are unregistered -A, --has-addresses Filters hostnames that have addresses -H A|AAAA|ANY|CNAME|HINFO|LOC|MINFO|MX|NS|PTR|SOA|SRV|TXT|WKS, --has-records Filters hostnames that have a certain DNS record type -t A|AAAA|ANY|CNAME|HINFO|LOC|MINFO|MX|NS|PTR|SOA|SRV|TXT|WKS, --query Queries a specific type of DNS record -h, --help Print help information
## Arguments
[HOST ...] The host name(s) to query
Public Instance Methods
process_hostname(host)
click to toggle source
Processes a single hostname.
@param [Ronin::Support::Network::Host] host
The host object to process.
# File lib/ronin/cli/commands/host.rb, line 177 def process_hostname(host) if options[:subdomain] puts host.subdomain(options[:subdomain]) elsif options[:domain] puts host.domain elsif options[:tld] puts host.tld elsif options[:suffix] puts host.suffix elsif options[:ips] puts host.get_addresses elsif options[:registered] puts host if host.registered? elsif options[:unregistered] puts host if host.unregistered? elsif options[:has_addresses] puts host if host.has_addresses? elsif options[:has_records] records = host.get_records(options[:has_records]) puts host unless records.empty? elsif options[:query] print_records(host.get_records(options[:query])) else puts host.name end end
process_value(host)
click to toggle source
Queries the given host.
@param [String] host
# File lib/ronin/cli/commands/host.rb, line 142 def process_value(host) host = Support::Network::Host.new(host) if options[:change_suffix] process_host(host.change_suffix(options[:change_suffix])) elsif options[:enum_tlds] host.each_tld(&method(:process_hostname)) elsif options.has_key?(:enum_suffixes) host.each_suffix( type: options[:enum_suffixes], &method(:process_hostname) ) elsif options[:enum_subdomains] path = options[:enum_subdomains] unless File.file?(path) print_error "wordlist file not found: #{path.inspect}" exit(-1) end Wordlist::File.open(path) do |wordlist| wordlist.each do |subname| process_hostname(host.subdomain(subname)) end end else process_hostname(host) end end