当前位置: 首页>>代码示例>>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;未经允许,请勿转载。