Method: #rand_text_alpha

Defined in:
lib/rex/zip/samples/mkwar.rb

#rand_text_alpha(len) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rex/zip/samples/mkwar.rb', line 18

def rand_text_alpha(len)
  buff = ""

  foo = []
  foo += ('A' .. 'Z').to_a
  foo += ('a' .. 'z').to_a

  # Generate a buffer from the remaining bytes
  if foo.length >= 256
    len.times { buff << Kernel.rand(256) }
  else
    len.times { buff << foo[ rand(foo.length) ] }
  end

  return buff
end