Method: Rex::Text.to_ebcdic_rex

Defined in:
lib/rex/text.rb

.to_ebcdic_rex(str) ⇒ Object

A native implementation of the ASCII->EBCDIC table, used to fall back from using Iconv



399
400
401
402
403
404
405
406
407
408
409
# File 'lib/rex/text.rb', line 399

def self.to_ebcdic_rex(str)
  new_str = []
  str.each_byte do |x|
    if Iconv_ASCII.index(x.chr)
      new_str << Iconv_EBCDIC[Iconv_ASCII.index(x.chr)]
    else
      raise Rex::Text::IllegalSequence, ("\\x%x" % x)
    end
  end
  new_str.join
end