OWASP O2 Platform Blog

O2Script: Not Optimized fuzz string generator

Here is a very non-optimized fuzz string generator (a value of 5 generates about 10Million items, and one of the bottlenecks is in the use of List<string> to hold the data)

var baseChars = new List<char>();

for(var letter = 'a' ; letter < 'z' ; letter++)
    baseChars.Add(letter);

 

Func<List<char>,string, int, List<String>> generateStrings = null;
generateStrings = (chars, prefix, depth) =>    {
                                                if (depth-- > 0)
                                                {                                                   
                                                    var strings = new List<string>();
                                                    foreach(var @char in chars)                                                   
                                                        strings.Add(prefix + @char);
                                                   
                                                    var newStrings = new List<string>();
                                                    foreach(var @string in strings)                                                                       
                                                        newStrings.AddRange(generateStrings(chars, @string, depth));   
                                                    strings.AddRange(newStrings);
                                                    return strings;
                                                }
                                                return new List<string>();
                                              };
                                 
var fuzzStrings =     generateStrings(baseChars, "", 4); 
return fuzzStrings.size();

April 4, 2011 - Posted by | Misc Topics

1 Comment »

  1. […] O2Script: Not Optimized fuzz string generator […]

    Pingback by Script to fetch and present large number of Wordpress.com blog entries « O2Platform.com for Developers | April 16, 2011 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: