Ejemplo n.º 1
0
def s_random(value,
             min_length,
             max_length,
             num_mutations=25,
             fuzzable=True,
             step=None,
             name=None):
    '''
    Generate a random chunk of data while maintaining a copy of the original. A random length range can be specified.
    For a static length, set min/max length to be the same.

    @type  value:         Raw
    @param value:         Original value
    @type  min_length:    Integer
    @param min_length:    Minimum length of random block
    @type  max_length:    Integer
    @param max_length:    Maximum length of random block
    @type  num_mutations: Integer
    @param num_mutations: (Optional, def=25) Number of mutations to make before reverting to default
    @type  fuzzable:      Boolean
    @param fuzzable:      (Optional, def=True) Enable/disable fuzzing of this primitive
    @type  step:          Integer
    @param step:          (Optional, def=None) If not null, step count between min and max reps, otherwise random
    @type  name:          String
    @param name:          (Optional, def=None) Specifying a name gives you direct access to a primitive
    '''

    random = primitives.random_data(value, min_length, max_length,
                                    num_mutations, fuzzable, step, name)
    blocks.CURRENT.push(random)
Ejemplo n.º 2
0
def s_random(value, min_length, max_length, num_mutations=25, fuzzable=True, step=None, heuristic=None, name=None):
    """
    Generate a random chunk of data while maintaining a copy of the original. A random length range can be specified.
    For a static length, set min/max length to be the same.

    @type  value:         Raw
    @param value:         Original value
    @type  min_length:    Integer
    @param min_length:    Minimum length of random block
    @type  max_length:    Integer
    @param max_length:    Maximum length of random block
    @type  num_mutations: Integer
    @param num_mutations: (Optional, def=25) Number of mutations to make before reverting to default
    @type  fuzzable:      Boolean
    @param fuzzable:      (Optional, def=True) Enable/disable fuzzing of this primitive
    @type  step:          Integer
    @param step:          (Optional, def=None) If not null, step count between min and max reps, otherwise random
    @param heuristic:     (Optional, def=None) Heuristic to compute a list of wanted random value length
    @type  name:          String
    @type  name:          String
    @param name:          (Optional, def=None) Specifying a name gives you direct access to a primitive
    """

    random = primitives.random_data(value, min_length, max_length, num_mutations, fuzzable, step, heuristic, name)
    blocks.CURRENT.push(random)
Ejemplo n.º 3
0
def s_random (value, min_length, max_length, num_mutations=25, fuzzable=True, name=None):
    '''
    Generate a random chunk of data while maintaining a copy of the original. A random length range can be specified.
    For a static length, set min/max length to be the same.

    @type  value:         Raw
    @param value:         Original value
    @type  min_length:    Integer
    @param min_length:    Minimum length of random block
    @type  max_length:    Integer
    @param max_length:    Maximum length of random block
    @type  num_mutations: Integer
    @param num_mutations: (Optional, def=25) Number of mutations to make before reverting to default
    @type  fuzzable:      Boolean
    @param fuzzable:      (Optional, def=True) Enable/disable fuzzing of this primitive
    @type  name:          String
    @param name:          (Optional, def=None) Specifying a name gives you direct access to a primitive
    '''

    random = primitives.random_data(value, min_length, max_length, num_mutations, fuzzable, name)
    blocks.CURRENT.push(random)
Ejemplo n.º 4
0
 def push_bson_doc(self, doc):
     self.block.push(random_data(BSON.encode(doc), min_length=0,
                     max_length=MAX_BSON_SIZE))