def test_scan(self): malware = 'eicar.com.txt' # malware = 'blat.ex_' my_avira_engine = avira_engine() TEST_FILE_DIR_PATH = os.path.join(os.path.dirname(__file__), '..', 'file') path = PickleableFileSample.path_factory(os.path.join(TEST_FILE_DIR_PATH, malware)) # path = os.path.join(TEST_FILE_DIR_PATH, 'eicar.com.txt') my_scan = my_avira_engine.scan(path) if my_scan.infected: print print "Infected:" print my_scan.infected_string print ok_(my_scan, msg="Test A/V def update - version")
def avira_scan(file): my_avira_engine = avira_engine() result = my_avira_engine.scan(PickleableFileSample.string_factory(file)) file_md5_hash = hashlib.md5(file).hexdigest().upper() found = is_hash_in_db(file_md5_hash) if found: found['user_uploads'][-1].setdefault('av_results', []).append(scan_to_dict(result, 'Avira')) if result.infected: found['user_uploads'][-1]['detection_ratio']['infected'] += 1 found['user_uploads'][-1]['detection_ratio']['count'] += 1 data = found else: data = dict(md5=file_md5_hash) data['user_uploads'][-1].setdefault('av_results', []).append(scan_to_dict(result, 'Avira')) db_insert(data) return data