當前位置: 首頁>>代碼示例>>Python>>正文


Python conf.mib方法代碼示例

本文整理匯總了Python中scapy.config.conf.mib方法的典型用法代碼示例。如果您正苦於以下問題:Python conf.mib方法的具體用法?Python conf.mib怎麽用?Python conf.mib使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scapy.config.conf的用法示例。


在下文中一共展示了conf.mib方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _make_graph

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import mib [as 別名]
def _make_graph(self, other_keys=None, **kargs):
        if other_keys is None:
            other_keys = []

        nodes = [(k,self[k]) for k in list(self.keys())]
        oids = [self[k] for k in list(self.keys())]
        for k in other_keys:
            if k not in oids:
                nodes.append(self.oidname(k),k)
        s = 'digraph "mib" {\n\trankdir=LR;\n\n'
        for k,o in nodes:
            s += '\t"%s" [ label="%s"  ];\n' % (o,k)
        s += "\n"
        for k,o in nodes:
            parent,remainder = self._findroot(o[:-1])
            remainder = remainder[1:]+o[-1]
            if parent != ".":
                parent = self[parent]
            s += '\t"%s" -> "%s" [label="%s"];\n' % (parent, o,remainder)
        s += "}\n"
        do_graph(s, **kargs) 
開發者ID:DinoTools,項目名稱:dionaea,代碼行數:23,代碼來源:mib.py

示例2: _make_graph

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import mib [as 別名]
def _make_graph(self, other_keys=[], **kargs):
        nodes = [(k,self[k]) for k in self.keys()]
        oids = [self[k] for k in self.keys()]
        for k in other_keys:
            if k not in oids:
                nodes.append(self.oidname(k),k)
        s = 'digraph "mib" {\n\trankdir=LR;\n\n'
        for k,o in nodes:
            s += '\t"%s" [ label="%s"  ];\n' % (o,k)
        s += "\n"
        for k,o in nodes:
            parent,remainder = self._findroot(o[:-1])
            remainder = remainder[1:]+o[-1]
            if parent != ".":
                parent = self[parent]
            s += '\t"%s" -> "%s" [label="%s"];\n' % (parent, o,remainder)
        s += "}\n"
        do_graph(s, **kargs) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:20,代碼來源:mib.py

示例3: _make_graph

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import mib [as 別名]
def _make_graph(self, other_keys=None, **kargs):
        if other_keys is None:
            other_keys = []
        nodes = [(self[key], key) for key in self.iterkeys()]
        oids = set(self.iterkeys())
        for k in other_keys:
            if k not in oids:
                nodes.append(self.oidname(k), k)
        s = 'digraph "mib" {\n\trankdir=LR;\n\n'
        for k, o in nodes:
            s += '\t"%s" [ label="%s"  ];\n' % (o, k)
        s += "\n"
        for k, o in nodes:
            parent, parent_key, remainder = self._findroot(o[:-1])
            remainder = remainder[1:] + o[-1]
            if parent != ".":
                parent = parent_key
            s += '\t"%s" -> "%s" [label="%s"];\n' % (parent, o, remainder)
        s += "}\n"
        do_graph(s, **kargs) 
開發者ID:secdev,項目名稱:scapy,代碼行數:22,代碼來源:mib.py

示例4: load_mib

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import mib [as 別名]
def load_mib(filenames):
    the_mib = {'iso': ['1']}
    unresolved = {}
    for k in list(conf.mib.keys()):
        mib_register(k, conf.mib[k].split("."), the_mib, unresolved)

    if type(filenames) is str:
        filenames = [filenames]
    for fnames in filenames:
        for fname in glob(fnames):
            f = open(fname)
            text = f.read()
            cleantext = " ".join(
                _mib_re_strings.split(" ".join(_mib_re_comments.split(text))))
            for m in _mib_re_oiddecl.finditer(cleantext):
                gr = m.groups()
                ident,oid = gr[0],gr[-1]
                ident=fixname(ident)
                oid = oid.split()
                for i in range(len(oid)):
                    m = _mib_re_both.match(oid[i])
                    if m:
                        oid[i] = m.groups()[1]
                mib_register(ident, oid, the_mib, unresolved)

    newmib = MIBDict(_name="MIB")
    for k,o in the_mib.items():
        newmib[k]=".".join(o)
    for k,o in unresolved.items():
        newmib[k]=".".join(o)

    conf.mib=newmib 
開發者ID:DinoTools,項目名稱:dionaea,代碼行數:34,代碼來源:mib.py

示例5: load_mib

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import mib [as 別名]
def load_mib(filenames):
    the_mib = {'iso': ['1']}
    unresolved = {}
    for k in conf.mib.keys():
        mib_register(k, conf.mib[k].split("."), the_mib, unresolved)

    if type(filenames) is str:
        filenames = [filenames]
    for fnames in filenames:
        for fname in glob(fnames):
            f = open(fname)
            text = f.read()
            cleantext = " ".join(_mib_re_strings.split(" ".join(_mib_re_comments.split(text))))
            for m in _mib_re_oiddecl.finditer(cleantext):
                gr = m.groups()
                ident,oid = gr[0],gr[-1]
                ident=fixname(ident)
                oid = oid.split()
                for i in range(len(oid)):
                    m = _mib_re_both.match(oid[i])
                    if m:
                        oid[i] = m.groups()[1]
                mib_register(ident, oid, the_mib, unresolved)

    newmib = MIBDict(_name="MIB")
    for k,o in the_mib.iteritems():
        newmib[k]=".".join(o)
    for k,o in unresolved.iteritems():
        newmib[k]=".".join(o)

    conf.mib=newmib 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:33,代碼來源:mib.py

示例6: load_mib

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import mib [as 別名]
def load_mib(filenames):
    the_mib = {'iso': ['1']}
    unresolved = {}
    for k in conf.mib.keys():
        mib_register(k, conf.mib[k].split("."), the_mib, unresolved)

    if type(filenames) is str:
        filenames = [filenames]
    for fnames in filenames:
        for fname in glob(fnames):
            f = open(fname)
            text = f.read()
            cleantext = " ".join(_mib_re_strings.split(" ".join(_mib_re_comments.split(text))))
            for m in _mib_re_oiddecl.finditer(cleantext):
                gr = m.groups()
                ident,oid = gr[0],gr[-1]
                ident=fixname(ident)
                oid = oid.split()
                for i in range(len(oid)):
                    m = _mib_re_both.match(oid[i])
                    if m:
                        oid[i] = m.groups()[1]
                mib_register(ident, oid, the_mib, unresolved)

    newmib = MIBDict(_name="MIB")
    for k,o in the_mib.items():
        newmib[k]=".".join(o)
    for k,o in unresolved.items():
        newmib[k]=".".join(o)

    conf.mib=newmib 
開發者ID:entynetproject,項目名稱:arissploit,代碼行數:33,代碼來源:mib.py

示例7: load_mib

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import mib [as 別名]
def load_mib(filenames):
    """
    Load the conf.mib dict from a list of filenames
    """
    the_mib = {'iso': ['1']}
    unresolved = {}
    alias = {}
    # Export the current MIB to a working dictionary
    for k in six.iterkeys(conf.mib):
        _mib_register(conf.mib[k], k.split("."), the_mib, unresolved, alias)

    # Read the files
    if isinstance(filenames, (str, bytes)):
        filenames = [filenames]
    for fnames in filenames:
        for fname in glob(fnames):
            with open(fname) as f:
                text = f.read()
            cleantext = " ".join(
                _mib_re_strings.split(" ".join(_mib_re_comments.split(text)))
            )
            for m in _mib_re_oiddecl.finditer(cleantext):
                gr = m.groups()
                ident, oid = gr[0], gr[-1]
                ident = fixname(ident)
                oid = oid.split()
                for i, elt in enumerate(oid):
                    m = _mib_re_both.match(elt)
                    if m:
                        oid[i] = m.groups()[1]
                _mib_register(ident, oid, the_mib, unresolved, alias)

    # Create the new MIB
    newmib = MIBDict(_name="MIB")
    # Add resolved values
    for oid, key in six.iteritems(the_mib):
        newmib[".".join(key)] = oid
    # Add unresolved values
    for oid, key in six.iteritems(unresolved):
        newmib[".".join(key)] = oid
    # Add aliases
    for key, oid in six.iteritems(alias):
        newmib[key] = oid

    conf.mib = newmib


####################
#  OID references  #
####################

#      pkcs1       # 
開發者ID:secdev,項目名稱:scapy,代碼行數:54,代碼來源:mib.py


注:本文中的scapy.config.conf.mib方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。