import gradio as gr import hashlib import requests VIRUSSHARE_URL = "https://virusshare.com/hashfiles/VirusShare_00000.md5" def check_file_hash(file): try: # Загрузка хешей из VirusShare response = requests.get(VIRUSSHARE_URL) response.raise_for_status() # Проверка на ошибки HTTP known_bad_hashes = {line.strip().split()[0] for line in response.text.splitlines()} file_content = file.read() md5_hash = hashlib.md5(file_content).hexdigest() if md5_hash in known_bad_hashes: return f"File matches a known malicious hash! ({md5_hash})" else: return "File hash not found in the database." except requests.exceptions.RequestException as e: return f"Error downloading hash database: {e}" except Exception as e: return f"Error: {e}" iface = gr.Interface( fn=check_file_hash, inputs=gr.File(label="Upload a file"), outputs="text", title="Simple MD5 Hash Checker (VirusShare)", description="Checks file hash against the VirusShare database. This is NOT a replacement for a real antivirus!" ) iface.launch()