本文整理汇总了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]
示例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)
示例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
示例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)
示例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)