Method: Rex::Text.hex_to_raw

Defined in:
lib/rex/text.rb

.hex_to_raw(str) ⇒ Object

Converts a hex string to a raw string

Examples:

Rex::Text.hex_to_raw("\\x41\\x7f\\x42") # => "A\x7fB"


960
961
962
# File 'lib/rex/text.rb', line 960

def self.hex_to_raw(str)
  [ str.downcase.gsub(/'/,'').gsub(/\\?x([a-f0-9][a-f0-9])/, '\1') ].pack("H*")
end