Module: Ronin::Wordlists::CLI::WordlistOption
- Defined in:
- lib/ronin/wordlists/cli/wordlist_option.rb
Overview
Adds the -W,--wordlist {NAME | PATH}
option to a command that includes
WordlistOption.
Instance Attribute Summary collapse
-
#wordlist ⇒ ::Wordlist?
readonly
The opened wordlist file.
Class Method Summary collapse
-
.included(command) ⇒ Object
private
Adds the
-W,--wordlist {NAME | PATH}
option to the command including WordlistOption.
Instance Attribute Details
#wordlist ⇒ ::Wordlist? (readonly)
The opened wordlist file.
62 63 64 |
# File 'lib/ronin/wordlists/cli/wordlist_option.rb', line 62 def wordlist @wordlist end |
Class Method Details
.included(command) ⇒ 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.
Adds the -W,--wordlist {NAME | PATH}
option to the command including
Ronin::Wordlists::CLI::WordlistOption.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ronin/wordlists/cli/wordlist_option.rb', line 42 def self.included(command) command.option :wordlist, short: '-W', value: { type: String, usage: '{NAME | PATH}' }, desc: 'The wordlist name or file' do |path_or_name| @wordlist = if File.file?(path_or_name) Wordlist.open(path_or_name) else Wordlists.open(path_or_name) end rescue WordlistNotFound => error raise(OptionParser::InvalidArgument,"unknown wordlist: #{error.}") end end |