kitty.model.low_level.container_mutator module

Container mutators treat fields of the container as atomic blocks, and perform mutations over the collection of the field.

Examples of such mutations are:
remove fields from the rendered payload repeat fields in the rendered payload change the order of fields etc.
class kitty.model.low_level.container_mutator.DuplicateMutator(field_count, dup_num, fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]

Bases: kitty.model.low_level.container_mutator.FieldRangeMutator

Duplicate X fields Y times in the final payload

__init__(field_count, dup_num, fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]
Parameters:
  • field_count – how many (sequential) fields to duplicate
  • dup_num – how many times to duplicate each of the field
  • fields (field or iterable of fields) – enclosed field(s) (default: [])
  • delim (field) – delimiter between elements in the list (default: None)
  • encoder (BitsEncoder) – encoder for the container (default: ENC_BITS_DEFAULT)
  • fuzzable – is container fuzzable (default: True)
  • name – (unique) name of the container (default: None)
Example:
DuplicateMutator(field_count=2, dup_num=2, fields=[
    Static('A'),
    Static('B'),
    Static('C'),
    Static('D'),
])

will result in: AABBCD, ABBCCD, ABCCDD

class kitty.model.low_level.container_mutator.FieldRangeMutator(field_count, fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]

Bases: kitty.model.low_level.container.Container

Base class for mutating a field range, it should not be instantiated. Mutators are intended to be used internally in the framework, not in the template declaration directly, and as such, they provide empty response when not mutated.

__init__(field_count, fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]
Parameters:
  • field_count – how many fields to omit in each mutation
  • fields (field or iterable of fields) – enclosed field(s) (default: [])
  • delim (field) – delimiter between elements in the list (default: None)
  • encoder (BitsEncoder) – encoder for the container (default: ENC_BITS_DEFAULT)
  • fuzzable – is container fuzzable (default: True)
  • name – (unique) name of the container (default: None)
is_default()[source]
render(ctx=None)[source]
reset()[source]
class kitty.model.low_level.container_mutator.List(fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]

Bases: kitty.model.low_level.container.OneOf

Describe a list of elements in the template. In addition to the standard mutations of its element, a List also performs mutation of full elements, by reordering, duplicating and omitting them.

__init__(fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]
Parameters:
  • fields (field or iterable of fields) – enclosed field(s) (default: [])
  • delim (field) – delimiter between elements in the list (default: None)
  • encoder (BitsEncoder) – encoder for the container (default: ENC_BITS_DEFAULT)
  • fuzzable – is container fuzzable (default: True)
  • name – (unique) name of the container (default: None)
Example:
List([
    BE32(name='id1', value=1),
    BE32(name='id2', value=2),
    BE32(name='id3', value=10),
    BE32(name='id4', value=50),
])
class kitty.model.low_level.container_mutator.OmitMutator(field_count, fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]

Bases: kitty.model.low_level.container_mutator.FieldRangeMutator

Omit X fields from the final payload

Example:
OmitMutator(field_count=1, fields=[
    Static('A'),
    Static('B'),
    Static('C'),
    Static('D'),
])

will result in: BCD, ACD, ABD, ABC

class kitty.model.low_level.container_mutator.RotateMutator(field_count, fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]

Bases: kitty.model.low_level.container_mutator.FieldRangeMutator

Perform rotation of X fields in the final payload

__init__(field_count, fields=[], delim=None, encoder=<kitty.model.low_level.encoder.BitsEncoder object>, fuzzable=True, name=None)[source]
Parameters:
  • field_count – how many fields to omit in each mutation
  • fields (field or iterable of fields) – enclosed field(s) (default: [])
  • delim (field) – delimiter between elements in the list (default: None)
  • encoder (BitsEncoder) – encoder for the container (default: ENC_BITS_DEFAULT)
  • fuzzable – is container fuzzable (default: True)
  • name – (unique) name of the container (default: None)
Example:
RotateMutator(field_count=3, fields=[
    Static('A'),
    Static('B'),
    Static('C'),
    Static('D'),
])

will result in: BCAD, CABD, ACDB, ADBC