Changeset 5494

Show
Ignore:
Timestamp:
04/23/08 01:54:00 (3 weeks ago)
Author:
egypt
Message:

add whitespace randomization to Rex::Text. Will update modules to use this instead of copy-paste

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework3/trunk/lib/rex/text.rb

    r5490 r5494  
    792792        end 
    793793 
     794        # 
     795        # Randomize the whitespace in a string 
     796        # 
     797        def self.randomize_space(str) 
     798                str.gsub(/\s+/) { |s| 
     799                        len = rand(50)+2 
     800                        set = "\x09\x20\x0d\x0a" 
     801                        buf = '' 
     802                        while (buf.length < len) 
     803                                buf << set[rand(set.length)].chr 
     804                        end 
     805                         
     806                        buf 
     807                } 
     808        end 
     809 
    794810        # Returns true if zlib can be used. 
    795811        def self.zlib_present?