S-aghori/Netscanner

GitHub: S-aghori/Netscanner

一个用纯 Python 标准库实现的红队网络侦察工具包,将主机发现、端口扫描、Banner 抓取、CVE 匹配与报告生成整合为自动化流水线,专为 OSCP 备考和渗透测试方法论学习设计。

Stars: 0 | Forks: 0

# 🔴 NetScanner v1.0 — 红队网络侦察工具包 ![Python](https://img.shields.io/badge/Python-3.x-00ff9d?style=flat-square&logo=python) ![Platform](https://img.shields.io/badge/Platform-Kali%20Linux-557C94?style=flat-square&logo=kali-linux) ![Purpose](https://img.shields.io/badge/Purpose-OSCP%20Prep-red?style=flat-square) ![License](https://img.shields.io/badge/License-Educational-orange?style=flat-square) ![Status](https://img.shields.io/badge/Status-Complete-brightgreen?style=flat-square) ## ⚠️ 免责声明 ## 🎯 此工具的功能 NetScanner 在一个 pipeline 中自动执行完整的 OSCP 侦察方法论: ``` Host Discovery → Port Scan → Banner Grab → CVE Lookup → Exploit → HTML Report ``` ## 📸 截图 ### 1. 扫描器运行中 — 发现 12 个开放端口 ![扫描器运行中](https://raw.githubusercontent.com/S-aghori/Netscanner/main/screenshots/The_Scanner_Running.png) ### 2. CVE 查询 — 自动漏洞检测 ![CVE 查询](https://static.pigsec.cn/wp-content/uploads/repos/cas/9b/9bf2fcac01dc93bfd379b655fb968d3eb9f00789eb0c8e80c1d976c25487ccd2.png) ### 3. ROOT Shell — uid=0(root) ![ROOT Shell](https://static.pigsec.cn/wp-content/uploads/repos/cas/4c/4c3861ba3ec5467bca566c0e87d5013842a0cc2558ec75a53526730e666d2473.png) ### 4. 密码破解 — /etc/shadow 已导出 ![密码破解](https://static.pigsec.cn/wp-content/uploads/repos/cas/45/45fefedc834cca5033bcdb8be1d65e2e68d69d61f19229182b1e83973470ab64.png) ### 5. HTML 渗透测试报告 — 自动生成 ![HTML 报告](https://static.pigsec.cn/wp-content/uploads/repos/cas/07/07ca1272fa312e6353baf955ca18ee5c6342ac02326e5b86667b64066a0369ec.png) ## 🛠️ 项目结构 ``` netscanner/ ├── scanner.py ← Main CLI entry point (ties everything together) ├── host_discover.py ← Multithreaded ping sweep ├── port_scan.py ← 100-thread TCP port scanner ├── banner_grab.py ← Service & version detection ├── cve_lookup.py ← Auto CVE matching from banners ├── report_gen.py ← Professional HTML report generator └── screenshots/ ← Lab proof screenshots ``` ## ⚙️ 要求 无需外部库 — 仅使用 Python 标准库! ``` python3 --version # Python 3.6+ ``` ## 🚀 用法 ### 带有主机发现的全面扫描 ``` python scanner.py -t 192.168.56.0/24 --discover -o report.json ``` ### 扫描单个目标 ``` python scanner.py -t 192.168.56.200 -p 1-1024 -o results.json ``` ### 扫描全端口范围 ``` python scanner.py -t 192.168.56.200 -p 1-65535 -o full.json ``` ### 运行单个模块 ``` # Host discovery python host_discover.py 192.168.56.0/24 # Port scan python port_scan.py 192.168.56.200 # Banner grab python banner_grab.py 192.168.56.200 # CVE lookup python cve_lookup.py 192.168.56.200 # 生成 HTML 报告 python report_gen.py ``` ## 📊 示例输出 ``` ╔══════════════════════════════════════╗ ║ NETSCANNER v1.0 ║ ║ Red Team Recon Toolkit ║ ║ [!] For authorized testing only ║ ╚══════════════════════════════════════╝ [*] Phase 1 — Host Discovery on 192.168.56.0/24 [+] Host up: 192.168.56.200 [+] Found 1 live host [*] Phase 2 — Port Scan on 192.168.56.200 (1-1024) [+] 12 open port(s): [21, 22, 23, 25, 53, 80, 111, 139, 445, 512, 513, 514] [*] Phase 3 — Banner Grab on 192.168.56.200 21/tcp open 220 (vsFTPd 2.3.4) 22/tcp open SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1 80/tcp open HTTP/1.1 200 OK Server: Apache/2.2.8 [+] Scan complete! Report saved → report.json ``` ### CVE 查询输出 ``` ══════════════════════════════════════════════════════ CVE FINDINGS FOR 192.168.56.200 ══════════════════════════════════════════════════════ [🔴 CRITICAL] Port : 21/tcp Banner : 220 (vsFTPd 2.3.4) CVE : CVE-2011-2523 Detail : vsftpd 2.3.4 backdoor — gives instant root shell Exploit : exploit/unix/ftp/vsftpd_234_backdoor [🔴 CRITICAL] Port : 445/tcp CVE : CVE-2007-2447 Detail : Samba 3.x usermap_script — remote root command injection Exploit : exploit/multi/samba/usermap_script [!] Total vulnerabilities found: 3 ══════════════════════════════════════════════════════ ``` ## ⚔️ 实验室结果 — Metasploitable2 在受控的 VirtualBox 实验室环境中针对 Metasploitable2 进行了测试: | 端口 | 服务 | 版本 | CVE | 结果 | |---|---|---|---|---| | 21 | FTP | vsftpd 2.3.4 | CVE-2011-2523 | ✅ 通过后门获取 ROOT shell | | 22 | SSH | OpenSSH 4.7p1 | CVE-2008-0166 | ✅ 已识别 | | 80 | HTTP | Apache 2.2.8 | CVE-2012-0053 | ✅ 已识别 | | 445 | Samba | 3.0.20 | CVE-2007-2447 | ✅ ROOT shell | | 1524 | 后门 | — | — | ✅ 通过 netcat 即时获取 ROOT | | 3306 | MySQL | 5.0.51a | — | ✅ 无密码登录 | | shadow | 密码 | md5crypt | — | ✅ 破解了 3 个密码 | ## 🧠 学习的概念 | 概念 | 使用位置 | |---|---| | TCP Sockets | port_scan.py, banner_grab.py | | Multithreading | host_discover.py, port_scan.py | | Subprocess | host_discover.py (ping sweep) | | String matching | cve_lookup.py | | JSON handling | scanner.py, report_gen.py | | HTML generation | report_gen.py | | OSCP 方法论 | 完整 pipeline | | CVE 研究 | cve_lookup.py | | 密码破解 | John the Ripper + rockyou.txt | ## 🗺️ OSCP 方法论图 ``` Phase 1 → host_discover.py Recon ✅ Phase 2 → port_scan.py Enumeration ✅ Phase 3 → banner_grab.py Service ID ✅ Phase 4 → cve_lookup.py Vuln Research ✅ Phase 5 → Metasploit Exploitation ✅ (ROOT) Phase 6 → Post Exploitation Loot ✅ (/etc/shadow) Phase 7 → report_gen.py Reporting ✅ ``` ## 🔮 计划升级 - [ ] 使用 Scapy 进行 SYN 隐身扫描 - [ ] 通过 TTL 分析进行 OS 指纹识别 - [ ] 集成 NVD API 进行实时 CVE 查询 - [ ] UDP 端口扫描 - [ ] 自动 Metasploit 模块建议 - [ ] 集成 CVSS 评分 ## 📁 相关内容 - 🔗 Medium 文章:[关于我如何构建和使用此工具的完整文章] - 🔗 项目 1:[之前的网络安全项目] - 🔗 LinkedIn:[S-aghori] ## 👤 作者 **S-aghori** — 正在准备 OSCP 的网络安全学生 公开构建项目以记录这一旅程。 *构建于 Kali Linux | 测试于 Metasploitable2 | 仅供教育使用*
标签:Facebook API, Python, 云存储安全, 插件系统, 无后门, 网络安全, 网络扫描, 网络调试, 自动化, 隐私保护