performing-dns-tunneling-detection
它能做什么
这个工具会分析 DNS 流量,查找可疑行为,例如可用来隐藏数据的“DNS 隧道”。它会检查 DNS 请求的名称、长度和其他细节,以识别异常行为。
适用场景
- ✓当你在调查可能的数据泄露时。
- ✓在安全测试中,需要检查是否存在隐藏隧道时。
- ✓在分析网络流量中的恶意活动时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-dns-tunneling-detection/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“分析这个 DNS 流量文件,告诉我是否有 DNS 隧道的迹象。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会计算 DNS 请求名称的“熵”(也就是随机程度)。非常随机或特别长的名称,可能意味着有数据被藏在其中。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Performing DNS Tunneling Detection
When to Use
- When conducting security assessments that involve performing dns tunneling detection
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
Prerequisites
- Familiarity with security operations concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Instructions
Analyze DNS traffic for indicators of DNS tunneling using entropy analysis and statistical methods on query name characteristics.
import math
from collections import Counter
def shannon_entropy(data):
if not data:
return 0
counter = Counter(data)
length = len(data)
return -sum((c/length) * math.log2(c/length) for c in counter.values())
# Legitimate domain: low entropy (~3.0-3.5)
print(shannon_entropy("www.google.com"))
# DNS tunnel: high entropy (~4.0-5.0)
print(shannon_entropy("aGVsbG8gd29ybGQ.tunnel.example.com"))
Key detection indicators:
- High Shannon entropy in query names (> 3.5 for subdomain labels)
- Unusually long query names (> 50 characters)
- High volume of TXT record requests to a single domain
- High unique subdomain count per parent domain
- Non-standard character distribution in labels
Examples
from scapy.all import rdpcap, DNS, DNSQR
packets = rdpcap("dns_traffic.pcap")
for pkt in packets:
if pkt.haslayer(DNSQR):
query = pkt[DNSQR].qname.decode()
entropy = shannon_entropy(query)
if entropy > 4.0:
print(f"Suspicious: {query} (entropy={entropy:.2f})")
常见问题
什么是 DNS 隧道?
这是一种把数据藏在正常 DNS 请求中的技术,用来绕过防火墙或其他安全屏障。
这里为什么要关注熵?
正常的 DNS 请求有一定的可预测性,而被隐藏的数据往往更加随机,因此熵值更高。
我需要是网络专家才能使用吗?
不需要,但具备基本的网络安全知识有助于你理解结果。
详情
作者的原始描述
Detects DNS tunneling by computing Shannon entropy of DNS query names, analyzing query length distributions, inspecting TXT record payloads, and identifying high subdomain cardinality. Uses scapy for packet capture analysis and statistical methods to distinguish legitimate DNS from covert channels. Use when hunting for data exfiltration. '
热度
- GitHub 星标
- 35k
- 排名
- #8221
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。