Method: Rex::Encoder::NonAlpha.encode

Defined in:
lib/rex/encoder/nonalpha.rb

.encode(buf) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rex/encoder/nonalpha.rb', line 46

def NonAlpha.encode(buf)
  table = ""
  tablelen = 0
  nonascii = ""
  encoded = gen_decoder()
  buf.each_byte { |block|
    newchar, table, tablelen = encode_byte(block.unpack('C')[0], table, tablelen)
    nonascii += newchar
  }
  encoded.gsub!(/A/, tablelen)
  encoded.gsub!(/B/, tablelen+5)
  encoded += table
  encoded += nonascii
end