netzob.Common.Utils package


netzob.Common.Utils.Decorators module


This class decorator adds (if necessary) an instance of the logger (self.__logger) to the attached class and removes from the getState the logger.


Decorator which reduces the amount of code to type-check attributes.

Its allows to replace the following code:

def id(self, id):
    if not isinstance(id, uuid.UUID):
       raise TypeError("Invalid types for argument id, must be an UUID")
    self.__id = id


def id(self, id):
   self.__id = id


set type = “SELF” to check the type of the self parameter


if argument is None, the type checking is not executed on it.

netzob.Common.Utils.MatrixList module

class MatrixList[source]

Bases: list

This type of list has been created to represent it as matrix which means its a list of list.

The __str__ method has been redefined to propose a nice representation of its content.


A list of sorted strings. Each string will be displayed as a column header

netzob.Common.Utils.SortableObject module

class SortableObject[source]

Bases: object


netzob.Common.Utils.SortedTypedList module

netzob.Common.Utils.TypedList module

class TypedList(membersTypes, *args)[source]


A strong typed list based on collections.MutableSequence.

The idea is to verify members type when editing the list. By using this class instead of the typical list, we enforce members type.

>>> typedList = TypedList(str)
>>> typedList.append("toto")
>>> typedList.extend(["titi", "tata"])
>>> len(typedList)
>>> typedList[1]
>>> typedList.append(3)
Traceback (most recent call last):
TypeError: Invalid type for argument, expecting: <type 'str'>
>>> typedList.extend(["tutu", 5])
Traceback (most recent call last):
TypeError: Invalid type for argument, expecting: <type 'str'>
insert(i, v)[source]

netzob.Common.Utils.all module

Module contents