Automated Vulnerability Scanning, Threat Intelligence, and Risk Assessment System
- Overview
- Features
- Repository Structure
- Architecture
- Technology Stack
- Installation
- Quick Start
- System Components
- Alert System
- Data Flow
- API Documentation
- Dashboard
- Configuration
- Project Requirements Compliance
The Cyber Risk Assessment Platform (CRATIP) is an enterprise-grade security assessment system that combines automated vulnerability scanning, threat intelligence enrichment, and AI-powered risk analysis to provide comprehensive security insights.
β
Automated Vulnerability Scanning - Nmap-based network discovery and service detection
β
Threat Intelligence Integration - Real-time data from VirusTotal, Shodan, Vulners, and NVD
β
Risk Scoring & Analysis - ML-based scoring with critical/high/medium/low classification
β
Automated Alerting - Real-time notifications for high-risk vulnerabilities
β
Centralized Dashboard - Interactive Streamlit interface with charts and metrics
β
Audit-Ready Reports - PDF, Excel, and CSV export capabilities
β
AI Analyst - OpenAI-powered threat analysis and remediation recommendations
Directory structure:
βββ nevinbeno-The-CRATIP/
βββ README.md
βββ requirements.txt
βββ backend/
β βββ alerts.py
β βββ config.py
β βββ database.py
β βββ main.py
β βββ schemas.py
β βββ reports/
β β βββ csv_report.py
β β βββ excel_report.py
β β βββ pdf_report.py
β βββ services/
β βββ layer1_service.py
β βββ layer2_service.py
β βββ layer3_service.py
β βββ orchestrator.py
βββ dashboard/
β βββ app.py
β βββ data_loader.py
β βββ _pages/
β β βββ ai_analyst.py
β β βββ alerts.py
β β βββ nmap.py
β β βββ overview.py
β β βββ reports.py
β β βββ risk_analysis.py
β β βββ threat_intel.py
β β βββ threat_summary.py
β β βββ vulnerability.py
β βββ utils/
β βββ pdf_export.py
βββ layer1_scanning/
β βββ __init__.py
β βββ profiles.py
β βββ scanner.py
β βββ utils.py
βββ layer2_threat_intel/
β βββ __init__.py
β βββ enricher.py
β βββ utils.py
β βββ clients/
β βββ nvd.py
β βββ shodan.py
β βββ virustotal.py
β βββ vulners.py
βββ layer3_risk_scoring/
β βββ ai_reasoner.py
β βββ scorer.py
βββ .devcontainer/
βββ devcontainer.json
- Automated Nmap scans with customizable profiles (Quick, Normal, Intensive)
- Service detection and version identification
- Port state analysis
- CIDR/ASN filtering support
- VirusTotal: IP reputation and malware detection
- Shodan: Public exposure and vulnerability assessment
- Vulners: CVE database integration
- NVD: National Vulnerability Database lookups
- Asset-level risk scoring (0-100 scale)
- Severity classification (Critical/High/Medium/Low)
- Service-based risk calculations
- Threat intel impact scoring
- π΄ Critical Risk Score (β₯80)
- π High Risk Score (β₯60)
- π Multiple Vulnerabilities (β₯5)
- π High-Risk Ports Exposed (SSH, RDP, SMB, SQL)
- π΄ Malicious IP Detected
- π Shodan Vulnerabilities (>5)
- π‘ Unusual Port Activity (>20 open ports)
- Real-time generation after each scan
- Configurable thresholds
- Dashboard integration with filtering
- Historical tracking and analytics
- CSV export capability
- Overview: Executive summary with KPIs
- Nmap Results: Detailed service inventory
- Vulnerability Insights: Severity-based analysis
- Threat Summary: Aggregated threat intelligence
- Threat Intel: Detailed external data sources
- Risk Analysis: Risk scoring and trends
- Alerts: Real-time security notifications
- AI Analyst: GPT-powered security insights
- Reports: Compliance-ready documentation
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DASHBOARD (Streamlit) β
β Overview | Nmap | Vulnerabilities | Threats | Alerts β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BACKEND API (FastAPI) β
β /scan/start | /nmap/results | /risk/summary | /alerts β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββΌββββββββββββββ
βΌ βΌ βΌ
ββββββββββ ββββββββββ ββββββββββ
βLayer 1 β βLayer 2 β βLayer 3 β
β Nmap ββββΆβThreat ββββΆβ Risk β
βScanningβ β Intel β βScoring β
ββββββββββ ββββββββββ βββββ¬βββββ
β
βΌ
βββββββββββββ
β Alerts β
βGeneration β
βββββββ¬ββββββ
β
βΌ
βββββββββββββ
β Database β
β (SQLite) β
βββββββββββββ
Backend:
- FastAPI 0.115.0 - High-performance async API framework
- SQLite 3 - Embedded database for scan storage
- Pydantic 2.9.0 - Data validation
Scanning & Security:
- python-nmap 0.7.1 - Network scanning
- Shodan 1.31.0 - Internet-wide asset discovery
- Vulners 2.1.0 - Vulnerability intelligence
Dashboard:
- Streamlit 1.39.0 - Interactive web interface
- Plotly 5.24.1 - Data visualization
- Pandas 2.2.3 - Data manipulation
Reporting:
- ReportLab 4.2.5 - PDF generation
- XlsxWriter 3.2.0 - Excel reports
- OpenPyXL 3.1.5 - Excel manipulation
- Python 3.10 or higher
- Nmap installed on system. (Install nmap)
- API keys (optional but recommended):
git clone nevinbeno/The-CRATIP.git
cd The-CRATIPpython -m venv .venv.venv\Scripts\activate # windows
source .venv/bin/activate # linux / Macpip install --upgrade pip # (optional: upgrade pip)
pip install -r requirements.txtCreate a .env file in the project root:
# API Keys (Optional)
VIRUSTOTAL_API_KEY=your_virustotal_key
SHODAN_API_KEY=your_shodan_key
VULNERS_API_KEY=your_vulners_key
NVD_API_KEY=your_nvd_key
OPENROUTER_API_KEY=your_openrouter_key
# Database
DATABASE_URL=sqlite:///backend/cratip.db
# Backend
BACKEND_HOST=127.0.0.1
BACKEND_PORT=8000Terminal 1 - Backend:
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000Terminal 2 - Dashboard:
streamlit run dashboard/app.py# Start Backend
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd backend; uvicorn main:app --reload"
# Start Dashboard
Start-Process powershell -ArgumentList "-NoExit", "-Command", "streamlit run dashboard/app.py"- Dashboard: http://localhost:8501
- API Documentation: http://localhost:8000/docs
- Backend Health: http://localhost:8000/health
def run_layer1_scan(targets, ports, scan_profile):
"""
Executes Nmap scan and returns flat service list
Returns:
{
"services": [...],
"total_services": N
}
"""def run_layer2_enrichment(layer1_result):
"""
Enriches scan with threat intelligence
Returns:
{
"data": {host: {services: [...]}},
"threat_intel": {host: {vt, shodan, ...}}
}
"""def run_layer3_scoring(layer2_result):
"""
Calculates risk scores and aggregates statistics
Returns:
{
"assets": [{ip, risk_score, risk_level, ...}],
"risk": {total_assets, critical, high, ...}
}
"""CREATE TABLE scans (
id INTEGER PRIMARY KEY,
scan_type TEXT,
scan_profile TEXT,
targets TEXT,
ports TEXT,
layer1_json TEXT,
layer2_json TEXT,
layer3_json TEXT,
created_at TEXT
);CREATE TABLE alerts (
id INTEGER PRIMARY KEY,
alert_type TEXT,
severity TEXT,
title TEXT,
description TEXT,
targets TEXT,
created_at TEXT,
acknowledged INTEGER DEFAULT 0
);CREATE TABLE audit_logs (
id INTEGER PRIMARY KEY,
timestamp TEXT,
username TEXT,
action TEXT,
details TEXT
);Alert thresholds can be customized in backend/alerts.py:
ALERT_THRESHOLDS = {
"CRITICAL_RISK_SCORE": 80,
"HIGH_RISK_SCORE": 60,
"CRITICAL_VULNERABILITIES": 5,
"HIGH_RISK_PORTS": {22, 3389, 445, 1433, 3306},
"MALICIOUS_IP_THRESHOLD": 3,
}Scan Completed
β
Layer 3 Results Available
β
generate_alerts_from_scan()
β
Check Each Alert Rule
β
Create Alert in Database
β
Display in Dashboard
- Alert Overview: Total, Active, Critical, High, Acknowledged counts
- Filtering: By severity, status, and type
- Visualization: Severity distribution pie chart, timeline chart
- Export: CSV download for all alerts
1. User Initiates Scan (Dashboard)
β
2. POST /scan/start (Backend API)
β
3. Background Task Starts
β
4. Layer 1: Nmap Scan
Output: Flat list of services
β
5. Layer 2: Threat Intelligence
Output: Host-organized data + threat intel
β
6. Layer 3: Risk Scoring
Output: Assets + aggregated risk summary
β
7. Alert Generation
Checks thresholds, creates alerts
β
8. Database Storage
All layers saved as JSON
β
9. Dashboard Auto-Refresh
Loads data via API endpoints
β
10. Display: Charts, Metrics, Tables, Alerts
Layer 1 Output:
{
"services": [
{
"host": "192.168.1.1",
"port": 80,
"protocol": "tcp",
"state": "open",
"service": "http",
"product": "Apache",
"version": "2.4.41",
"vulnerabilities": 2
}
],
"total_services": 10
}Layer 2 Output:
{
"data": {
"192.168.1.1": {
"services": [...]
}
},
"threat_intel": {
"192.168.1.1": {
"virustotal": {...},
"shodan": {...},
"vulners": [...],
"nvd": [...]
}
}
}Layer 3 Output:
{
"assets": [
{
"ip": "192.168.1.1",
"risk_score": 75,
"risk_level": "HIGH",
"open_ports": 5,
"vulnerabilities": 10
}
],
"risk": {
"total_assets": 5,
"critical": 1,
"high": 2,
"medium": 1,
"low": 1,
"overall_score": 65
}
}Start a new vulnerability scan
Request:
{
"targets": ["192.168.1.1", "192.168.1.2"],
"ports": "1-1000",
"scan_profile": "Normal"
}Response:
{
"status": "started",
"targets": ["192.168.1.1", "192.168.1.2"],
"scan_profile": "Normal"
}Get current scan status
Response:
{
"state": "running",
"started_at": "2026-01-12T10:30:00",
"finished_at": null
}Get flattened scan results
Response: Array of service objects
Get threat intelligence data
Response: Array of IP-based threat intel
Get aggregated risk summary
Response:
{
"total_assets": 5,
"critical": 1,
"high": 2,
"medium": 1,
"low": 1,
"overall_score": 65
}Get all alerts
Get unacknowledged alerts only
Get alert statistics
Response:
{
"total": 15,
"active": 8,
"critical": 3,
"high": 5,
"medium": 7,
"acknowledged": 7
}- π Overview - Executive summary with key metrics
- π°οΈ Nmap - Detailed scan results table
- π Vulnerability Insights - Severity-based vulnerability analysis
β οΈ Threat Summary - Aggregated threat posture- π Threat Intel - External intelligence sources
- π Risk Analysis - Risk scoring and trends
- π¨ Alerts - Security alert monitoring
- π§ AI Analyst - GPT-powered insights
- π Reports - Export and compliance
- Real-time Updates: Auto-refresh during scans
- Interactive Charts: Plotly-based visualizations
- Filtering: Multi-criteria filtering on all pages
- Export: CSV, Excel, PDF report generation
- Dark/Light Theme: User-selectable interface mode
- Quick: Fast scan of top 100 ports
- Normal: Standard scan with service detection
- Intensive: Comprehensive scan with OS detection
Configure in .env:
VIRUSTOTAL_RATE_LIMIT=4
SHODAN_RATE_LIMIT=1Modify thresholds in backend/alerts.py:
ALERT_THRESHOLDS = {
"CRITICAL_RISK_SCORE": 80,
"HIGH_RISK_SCORE": 60,
# Add custom thresholds
}| Requirement | Status | Implementation |
|---|---|---|
| Automated vulnerability scanning and risk scoring | β Complete | Layer 1 (Nmap) + Layer 3 (Risk Scoring) |
| Integration with third-party security APIs | β Complete | VirusTotal, Shodan, Vulners, NVD |
| Centralized dashboards for monitoring | β Complete | 9-page Streamlit dashboard |
| Alerts for high-risk vulnerabilities | β Complete | Automated alert system with 7 types |
| Audit-ready reports | β Complete | PDF, Excel, CSV exports |
- AI-powered threat analysis
- Historical trend tracking
- Real-time metric updates
- Configurable alert thresholds
- Comprehensive audit logging
Backend not starting:
# Check if port 8000 is available
netstat -ano | findstr :8000
# Kill existing process if needed
taskkill /PID <pid> /FDashboard connection error:
- Ensure backend is running on port 8000
- Check
API = "http://127.0.0.1:8000"in dashboard/app.py
Nmap not found:
- Install Nmap from https://nmap.org/download.html
- Add to system PATH
API keys not working:
- Verify
.envfile is in project root - Check key format (no quotes needed)
- Restart backend after adding keys
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License.
- Development Team - Infosys Final Project
- Mr. Utkarsh Dixit, Mentor at Infosys
- Nmap Development Team
- FastAPI Framework
- Streamlit Community
- Security Intelligence Providers (VirusTotal, Shodan, Vulners, NVD)
For issues and questions:
- Create an issue in the repository
- Contact the development team
Version: 1.0.0
Status: Production Ready β
π Project Successfully Running! π Access URLs: Dashboard (Streamlit):
Local: http://localhost:8502 Network: http://192.168.1.6:8502 Backend API (FastAPI):
API Documentation: http://localhost:8000/docs
Health Check: http://localhost:8000/health
π How to Use:
Open the Dashboard β http://localhost:8502
Configure Scan β Use left sidebar
Enter target IPs or domains (e.g., scanme.nmap.org)
Select scan profile (Quick/Normal/Intensive)
Optional: Specify ports
Start Scan β Click the "Start Scan" button
Monitor Results β Navigate through tabs:
π Overview - Executive summary
π°οΈ Nmap - Scan details
π¨ Alerts - Security notifications
π Risk Analysis - Risk scores
π§ AI Analyst - GPT insights
β¨ All Features Active:
β
Automated vulnerability scanning
β
Threat intelligence (VirusTotal, Shodan, Vulners, NVD)
β
Risk scoring and classification
β
Real-time security alerts
β
Interactive dashboards with charts
β
PDF/Excel/CSV report exports
Your Cyber Risk Assessment Platform is ready to scan! π‘οΈ