diff --git a/libs/ha.txt b/ha.txt similarity index 100% rename from libs/ha.txt rename to ha.txt diff --git a/libs/__pycache__/filesearch.cpython-314.pyc b/libs/__pycache__/filesearch.cpython-314.pyc index 44ef19e..28cd85a 100644 Binary files a/libs/__pycache__/filesearch.cpython-314.pyc and b/libs/__pycache__/filesearch.cpython-314.pyc differ diff --git a/libs/__pycache__/hashd.cpython-314.pyc b/libs/__pycache__/hashd.cpython-314.pyc index 0298d7e..00b9509 100644 Binary files a/libs/__pycache__/hashd.cpython-314.pyc and b/libs/__pycache__/hashd.cpython-314.pyc differ diff --git a/libs/hashd.py b/libs/hashd.py index 740b3b6..bd7fa87 100644 --- a/libs/hashd.py +++ b/libs/hashd.py @@ -1,22 +1,19 @@ import hashlib import os -# Anchor hashes.txt relative to the libs folder BASE_DIR = os.path.dirname(os.path.abspath(__file__)) HASH_LIST_PATH = os.path.join( BASE_DIR, "hashes.txt" -) # or os.path.join(BASE_DIR, "..", "hashes.txt") +) def hashcheck(fileToCheck): - # Remove trailing spaces or wrapped quotes from drag-and-drop clean_path = str(fileToCheck).strip().strip('"').strip("'") if not os.path.isfile(clean_path): print(f"Error: Path does not exist or is a directory: {clean_path}") return False - # Read file in binary mode and compute hash with open(clean_path, "rb") as f: digest = hashlib.file_digest(f, "sha256") file_hash = digest.hexdigest() diff --git a/libs/hashes.txt b/libs/hashes.txt index bcff54d..b3db20a 100644 --- a/libs/hashes.txt +++ b/libs/hashes.txt @@ -23138,3 +23138,4 @@ A1475A0042FE86E50531BB8B8182F9E27A3A61F204700F42FD26406C3BDEC862 000000627a55405cf609a534f2bd38ab2b74a50b17b4db5c271ef3305e38c830 00000048b1c9e60c14a6619f0292dea96df7f10c11cfa9ae28693219c0ae844b 00000045ef6ec5eb590ef16ef79d467734ea7d9144d7990511514f08ed3cb673 +4F19AB252F8DC17EB245F69A99EB58FCAFA86794D3E3CD7F313DBA7C374D401A \ No newline at end of file diff --git a/main.py b/main.py index c7e479a..c5f6d99 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,30 @@ +from pathlib import Path from libs.filesearch import watch_downloads from libs.hashd import hashcheck +from plyer import notification +import time +import os +PROJECT_DIR = Path(__file__).parent.resolve() +print(f"Monitoring Downloads folder: ") +notification.notify( + title="Vanti", + message=f"Vanti is enabled, keeping you secured", + app_name="Vanti", + timeout=5, +) for file_path in watch_downloads(): - + if file_path.name == "hashes.txt": + continue + time.sleep(2) print("Received file path:", repr(file_path)) - hashcheck(file_path) \ No newline at end of file + is_virus = hashcheck(file_path) + print(f"{file_path} is a virus: {is_virus}") + if is_virus: + os.remove(file_path) + notification.notify( + title="Virus Contained", + message=f"The file {file_path} has been detected as a virus and has been contained. Move it out of the containment folder to keep it or else it will be deleted in 24 Hours", + app_name="Vanti", + timeout=5, + ) \ No newline at end of file