当前位置: 首页>>代码示例>>Python>>正文


Python base_classes.Gen方法代码示例

本文整理汇总了Python中scapy.base_classes.Gen方法的典型用法代码示例。如果您正苦于以下问题:Python base_classes.Gen方法的具体用法?Python base_classes.Gen怎么用?Python base_classes.Gen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scapy.base_classes的用法示例。


在下文中一共展示了base_classes.Gen方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __findaddr

# 需要导入模块: from scapy import base_classes [as 别名]
# 或者: from scapy.base_classes import Gen [as 别名]
def __findaddr(self, pkt):
        if conf.route is None:
            # unused import, only to initialize conf.route
            import scapy.route  # noqa: F401
        dst = ("0.0.0.0" if self.dstname is None
               else getattr(pkt, self.dstname) or "0.0.0.0")
        if isinstance(dst, (Gen, list)):
            r = {conf.route.route(str(daddr)) for daddr in dst}
            if len(r) > 1:
                warning("More than one possible route for %r" % (dst,))
            return min(r)[1]
        return conf.route.route(dst)[1] 
开发者ID:secdev,项目名称:scapy,代码行数:14,代码来源:fields.py

示例2: i2h

# 需要导入模块: from scapy import base_classes [as 别名]
# 或者: from scapy.base_classes import Gen [as 别名]
def i2h(self, pkt, x):
        if x is None:
            if conf.route6 is None:
                # unused import, only to initialize conf.route6
                import scapy.route6  # noqa: F401
            dst = ("::" if self.dstname is None else getattr(pkt, self.dstname))  # noqa: E501
            if isinstance(dst, (Gen, list)):
                r = {conf.route6.route(str(daddr)) for daddr in dst}
                if len(r) > 1:
                    warning("More than one possible route for %r" % (dst,))
                x = min(r)[1]
            else:
                x = conf.route6.route(dst)[1]
        return IP6Field.i2h(self, pkt, x) 
开发者ID:secdev,项目名称:scapy,代码行数:16,代码来源:fields.py

示例3: route

# 需要导入模块: from scapy import base_classes [as 别名]
# 或者: from scapy.base_classes import Gen [as 别名]
def route(self):
        fld, dst = self.getfield_and_val("pdst")
        fld, dst = fld._find_fld_pkt_val(self, dst)
        if isinstance(dst, Gen):
            dst = next(iter(dst))
        if isinstance(fld, IP6Field):
            return conf.route6.route(dst)
        elif isinstance(fld, IPField):
            return conf.route.route(dst)
        else:
            return None, None, None 
开发者ID:secdev,项目名称:scapy,代码行数:13,代码来源:l2.py

示例4: route

# 需要导入模块: from scapy import base_classes [as 别名]
# 或者: from scapy.base_classes import Gen [as 别名]
def route(self):
        dst = self.dst
        if isinstance(dst, Gen):
            dst = next(iter(dst))
        if conf.route is None:
            # unused import, only to initialize conf.route
            import scapy.route  # noqa: F401
        return conf.route.route(dst) 
开发者ID:secdev,项目名称:scapy,代码行数:10,代码来源:inet.py

示例5: route

# 需要导入模块: from scapy import base_classes [as 别名]
# 或者: from scapy.base_classes import Gen [as 别名]
def route(self):
        """Used to select the L2 address"""
        dst = self.dst
        if isinstance(dst, Gen):
            dst = next(iter(dst))
        return conf.route6.route(dst) 
开发者ID:secdev,项目名称:scapy,代码行数:8,代码来源:inet6.py


注:本文中的scapy.base_classes.Gen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。