Method: Rex::Text.from_ebcdic_rex

Defined in:
lib/rex/text.rb

.from_ebcdic_rex(str) ⇒ Object

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



413
414
415
416
417
418
419
420
421
422
423
# File 'lib/rex/text.rb', line 413

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