當前位置: 首頁>>代碼示例>>Python>>正文


Python conf.use_pcap方法代碼示例

本文整理匯總了Python中scapy.config.conf.use_pcap方法的典型用法代碼示例。如果您正苦於以下問題:Python conf.use_pcap方法的具體用法?Python conf.use_pcap怎麽用?Python conf.use_pcap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scapy.config.conf的用法示例。


在下文中一共展示了conf.use_pcap方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _pcap_check

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import use_pcap [as 別名]
def _pcap_check(cls):
        """Performs checks/restart pcap adapter"""
        if not conf.use_pcap:
            # Winpcap/Npcap isn't installed
            return

        _detect = pcap_service_status()

        def _ask_user():
            if not conf.interactive:
                return False
            msg = "Do you want to start it ? (yes/no) [y]: "
            try:
                # Better IPython compatibility
                import IPython
                return IPython.utils.io.ask_yes_no(msg, default='y')
            except (NameError, ImportError):
                while True:
                    _confir = input(msg)
                    _confir = _confir.lower().strip()
                    if _confir in ["yes", "y", ""]:
                        return True
                    elif _confir in ["no", "n"]:
                        return False
        if _detect:
            # No action needed
            return
        else:
            warning(
                "Scapy has detected that your pcap service is not running !"
            )
            if not conf.interactive or _ask_user():
                succeed = pcap_service_start(askadmin=conf.interactive)
                if succeed:
                    log_loading.info("Pcap service started !")
                    return
        warning("Could not start the pcap service ! "
                "You probably won't be able to send packets. "
                "Deactivating unneeded interfaces and restarting "
                "Scapy might help. Check your winpcap/npcap installation "
                "and access rights.") 
開發者ID:secdev,項目名稱:scapy,代碼行數:43,代碼來源:__init__.py

示例2: reload

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import use_pcap [as 別名]
def reload(self):
        """Reload interface list"""
        self.restarted_adapter = False
        self.data.clear()
        if conf.use_pcap:
            # Reload from Winpcapy
            from scapy.arch.pcapdnet import load_winpcapy
            load_winpcapy()
        self.load()
        # Reload conf.iface
        conf.iface = get_working_if() 
開發者ID:secdev,項目名稱:scapy,代碼行數:13,代碼來源:__init__.py


注:本文中的scapy.config.conf.use_pcap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。