CoolFace
Apppublic

NorthernTribe-Research/ai-phishing-detector

sourceHugging Facemitupdated 7mo agoView on Hugging Face
0likes
App README

![License](https://opensource.org/licenses/MIT) ![Python](https://www.python.org/) ![Docker](Dockerfile) ![Hugging Face](https://huggingface.co/spaces/unit731/ai-phishing-detector)

Enterprise-Grade Neural Threat Detection Engine

A production-ready, multi-modal inference engine designed to detect sophisticated AI-generated phishing, impersonation, and social engineering attacks across Email, SMS, and Social Platforms.


System Overview

This solution leverages Zero-Shot Natural Language Inference (NLI) and Computer Vision (OCR) to identify malicious intent without relying solely on static signature databases. It is designed for rapid deployment in containerized environments (Docker/Kubernetes) or serverless platforms like Hugging Face Spaces.

Core Capabilities

FeatureDescriptionTechnology Stack
Contextual AnalysisDetects coercion, urgency, and fear-mongering tactics.DeBERTa-v3 (Zero-Shot)
Impersonation DetectionIdentifies brand spoofing and executive masquerading.Stylometry & NLI
Visual Threat IntelExtracts text from screenshots/images for analysis.Tesseract / EasyOCR
Threat IntelligenceValidates URLs against risk heuristics and homographs.Heuristic Engine
Explainable AIProvides human-readable breakdown of why a message is risky.Shapley / Attention

Architecture

mermaid
graph TD
    User[User / Client] -->|Text or Image| API[FastAPI / Gradio Interface]
    API --> Router{Input Type?}
    
    Router -->|Image| OCR[OCR Engine]
    OCR -->|Extracted Text| Pre[Preprocessing Pipeline]
    Router -->|Text| Pre
    
    Pre -->|Cleaned Text| NLI[Zero-Shot Classifier]
    Pre -->|Metadata| Heur[Heuristic Engine]
    
    subgraph Inference Engine
        NLI -->|Intent Probabilities| Aggregator
        Heur -->|URL/Urgency Scores| Aggregator
        Aggregator -->|Final Risk Score| Outcome[Risk Assessment]
    end
    
    Outcome -->|JSON / UI| User

Quickstart

Option A: Docker (Recommended)

Run the fully containerized application to ensure environment consistency.

bash
# Build the container
docker build -t unit731/phish-detector .

# Run on port 7860
docker run -p 7860:7860 unit731/phish-detector

Option B: Local Python Environment

bash
# 1. Clone repository
git clone https://github.com/734ai/phish_detector_space_files.git
cd phish_detector_space_files

# 2. Setup Virtual Environment
python -m venv .venv
source .venv/bin/activate

# 3. Install Dimensions
pip install -r requirements.txt

# 4. Launch Application
python app.py

Configuration

The application can be configured via Environment Variables for enterprise integration.

VariableDescriptionDefault
HF_TOKENHugging Face Token for gated models.None
PORTListening port for the application.7860
LOG_LEVELLogging verbosity (INFO, DEBUG, ERROR).INFO

Security & Privacy

  • —Data Handling: This application processes data in-memory. No data is persisted to disk or external databases by default.
  • —PII Safety: We recommend sanitizing PII (Personally Identifiable Information) before submission, although the model runs locally within the container.
  • —Container Security: The Docker image is built on python:3.10-slim to minimize attack surface. Run as a non-root user (configured in Dockerfile).

Directory Structure

text
.
├── app.py                 # Application Entrypoint (Gradio/FastAPI)
├── Dockerfile             # Container Definition
├── requirements.txt       # Python Dependencies
├── src/
│   ├── inference.py       # Core Logic & Model Loading
│   ├── ocr.py             # Optical Character Recognition Pipeline
│   ├── preprocessing.py   # Text Normalization & Heuristics
│   └── scoring.py         # Risk Aggregation Logic
└── assets/                # Static Resources (UI Styles, Images)

Contributing

We welcome contributions from the security community. Please follow these steps:

  1. 1.Fork the repository.
  2. 2.Create a feature branch (git checkout -b feature/AmazingFeature).
  3. 3.Commit your changes.
  4. 4.Open a Pull Request.

License

Distributed under the MIT License. See LICENSE for more information.


Developed by Unit 731 for a safer internet.