Class: Ronin::CLI::Commands::Host Private
- Inherits:
-
ValueProcessorCommand
- Object
- Core::CLI::Command
- Ronin::CLI::Command
- ValueProcessorCommand
- Ronin::CLI::Commands::Host
- Includes:
- DNS
- Defined in:
- lib/ronin/cli/commands/host.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.
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
Constant Summary
Constants included from DNS
Instance Attribute Summary
Attributes included from DNS
Attributes inherited from ValueProcessorCommand
Instance Method Summary collapse
-
#process_hostname(host) ⇒ Object
private
Processes a single hostname.
-
#process_value(host) ⇒ Object
private
Queries the given host.
Methods included from DNS
included, #initialize, #print_record, #print_records, #resolver
Methods inherited from ValueProcessorCommand
#initialize, #process_file, #run
Instance Method Details
#process_hostname(host) ⇒ 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.
Processes a single hostname.
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/ronin/cli/commands/host.rb', line 177 def process_hostname(host) if [:subdomain] puts host.subdomain([:subdomain]) elsif [:domain] puts host.domain elsif [:tld] puts host.tld elsif [:suffix] puts host.suffix elsif [:ips] puts host.get_addresses elsif [:registered] puts host if host.registered? elsif [:unregistered] puts host if host.unregistered? elsif [:has_addresses] puts host if host.has_addresses? elsif [:has_records] records = host.get_records([:has_records]) puts host unless records.empty? elsif [:query] print_records(host.get_records([:query])) else puts host.name end end |
#process_value(host) ⇒ 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.
Queries the given host.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/ronin/cli/commands/host.rb', line 142 def process_value(host) host = Support::Network::Host.new(host) if [:change_suffix] process_host(host.change_suffix([:change_suffix])) elsif [:enum_tlds] host.each_tld(&method(:process_hostname)) elsif .has_key?(:enum_suffixes) host.each_suffix( type: [:enum_suffixes], &method(:process_hostname) ) elsif [:enum_subdomains] path = [: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 |