Class: Ronin::CLI::Commands::TldList Private
- Inherits:
-
Ronin::CLI::Command
- Object
- Core::CLI::Command
- Ronin::CLI::Command
- Ronin::CLI::Commands::TldList
- Includes:
- CommandKit::Options::Verbose, Core::CLI::Logging, Support::Network::TLD
- Defined in:
- lib/ronin/cli/commands/tld_list.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.
Updates and parses the TLD list file.
Usage
ronin tld-list [options]
Options
-v, --verbose Enables verbose output
-u, --update Updates the TLD list file
-U, --url URL URL to the TLD list (Default: https://data.iana.org/TLD/tlds-alpha-by-domain.txt)
-p, --path FILE Path to the TLD list file (Default: ~/.cache/ronin/ronin-support/tlds-alpha-by-domain.txt)
-h, --help Print help information
Instance Method Summary collapse
-
#download ⇒ Object
private
Downloads the TLD list file.
-
#downloaded? ⇒ Boolean
private
Determines if the TLD list file has been downloaded already.
-
#run ⇒ Object
private
Runs the
ronin tld-list
command. -
#stale? ⇒ Boolean
private
Determines if the TLD list file is stale.
-
#update ⇒ Object
private
Updates the TLD list file.
Instance Method Details
#download ⇒ 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.
Downloads the TLD list file.
110 111 112 113 114 115 116 |
# File 'lib/ronin/cli/commands/tld_list.rb', line 110 def download if verbose? log_info "Downloading TLD list from #{[:url]} to #{[:path]} ..." end List.download(url: [:url], path: [:path]) end |
#downloaded? ⇒ Boolean
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.
Determines if the TLD list file has been downloaded already.
94 95 96 |
# File 'lib/ronin/cli/commands/tld_list.rb', line 94 def downloaded? List.downloaded?([:path]) end |
#run ⇒ 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 tld-list
command.
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/ronin/cli/commands/tld_list.rb', line 75 def run if !downloaded? download elsif [:update] || stale? update end list_file = List.load_file([:path]) list_file.each do |tld| puts tld end end |
#stale? ⇒ Boolean
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.
Determines if the TLD list file is stale.
103 104 105 |
# File 'lib/ronin/cli/commands/tld_list.rb', line 103 def stale? List.stale?([:path]) end |
#update ⇒ 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.
Updates the TLD list file.
121 122 123 124 125 126 127 |
# File 'lib/ronin/cli/commands/tld_list.rb', line 121 def update if verbose? log_info "Updating TLD list file #{[:path]} ..." end List.update(path: [:path]) end |