Pawanchandraupreti/Vuln_scanner_version_2

GitHub: Pawanchandraupreti/Vuln_scanner_version_2

一款局域网漏洞扫描器,可发现主机、检测开放端口与服务、评级风险并生成专业PDF安全报告。

Stars: 0 | Forks: 0

# 🔍 局域网漏洞扫描器 一款实用的网络安全工具,可扫描您局域网内的设备, 识别开放的端口,标记带有严重性评级的高风险服务,并生成 专业的 PDF 安全报告——这正是小型企业愿意付费购买的服务。 ## 功能说明 - 发现子网内所有活跃的主机 - 检测开放端口并识别正在运行的服务和版本 - 为每项发现评级:`CRITICAL / HIGH / MEDIUM / LOW` - 针对每个漏洞提供具体的修复建议 - 输出整洁的、深色主题的 PDF 报告(可选) ## 安装说明 ### 快速设置 (Windows) ``` # 运行 setup 脚本 setup.bat ``` ### 手动设置 ``` # 1. 创建 virtual environment python -m venv venv # 2. 激活 virtual environment # 在 Windows 上: venv\Scripts\activate # 在 Linux/macOS 上: source venv/bin/activate # 3. 安装依赖 pip install -r requirements.txt ``` ### 完整安装(包含 nmap 以获取高级功能) ``` # 安装 nmap system tool # Linux: sudo apt install nmap # macOS: brew install nmap # Windows: https://nmap.org/download.html # 然后安装 Python 依赖 pip install -r requirements.txt ``` ## 用法 ``` # 基本扫描(自动检测你的 subnet) python main.py # 扫描特定目标 python main.py --target 192.168.1.0/24 python main.py --target 192.168.1.100 # 仅扫描特定 ports python main.py --target 192.168.1.0/24 --ports 22,80,443,3306 # 跳过 PDF generation python main.py --no-report # 同时将结果保存为 JSON python main.py --json # 自定义输出 PDF 名称 python main.py --output my_report.pdf ``` ## 功能特性 ### 扫描模式 - **nmap 模式**(当安装了 nmap 时):支持版本检测的全功能扫描 - **Socket 模式**(后备):在没有 nmap 的情况下工作,使用 Python socket 连接 ### 支持的操作系统 - Windows(已通过 Python 3.14 测试) - Linux - macOS ### 端口分析 扫描器会检查常见端口上已知的高风险服务,包括: - 21-25:FTP、SSH、Telnet、SMTP - 80、443:HTTP、HTTPS - 3306、5432、27017:数据库 - 3389、5900、6379:远程访问和缓存 - 以及更多... ## 示例 ### 扫描您的整个网络 ``` python main.py ``` 输出: ``` VULNSCAN - Local Network Vulnerability Scanner ================================================= [*] Scanning network: 192.168.1.0/24 [*] Ports: 21-25,53,80,... ───────────────────────────────────────────────── 192.168.1.50 (myserver.local) OS : Ubuntu 20.04 LTS Ports : 22, 80, 443 Risk : HIGH PORT SERVICE SEVERITY RECOMMENDATION ─────────────────────────────────────────────── 22 SSH LOW Secure if updated... 80 HTTP MEDIUM Unencrypted web traffic... 443 HTTPS LOW Encrypted web... ``` ## 故障排除 ### “nmap not found”警告 这是正常的!扫描器将回退到基于 Python 的 socket 扫描。 如需进行带有版本检测的完整扫描,请安装 nmap。 ### “未找到活跃主机” - 检查您的目标 IP 范围是否正确 - 验证网络连接 - 尝试手动 ping 目标 ### Unicode/编码错误 (Windows) 这些问题已在最新版本中修复。如果您遇到任何问题,请提交报告。 ## 环境要求 **核心:** - Python 3.7+ - python-nmap(可选,会自动回退到 socket 扫描) **系统:** - nmap(可选,用于高级功能) **可选:** - reportlab(用于生成 PDF) ## 许可证 MIT ## 作者 Pawan Chandra Upreti GitHub: https://github.com/Pawanchandraupreti # 扫描特定的子网 sudo python main.py --target 192.168.1.0/24 # 扫描单个主机 sudo python main.py --target 192.168.1.105 # 自定义端口 sudo python main.py --target 192.168.1.0/24 --ports 22,80,443,3306,5432 # 跳过 PDF,仅在终端输出 sudo python main.py --no-report # 同时导出 JSON sudo python main.py --json # 自定义输出路径 sudo python main.py --output my_home_scan.pdf ``` > **Note:** Run with `sudo` for OS detection and accurate SYN scanning. > Without sudo, nmap falls back to TCP connect scans (still works, slightly slower). ## 输出 **Terminal:** ``` 192.168.1.1 (router.local) OS : Linux 4.x Ports : 22, 80, 443 Risk : MEDIUM PORT SERVICE SEVERITY RECOMMENDATION 22 SSH LOW 如果已更新则是安全的。确保使用基于密钥的身份验证... 80 HTTP MEDIUM 未加密的 Web 流量。建议强制使用 HTTPS。 ``` **PDF Report includes:** - Executive summary with severity counts - Device overview table - Per-device findings with service versions - Remediation priority guide ## Scanned Ports (Default) | Port | Service | Why it matters | |-------|------------|---------------------------------------| | 21 | FTP | Plaintext credentials | | 23 | Telnet | Completely unencrypted | | 445 | SMB | WannaCry / EternalBlue target | | 3389 | RDP | Brute-forced constantly | | 5900 | VNC | Often runs with no authentication | | 6379 | Redis | Frequently exposed with no auth | | 27017 | MongoDB | Frequently exposed with no auth | | ... | +15 more | | ## 项目结构 ``` vuln_scanner/ ├── main.py # CLI 入口点,终端输出 ├── scanner.py # 核心 nmap 封装与风险分类 ├── report.py # PDF 报告生成器 (ReportLab) └── requirements.txt ``` ## 展示的技能 - Network scanning with nmap (industry standard tool) - Service fingerprinting and version detection - Risk classification and CVE-aware port assessment - Professional report generation - CLI tool design with argparse ## Ethical Use Only scan networks you own or have explicit permission to test. Unauthorized scanning may be illegal in your jurisdiction. ```
标签:Nmap, Python, 云存储安全, 插件系统, 无后门, 网络安全, 网络扫描, 自动化报告, 虚拟驱动器, 逆向工具, 隐私保护