Team Ai
Apppublic

S23kshi/Ai_Network_Security_Scanner

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

๐Ÿ›ก๏ธ 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

FeatureDetails
โšก Multi-threaded scanningThreadPoolExecutor, up to 500 workers
๐Ÿ” Full port rangeScan any range 1โ€“65535
๐Ÿท๏ธ Service detection50+ common services identified by port
๐Ÿ“ก Banner grabbingReads service responses for fingerprinting
๐Ÿค– AI risk analysisRule-based engine with CVE mapping
๐Ÿ“Š Risk scoring0โ€“100 overall risk score per scan
๐Ÿ’พ ExportTXT, CSV, JSON reports

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

bash
# 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

bash
# 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 200

CLI arguments:

FlagDefaultDescription
--host(prompted)Target IP or hostname
--start1First port
--end1024Last port
--workers300Thread count (10โ€“500)

Web Dashboard

bash
streamlit run app.py

Opens 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:

LevelColourExamples
๐Ÿ”ด CriticalRedTelnet (23), SMB (445), Redis (6379), MongoDB (27017), RDP (3389)
๐ŸŸ  HighOrangeFTP (21), VNC (5900), MySQL (3306), MSSQL (1433)
๐ŸŸก MediumYellowHTTP (80), SMTP (25), DNS (53)
๐ŸŸข LowGreenSSH (22)
โœ… SafeGreenHTTPS (443)
๐Ÿ”ต InfoBlueUnknown ports

๐Ÿ“ธ Screenshots

Add screenshots of your CLI and web UI to `assets/` and link them here.
CLI ModeWeb Dashboard
[image][image]

๐Ÿ”ญ 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

LayerTechnology
LanguagePython 3.10+
Networkingsocket, concurrent.futures
Web UIStreamlit
Datapandas
Chartsmatplotlib
CLI colourscolorama
AI EngineRule-based classifier (extensible to scikit-learn)

โš ๏ธ 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!