当前位置: 首页>>代码示例>>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;未经允许,请勿转载。