primitives Package

primitives Package

base Module

class sulley.primitives.base.base[source]

Bases: object

The primitive base class implements common functionality shared across most primitives.

Most of these methods get overridden in their respective classes anyway.

mutate()[source]

Mutate the primitive by stepping through the fuzz library, return False on completion.

Iterates until the mutant_index == self.num_mutation()

Return type:Boolean
Returns:True on success, False otherwise.
num_mutations()[source]

Calculate and return the total number of mutations for this individual primitive.

Return type:Integer
Returns:Number of mutated forms this primitive can take
render()[source]

Nothing fancy on render, simply return the value.

reset()[source]

Reset this primitive to the starting mutation state.

bit_field Module

class sulley.primitives.bit_field.bit_field(value, width, max_num=None, endian='<', format='binary', signed=False, full_range=False, fuzzable=True, name=None)[source]

Bases: sulley.primitives.base.base

add_integer_boundaries(integer)[source]

Add the supplied integer and border cases to the integer fuzz heuristics library.

Parameters:integer (Int) – Integer to append to fuzz heuristics
render()[source]

Render the primitive.

to_binary(number=None, bit_count=None)[source]

Convert a number to a binary string.

Parameters:
  • number (Integer) – (Optional, def=self.value) Number to convert
  • bit_count (Integer) – (Optional, def=self.width) Width of bit string
Return type:

String

Returns:

Bit string

to_decimal(binary)[source]

Convert a binary string to a decimal number.

Parameters:binary (String) – Binary string
Return type:Integer
Returns:Converted bit string

byte Module

class sulley.primitives.byte.byte(value, endian='<', format='binary', signed=False, full_range=False, fuzzable=True, name=None)[source]

Bases: sulley.primitives.bit_field.bit_field

delim Module

class sulley.primitives.delim.delim(value, fuzzable=True, name=None)[source]

Bases: sulley.primitives.base.base

group Module

class sulley.primitives.group.group(name, values)[source]

Bases: sulley.primitives.base.base

mutate()[source]

Move to the next item in the values list.

Return type:False
Returns:False
num_mutations()[source]

Number of values in this primitive.

Return type:Integer
Returns:Number of values in this primitive.

qword Module

class sulley.primitives.qword.qword(value, endian='<', format='binary', signed=False, full_range=False, fuzzable=True, name=None)[source]

Bases: sulley.primitives.bit_field.bit_field

random_data Module

class sulley.primitives.random_data.random_data(value, min_length, max_length, max_mutations=25, fuzzable=True, step=None, name=None)[source]

Bases: sulley.primitives.base.base

mutate()[source]

Mutate the primitive value returning False on completion.

Return type:Boolean
Returns:True on success, False otherwise.
num_mutations()[source]

Calculate and return the total number of mutations for this individual primitive.

Return type:Integer
Returns:Number of mutated forms this primitive can take

static Module

class sulley.primitives.static.static(value, name=None)[source]

Bases: sulley.primitives.base.base

mutate()[source]

Do nothing.

Return type:False
Returns:False
num_mutations()[source]

Return 0.

Return type:0
Returns:0

string Module

class sulley.primitives.string.string(value, size=-1, padding='x00', encoding='ascii', fuzzable=True, max_len=0, name=None)[source]

Bases: sulley.primitives.base.base

add_long_strings(sequence)[source]

Given a sequence, generate a number of selectively chosen strings lengths of the given sequence and add to the string heuristic library.

@type sequence: String @param sequence: Sequence to repeat for creation of fuzz strings.

fuzz_library = []
mutate()[source]

Mutate the primitive by stepping through the fuzz library extended with the “this” library, return False on completion.

Return type:Boolean
Returns:True on success, False otherwise.
num_mutations()[source]

Calculate and return the total number of mutations for this individual primitive.

Return type:Integer
Returns:Number of mutated forms this primitive can take
render()[source]

Render the primitive, encode the string according to the specified encoding.

word Module

class sulley.primitives.word.word(value, endian='<', format='binary', signed=False, full_range=False, fuzzable=True, name=None)[source]

Bases: sulley.primitives.bit_field.bit_field