class Ronin::CLI::Commands::Xor
XORs each character of data with a key.
## Usage
ronin xor [options] [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
Public Instance Methods
process_string(string)
click to toggle source
XORs the string.
@param [String] string
The input string.
@return [String]
The XORed string.
# 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)
click to toggle source
Runs the ‘ronin xor` command.
@param [Array<String>] files
Additional files to process.
Calls superclass method
# 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