# radadiyaaditya/dns-filtering-with-ml architecture

> Architecture diagram of the GitHub repository radadiyaaditya/dns-filtering-with-ml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/radadiyaaditya/dns-filtering-with-ml
- Repository: https://github.com/radadiyaaditya/dns-filtering-with-ml

## Overview

##### Project Type Analysis
This is a specialized network security application that combines Software-Defined Networking (SDN) with Machine Learning to create an intelligent packet filtering system. The project aims to detect and filter unwanted traffic by analyzing domain names and their actual content.

##### Main Components

a) Input Layer:
- Network Traffic Interceptor (using Scapy)
- Packet Capture Component
- Domain Name Extractor

b) Processing Layer:
- Web Scraping Module (BeautifulSoup)
- ML Processing Components:
- Sentence Transformer Module
- Hugging Face Models
- Similarity Analysis Engine (simwords.py)

c) SDN Control Layer:
- SDN Controller
- Policy Enforcement Module
- Traffic Filtering Rules

d) Output Layer:
- Packet Forward/Drop Decision
- Traffic Management Actions

##### Specific Elements

a) Input Section:
**[Network Traffic] → [Packet Capture] → [Domain Extraction]**

b) Processing Section:
**[Web Scraper] → [Content Analysis] → [ML Processing]**
- ↓
- [Similarity Comparison Engine]

c) Decision Section:
**[SDN Controller] ← [Policy Engine] ← [ML Decision Output]**
- ↓
**[Traffic Filtering]**

##### Technical Details to Highlight

- Python3 as the primary implementation language
- BeautifulSoup for web content extraction
- Hugging Face and Sentence Transformers for ML processing
- Scapy for packet manipulation
- SDN integration points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        NT[Network Traffic]
        PC[Packet Capture]
        DE[Domain Extractor]
    end

    subgraph Processing
        WS[Web Scraper]
        CA[Content Analysis]
        ML[ML Processing]
        SAE[Similarity Analysis Engine]:::simAnalysis
        HF[HuggingFace Models]
        ST[Sentence Transformers]
    end

    subgraph Control
        PE[Policy Engine]
        SDNC[SDN Controller]
        TF[Traffic Filter]
    end

    %% Input Layer Connections
    NT --> PC
    PC --> DE

    %% Processing Layer Connections
    DE --> WS
    WS --> CA
    CA --> ML
    ML --> SAE
    HF --> ML
    ST --> ML
    SAE --> PE

    %% Control Layer Connections
    PE --> SDNC
    SDNC --> TF
    TF -.-> NT

    %% Styles
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef input fill:#b3e0ff,stroke:#333
    classDef processing fill:#98fb98,stroke:#333
    classDef control fill:#ffd700,stroke:#333
    classDef simAnalysis fill:#98fb98,stroke:#333

    class NT,PC,DE input
    class WS,CA,ML,SAE,HF,ST processing
    class PE,SDNC,TF control

    %% Click Events
    click SAE "https://github.com/RadadiyaAditya/DNS-Filtering-with-ML/blob/main/simwords.py"

    %% Legend
    subgraph Legend
        L1[Network Components]:::input
        L2[Processing Components]:::processing
        L3[Control Components]:::control
    end
```
