From 0ca02553856fe18f7de0cf02fff36158d381d14d Mon Sep 17 00:00:00 2001 From: Ketan Date: Fri, 2 Oct 2026 13:27:22 -0400 Subject: [PATCH] PROTOTYPE --- libs/ha.txt => ha.txt | 0 libs/__pycache__/filesearch.cpython-314.pyc | Bin 3213 -> 3213 bytes libs/__pycache__/hashd.cpython-314.pyc | Bin 1937 -> 1933 bytes libs/hashd.py | 5 +--- libs/hashes.txt | 1 + main.py | 27 ++++++++++++++++++-- 6 files changed, 27 insertions(+), 6 deletions(-) rename libs/ha.txt => ha.txt (100%) 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 44ef19e23575dbc9611726e133adebbe302f0a62..28cd85a42c0c4820d4976333344021b810cd9de4 100644 GIT binary patch delta 19 YcmeB`?3Luw=HumJ00N7-8@ZZ!03<#G#sB~S delta 19 YcmeB`?3Luw=HumJ00O<)8@ZZ!03-MVx&QzG diff --git a/libs/__pycache__/hashd.cpython-314.pyc b/libs/__pycache__/hashd.cpython-314.pyc index 0298d7eb6c4364a425a7167a217d6c8ee1595426..00b9509334e8b6f2998a1ded275015e30133a058 100644 GIT binary patch delta 80 zcmbQp-^pUBUv&Bx2d00fS6_GNwB$UBpjha1Q%=4E7HXkd6Uc@wK2>lZc#4xY`-Y}Sk- k9zeMd%#4hTw;A|uGjM)jW8mSN9KdeMA04A{!#Q*>R 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