def virustotal_malware(self, indicator): current_time = datetime.datetime.utcnow() base_url = "https://www.virustotal.com/en/file/" scraper = VirusTotalScraper() scraper.run(indicator) malware = scraper.parse_malware() source = "VirusTotal" if malware: # Delete old entries before inserting new ones - not ideal solution but will work for now MalwareRecord.objects.filter(query_keyword=indicator, report_source=source).delete() MalwareRecord.objects.bulk_create([ MalwareRecord(submission_date=record[0], SHA256_value=record[1], report_link=base_url + str(record[1] + "/analysis"), report_source=source, query_keyword=indicator, query_date=current_time) for record in malware ])