def get_url(): """ 获取要查询的恶意域名url """ sql = 'SELECT url FROM virustotal_info WHERE total is NULL or total =" " ' result_list = [] sql_query = MysqlConnection(host="172.26.253.3", user="******", passwd="platform", db="cyn_malicious_domain") result_list = sql_query.execute_query(sql) if result_list: return result_list else: return
def update_db(self): """ 更新查询结果到数据库中 """ sql = ( 'UPDATE virustotal_info set date="%s",total = "%s",positives="%s",ip="%s",resolution_country="%s",category="%s",verify_result="%s" WHERE url = "%s"' % ( self.date, self.total, self.positives, self.ip, self.resolution_country, self.category, str(self.verify_result), self.url, ) ) sql_query = MysqlConnection(host="172.26.253.3", user="******", passwd="platform", db="cyn_malicious_domain") sql_query.execute_update(sql)