S23kshi/Ai_Network_Security_Scanner
0
๐ก๏ธ AI-Powered Network Security Scanner
A professional-grade, AI-enhanced TCP port scanner with a CLI and a Streamlit web dashboard โ built for security researchers, students, and portfolio showcase.
๐ Project Overview
This tool combines multi-threaded port scanning, service fingerprinting, banner grabbing, and an AI-powered risk analysis engine to give you a complete picture of the exposed attack surface on any network target.
Designed as a B.Tech final-year / capstone project, it demonstrates:
- Systems programming โ raw TCP socket programming in Python
- Concurrency โ ThreadPoolExecutor for high-speed parallel scanning
- AI/ML thinking โ rule-based risk classifier (extensible to scikit-learn)
- Full-stack development โ CLI + reactive Streamlit web dashboard
- Security domain knowledge โ CVE mapping, CVSS-inspired risk scoring
โจ Features
Core Engine
CLI (main.py)
- Coloured terminal output via colorama
- ASCII art banner
- Real-time animated progress bar
- Interactive or argument-driven mode
- Automatic report saving to
reports/
Web Dashboard (app.py)
- Dark cybersecurity-themed Streamlit UI
- Live progress bar during scan
- KPI metric cards (ports scanned, open, risk score)
- AI risk breakdown with colour-coded badges
- Donut chart โ risk distribution
- Bar chart โ open ports by risk level
- Expandable per-port recommendations
- One-click download: CSV / TXT / JSON
๐๏ธ Project Structure
AI-Network-Scanner/
โ
โโโ main.py โ CLI entry point
โโโ app.py โ Streamlit web dashboard
โโโ scanner.py โ Core scanning engine (TCP, banner grabbing)
โโโ ai_analyzer.py โ AI risk classifier & CVE knowledge base
โโโ banner.py โ CLI ASCII art and coloured output helpers
โโโ exporter.py โ TXT / CSV / JSON export utilities
โโโ utils.py โ Input validation & hostname resolution
โ
โโโ reports/ โ Auto-generated scan reports saved here
โโโ assets/ โ Screenshots / media (add your own)
โ
โโโ requirements.txt
โโโ README.md๐ Installation
Prerequisites
- Python 3.10 or higher
- pip
Steps
# 1. Clone or download the project
git clone https://github.com/yourname/AI-Network-Scanner.git
cd AI-Network-Scanner
# 2. (Recommended) Create a virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt๐ฅ๏ธ Usage
CLI Mode
# Interactive mode (prompts for input)
python main.py
# Non-interactive with arguments
python main.py --host 127.0.0.1 --start 1 --end 1024
python main.py --host scanme.nmap.org --start 20 --end 500 --workers 200CLI arguments:
Web Dashboard
streamlit run app.pyOpens at http://localhost:8501 โ configure your target in the sidebar and click START SCAN.
๐ค AI Risk Engine
The ai_analyzer.py module implements a rule-based AI risk classifier:
- Each port maps to a risk profile:
Critical โ High โ Medium โ Low โ Safe - Profiles include descriptions, known CVE identifiers, and security recommendations
- An overall risk score (0โ100) is computed as a weighted average across all open ports
- Easily extensible: swap the rule-based engine for a scikit-learn model trained on CVE data
Risk levels:
๐ธ Screenshots
Add screenshots of your CLI and web UI to `assets/` and link them here.
๐ญ Future Improvements
- [ ] UDP scanning in addition to TCP
- [ ] OS fingerprinting via TTL analysis
- [ ] ML risk model trained on NVD CVE dataset (scikit-learn / XGBoost)
- [ ] Scheduled scans with email/Slack alerts on new open ports
- [ ] Nmap integration for deeper service version detection
- [ ] PDF report generation with company branding
- [ ] IPv6 support
- [ ] Subnet / CIDR range scanning (e.g., 192.168.1.0/24)
๐ ๏ธ Tech Stack
โ ๏ธ Legal & Ethical Disclaimer
This tool is for educational and authorized security testing purposes only. Unauthorized port scanning may violate computer crime laws in your jurisdiction (e.g., CFAA in the USA, Computer Misuse Act in the UK, IT Act in India). Only scan systems you own or have explicit written permission to test. The authors accept no liability for misuse of this software.
๐ค Author
Built as a B.Tech / Capstone portfolio project. Demonstrates proficiency in Python, cybersecurity, concurrency, AI/ML, and full-stack development.
โญ If this project helped you, consider starring the repo!
