Package sulley :: Module primitives :: Class bit_field
[show private | hide private]
[frames | no frames]

Type bit_field

    object --+    
             |    
base_primitive --+
                 |
                bit_field

Known Subclasses:
byte, dword, qword, word

Method Summary
  __init__(self, value, width, max_num, endian, format, signed, full_range, fuzzable, name)
The bit field primitive represents a number of variable length and is used to define all other integer types.
  add_integer_boundaries(self, integer)
Add the supplied integer and border cases to the integer fuzz heuristics library.
  render(self)
Render the primitive.
String to_binary(self, number, bit_count)
Convert a number to a binary string.
Integer to_decimal(self, binary)
Convert a binary string to a decimal number.
    Inherited from base_primitive
Integer exhaust(self)
Exhaust the possible mutations for this primitive.
Boolean mutate(self)
Mutate the primitive by stepping through the fuzz library, return False on completion.
Integer num_mutations(self)
Calculate and return the total number of mutations for this individual primitive.
  reset(self)
Reset this primitive to the starting mutation state.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(self, value, width, max_num=None, endian='<', format='binary', signed=False, full_range=False, fuzzable=True, name=None)
(Constructor)

The bit field primitive represents a number of variable length and is used to define all other integer types.
Parameters:
value - Default integer value
           (type=Integer)
width - Width of bit fields
           (type=Integer)
endian - (Optional, def=LITTLE_ENDIAN) Endianess of the bit field (LITTLE_ENDIAN: <, BIG_ENDIAN: >)
           (type=Character)
format - (Optional, def=binary) Output format, "binary" or "ascii"
           (type=String)
signed - (Optional, def=False) Make size signed vs. unsigned (applicable only with format="ascii")
           (type=Boolean)
full_range - (Optional, def=False) If enabled the field mutates through *all* possible values.
           (type=Boolean)
fuzzable - (Optional, def=True) Enable/disable fuzzing of this primitive
           (type=Boolean)
name - (Optional, def=None) Specifying a name gives you direct access to a primitive
           (type=String)
Overrides:
sulley.primitives.base_primitive.__init__

add_integer_boundaries(self, integer)

Add the supplied integer and border cases to the integer fuzz heuristics library.
Parameters:
integer - Integer to append to fuzz heuristics
           (type=Int)

render(self)

Render the primitive.
Overrides:
sulley.primitives.base_primitive.render

to_binary(self, number=None, bit_count=None)

Convert a number to a binary string.
Parameters:
number - (Optional, def=self.value) Number to convert
           (type=Integer)
bit_count - (Optional, def=self.width) Width of bit string
           (type=Integer)
Returns:
Bit string
           (type=String)

to_decimal(self, binary)

Convert a binary string to a decimal number.
Parameters:
binary - Binary string
           (type=String)
Returns:
Converted bit string
           (type=Integer)

Generated by Epydoc 2.1 on Fri Jul 27 17:40:03 2007 http://epydoc.sf.net