Class: Ronin::CLI::Commands::CipherCommand Private
- Inherits:
-
FileProcessorCommand
- Object
- Core::CLI::Command
- Ronin::CLI::Command
- FileProcessorCommand
- Ronin::CLI::Commands::CipherCommand
- Includes:
- KeyOptions
- Defined in:
- lib/ronin/cli/cipher_command.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.
Base class for all commands which use ciphers.
Instance Attribute Summary
Attributes included from KeyOptions
Instance Method Summary collapse
-
#cipher(**kwargs) ⇒ Ronin::Support::Crypto::Cipher
private
Initializes a new cipher.
-
#open_file(path) {|file| ... } ⇒ File?
private
Opens the file in binary mode.
-
#process_input(input) ⇒ Object
private
Decrypts the input stream.
-
#run(*files) ⇒ Object
private
Runs the
ronin encrypt
command.
Methods included from KeyOptions
Methods inherited from FileProcessorCommand
Instance Method Details
#cipher(**kwargs) ⇒ Ronin::Support::Crypto::Cipher
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.
Initializes a new cipher.
129 130 131 132 133 134 135 136 |
# File 'lib/ronin/cli/cipher_command.rb', line 129 def cipher(**kwargs) Support::Crypto::Cipher.new( [:cipher], key: @key, hash: [:hash], password: [:password], **kwargs ) end |
#open_file(path) {|file| ... } ⇒ File?
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.
Opens the file in binary mode.
115 116 117 |
# File 'lib/ronin/cli/cipher_command.rb', line 115 def open_file(path,&block) super(path,'rb',&block) end |
#process_input(input) ⇒ 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.
Decrypts the input stream.
144 145 146 |
# File 'lib/ronin/cli/cipher_command.rb', line 144 def process_input(input) cipher.stream(input, block_size: @block_size, output: stdout) end |
#run(*files) ⇒ 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 encrypt
command.
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ronin/cli/cipher_command.rb', line 84 def run(*files) if [:list_ciphers] puts Support::Crypto::Cipher.supported return end unless ([:key] || [:key_file] || [:password]) print_error "must specify --password, --key, or --key-file" exit(1) end super(*files) end |