yousaf-rahil/D-SD-Enumerator

GitHub: yousaf-rahil/D-SD-Enumerator

两个Python脚本,分别实现DNS记录查询和基于字典的多线程子域发现,用于网络安全学习与CTF侦察。

Stars: 0 | Forks: 0

# 🔍 D-SD Enumerator ![Python](https://raw.githubusercontent.com/yousaf-rahil/D-SD-Enumerator/main/) ![安全](https://raw.githubusercontent.com/yousaf-rahil/D-SD-Enumerator/main/) ![渗透测试](https://raw.githubusercontent.com/yousaf-rahil/D-SD-Enumerator/main/) ![多线程](https://raw.githubusercontent.com/yousaf-rahil/D-SD-Enumerator/main/) ## 📌 功能说明 ### 🔎 DNS 枚举器 (`dns_enumerator.py`) - 运行前检查网络连接 - 查询多种 DNS 记录类型 - 获取的记录类型:**A、AAAA、CNAME、MX、TXT** - 使用 Google 公共 DNS (8.8.8.8) 作为解析器 - 直接将结果显示在终端 ### 🌐 子域枚举器 (`subdomain_enumerator.py`) - 使用**多线程**实现快速发现 - 从子域字典文件中读取 - 将发现的子域保存到 `.txt` 文件中 - 使用 **Lock()** 实现线程安全的文件写入 - 优雅的 Ctrl+C 退出处理 ## 🛠️ 环境要求 ``` pip install tqdm dnspython requests ``` ## 🚀 使用方法 ### DNS 枚举器 ``` # 在第30行更改 target_domain 变量 # 然后运行: python3 dns_enumerator.py ``` ### 子域枚举器 ``` # 在第17行更改 target 变量 # 确保 subdomains.txt 在同一目录下 python3 subdomain_enumerator.py ``` ## 📂 项目结构 ``` D-SD-Enumerator/ │ ├── dns_enumerator.py # DNS record enumeration ├── subdomain_enumerator.py # Subdomain discovery ├── subdomains.txt # Wordlist for subdomains └── discovered_subdomains.txt # Output file (auto-created) ``` ## 📄 代码预览 ### DNS 枚举器 ``` record_list = ['A', 'AAAA', 'CNAME', 'MX', 'TXT'] resolver = dns.resolver.Resolver() resolver.nameservers = ['8.8.8.8'] for i in record_list: try: answer = resolver.resolve(target_domain, i) if answer.rrset: print(f"{i} records of {target_domain}") for data in answer.rrset: print(f"\t{data}") except dns.resolver.NoAnswer: continue ``` ### 子域枚举器 ``` def sub_domain(subdomains): url = f"http://{subdomains}.{target}" try: requests.get(url) except requests.ConnectionError: pass else: print(f"[+] Discovered: {url}") with lock: with open('discovered_subdomains.txt', 'a') as file: file.write(url + '\n') # Threading 实现 for subdomain in subdomains: t1 = threading.Thread(target=sub_domain, args=(subdomain,)) t1.start() thread.append(t1) ``` ## 💡 渗透测试背景 这些脚本涵盖了渗透测试的**侦察阶段**——这是任何真实世界渗透测试的第一步: - **DNS 枚举**可以揭示服务器架构、邮件服务器和隐藏服务 - **子域枚举**可以发现可能含有漏洞的隐藏或遗忘的子域 ## 🔧 技术栈 - Python 3 - `dnspython` — DNS 查询 - `requests` — HTTP 请求 - `threading` — 并发子域扫描 - `tqdm` — 进度条 - `socket` — 网络连接检查 ## 👨‍💻 作者 **Yousaf Rahil** — 有抱负的初级渗透测试工程师 [![领英](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://linkedin.com/in/yousaf-rahil-589a812a8)
标签:dnspython, DNS枚举, GitHub, Python, requests, SYN扫描, tqdm, 侦查, 域名侦查, 域名解析, 子域名枚举, 字典爆破, 学习工具, 数据展示, 无后门, 系统安全, 红队, 网络安全, 网络安全工具, 逆向工具, 隐私保护