Files
Azure/src/scanner.py

36 lines
1.0 KiB
Python
Raw Normal View History

from detections import *
from console import console
from rich.table import Table
from time import time
2026-04-04 15:42:57 +11:00
import os
class Scanner:
def __init__(self):
self.detections = {
"Hash Detection": Hash(),
"Yara Pattern Matching": Yara(),
"Heuristics": Heuristics()
}
def scan_file(self, file_path: str):
with console.status(f"Scanning {file_path}...") as status:
f = open(file_path, "rb")
contents = f.read()
table = Table("Scan", "Match")
for name, detection in self.detections.items():
2026-04-04 15:42:57 +11:00
console.print(f"Running {name}..")
2026-04-04 15:42:57 +11:00
match = detection.run(contents, f, os.path.realpath(file_path))
table.add_row(name, "[bold orange1]⚠️ Match" if match else "[bold green]✅ Clean")
2026-04-04 15:42:57 +11:00
print()
f.close()
print()
console.print(table)