Class: Ronin::CLI::Commands::Xor Private
- Inherits:
-
StringProcessorCommand
- Object
- Core::CLI::Command
- Ronin::CLI::Command
- FileProcessorCommand
- StringProcessorCommand
- Ronin::CLI::Commands::Xor
- Includes:
- KeyOptions
- Defined in:
- lib/ronin/cli/commands/xor.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.
XORs each character of data with a key.
Usage
ronin xor [] [FILE ...]
Options
-f, --file FILE Optional file to process
--string STRING Optional string to process
-M, --multiline Process each line separately
-n, --keep-newlines Preserves newlines at the end of each line
-k, --key STRING The key String
-K, --key-file FILE The key file
-h, --help Print help information
Arguments
[FILE ...] Optional file(s) to process
Instance Attribute Summary
Attributes included from KeyOptions
Attributes inherited from StringProcessorCommand
Instance Method Summary collapse
-
#process_string(string) ⇒ String
private
XORs the string.
-
#run(*files) ⇒ Object
private
Runs the
ronin xor
command.
Methods included from KeyOptions
Methods inherited from StringProcessorCommand
#initialize, #print_string, #process_input
Methods inherited from FileProcessorCommand
#open_file, #process_file, #process_input
Constructor Details
This class inherits a constructor from Ronin::CLI::StringProcessorCommand
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.
XORs the string.
80 81 82 83 84 85 86 |
# File 'lib/ronin/cli/commands/xor.rb', line 80 def process_string(string) xored_string = Support::Crypto.xor(string,@key) # escapes the String if outputing to a TTY xored_string = xored_string.dump if stdout.tty? return xored_string 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 xor
command.
62 63 64 65 66 67 68 69 |
# File 'lib/ronin/cli/commands/xor.rb', line 62 def run(*files) unless @key print_error "must specify --key or --key-file" exit(-1) end super(*files) end |