Example #1
0
    def add_portservice(self, ipaddress, port, banner=None, service=""):
        """增加一个端口/服务信息"""
        if banner is None:
            banner = {}

        if isinstance(banner, dict) is not True:
            logger.warning('数据类型检查错误,数据 {}'.format(banner))
            banner = {}
        result = PortService.add_or_update(ipaddress=ipaddress,
                                           port=port,
                                           banner=banner,
                                           service=service)
        return result
Example #2
0
    def add_portservice(self, hid, port, proxy=None, banner=None, service=""):
        if proxy is None:
            proxy = {}
        if banner is None:
            banner = {}

        # 数据类型检查
        if isinstance(proxy, dict) is not True:
            logger.warning('数据类型检查错误,数据 {}'.format(proxy))
            proxy = {}
        if isinstance(banner, dict) is not True:
            logger.warning('数据类型检查错误,数据 {}'.format(banner))
            banner = {}
        result = PortService.add_or_update(hid=hid,
                                           port=port,
                                           proxy=proxy,
                                           banner=banner,
                                           service=service)
        return result