Share
## https://sploitus.com/exploit?id=118BD7C3-9E08-5E20-B90F-402659FBF5F2
# ๐ก๏ธ CyberGuard AI โ Cyber Threat Intelligence System
An **AI-powered, NLP-based Cyber Threat Intelligence System** built with
DistilBERT, Streamlit, and Python. Detects and classifies 6 threat types
from raw text with explainable AI, NER, keyword extraction, and PDF reports.
---
## ๐ Quick Start
### 1. Install dependencies
```bash
cd cyber_threat_intel
pip install -r requirements.txt
```
### 2. Launch the app (no training needed โ uses rule-based engine instantly)
```bash
streamlit run app.py
```
### 3. (Optional) Train DistilBERT for higher accuracy
```bash
python train.py
streamlit run app.py # now uses the fine-tuned model
```
---
## ๐ Project Structure
```
cyber_threat_intel/
โโโ app.py # Main Streamlit dashboard
โโโ train.py # DistilBERT training pipeline
โโโ requirements.txt
โ
โโโ config/
โ โโโ settings.py # Global config, constants, paths
โ
โโโ data/
โ โโโ data_generator.py # Synthetic dataset generator
โ
โโโ nlp/
โ โโโ preprocessor.py # Text cleaning, NER, keyword extraction
โ
โโโ models/
โ โโโ classifier.py # DistilBERT fine-tune + inference
โ โโโ rule_based.py # Keyword-frequency fallback
โ โโโ saved/ # Saved model weights (after training)
โ
โโโ intelligence/
โ โโโ engine.py # Threat analysis orchestration
โ โโโ report_generator.py # PDF / text report generator
โ
โโโ ui/
โ โโโ components.py # Reusable Streamlit UI components
โ
โโโ reports/ # Auto-saved PDF/text reports
โโโ assets/ # Static assets
```
---
## ๐ฏ Detected Threat Types
| Threat | Severity | Description |
|---|---|---|
| โ
Benign | None | Normal security communications |
| ๐ฃ Phishing | High | Credential harvesting, social engineering |
| ๐ฆ Malware | Critical | Trojans, RATs, spyware, botnets |
| ๐ฐ Ransomware | Critical | File encryption, ransom demands |
| ๐ฅ DDoS | High | Volumetric/application layer flood attacks |
| ๐ SQL Injection | High | Database query manipulation attacks |
---
## ๐ง System Architecture
```
Input Text
โ
โผ
NLP Preprocessor โโโบ Text Cleaning, Tokenization, Lemmatization
โ
โโโโบ Named Entity Recognition (IPs, URLs, Emails, CVEs, Hashes)
โ
โโโโบ Keyword Extraction (per threat category)
โ
โผ
Classifier
โโโ DistilBERT (if trained model exists)
โโโ Rule-Based Fallback (always available)
โ
โผ
Threat Intel Engine โโโบ Severity + Risk Score + XAI Reasoning
โ
โผ
Streamlit Dashboard โโโบ Charts, Entity Tags, Recommendations
โ
โผ
PDF Report Generator
```
---
## โก Features
- ๐ **Real-time analysis** โ instant results as you type/submit
- ๐ง **DistilBERT** โ transformer-based multi-class classification
- ๐ฏ **Confidence scoring** โ probability distribution across all 6 classes
- ๐ **NER** โ extracts IPs, URLs, emails, CVEs, file hashes
- ๐ท๏ธ **Keyword extraction** โ maps to threat categories
- ๐งฉ **Explainable AI** โ human-readable reasoning for each prediction
- ๐ **Interactive charts** โ gauge, donut, bar charts via Plotly
- ๐ **PDF reports** โ downloadable threat intelligence reports
- ๐ **Analysis history** โ tracks all analyses in session
- โก **Rule-based fallback** โ works without GPU/training
---
## ๐ฆ Requirements
- Python 3.9+
- 4GB RAM minimum (8GB recommended for training)
- GPU optional (CPU inference supported)