當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。