本文整理匯總了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)