当前位置: 首页>>代码示例>>Python>>正文


Python Host.addService方法代码示例

本文整理汇总了Python中model.hosts.Host.addService方法的典型用法代码示例。如果您正苦于以下问题:Python Host.addService方法的具体用法?Python Host.addService怎么用?Python Host.addService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.hosts.Host的用法示例。


在下文中一共展示了Host.addService方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test

# 需要导入模块: from model.hosts import Host [as 别名]
# 或者: from model.hosts.Host import addService [as 别名]
    def test(self):
        """
        DELETE THIS BEFORE RELEASE
        used for internal testing (not correct way but we need to use it like
        this for now)
        """
                                                              
                       
                       
                                                                       
               
        global test_count
        test_count += 1
        model.api.showPopup("Creating test host %d" % test_count)
                                                                     
        from utils.error_report import exception_handler
        
        def raiser():
            sys.excepthook = exception_handler
            time.sleep(3)
            raise Exception("Exception from a secondary thread...")
                                            
                  
                                                                

        from model.hosts import Host
        from model.hosts import Interface
        from model.hosts import Service
        from model.hosts import HostApplication

        self._main_app.getLogger().log("testing..")
        self._main_app.getLogger().log("creating test host %d" % test_count)
        host = Host("TestHost-%d" % test_count, "Windows 2003")
        service = Service( "TestService-%d" % test_count, "TCP", [80,8080], "running")
        interface = Interface("eth%d" % test_count, mac = "00:00:00:00:00:00",
                 ipv4_address = "10.1.1.%d" % test_count, ipv4_mask = "255.255.0.0",
                 ipv4_gateway = "10.1.1.%d" % (test_count+1),
                 hostname_resolution = "TestHost-%d" % test_count)
        app = HostApplication( "AppTest-%d" % test_count, "running", "1.0 beta")

        
        host.addInterface(interface)
        host.addService(service)
        host.addApplication(app)
        interface.addService(service)
        app.addService(service)
        service.addInterface(interface)
        self._model_controller.addHostASYNC(host)
开发者ID:adityapooniya,项目名称:faraday,代码行数:50,代码来源:mainwindow.py


注:本文中的model.hosts.Host.addService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。