Class: Ronin::CLI::Commands::Rot Private
- Inherits:
-
StringProcessorCommand
- Object
- Core::CLI::Command
- Ronin::CLI::Command
- FileProcessorCommand
- StringProcessorCommand
- Ronin::CLI::Commands::Rot
- Defined in:
- lib/ronin/cli/commands/rot.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.
Rotates each character of data within an alphabet.
Usage
ronin rot [] [FILE ...]
Options
-f, --file FILE Optional file to process
--string STRING Optional string to process
-M, --multiline Process each line separately
--keep-newlines Preserves newlines at the end of each line
-A, --alphabet ABC... Alphabet characters
-n, --modulo NUM Number of characters to rotate (Default: 13)
-h, --help Print help information
Arguments
[FILE ...] Optional file(s) to process
Instance Attribute Summary collapse
-
#alphabets ⇒ Array<Array<String>>
readonly
private
The alphabets to rotate within.
-
#modulo ⇒ Integer
readonly
private
The number of characters to rotate.
Attributes inherited from StringProcessorCommand
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Rot
constructor
private
Initializes the
ronin rot
command. -
#process_string(string) ⇒ String
private
Rotates each character in the string.
Methods inherited from StringProcessorCommand
#print_string, #process_input, #run
Methods inherited from FileProcessorCommand
#open_file, #process_file, #process_input, #run
Constructor Details
#initialize(**kwargs) ⇒ Rot
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 the ronin rot
command.
88 89 90 91 92 93 |
# File 'lib/ronin/cli/commands/rot.rb', line 88 def initialize(**kwargs) super(**kwargs) @modulo = 13 @alphabets = [] end |
Instance Attribute Details
#alphabets ⇒ Array<Array<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 alphabets to rotate within.
80 81 82 |
# File 'lib/ronin/cli/commands/rot.rb', line 80 def alphabets @alphabets end |
#modulo ⇒ Integer (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 number of characters to rotate.
75 76 77 |
# File 'lib/ronin/cli/commands/rot.rb', line 75 def modulo @modulo end |
Instance Method Details
#process_string(string) ⇒ String
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.
Rotates each character in the string.
104 105 106 107 108 109 110 |
# File 'lib/ronin/cli/commands/rot.rb', line 104 def process_string(string) unless @alphabets.empty? Support::Crypto.rot(string,@modulo, alphabets: @alphabets) else Support::Crypto.rot(string,@modulo) end end |