# marwenkouidhi/automatic-detection-of-email-phishing-attacks architecture

> Architecture diagram of the GitHub repository marwenkouidhi/automatic-detection-of-email-phishing-attacks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marwenkouidhi/automatic-detection-of-email-phishing-attacks
- Repository: https://github.com/marwenkouidhi/automatic-detection-of-email-phishing-attacks

## Overview

##### Main Components
- Data Sources / Datasets: Represent the two primary external datasets (Nazario and TREC phishing corpora) mentioned in the README.
- Preprocessing Module: Represented by the preprocess directory, which contains notebooks that load data, merge datasets, extract features, and prepare DataFrames for use by the models.
- Modeling Module: Represented by the modeling directory (noting the README refers to a “models” directory, but the file tree shows “modeling”). This module contains various notebooks, each corresponding to a different phishing detection approach:
- NLP-based email content classification
- Header-based abnormality detection
- Unwanted content (e.g., suspicious links) detection
- Environment / Configuration: The environment.yml file which defines the Conda environment and installed dependencies.
- (Optionally) Data Storage or Visualization: Even if implicit, you may wish to denote intermediate data storage (DataFrames), especially since the notebooks indicate data transformations.

##### Relationships and Interactions
- Optionally, indicate overall decision logic or integration where the output of each model might be aggregated to produce a final phishing/non-phishing decision.

##### Architectural Patterns and Design Principles
- Modular Design: The separation between the preprocessing stage and each individual model ensures modularity and easier testing or improvements.
- Pipeline Architecture: The system follows a clear pipeline structure from data ingestion, preprocessing, to model inference.
- Reproducibility: Using a Conda environment (specified in environment.yml) ensures the computational environment is reproducible.

##### Specific Technologies, Frameworks, or Libraries
- Although not detailed in every notebook, highlight that TensorFlow and BERT are used in at least one model for fake news detection as per one of the notebook names.
- NLP libraries for processing email content.
- Data manipulation tools (Pandas for DataFrame handling) are implied in the preprocessing scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Sources
    subgraph "Data Sources"
        DS1["Nazario Phishing Dataset"]:::dataset
        DS2["TREC Phishing Dataset"]:::dataset
    end

    %% Preprocessing Module
    PP["Preprocessing: Data Cleaning & Feature Extraction"]:::preprocessing

    %% Modeling Modules
    subgraph "Modeling Modules"
        M1["Model 1: NLP-based Email Content Classification"]:::modeling
        M2["Model 2: Header Abnormality Detection"]:::modeling
        M3["Model 3: Unwanted Content Detection"]:::modeling
        M4["Model 4: Fake News Detection (TensorFlow+BERT)"]:::modeling
    end

    %% Decision Aggregation / Output
    DA["Decision Aggregation & Outcome"]:::modeling
    ENV["Conda Environment (environment.yml)"]:::environment

    %% Connections from Data Sources to Preprocessing
    DS1 --> PP
    DS2 --> PP

    %% Connections from Preprocessing to Modeling Modules
    PP --> M1
    PP --> M2
    PP --> M3
    PP --> M4

    %% Connections from Models to Decision Aggregation
    M1 --> DA
    M2 --> DA
    M3 --> DA
    M4 --> DA

    %% Environment supports Preprocessing and Modeling
    ENV --- PP
    ENV --- M1
    ENV --- M2
    ENV --- M3
    ENV --- M4

    %% Click events for component mapping
    click PP "https://github.com/marwenkouidhi/automatic-detection-of-email-phishing-attacks/tree/main/preprocess/"
    click M1 "https://github.com/marwenkouidhi/automatic-detection-of-email-phishing-attacks/blob/main/modeling/email-body-classification.ipynb"
    click M2 "https://github.com/marwenkouidhi/automatic-detection-of-email-phishing-attacks/blob/main/modeling/emails-header-classification.ipynb"
    click M3 "https://github.com/marwenkouidhi/automatic-detection-of-email-phishing-attacks/blob/main/modeling/PhishingURLDetection.ipynb"
    click M4 "https://github.com/marwenkouidhi/automatic-detection-of-email-phishing-attacks/blob/main/modeling/fake-news-basic-work-tensorflow-with-bert.ipynb"
    click ENV "https://github.com/marwenkouidhi/automatic-detection-of-email-phishing-attacks/blob/main/environment.yml"

    %% Styles
    classDef dataset fill:#f4cccc,stroke:#000,stroke-width:1px;
    classDef preprocessing fill:#c9daf8,stroke:#000,stroke-width:1px;
    classDef modeling fill:#d9ead3,stroke:#000,stroke-width:1px;
    classDef environment fill:#fff2cc,stroke:#000,stroke-width:1px;
```
