Example #1
0
 def add_vulnerability(self,
                       hid_or_ipaddress=None,
                       extra_data=None,
                       desc=''):
     if extra_data is None:
         extra_data = {}
     if isinstance(extra_data, dict) is not True:
         logger.warning('数据类型检查错误,数据 {}'.format(extra_data))
         extra_data = {}
     if isinstance(hid_or_ipaddress, int):
         result = Vulnerability.add_or_update(hid_or_ipaddress,
                                              self.loadpath, extra_data,
                                              desc)
         return result
     elif isinstance(hid_or_ipaddress, str):
         result = Vulnerability.add_or_update(
             Host.get_by_ipaddress(hid_or_ipaddress).get('id'),
             self.loadpath, extra_data, desc)
         return result
Example #2
0
    def add_vulnerability(self, ipaddress=None, extra_data=None, desc=''):
        """增加一个漏洞信息"""
        if extra_data is None:
            extra_data = {}
        if isinstance(extra_data, dict) is not True:
            logger.warning('数据类型检查错误,数据 {}'.format(extra_data))
            extra_data = {}

        result = Vulnerability.add_or_update(ipaddress, self.loadpath,
                                             extra_data, desc)
        return result