Class: Unisec::CLI::Commands::Dump::Reverse

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/unisec/cli/dump.rb

Overview

CLI command unisec dump rev for the method Hexdump.reverse from the lib.

Example:

$ unisec dump rev 0a0d --enc=utf16be
਍ (U+0A0D) - 0a0d

$ unisec dump rev 808080 --enc=utf8 --exact=false
񀀀 (U+40000) - f1 80 80 80
򀀀 (U+80000) - f2 80 80 80
󀀀 (U+C0000) - f3 80 80 80
􀀀 (U+100000) - f4 80 80 80

Instance Method Summary collapse

Instance Method Details

#call(hexbytes: nil, **options) ⇒ Object

Search X byte(s) hexadecimal value in Y encoding, basically which characters will give this resulting encoded value

Parameters:

  • hexbytes (String) (defaults to: nil)

    The target encoding in which to search.



160
161
162
163
# File 'lib/unisec/cli/dump.rb', line 160

def call(hexbytes: nil, **options)
  hexbytes = $stdin.read.chomp if hexbytes == '-'
  puts Unisec::Hexdump.display_reverse(hexbytes, options[:enc], exact: options[:exact].to_bool)
end