0

このコードは sqlmap プロジェクトhttps://github.com/sqlmapproject/sqlmap/blob/master/lib/core/datatype.pyで見つかりまし た。

コンストラクタを呼ぶ意味がわからない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
4

1 に答える 1

1

InjectionDictクラスはサブクラスであり、継承元の基本クラスはAttribDict. それがこの構文の意味です

class InjectionDict(AttribDict):

次に、InjectDict__init__メソッドで、基本クラスの__init__メソッドを最初に呼び出してから、残りのサブクラス固有の__init__作業を行います。

AttribDict.__init__(self)

この動作が何のために使用されるかについてのより完全な説明については、この投稿を参照してください。

于 2014-08-23T15:28:03.933 に答える