def MalwareCheck(urllist): RESULT = {} domainlist = list() try: domainlist = getDomains(urllist) if domainlist: if isInternetAvailable(): UpdateDB() else: print "\n[WARNING] No Internet Connection. Skipping Malware Database Update." DB = os.path.join(MALWARE_DB_DIR, 'malwaredomainlist') with io.open(DB, mode='r', encoding="utf8", errors="ignore") as f: entry_list = f.readlines() for entry in entry_list: enlist = entry.split('","') if len(enlist) > 5: details_dict = dict() details_dict["domain_or_url"] = enlist[1] details_dict["ip"] = enlist[2] details_dict["desc"] = enlist[4] details_dict["bad"] = "yes" for domain in domainlist: if (domain in details_dict["domain_or_url"]) or (domain in details_dict["ip"]): RESULT[domain] = details_dict for domain in domainlist: if domain not in RESULT: x = dict() x["bad"] = "no" RESULT[domain] = x except: PrintException("[ERROR] Performing Malware Check") return RESULT
def MalwareCheck(urllist): RESULT = {} domainlist = list() try: domainlist = getDomains(urllist) if domainlist: if isInternetAvailable(): UpdateDB() else: print "\n[WARNING] No Internet Connection. Skipping Malware Database Update." DB = os.path.join(MALWARE_DB_DIR, 'malwaredomainlist') with io.open(DB, mode='r', encoding="utf8", errors="ignore") as f: entry_list = f.readlines() for entry in entry_list: enlist = entry.split('","') if len(enlist) > 5: details_dict = dict() details_dict["domain_or_url"] = enlist[1] details_dict["ip"] = enlist[2] details_dict["desc"] = enlist[4] details_dict["bad"] = "yes" for domain in domainlist: if (domain in details_dict["domain_or_url"]) or (domain in details_dict["ip"]): RESULT[domain] = details_dict for domain in domainlist: if domain not in RESULT: x = dict() x["bad"] = "no" RESULT[domain] = x except: PrintException("[ERROR] Performing Malware Check") return RESULT
def malware_check(urllist): result = {} domainlist = list() try: domainlist = get_domains(urllist) if domainlist: if isInternetAvailable(): update_malware_db() else: print "\n[WARNING] No Internet Connection. Skipping Malware Database Update." mal_db = os.path.join(MALWARE_DB_DIR, 'malwaredomainlist') with io.open(mal_db, mode='r', encoding="utf8", errors="ignore") as flip: entry_list = flip.readlines() for entry in entry_list: enlist = entry.split('","') if len(enlist) > 5: details_dict = dict() details_dict["domain_or_url"] = enlist[1] details_dict["ip"] = enlist[2] details_dict["desc"] = enlist[4] details_dict["bad"] = "yes" for domain in domainlist: if (details_dict["domain_or_url"].startswith(domain) or details_dict["ip"].startswith(domain)): result[domain] = details_dict # Good Domains for domain in domainlist: if domain not in result: tmp_d = dict() tmp_d["bad"] = "no" result[domain] = tmp_d except: PrintException("[ERROR] Performing Malware Check") return result