Skip to content

Latest commit

 

History

History
114 lines (81 loc) · 4.78 KB

File metadata and controls

114 lines (81 loc) · 4.78 KB

🛡️ File Scanning & Security System

A Python CLI tool that scans, analyzes, and manages local files, identifying potentially suspicious files based on extensions, names, and size.


✨ Core Features

Feature Description
🔍 Recursive Scanning Deep directory traversal to extract metadata (Name, Ext, Size, Path).
🚨 Triple-Threat Detection Identifies risks based on Dangerous Extensions, Malicious Names, and Size (>10MB).
🛡️ Smart Whitelisting Easily mark false positives as "Safe" to ignore them in future scans.
📊 Audit Logging Automatically generates structured logs for every detected threat.
📈 Real-time Analytics Aggregated stats including threat level distributions and disk footprint.
🗑️ Secure Remediation Directly delete flagged threats with built-in safety confirmations.
⚡ Advanced Filtering Filter results by specific extensions or calculate footprint for threat categories.

🎯 Threat Scoring System

Each file is analyzed against three primary risk factors. The Suspicion Level (1-3) is calculated as the sum of these matches:

  1. Level 1 (Low): Matches one criteria (e.g., just a large file).
  2. Level 2 (Medium): Matches two criteria (e.g., suspicious name + dangerous extension).
  3. Level 3 (High): Matches all three criteria (e.g., large .exe named Update.exe).

🛠️ Setup & Installation

Prerequisites

  • Python 3.10+
  • No external libraries required! (Built using Python Standard Library).

Step 1: Clone the Repository

git clone <repository-url>
cd file-security-scanner

Step 2: Define Suspicious File Criteria

Tune the detection engine by modifying these files in the root directory:

  • suspicious_file_types.txt: Define extensions to flag (e.g., exe, bat).
  • suspicious_file_names.txt: Define keywords to flag (e.g., password, crack).

Step 3: Run the Application

python main.py

📖 Usage Guide (Menu Options)

  1. Scan Folder: Define the target root directory for analysis.
  2. Identify & Log: Run the detection engine and generate a security audit log.
  3. Mark as Safe: Whitelist specific files to prevent future flagging.
  4. Display Statistics: View a high-level summary of the scan results.
  5. Delete Files: Safely remove flagged files from the system.
  6. Threat Levels: Breakdown of files by their specific risk score (1, 2, or 3).
  7. Filter Results: Search for specific extensions within the flagged list.
  8. Size Analysis: Calculate the total storage impact of suspicious files.
  9. Exit: Safely close the system.

📂 Project Architecture

🧠 Core Engine

File Responsibility
main.py CLI Entry point and menu orchestration.
scanner.py Directory traversal and metadata extraction.
suspicious.py Threat detection logic and scoring algorithms.
logger.py Structured audit logging of security events.
delete_suspicious.py Logic for secure and confirmed file removal.

📊 Analysis & Utilities

File Responsibility
statistics.py Data aggregation for scan summaries.
calculate_sizes.py Calculates storage impact of whitelisted files.
calculate_total_size.py Calculates storage impact of flagged files.
count_extensions.py Frequency analysis of file extensions.
count_suspicious_level.py Threat level distribution analysis.
filter_by_extension.py Utility for precise search within scan results.
safe_files.py State management for the whitelisting system.
list_validator.py Robust data structure and type validation.
file_reader.py Configuration and criteria parsing.

📢 Disclaimer

Caution

This tool is intended for educational and security auditing purposes.
Always verify files manually before performing deletion actions.

The developer is not responsible for any accidental data loss.


Developed with ❤️ for the Security Community