14.2. framework package

14.2.1. framework.basic_primitives module

fuddly.framework.basic_primitives.calc_parity_bit(x)

return 0 if the number of bits is even, otherwise returns 1

fuddly.framework.basic_primitives.corrupt_bits(s, p=0.01, n=None, ascii=False)

Flip a given percentage or number of bits from a string

fuddly.framework.basic_primitives.corrupt_bytes(s, p=0.01, n=None, ctrl_char=False)

Corrupt a given percentage or number of bytes from a string

fuddly.framework.basic_primitives.rand_string(size=None, min=1, max=10, str_set='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c')

14.2.2. framework.data module

14.2.3. framework.data_model module

14.2.4. framework.node module

14.2.5. framework.node_builder module

14.2.6. framework.value_types module

class fuddly.framework.value_types.BitField(subfield_limits=None, subfield_sizes=None, subfield_values=None, subfield_val_extremums=None, padding=0, lsb_padding=True, show_padding=False, endian=1, determinist=True, subfield_descs=None, subfield_value_descs=None, defaults=None)

Bases: VT_Alt

Provide: - either @subfield_limits or @subfield_sizes - either @subfield_values or @subfield_val_extremums

__compute_total_possible_values()

the returned number correspond to the total number of values that can be returned by the BitField in determinist mode. This number does not cover all the values such a BitField should be able to generate. Refer to get_value() comments for more information.

__init__(subfield_limits=None, subfield_sizes=None, subfield_values=None, subfield_val_extremums=None, padding=0, lsb_padding=True, show_padding=False, endian=1, determinist=True, subfield_descs=None, subfield_value_descs=None, defaults=None)
__module__ = 'fuddly.framework.value_types'
_check_constraints(sf_values)
_enable_fuzz_mode(fuzz_magnitude=1.0, only_corner_cases=False, only_corner_cases_and_extra=False, only_invalid_cases=False, node_is_optional=False)
_enable_normal_mode()
_encode_bitfield(val)
_read_value_from(blob, size, endian, constraints)

Used by .do_absorb(). side effect: may change self.padding_one dictionary.

_reset_idx(reset_idx_inuse=True)
absorb_auto_helper(blob, constraints)
after_enabling_mode()
property bit_length
property byte_length
change_subfield(idx, values=None, extremums=None)

Change the constraints on a given subfield.

Parameters:
  • idx (int) – subfield index, from 0 (low significant subfield) to nb_subfields-1 (specific index -1 is used to choose the last subfield).

  • values (list) – new values for the subfield (remove previous value list or remove previous extremums if no value list was used for this subfield)

  • extremums (list) – new extremums for the subfield (remove previous extremums or remove previous value list if no extremums were used for this subfield)

property count_of_possible_values

the returned number correspond to the total number of values that can be returned by the BitField in determinist mode. This number does not cover all the values such a BitField should be able to generate. Refer to get_value() comments for more information.

do_absorb(blob, constraints, off=0, size=None)
do_cleanup_absorb()

To be called after self.do_absorb() or self.do_revert_absorb()

do_revert_absorb()

If needed should be called just after self.do_absorb().

extend(bitfield, rightside=True)
extend_left(bitfield)
extend_right(bitfield)
get_current_raw_val()
get_current_value()

Provide the current value of the object. Should not change the state of the object except if no current values.

Returns: bytes

get_subfield(idx)
get_value()

In determinist mode, all the values such a BitField should be able to generate are not covered but only a subset of them (i.e., all combinations are not computed). It has been chosen to only keep the value based on the following algorithm: “exhaust each subfield one at a time”.

Rationale: In most cases, computing all combinations does not make sense for fuzzing purpose.

idx_from_desc(sf_desc)
is_compatible(integer, size)
is_exhausted()
make_determinist()
make_private(forget_current_state)
make_random()
padding_one = [0, 1, 3, 7, 15, 31, 63, 127]
pretty_print(max_size=None)
reset_state()
rewind()
set_bitfield(sf_values=None, sf_val_extremums=None, sf_limits=None, sf_sizes=None, sf_descs=None, sf_val_descs=None, sf_defaults=None)
set_default_value(sf_values)
set_size_from_constraints(size=None, encoded_size=None)
set_subfield(idx, val)
Parameters:
  • idx – Either an integer which should be the subfield index, from 0 (low significant subfield) to nb_subfields-1 (specific index -1 is used to choose the last subfield). Or a string which should be the description of the field.

  • val (int) – new value for the subfield

update_raw_value(val)
class fuddly.framework.value_types.Filename(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None, encoding_arg=None, values_desc=None, **kwargs)

Bases: String

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
_get_path_depth(path)
_get_path_from_value(value, knowledge)

Returned path always terminates with a separator

linux_prefix = [b'../', b'..\xc0\xaf', b'\xc0\xae\xc0\xae\xc0\xaf']
linux_specific_fnames = [b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', b'././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././TEST']
linux_suffix = [b'etc/password']
path_mode = False
subclass_specific_init(specific_suffix=None, uri_parsing=False)

Specific init for Filename

Parameters:
  • specific_suffix – List of specific suffixes that will be used for path traversal test cases in addition to the current list.

  • uri_parsing – if the filename is to be consumed as an URI

subclass_specific_test_cases(knowledge, orig_val, fuzz_magnitude=1.0)

To be overwritten by class that inherits from String if specific test cases need to be implemented

Parameters:
  • knowledge

  • orig_val

  • fuzz_magnitude

Returns:

list of test cases or None

Return type:

list

uri_prefix = [b'%2e%2e%2f', b'%2e%2e/', b'..%2f', b'..%252f', b'.%252e/', b'%2e%2e%5c', b'..%255c', b'..%c0%af', b'%c0%ae%c0%ae%c0%af']
uri_suffix = [b'MARKER.txt']
windows_prefix = [b'..\\', b'\xc0\xae\xc0\xae\\']
windows_specific_fnames = [b'PRN', b'NUL.txt', b'C:\\..\\..\\', b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.txt']
windows_suffix = [b'Windows\\system.ini']
class fuddly.framework.value_types.FolderPath(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None, encoding_arg=None, values_desc=None, **kwargs)

Bases: Filename

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
subclass_specific_test_cases(knowledge, orig_val, fuzz_magnitude=1.0)

To be overwritten by class that inherits from String if specific test cases need to be implemented

Parameters:
  • knowledge

  • orig_val

  • fuzz_magnitude

Returns:

list of test cases or None

Return type:

list

class fuddly.framework.value_types.GSM7bitPacking(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None, encoding_arg=None, values_desc=None, **kwargs)

Bases: String

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
_encoder_arg = None
_encoder_cls

alias of GSM7bitPacking_Enc

init_encoder()
class fuddly.framework.value_types.GSMPhoneNum(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None, encoding_arg=None, values_desc=None, **kwargs)

Bases: String

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
_encoder_arg = None
_encoder_cls

alias of GSMPhoneNum_Enc

init_encoder()
class fuddly.framework.value_types.GZIP(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None, encoding_arg=None, values_desc=None, **kwargs)

Bases: String

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
_encoder_arg = None
_encoder_cls

alias of GZIP_Enc

init_encoder()
class fuddly.framework.value_types.INT(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: VT

Base class to be inherited and not used directly

GEN_MAX_INT = 4294967296
GEN_MIN_INT = -4294967296
__annotations__ = {}
__init__(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)
__module__ = 'fuddly.framework.value_types'
_check_constraints_and_update(val, update=True)
_convert_value(val)
_instanciate_obj(values, fuzz_mode=False)
_read_value_from(blob, size)
_unconvert_value(val)
absorb_auto_helper(blob, constraints)
add_specific_fuzzy_vals(vals)
alt_cformat = None
cformat = None
copy_attrs_from(vt)
determinist = True
do_absorb(blob, constraints, off=0, size=None)
do_cleanup_absorb()
do_revert_absorb()

If needed should be called just after self.do_absorb().

endian = None
fuzzy_values = None
get_current_raw_val()
get_current_value()

Provide the current value of the object. Should not change the state of the object except if no current values.

Returns: bytes

get_fuzzed_vt_list(only_corner_cases=False, only_corner_cases_and_extra=False, only_invalid_cases=False)
get_specific_fuzzy_vals()
get_value()

Walk other the values of the object on a per-call basis.

Returns: bytes

is_compatible(integer)
is_exhausted()
is_invalid(val)
is_size_compatible(integer)
is_valid(val)
make_determinist()
make_private(forget_current_state)
make_random()
maxi = None
maxi_gen = None
mini = None
mini_gen = None
pretty_print(max_size=None)
reset_state()
rewind()
set_default_value(val)
set_size_from_constraints(size=None, encoded_size=None)
size = None
update_raw_value(val)
usable = False
value_space_size = None
class fuddly.framework.value_types.INT16(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
fuzzy_values = [65535, 0, 32768, 32767]
size = 16
usable = False
value_space_size = 65535
class fuddly.framework.value_types.INT32(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
fuzzy_values = [4294967295, 0, 2147483648, 2147483647]
size = 32
usable = False
value_space_size = 4294967295
class fuddly.framework.value_types.INT64(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
fuzzy_values = [18446744073709551615, 0, 9223372036854775808, 9223372036854775807, 1229782938247303441]
size = 64
usable = False
value_space_size = 18446744073709551615
class fuddly.framework.value_types.INT8(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
fuzzy_values = [255, 0, 1, 128, 127]
size = 8
usable = False
value_space_size = 255
class fuddly.framework.value_types.INT_str(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, base=10, letter_case='upper', min_size=None, reverse=False, values_desc=None)

Bases: INT

__annotations__ = {}
__init__(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, base=10, letter_case='upper', min_size=None, reverse=False, values_desc=None)
__module__ = 'fuddly.framework.value_types'
_convert_value(val)
_instanciate_obj(values, fuzz_mode=False)
_prepare_format_str(min_size, base, letter_case)
_read_value_from(blob, size)
_unconvert_value(val)
copy_attrs_from(vt)
endian = 3
fuzzy_values = [0, -1, -4294967296, 4294967295, 4294967296]
get_fuzzed_vt_list(only_corner_cases=False, only_corner_cases_and_extra=False, only_invalid_cases=False)
is_compatible(integer)
pretty_print(max_size=None)
regex_bin = b'-?[01]'
regex_decimal = b'-?\\d'
regex_lower_hex = b'-?[0123456789abcdef]'
regex_octal = b'-?[01234567]'
regex_upper_hex = b'-?[0123456789ABCDEF]'
usable = True
value_space_size = -1
class fuddly.framework.value_types.SINT16_be(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT16

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '>H'
cformat = '>h'
endian = 1
maxi = 32767
mini = -32768
usable = True
class fuddly.framework.value_types.SINT16_le(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT16

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '<H'
cformat = '<h'
endian = 2
maxi = 32767
mini = -32768
usable = True
class fuddly.framework.value_types.SINT32_be(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT32

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '>L'
cformat = '>l'
endian = 1
maxi = 2147483647
mini = -2147483648
usable = True
class fuddly.framework.value_types.SINT32_le(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT32

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '<L'
cformat = '<l'
endian = 2
maxi = 2147483647
mini = -2147483648
usable = True
class fuddly.framework.value_types.SINT64_be(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT64

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '>Q'
cformat = '>q'
endian = 1
maxi = 9223372036854775807
mini = -9223372036854775808
usable = True
class fuddly.framework.value_types.SINT64_le(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT64

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '<Q'
cformat = '<q'
endian = 2
maxi = 9223372036854775807
mini = -9223372036854775808
usable = True
class fuddly.framework.value_types.SINT8(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT8

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = 'B'
cformat = 'b'
endian = 3
maxi = 127
mini = -128
usable = True
class fuddly.framework.value_types.String(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None, encoding_arg=None, values_desc=None, **kwargs)

Bases: VT_Alt

Value type that represents a character string.

encoded_string

shall be set to True by any subclass that deals with encoding

Type:

bool

subclass_fuzzing_list

attribute to be added by subclasses that provide specific test cases.

Type:

list

ASCII = 'ascii'
DEFAULT_MAX_SZ = 10000
LATIN_1 = 'iso8859-1'
UTF16BE = 'utf-16-be'
UTF16LE = 'utf-16-le'
__annotations__ = {}
__init__(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None, encoding_arg=None, values_desc=None, **kwargs)

Initialize the String

Parameters:
  • values – Exhaustive list of character strings that are valid for the node backed by this String object. The first item of the list is the default value, except if the parameter default is provided.

  • samples – Examples of character strings that are valid for the node backed by this String object.

  • size – Valid character string size for the node backed by this String object.

  • min_sz – Minimum valid size for the character strings for the node backed by this String object. If not set, this parameter will be automatically inferred by looking at the parameter values if provided. Note this size parameter should take into account the codec parameter, meaning that min_sz will be leveraged upon strings encoded with the specified codec.

  • max_sz – Maximum valid size for the character strings for the node backed by this String object. If not set, this parameter will be automatically inferred by looking at the parameter values if provided. Note this size parameter should take into account the codec parameter, meaning that max_sz will be leveraged upon strings encoded with the specified codec.

  • determinist – If set to True generated values will be in a deterministic order, otherwise in a random order.

  • codec – codec to use for encoding the string (e.g., ‘latin-1’, ‘utf8’)

  • case_sensitive – If the string is set to be case-sensitive then specific additional test cases will be generated in fuzzing mode.

  • default – If not None, this value will be provided by default at first and also each time framework.value_types.String.reset_state() is called().

  • extra_fuzzy_list – During data generation, if this parameter is specified with some specific values, they will be part of the test cases generated by the generic operator tTYPE.

  • absorb_regexp (str) – You can specify a regular expression in this parameter as a supplementary constraint for data absorption operation.

  • alphabet – The alphabet to use for generating data, in case no values is provided, or only samples. Also used during absorption to validate the contents. It is checked if there is no values.

  • values_desc (dict) – Dictionary that maps string values to their descriptions (character strings). Leveraged for display purpose. Even if provided, all values do not need to be described.

  • min_encoded_sz – Only relevant for subclasses that leverage the encoding infrastructure. Enable to provide the minimum legitimate size for an encoded string.

  • max_encoded_sz – Only relevant for subclasses that leverage the encoding infrastructure. Enable to provide the maximum legitimate size for an encoded string.

  • encoding_arg – Only relevant for subclasses that leverage the encoding infrastructure and that allow their encoding scheme to be configured. This parameter is directly provided to String.init_encoding_scheme(). Any object that go through this parameter should support the __copy__ method.

  • kwargs – for subclass usage

__module__ = 'fuddly.framework.value_types'
__repr__()

Return repr(self).

_append_representative_values(enforce_max_enc_sz=False, enforce_min_enc_sz=False)
_bytes2str(val)
_check_alphabet(val, constraints)
_check_constraints(value: bytes, enforce_max_sz=False, enforce_min_sz=False, enforce_max_enc_sz=False, enforce_min_enc_sz=False, update_list=False)
_check_constraints_and_update(val)
_check_contents(val, val_sz, constraints)
_enable_fuzz_mode(fuzz_magnitude=1.0, only_corner_cases=False, only_corner_cases_and_extra=False, only_invalid_cases=False)
_enable_normal_mode()
_encoder_cls = None
_encoder_obj = None
_ensure_enc_sizes_consistency()
_populate_values(enforce_max_enc_sz=False, enforce_min_enc_sz=False)
_read_value_from(blob, constraints)
_str2bytes(val)
absorb_auto_helper(blob, constraints)
ctrl_char_set = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f'
decode(val)

Exclusively overloaded by the decorator @from_encoder

do_absorb(blob, constraints, off=0, size=None)

Core function for absorption.

Parameters:
  • blob – binary string on which to perform absorption

  • constraints – constraints to comply with

  • off – absorption should start at offset off from blob

  • size – if provided, size relates to the string to be absorbed (which can be encoded)

Returns:

value, off, size

do_cleanup_absorb()

To be called after self.do_absorb() or self.do_revert_absorb()

do_revert_absorb()

If needed should be called just after self.do_absorb(). (safe to recall it more than once)

encode(val)

Exclusively overloaded by the decorator @from_encoder

encoded_string = False
encoding_test_cases(current_val, max_sz, min_sz, min_encoded__sz, max_encoded_sz)

To be optionally overloaded by a subclass that deals with encoding in order to provide specific test cases on encoding scheme.

Parameters:
  • current_val – the current value (not encoded)

  • max_sz – maximum size for a not encoded string

  • min_sz – minimum size for a not encoded string

  • min_encoded_sz – minimum encoded size for a string

  • max_encoded_sz – maximum encoded size for a string

Returns:

the list of encoded test cases

Return type:

list

extended_char_set = '\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
static fuzz_cases_c_strings(knowledge, orig_val, sz, fuzz_magnitude)

Produces test cases relevant for C strings This method is also used by INT_str()

Parameters:
  • knowledge

  • orig_val

  • sz

  • fuzz_magnitude

Returns:

static fuzz_cases_ctrl_chars(knowledge, orig_val, sz, max_sz, codec)

Produces test cases relevant when control characters are interpreted by the consumer This method is also used by INT_str()

Parameters:
  • knowledge

  • orig_val

  • sz

  • max_sz

  • codec

Returns:

static fuzz_cases_letter_case(knowledge, orig_val)

Produces test cases relevant if the described element is case sensitive.

Parameters:
  • knowledge

  • orig_val

Returns:

get_current_raw_val(str_form=False)
get_current_value()

Provide the current value of the object. Should not change the state of the object except if no current values.

Returns: bytes

get_value()

Walk other the values of the object on a per-call basis.

Returns: bytes

init_encoder = None
is_exhausted()
is_invalid(val)
is_valid(val)
make_determinist()
make_private(forget_current_state)
make_random()
non_ctrl_char = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
pretty_print(max_size=None)
printable_char_set = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
reset_encoder()
reset_state()
rewind()
set_default_value(val)
set_description(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None)

@size take precedence over @min_sz and @max_sz

set_size_from_constraints(size=None, encoded_size=None)
subclass_specific_init(**kwargs)

To be overwritten by class that inherits from String if specific init is necessary, for instance new parameters.

Parameters:

**kwargs

Returns:

subclass_specific_test_cases(knowledge, orig_val, fuzz_magnitude)

To be overwritten by class that inherits from String if specific test cases need to be implemented

Parameters:
  • knowledge

  • orig_val

  • fuzz_magnitude

Returns:

list of test cases or None

Return type:

list

class fuddly.framework.value_types.UINT16_be(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT16

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '>h'
cformat = '>H'
endian = 1
maxi = 65535
mini = 0
usable = True
class fuddly.framework.value_types.UINT16_le(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT16

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '<h'
cformat = '<H'
endian = 2
maxi = 65535
mini = 0
usable = True
class fuddly.framework.value_types.UINT32_be(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT32

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '>l'
cformat = '>L'
endian = 1
maxi = 4294967295
mini = 0
usable = True
class fuddly.framework.value_types.UINT32_le(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT32

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '<l'
cformat = '<L'
endian = 2
maxi = 4294967295
mini = 0
usable = True
class fuddly.framework.value_types.UINT64_be(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT64

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '>q'
cformat = '>Q'
endian = 1
maxi = 18446744073709551615
mini = 0
usable = True
class fuddly.framework.value_types.UINT64_le(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT64

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = '<q'
cformat = '<Q'
endian = 2
maxi = 18446744073709551615
mini = 0
usable = True
class fuddly.framework.value_types.UINT8(values=None, min=None, max=None, default=None, determinist=True, force_mode=False, fuzz_mode=False, values_desc=None)

Bases: INT8

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
alt_cformat = 'b'
cformat = 'B'
endian = 3
maxi = 255
mini = 0
usable = True
class fuddly.framework.value_types.VT

Bases: object

Base class to implement Types that are leveraged by typed nodes

BigEndian = 1
LittleEndian = 2
Native = 3
__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
_node_is_optional = None
add_specific_fuzzy_vals(vals)
copy_attrs_from(vt)
enc2struct = {1: '>', 2: '<', 3: '='}
endian = None
get_current_raw_val()
get_current_value()

Provide the current value of the object. Should not change the state of the object except if no current values.

Returns: bytes

get_fuzzed_vt_list(only_corner_cases=False, only_corner_cases_and_extra=False, only_invalid_cases=False)
get_specific_fuzzy_vals()
get_value()

Walk other the values of the object on a per-call basis.

Returns: bytes

is_exhausted()
property is_optional
knowledge_source = None
make_determinist()
make_private(forget_current_state)
make_random()
maxi = None
mini = None
pretty_print(max_size=None)
reset_state()
rewind()
set_default_value(val)
set_size_from_constraints(size=None, encoded_size=None)
class fuddly.framework.value_types.VT_Alt

Bases: VT

__annotations__ = {}
__init__()
__module__ = 'fuddly.framework.value_types'
_enable_fuzz_mode(fuzz_magnitude=1.0, only_corner_cases=False, only_corner_cases_and_extra=False, only_invalid_cases=False)
_enable_normal_mode()
add_specific_fuzzy_vals(vals)
after_enabling_mode()
enable_fuzz_mode(fuzz_magnitude=1.0, only_corner_cases=False, only_corner_cases_and_extra=False, only_invalid_cases=False)
enable_normal_mode()
property fuzz_mode_enabled
get_specific_fuzzy_vals()
switch_mode()
class fuddly.framework.value_types.Wrapper(values=None, samples=None, size=None, min_sz=None, max_sz=None, determinist=True, codec='latin-1', case_sensitive=True, default=None, extra_fuzzy_list=None, absorb_regexp=None, alphabet=None, min_encoded_sz=None, max_encoded_sz=None, encoding_arg=None, values_desc=None, **kwargs)

Bases: String

__annotations__ = {}
__module__ = 'fuddly.framework.value_types'
_encoder_arg = None
_encoder_cls

alias of Wrap_Enc

init_encoder()
fuddly.framework.value_types.from_encoder(encoder_cls, encoding_arg=None)

14.2.7. framework.generic_data_makers module

14.2.8. framework.target_helpers module

14.2.9. framework.targets.network module

14.2.10. framework.targets.local module

14.2.11. framework.targets.sim module

14.2.12. framework.targets.ssh module

14.2.13. framework.targets.printer module

14.2.14. framework.targets.debug module

14.2.15. framework.project module

14.2.16. framework.director_helpers module

14.2.17. framework.logger module

14.2.18. framework.monitor module

exception fuddly.framework.monitor.AddExistingProbeToMonitorError(probe_name)

Bases: Exception

Raised when a probe is being added a second time in a monitor

__init__(probe_name)
__module__ = 'fuddly.framework.monitor'
property probe_name
class fuddly.framework.monitor.BlockingProbeUser(probe, after_target_feedback_retrieval)

Bases: ProbeUser

__init__(probe, after_target_feedback_retrieval)
__module__ = 'fuddly.framework.monitor'
_clear()

Clear all events

_notify_armed()
_notify_status_retrieved()
_run(*args, **kwargs)
_wait_for_data_ready()

Wait on a request to arm

Returns:

True if the arm event happened, False if a stop was asked

or an error was signaled

Return type:

bool

_wait_for_fmk_sync()

Wait on a blocking event: data sent or timeout

Returns:

True if the blocking event happened, False if a stop was

asked or an error was signaled

Return type:

bool

property after_target_feedback_retrieval
notify_blocking()
notify_data_ready()
notify_error()

Informs the probe of an error

stop()
wait_until_armed(timeout=None)
wait_until_ready(timeout=None)
class fuddly.framework.monitor.Monitor

Bases: object

__init__()
__module__ = 'fuddly.framework.monitor'
_get_probe_ref(probe)
_wait_for_specific_probes(probe_user_class, probe_user_wait_method, probes=None, timeout=None)

Wait for probes to trigger a specific event

Parameters:
  • probe_user_class (ProbeUser) – probe_user class that defines the method.

  • probe_user_wait_method (method) – name of the probe_user’s method that will be used to wait.

  • probes (list of ProbeUser) – probes to wait for. If None all probes will be concerned.

  • timeout (float) – maximum time to wait for in seconds.

add_probe(probe, blocking=False, after_target_feedback_retrieval=False)
configure_probe(probe, *args)
disable_hooks()
enable_hooks()
get_probe_delay(probe)
get_probe_status(probe)
get_probes_names()
is_probe_launched(probe)
is_probe_stuck(probe)
is_target_ok()
iter_probes()
notify_data_sending_event()
notify_error()
notify_imminent_data_sending()
notify_target_feedback_retrieval()
set_data_model(dm)
set_fmk_ops(fmk_ops)
set_logger(logger)
set_probe_delay(probe, delay)
set_targets(targets)
start()
start_probe(probe, related_tg=None)
stop()
stop_all_probes()
stop_probe(probe)
property target_status
wait_for_probe_initialization()
wait_for_probe_status_retrieval()
class fuddly.framework.monitor.Probe(delay=1.0)

Bases: object

__init__(delay=1.0)
__module__ = 'fuddly.framework.monitor'
__str__()

Return str(self).

_start(dm, target, logger)
_stop(dm, target, logger)
arm(dm, target, logger)

Only used by blocking probes. Called by the framework just before sending a data.

Parameters:
  • dm – the current data model

  • target – the current target

  • logger – the current logger

configure(*args)

(Optional method) To be overloaded with any signature that fits your needs Could be called by user code through framework.monitor.Monitor.configure_probe() Use case example is to call it from an framework.director_helpers.Director

Parameters:

*args – anything that fits your needs

property delay
main(dm, target, logger)

To be overloaded by user-code

In the case of a basic probe, this method will be called in loop following a period specified within the associated project file.

In the case of a blocking probe, this method will be called by the framework just after having sent a data (or a batch of data).

Parameters:
  • dm – the current data model

  • target – the current target

  • logger – the current logger

Returns:

negative status if something is wrong

Return type:

ProbeStatus

reset()

To be overloaded by user-code (if needed).

Called each time the probe status is retrieved by the framework (through Monitor.get_probe_status()). Useful especially for periodic probe that may need to be reset after each data sending.

Note: shall be stateless and reentrant.

start(dm, target, logger)

Probe initialization

Returns:

may return a status or None

Return type:

ProbeStatus

property status
stop(dm, target, logger)
class fuddly.framework.monitor.ProbeCmd

Bases: Probe

Generic probe that enables you to execute shell commands and retrieve the output.

The monitoring can be done through different backend (e.g., SSH_Backend, Serial_Backend).

backend

backend to be used (e.g., SSH_Backend).

Type:

framework.comm_backends.Backend

init_command

ssh command to execute at init

Type:

str

recurrent_command

ssh command to execute at each probing

Type:

str

__annotations__ = {}
__init__()
__module__ = 'fuddly.framework.monitor'
backend = None
init_command = None
main(dm, target, logger)

To be overloaded by user-code

In the case of a basic probe, this method will be called in loop following a period specified within the associated project file.

In the case of a blocking probe, this method will be called by the framework just after having sent a data (or a batch of data).

Parameters:
  • dm – the current data model

  • target – the current target

  • logger – the current logger

Returns:

negative status if something is wrong

Return type:

ProbeStatus

recurrent_command = None
start(dm, target, logger)

Probe initialization

Returns:

may return a status or None

Return type:

ProbeStatus

stop(dm, target, logger)
class fuddly.framework.monitor.ProbeMem

Bases: Probe

Generic probe that enables you to monitor the process memory (RSS…) consumption. It can be done by specifying a threshold and/or a tolerance ratio.

The monitoring can be done through different backend (e.g., SSH_Backend, Serial_Backend).

backend

backend to be used (e.g., SSH_Backend).

Type:

framework.comm_backends.Backend

process_name

name of the process to monitor.

Type:

str

threshold

memory (RSS) threshold that the monitored process should not exceed. (dimension should be the same as what is provided by the ps command of the system under test)

Type:

int

tolerance

tolerance expressed in percentage of the memory (RSS) the process was using at the beginning of the monitoring (or after each time the tolerance has been exceeded).

Type:

int

command_pattern

format string for the ssh command. ‘{0:s}’ refer to the process name.

Type:

str

__annotations__ = {}
__init__()
__module__ = 'fuddly.framework.monitor'
_get_mem()
backend = None
command_pattern = 'ps -e -orss,comm | grep {0:s}'
main(dm, target, logger)

To be overloaded by user-code

In the case of a basic probe, this method will be called in loop following a period specified within the associated project file.

In the case of a blocking probe, this method will be called by the framework just after having sent a data (or a batch of data).

Parameters:
  • dm – the current data model

  • target – the current target

  • logger – the current logger

Returns:

negative status if something is wrong

Return type:

ProbeStatus

process_name = None
reset()

To be overloaded by user-code (if needed).

Called each time the probe status is retrieved by the framework (through Monitor.get_probe_status()). Useful especially for periodic probe that may need to be reset after each data sending.

Note: shall be stateless and reentrant.

start(dm, target, logger)

Probe initialization

Returns:

may return a status or None

Return type:

ProbeStatus

stop(dm, target, logger)
threshold = None
tolerance = 2
class fuddly.framework.monitor.ProbePID

Bases: Probe

Generic probe that enables you to monitor a process PID.

The monitoring can be done through different backend (e.g., SSH_Backend, Serial_Backend).

backend

backend to be used (e.g., SSH_Backend).

Type:

framework.comm_backends.Backend

process_name

name of the process to monitor.

Type:

str

max_attempts

maximum number of attempts for getting the process ID.

Type:

int

delay_between_attempts

delay in seconds between each attempt.

Type:

float

delay

delay before retrieving the process PID.

Type:

float

command_pattern

format string for the ssh command. ‘{0:s}’ refer to the process name.

Type:

str

__annotations__ = {}
__init__()
__module__ = 'fuddly.framework.monitor'
_get_pid(logger)
backend = None
command_pattern = 'pgrep {0:s}'
delay = 0.5
delay_between_attempts = 0.1
main(dm, target, logger)

To be overloaded by user-code

In the case of a basic probe, this method will be called in loop following a period specified within the associated project file.

In the case of a blocking probe, this method will be called by the framework just after having sent a data (or a batch of data).

Parameters:
  • dm – the current data model

  • target – the current target

  • logger – the current logger

Returns:

negative status if something is wrong

Return type:

ProbeStatus

max_attempts = 10
process_name = None
start(dm, target, logger)

Probe initialization

Returns:

may return a status or None

Return type:

ProbeStatus

stop(dm, target, logger)
class fuddly.framework.monitor.ProbeStatus(status=None, info=None)

Bases: object

__init__(status=None, info=None)
__module__ = 'fuddly.framework.monitor'
get_private_info()
get_timestamp()
set_private_info(pv)
set_timestamp()
property value
exception fuddly.framework.monitor.ProbeTimeoutError(probe_name, timeout, blocking_methods=None)

Bases: Exception

Raised when a probe is considered stuck

__init__(probe_name, timeout, blocking_methods=None)
Parameters:
  • probe_name (str) – name of the probe where the timeout occurred

  • timeout (float) – time the probe waited before its timeout

  • blocking_methods (list of str) – list of probe_methods where the timeout may have happened

__module__ = 'fuddly.framework.monitor'
property blocking_methods
property probe_name
property timeout
class fuddly.framework.monitor.ProbeUser(probe)

Bases: object

__annotations__ = {}
__init__(probe)
__module__ = 'fuddly.framework.monitor'
_clear()

Clear all events

_go_on()
_handle_exception(context)
_notify_probe_started()
_run(*args, **kwargs)
_wait(delay)
_wait_for_probe(event, timeout=None)

Wait for the probe to trigger a specific event

get_probe_delay()
get_probe_status()
is_alive()
is_stuck()

Tells if the probe has to be considered stuck by the monitor: i.e. if it is really stuck or if its stop was not acknowledged

join(timeout=None)
property probe
probe_init_timeout = 15.0
set_probe_delay(delay)
start(*args, **kwargs)
stop()
timeout = 5.0
wait_for_probe_init(timeout=None)
fuddly.framework.monitor.blocking_probe(project, after_target_feedback_retrieval=False)
fuddly.framework.monitor.probe(project)

14.2.19. framework.comm_backends module

class fuddly.framework.comm_backends.Backend(codec='latin_1')

Bases: object

__init__(codec='latin_1')
Parameters:

codec (str) – codec used by the monitored system to answer.

__module__ = 'fuddly.framework.comm_backends'
_exec_command(cmd)
Parameters:

cmd – command to execute through the communication channel

Returns: list of file descriptors (e.g., stdout, stderr)

_start()
_stop()
exec_command(cmd)
read_output(chan_desc)
Parameters:

chan_desc – object returned by Backend.exec_command() that enables to gather output data

Returns:

data retrieved through the communication channel

Return type:

bytes

start()
stop()
exception fuddly.framework.comm_backends.BackendError(msg, status=-1)

Bases: Exception

__init__(msg, status=-1)
__module__ = 'fuddly.framework.comm_backends'
class fuddly.framework.comm_backends.SSH_Backend(target_addr='localhost', port=22, bind_address=None, username=None, password=None, pkey_path=None, pkey_password=10, proxy_jump_addr=None, proxy_jump_bind_addr=None, proxy_jump_port=None, proxy_jump_username=None, proxy_jump_password=None, proxy_jump_pkey_path=None, proxy_jump_pkey_password=10, codec='latin-1', timeout=None, get_pty=False)

Bases: Backend

ASK_PASSWORD = 20

Backend to execute command through a serial line.

NO_PASSWORD = 10
__annotations__ = {}
__init__(target_addr='localhost', port=22, bind_address=None, username=None, password=None, pkey_path=None, pkey_password=10, proxy_jump_addr=None, proxy_jump_bind_addr=None, proxy_jump_port=None, proxy_jump_username=None, proxy_jump_password=None, proxy_jump_pkey_path=None, proxy_jump_pkey_password=10, codec='latin-1', timeout=None, get_pty=False)
Parameters:
  • target_addr (str) – IP of the SSH server.

  • port (int) – port of the SSH server.

  • username (str) – username to connect with.

  • password (str) – (optional) password related to the username. Could also be the special value SSHTarget.ASK_PASSWORD that will prompt the user for the password at the time of connection.

  • pkey_path (str) – (optional) path of the private key (if no password provided).

  • pkey_password – (optional) if the private key is encrypted, this parameter can be either the password to decrypt it, or the special value SSHTarget.ASK_PASSWORD that will prompt the user for the password at the time of connection. If the private key is not encrypted, then this parameter should be set to SSHTarget.NO_PASSWORD

  • proxy_jump_addr – If a proxy jump has to be done before reaching the target, this parameter should be provided with the proxy address to connect with.

  • proxy_jump_bind_addr – internal address of the proxy to communication with the target.

  • proxy_jump_port – port on which the SSH server of the proxy listen to.

  • proxy_jump_username – username to use for the connection with the proxy.

  • proxy_jump_password – (optional) password related to the username. Could also be the special value SSHTarget.ASK_PASSWORD that will prompt the user for the password at the time of connection.

  • proxy_jump_pkey_path – (optional) path to the private key related to the username.

  • proxy_jump_pkey_password – (optional) if the private key is encrypted, this parameter can be either the password to decrypt it, or the special value SSHTarget.ASK_PASSWORD that will prompt the user for the password at the time of connection. If the private key is not encrypted, then this parameter should be set to SSHTarget.NO_PASSWORD.

  • codec (str) – codec used by the monitored system to answer.

  • timeout (float) – timeout on blocking read/write operations. None disables timeouts on socket operations

  • get_pty (bool) – Request a pseudo-terminal from the server. It implies that processes executed from this ssh session will be attached to the pty and will be killed once the session is closed. (Otherwise they could remain on the server.)

__module__ = 'fuddly.framework.comm_backends'
static _create_pkey(pkey_path, pkey_password, prompt='PKey Password:')
_exec_command(cmd)
Parameters:

cmd – command to execute through the communication channel

Returns: list of file descriptors (e.g., stdout, stderr)

_read_fd(fdesc)
_start()
_stop()
read_output(chan_desc)
Parameters:

chan_desc – object returned by Backend.exec_command() that enables to gather output data

Returns:

data retrieved through the communication channel

Return type:

bytes

read_stderr(chan_desc)
read_stdout(chan_desc)
set_timeout(timeout)
class fuddly.framework.comm_backends.Serial_Backend(serial_port, baudrate=115200, bytesize=8, parity='N', stopbits=1, xonxoff=False, rtscts=False, dsrdtr=False, username=None, password=None, slowness_factor=5, cmd_notfound=b'command not found', codec='latin-1')

Bases: Backend

Backend to execute command through a serial line.

__annotations__ = {}
__init__(serial_port, baudrate=115200, bytesize=8, parity='N', stopbits=1, xonxoff=False, rtscts=False, dsrdtr=False, username=None, password=None, slowness_factor=5, cmd_notfound=b'command not found', codec='latin-1')
Parameters:
  • serial_port (str) – path to the tty device file. (e.g., ‘/dev/ttyUSB0’)

  • baudrate (int) – baud rate of the serial line.

  • bytesize (int) – number of data bits. (5, 6, 7, or 8)

  • parity (str) – parity checking. (‘N’, ‘O, ‘E’, ‘M’, or ‘S’)

  • stopbits (int) – number of stop bits. (1, 1.5 or 2)

  • xonxoff (bool) – enable software flow control.

  • rtscts (bool) – enable hardware (RTS/CTS) flow control.

  • dsrdtr (bool) – enable hardware (DSR/DTR) flow control.

  • username (str) – username to connect with. If None, no authentication step will be attempted.

  • password (str) – password related to the username.

  • slowness_factor (int) – characterize the slowness of the monitored system. The scale goes from 1 (fastest) to 10 (slowest). This factor is a base metric to compute the time to wait for the authentication step to terminate (if username and password parameter are provided) and other operations involving to wait for the monitored system.

  • cmd_notfound (bytes) – pattern used to detect if the command does not exist on the monitored system.

  • codec (str) – codec used to send/receive information through the serial line

__module__ = 'fuddly.framework.comm_backends'
_exec_command(cmd)
Parameters:

cmd – command to execute through the communication channel

Returns: list of file descriptors (e.g., stdout, stderr)

_read_serial(serial_chan, duration)
_start()
_stop()
read_output(chan_desc)
Parameters:

chan_desc – object returned by Backend.exec_command() that enables to gather output data

Returns:

data retrieved through the communication channel

Return type:

bytes

class fuddly.framework.comm_backends.Shell_Backend(timeout=None, codec='latin-1')

Bases: Backend

Backend to execute shell commands locally

__annotations__ = {}
__init__(timeout=None, codec='latin-1')
Parameters:
  • timeout (float) – timeout in seconds for reading the result of the command

  • codec (str) – codec used by the monitored system to answer.

__module__ = 'fuddly.framework.comm_backends'
_exec_command(cmd)
Parameters:

cmd – command to execute through the communication channel

Returns: list of file descriptors (e.g., stdout, stderr)

_start()
_stop()
read_output(chan_desc)
Parameters:

chan_desc – object returned by Backend.exec_command() that enables to gather output data

Returns:

data retrieved through the communication channel

Return type:

bytes

14.2.20. framework.tactics_helpers module

14.2.21. framework.fuzzing_primitives module

14.2.22. framework.encoders module

class fuddly.framework.encoders.BitInverter_Enc(encoding_arg=None)

Bases: Encoder, EncoderAbsorptionHelper

__module__ = 'fuddly.framework.encoders'
decode(byte_str)

To be overloaded. (Should be stateless.)

Raise EncoderUnrecognizedValue if decoding is not possible.

Parameters:

val (bytes) – the encoded value

Returns:

the decoded value

Return type:

bytes

encode(byte_str)

To be overloaded. (Should be stateless.)

Parameters:

val (bytes) – the value

Returns:

the encoded value

Return type:

bytes

how_much_can_be_consumed_from(blob: bytes)

To be overloaded. (Should be stateless.)

Try to determine the end of what is decodable from the beginning of blob. blob is always starting with the encoded part. Otherwise, the blob is to be considered not compliant with the Encoder. Raise EncoderUnrecognizedValue in this case.

If the blob is decodable but the correct size cannot be determined raise EncoderSizeNotFound.

Parameters:

blob (bytes) – the encoded binary string

Returns:

the size of what is decodable from the beginning of blob.

Return type:

int

class fuddly.framework.encoders.BitReverse_Enc(encoding_arg=None)

Bases: Encoder

__annotations__ = {}
__module__ = 'fuddly.framework.encoders'
_reverse_bits(x, nb_bits=8)

Reverse bits order of x

decode(val)

To be overloaded. (Should be stateless.)

Raise EncoderUnrecognizedValue if decoding is not possible.

Parameters:

val (bytes) – the encoded value

Returns:

the decoded value

Return type:

bytes

encode(val)

To be overloaded. (Should be stateless.)

Parameters:

val (bytes) – the value

Returns:

the encoded value

Return type:

bytes

class fuddly.framework.encoders.Encoder(encoding_arg=None)

Bases: object

__annotations__ = {}
__copy__()
__init__(encoding_arg=None)
__module__ = 'fuddly.framework.encoders'
decode(val)

To be overloaded. (Should be stateless.)

Raise EncoderUnrecognizedValue if decoding is not possible.

Parameters:

val (bytes) – the encoded value

Returns:

the decoded value

Return type:

bytes

encode(val)

To be overloaded. (Should be stateless.)

Parameters:

val (bytes) – the value

Returns:

the encoded value

Return type:

bytes

init_encoding_scheme(arg)

To be optionally overloaded by a subclass that deals with encoding, if encoding need to be initialized in some way. (called at init and in String.reset())

Parameters:

arg – provided through the encoding_arg parameter of the String constructor

reset()
class fuddly.framework.encoders.EncoderAbsorptionHelper

Bases: object

Helper used in the context of absorption

__annotations__ = {}
__module__ = 'fuddly.framework.encoders'
how_much_can_be_consumed_from(blob: bytes)

To be overloaded. (Should be stateless.)

Try to determine the end of what is decodable from the beginning of blob. blob is always starting with the encoded part. Otherwise, the blob is to be considered not compliant with the Encoder. Raise EncoderUnrecognizedValue in this case.

If the blob is decodable but the correct size cannot be determined raise EncoderSizeNotFound.

Parameters:

blob (bytes) – the encoded binary string

Returns:

the size of what is decodable from the beginning of blob.

Return type:

int

exception fuddly.framework.encoders.EncoderSizeNotFoundError

Bases: Exception

__module__ = 'fuddly.framework.encoders'
exception fuddly.framework.encoders.EncoderUnrecognizedValueError

Bases: Exception

__module__ = 'fuddly.framework.encoders'
class fuddly.framework.encoders.GSM7bitPacking_Enc(encoding_arg=None)

Bases: Encoder

__annotations__ = {}
__module__ = 'fuddly.framework.encoders'
decode(msg)

To be overloaded. (Should be stateless.)

Raise EncoderUnrecognizedValue if decoding is not possible.

Parameters:

val (bytes) – the encoded value

Returns:

the decoded value

Return type:

bytes

encode(msg)

To be overloaded. (Should be stateless.)

Parameters:

val (bytes) – the value

Returns:

the encoded value

Return type:

bytes

class fuddly.framework.encoders.GSMPhoneNum_Enc(encoding_arg=None)

Bases: Encoder

__annotations__ = {}
__module__ = 'fuddly.framework.encoders'
decode(msg)

To be overloaded. (Should be stateless.)

Raise EncoderUnrecognizedValue if decoding is not possible.

Parameters:

val (bytes) – the encoded value

Returns:

the decoded value

Return type:

bytes

encode(msg)

To be overloaded. (Should be stateless.)

Parameters:

val (bytes) – the value

Returns:

the encoded value

Return type:

bytes

class fuddly.framework.encoders.GZIP_Enc(encoding_arg=None)

Bases: Encoder

__annotations__ = {}
__module__ = 'fuddly.framework.encoders'
decode(val)

To be overloaded. (Should be stateless.)

Raise EncoderUnrecognizedValue if decoding is not possible.

Parameters:

val (bytes) – the encoded value

Returns:

the decoded value

Return type:

bytes

encode(val)

To be overloaded. (Should be stateless.)

Parameters:

val (bytes) – the value

Returns:

the encoded value

Return type:

bytes

init_encoding_scheme(arg=None)

To be optionally overloaded by a subclass that deals with encoding, if encoding need to be initialized in some way. (called at init and in String.reset())

Parameters:

arg – provided through the encoding_arg parameter of the String constructor

class fuddly.framework.encoders.Wrap_Enc(encoding_arg=None)

Bases: Encoder

Encoder to be used as a mean to wrap a Node with a prefix and/or a suffix, without defining specific Nodes for that (meaning you don’t need to model that part and want to simplify your data description).

__annotations__ = {}
__module__ = 'fuddly.framework.encoders'
decode(val)

To be overloaded. (Should be stateless.)

Raise EncoderUnrecognizedValue if decoding is not possible.

Parameters:

val (bytes) – the encoded value

Returns:

the decoded value

Return type:

bytes

encode(val)

To be overloaded. (Should be stateless.)

Parameters:

val (bytes) – the value

Returns:

the encoded value

Return type:

bytes

init_encoding_scheme(arg)

Take a list parameter specifying the prefix and the suffix to add to the value to encode, or to remove from an encoded value.

Parameters:

arg (list) – Prefix and suffix character strings. Can be individually set to None

14.2.23. framework.database module

class fuddly.framework.database.Database(fmkdb_path=None)

Bases: object

ASYNC_error_msg = 'while inserting a value into table ASYNC_DATA!'
CURRENT_DB_FORMAT_VERSION = 2
DDL_fname = 'fmk_db.sql'
DDLv1_fname = 'fmk_db_v1.sql'
DEFAULT_DB_NAME = 'fmkDB.db'
DEFAULT_DM_NAME = '__DEFAULT_DATAMODEL'
DEFAULT_GEN_NAME = '__DEFAULT_GNAME'
DEFAULT_GTYPE_NAME = '__DEFAULT_GTYPE'
FEEDBACK_TRAIL_TIME_WINDOW = 10
OUTCOME_DATA = 2
OUTCOME_ROWID = 1
__init__(fmkdb_path=None)
__module__ = 'fuddly.framework.database'
_get_color_function(colorized)
_handle_binary_content(content, sz_limit=None, raw=False, colorized=True)
_is_valid(connection, cursor, version=2)
_sql_handler()
_stop_sql_handler()
check_data_existence(data_id, colorized=True)
column_names_from(table)
disable()
display_data_info(data_id, with_data=False, with_fbk=False, with_fmkinfo=True, with_analysis=True, with_async_data=False, fbk_src=None, limit_data_sz=None, page_width=100, colorized=True, raw=False, decoding_hints=None, dm_list=None)
display_data_info_by_date(start, end, with_data=False, with_fbk=False, with_fmkinfo=True, with_analysis=True, with_async_data=False, fbk_src=None, prj_name=None, limit_data_sz=None, raw=False, page_width=100, colorized=True, decoding_hints=None, dm_list=None)
display_data_info_by_range(first_id, last_id, with_data=False, with_fbk=False, with_fmkinfo=True, with_analysis=True, with_async_data=False, fbk_src=None, prj_name=None, limit_data_sz=None, raw=False, page_width=100, colorized=True, decoding_hints=None, dm_list=None)
display_stats(colorized=True)
enable()
execute_sql_statement(sql_stmt, params=None)
export_data(first, last=None, colorized=True)
fetch_data(start_id=1, end_id=-1)
flush_current_feedback()
flush_feedback()
get_batch_processing_records(prj_name=None)
get_comments(first_data_id, last_data_id)
get_data_with_impact(prj_name=None, fbk_src=None, fbk_status_formula='? < 0', display=True, verbose=False, raw_analysis=False, colorized=True)
get_data_with_specific_fbk(fbk, prj_name=None, fbk_src=None, display=True, colorized=True)
get_data_without_fbk(prj_name=None, fbk_src=None, display=True, colorized=True)
get_db_analysis(prj_name=None, fbk_src=None, fbk_status_formula='? < 0', display=True, verbose=False, op_record_min_size=4, raw_analysis=False, colorized=True)
static get_default_db_path()
get_next_data_id(prev_id=None)
get_project_record(prj_name=None)
get_scenario_records(prj_name=None)
get_user_impact_analysis()
insert_analysis(data_id, content, date, impact=False)
insert_async_data(dtype, dm_name, raw_data, sz, sent_date, target_ref, prj_name, current_data_id=None)
insert_comment(data_id, content, date)
insert_data(dtype, dm_name, raw_data, sz, sent_date, ack_date, target_ref, prj_name, group_id=None, origin=None, attrs=None)
insert_data_model(dm_name)
insert_dmaker(dm_name, dtype, name, is_gen, stateful, is_scenario, clone_type=None, description=None, other_info=None)
insert_feedback(data_id, source, timestamp, content, status_code=None, store_in_db=True, from_fb_handler=False)
insert_fmk_info(data_id, content, date, error=False)
insert_project(prj_name)
insert_steps(data_id, step_id, dmaker_type, dmaker_name, data_id_src, user_input, info)
is_enabled()
iter_feedback_entries(last=True, source=None)
remove_data(data_id, colorized=True)
shrink_db()
start()
stop()
submit_sql_stmt(stmt, params=None, outcome_type: int | None = None, error_msg='')

This method is the only one that should submit request to the threaded SQL handler. It is also synchronized to guarantee request order (especially needed when you wait for the outcomes of your submitted SQL statement).

Parameters:
  • stmt (str) – SQL statement

  • params (tuple) – parameters

  • outcome_type (int) – type of the expected outcomes. If None, no outcomes are expected

  • error_msg (str) – specific error message to display in case of an error

Returns:

None or the expected outcomes

update_data(data_id, new_attrs=None)
class fuddly.framework.database.FeedbackGate(database, only_last_entries=True)

Bases: object

__bool__()
__init__(database, only_last_entries=True)
Parameters:

database (Database) – database to be associated with

__iter__()
__module__ = 'fuddly.framework.database'
get_feedback_from(source)
iter_entries(source=None)

Iterate over feedback entries that are related to the last data which has been sent by the framework.

Parameters:

source (FeedbackSource) – feedback source to consider

Returns:

A generator that iterates over all the requested feedback entries and provides for each:

  • the triplet: (status, timestamp, content) if source is associated to a specific feedback source

  • the 4-uplet: (source, status, timestamp, content) if source is None

Return type:

python generator

property size
sources_names()

Return a list of the feedback source names related to the last data which has been sent by the framework.

Returns:

names of the feedback sources

Return type:

list

fuddly.framework.database.regexp(expr, item)
fuddly.framework.database.regexp_bin(expr, item)
fuddly.framework.database.register_adapters_and_converters()

14.2.24. framework.scenario module

14.2.25. framework.dmhelpers.generic module

14.2.26. framework.dmhelpers.xml module

14.2.27. framework.evolutionary_helpers module

14.2.28. framework.info.generic module

class fuddly.info.generic.Hardware(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Info

ARM = 4
PowerPc = 3
Unknown = 5
X86_32 = 2
X86_64 = 1
__module__ = 'fuddly.info.generic'
__new__(value)
class fuddly.info.generic.InputHandling(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Info

Ctrl_Char_Set = 1
Printable_Char_Set = 2
Unknown = 3
__module__ = 'fuddly.info.generic'
__new__(value)
class fuddly.info.generic.Language(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Info

Ada = 2
C = 1
Pascal = 3
Unknown = 4
__module__ = 'fuddly.info.generic'
__new__(value)
class fuddly.info.generic.OS(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Info

Android = 3
Linux = 1
Unknown = 4
Windows = 2
__module__ = 'fuddly.info.generic'
__new__(value)
class fuddly.info.generic.OperationMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Info

Determinist = 1
Random = 2
__module__ = 'fuddly.info.generic'
__new__(value)
class fuddly.info.generic.Test(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Info

Cursory = 1
Deep = 3
Medium = 2
__module__ = 'fuddly.info.generic'
__new__(value)

14.2.29. framework.knowledge.feedback_collector module

class fuddly.framework.knowledge.feedback_collector.FeedbackCollector

Bases: object

__init__()
__iter__()
__module__ = 'fuddly.framework.knowledge.feedback_collector'
add_fbk_from(ref, fbk, status=0, timestamp=None)
cleanup()
fbk_lock = <unlocked _thread.lock object>
get_bytes()
get_error_code()
get_timestamp()
has_fbk_collector()
iter_and_cleanup_collector()
set_bytes(bstring)
set_error_code(err_code)
class fuddly.framework.knowledge.feedback_collector.FeedbackSource(src, subref=None, reliability=None, related_tg=None, display_feedback=True)

Bases: object

__eq__(other)

Return self==value.

__hash__()

Return hash(self).

__init__(src, subref=None, reliability=None, related_tg=None, display_feedback=True)
__module__ = 'fuddly.framework.knowledge.feedback_collector'
__str__()

Return str(self).

property display_feedback
property obj
property related_tg

14.2.30. framework.knowledge.feedback_handler module

14.2.31. framework.knowledge.information module

class fuddly.framework.knowledge.information.Info(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

__init__(val)
__module__ = 'fuddly.framework.knowledge.information'
__str__()

Return str(self).

decrease_trust(inc=1)
increase_trust(inc=1)
reset_trust()
property trust_level
property trust_value
class fuddly.framework.knowledge.information.InformationCollector

Bases: object

__bool__()
__init__()
__module__ = 'fuddly.framework.knowledge.information'
__str__()

Return str(self).

add_information(info, initial_trust_value=0)
is_assumption_valid(info)
is_info_class_represented(info_class)
reset_information()
class fuddly.framework.knowledge.information.TrustLevel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Maximum = 1
Medium = 2
Minimum = 3
__module__ = 'fuddly.framework.knowledge.information'

14.2.32. framework.constraint_helpers module

14.2.33. framework.plumbing module

14.2.34. libs.utils module

class fuddly.libs.utils.Accumulator

Bases: object

accumulate(msg)
clear()
class fuddly.libs.utils.ExternalDisplay(tui=False)

Bases: object

property disp
property is_enabled
property is_terminal
start_term(title=None, keepterm=False)
stop()
class fuddly.libs.utils.RichTerm(title=None, keepterm=False)

Bases: Term

CMD_HELP_HIDE = 6
CMD_HELP_MODE = 5
CMD_NEW_LOG_PANEL = 1
CMD_RM_LOG_PANEL = 2
hide_help_panel()
new_log_panel(title='', markup=False)
print_help(s, newline=True)
print_markup(s, newline=False)
print_on(fifo, s, newline=False)
print_status(s, newline=False)
remove_log_panel(fifo)
set_help_mode(markup=False)
start()
stop(force_kill=False)
class fuddly.libs.utils.Task(period=None, init_delay=0, new_window=False, new_window_title=None, name: str | None = None, markup_mode=True)

Bases: object

cleanup()
dm = None
feedback_gate = None
fmkops = None
period = None
print(msg)
print_nl(msg)
prj = None
setup()
targets = None
class fuddly.libs.utils.Term(title=None, keepterm=False)

Bases: object

print(s, newline=False)
print_help(s, newline=True)
print_markup(s, newline=False)
print_nl(s)
print_status(s, newline=False)
start()
stop(force_kill=False)
fuddly.libs.utils.chunk_lines(string, length, prefix='')
fuddly.libs.utils.find_file(filename, root_path)
fuddly.libs.utils.get_caller_object(stack_frame=2)
fuddly.libs.utils.retrieve_app_handler(filename)