File size: 1,173 Bytes
2c475fa 2f848a4 2c475fa 2f848a4 2c475fa 2f848a4 2c475fa 2f848a4 2c475fa 2f848a4 2c475fa 2f848a4 2c475fa 2f848a4 2c475fa 2f848a4 2c475fa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
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() |