Method: Rex::Text.randomize_space
- Defined in:
- lib/rex/text/randomize.rb
.randomize_space(str) ⇒ Object
Randomize the whitespace in a string
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rex/text/randomize.rb', line 51 def self.randomize_space(str) set = ["\x09", "\x20", "\x0d", "\x0a"] str.gsub(/\s+/) { |s| len = rand(50)+2 buf = '' while (buf.length < len) buf << set.sample end buf } end |