Class: Ronin::Wordlists::CLI::Commands::Download Private
- Inherits:
-
Ronin::Wordlists::CLI::Command
- Object
- Core::CLI::Command
- Ronin::Wordlists::CLI::Command
- Ronin::Wordlists::CLI::Commands::Download
- Includes:
- Core::CLI::Logging, WordlistDirOption
- Defined in:
- lib/ronin/wordlists/cli/commands/download.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.
Downloads a wordlist.
Usage
ronin-wordlists download [options] {NAME | URL}
Options
-d, --wordlist-dir DIR The wordlist directory
-h, --help Print help information
Arguments
NAME | URL The wordlist name or URL to download
Instance Method Summary collapse
-
#download(url) ⇒ Object
private
Downloads a wordlist from the URL.
-
#run(name_or_url) ⇒ Object
private
Runs the
ronin-wordlists download
command.
Methods included from WordlistDirOption
Instance Method Details
#download(url) ⇒ 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 a wordlist from the URL.
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/ronin/wordlists/cli/commands/download.rb', line 92 def download(url) log_info "Downloading wordlist #{url} ..." begin downloaded_wordlist = wordlist_dir.download(url) log_info "Wordlist #{downloaded_wordlist.name} downloaded" rescue DownloadFailed => error log_error error. exit(2) end end |
#run(name_or_url) ⇒ 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-wordlists download
command.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/ronin/wordlists/cli/commands/download.rb', line 68 def run(name_or_url) if name_or_url =~ %r{\A(?:git|http|https)://} url = name_or_url download(url) else index = WordlistIndex.load name = name_or_url if (entry = index[name]) download(entry.url) else print_error "unknown wordlist: #{name}" exit(1) end end end |