Module: Ronin::CLI::KeyOptions Private
- Included in:
- Commands::CipherCommand, Commands::Hmac, Commands::Xor
- Defined in:
- lib/ronin/cli/key_options.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Adds the --key
and --key-file
options to a command.
Instance Attribute Summary collapse
-
#key ⇒ String
readonly
private
The key string.
Class Method Summary collapse
-
.included(command) ⇒ Object
private
Adds the
--key
and--key-file
options to the including command.
Instance Attribute Details
#key ⇒ String (readonly)
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.
The key string.
56 57 58 |
# File 'lib/ronin/cli/key_options.rb', line 56 def key @key 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 --key
and --key-file
options to the including command.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ronin/cli/key_options.rb', line 31 def self.included(command) command.option :key, short: '-k', value: { type: String, usage: 'STRING' }, desc: 'The key String' do |string| @key = string end command.option :key_file, short: '-K', value: { type: String, usage: 'FILE' }, desc: 'The key file' do |path| @key = File.binread(path) rescue Errno::ENOENT raise(OptionParser::InvalidArgument,"no such file or directory: #{path.inspect}") end end |