0

I found this code in sqlmap project https://github.com/sqlmapproject/sqlmap/blob/master/lib/core/datatype.py .

I don't understand the meaning of calling the constructor AttribDict.__init__(self)

class InjectionDict(AttribDict):
    def __init__(self):
        AttribDict.__init__(self)

        self.place = None
        self.parameter = None
        self.ptype = None
        self.prefix = None
        self.suffix = None
        self.clause = None

        # data is a dict with various stype, each which is a dict with
        # all the information specific for that stype
        self.data = AttribDict()

        # conf is a dict which stores current snapshot of important
        # options used during detection
        self.conf = AttribDict()

        self.dbms = None
        self.dbms_version = None
        self.os = None
Savir
  • 17,568
  • 15
  • 82
  • 136
user3140467
  • 43
  • 10

1 Answers1

1

The InjectionDict class is a subclass, the base class it inherets from is AttribDict. That's what this syntax means

class InjectionDict(AttribDict):

Then in InjectDict's __init__ method, they are calling the base class's __init__ method first, before doing the rest of the subclass specific __init__ work.

AttribDict.__init__(self)

See this post for a more thorough explanation of what this behavior is used for.

Cory Kramer
  • 114,268
  • 16
  • 167
  • 218