Skip to content
Agentmart
Submit a tool

analyzing-network-covert-channels-in-malware

检测和分析恶意软件使用的隐蔽通信信道,包括 DNS 隧道、ICMP 数据泄露、HTTP 隐写术和协议滥用,用于 C2 通信和数据泄露。

Skill by killvxk

IndexedApache-2.0★ 57
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/killvxk-analyzing-network-covert-channels-in-malware

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

检测和分析恶意软件使用的隐蔽通信信道,包括 DNS 隧道、ICMP 数据泄露、HTTP 隐写术和协议滥用,用于 C2 通信和数据泄露。

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/analyzing-network-covert-channels-in-malware

What's inside

Skill name
analyzing-network-covert-channels-in-malware
Description
检测和分析恶意软件使用的隐蔽通信信道,包括 DNS 隧道、ICMP 数据泄露、HTTP 隐写术和协议滥用,用于 C2 通信和数据泄露。
License
Apache-2.0
Instructions
176 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (7)

  • LICENSE
  • SKILL.md
  • template.md · assets/
  • api-reference.md · references/
  • standards.md · references/
  • workflows.md · references/
  • agent.py · scripts/

SKILL.md (first lines)

# 分析恶意软件中的网络隐蔽信道

## 概述

恶意软件使用隐蔽信道将 C2 通信和数据泄露伪装成看似合法的网络流量。DNS 隧道将数据编码在 DNS 查询和响应中(iodine、dnscat2 等工具和 FrameworkPOS 等恶意软件家族均使用此技术)。ICMP 隧道将数据隐藏在回显请求/响应载荷中(icmpsh、ptunnel)。HTTP 隐蔽信道将 C2 数据嵌入头部、Cookie 或隐写图像中。协议滥用利用允许的协议绕过防火墙。现代基于机器学习的方法对 DNS 隧道检测可达 99% 以上的召回率,但低吞吐量泄露仍然具有挑战性。Palo Alto Unit42 在 2024 年跟踪了三个主要的 DNS 隧道活动(TrkCdn、SecShow、Savvy Seahorse),显示了该技术的持续普遍性。

## 前置条件

- Python 3.9+,安装 `scapy`、`dpkt`、`dnslib`
- Wireshark/tshark,用于 PCAP 分析
- Zeek(原 Bro),用于网络监控
- DNS 查询日志基础设施
- 对 DNS、ICMP、HTTP 协议的数据包级理解

## 操作步骤

### 步骤 1:DNS 隧道检测

```python
#!/usr/bin/env python3
"""检测网络流量中的 DNS 隧道和隐蔽信道。"""
import sys
import json
import math
from collections import Counter, defaultdict

try:
    from scapy.all import rdpcap, DNS, DNSQR, DNSRR, IP, ICMP
except ImportError:
    print("pip install scapy")
    sys.exit(1)


def entropy(data):
    if not data:
        return 0
    freq = Counter(data)
    length = len(data)
    return -sum((c/length) * math.log2(c/length) for c in freq.values())


def analyze_dns_tunneling(pcap_path):
    """检测 PCAP 中的 DNS 隧道指标。"""
    packets = rdpcap(pcap_path)
    domain_stats = defaultdict(lambda: {
        "queries": 0, "total_qname_len": 0, "subdomain_lengths": [],
        "query_types": Counter(), "unique_subdomains": set(),
    })

    for pkt in packets:
        if pkt.haslayer(DNS) and pkt.haslayer(DNSQR):
            qname = pkt[DNSQR].qname.decode('utf-8', errors='replace').rstrip('.')
            qtype = pkt[DNSQR].qtype

            parts = qname.split('.')
            if len(parts) >= 3:
                base_domain = '.'.join(parts[-2:])
                subdomain = '.'.join(parts[:-2])

                stats = domain_stats[base_domain]
                stats["queries"] += 1
                stats["total_qname_len"] += len(qname)
                stats["subdomain_lengths"].append(len(subdomain))
                stats["query_types"][qtype] += 1
                stats["unique_subdomains"].add(subdomain)

    # 对域名进行隧道指标评分
    suspicious = []
    for domain, stats in domain_stats.items():
        if stats["queries"] < 5:
            continue

        avg_subdomain_len = (sum(stats["subdomain_lengths"]) /
                             len(stats["subdomain_lengths"]))
        unique_ratio = len(stats["unique_subdomains"]) / stats["queries"]

        # 计算子域名熵
        all_subdomains = ''.join(stats["unique_subdomains"])
        sub_entropy = entropy(all_subdomains)

        score = 0
        reasons = []

        if avg_subdomain_len > 30:
            score += 30
            reasons.append(f"子域名过长(平均 {avg_subdomain_len:.0f} 字符)")
        if unique_ratio > 0.9:
            score += 25
            reasons.append(f"唯一性高({unique_ratio:.2%})")
        if sub_entropy > 4.0:
            score += 25
            reasons.append(f"熵值高({sub_entropy:.2f})")
        if stats["query_types"].get(16, 0) > 10:  # TXT 记录
            score += 20
            reasons.append(f"大量 TXT 查询({stats['query_types'][16]} 次)")

        if score >= 50:
            suspicious.append({
                "domain": domain,
                "score": score,
                "queries": stats["queries"],
                "avg_subdomain_length": round(avg_subdomain_len, 1),
                "unique_subdomains": len(stats["unique_subdomains"]),
                "subdomain_entropy": round(sub_entropy, 2),
                "reasons": reasons,
            })

    return sorted(suspicious, key=lambda x: -x["score"])


def analyze_icmp_tunneling(pcap_path):
    """检测 PCAP 中的 ICMP 隧道。"""
    packets = rdpcap(pcap_path)
    icmp_stats = defaultdict(lambda: {"count": 0, "payload_sizes": [], "payloads": []})

    for pkt in packets:
        if pkt.haslayer(ICMP) and pkt.haslayer(IP):
            src = pkt[IP].src
            dst = pkt[IP].dst
            key = f"{src}->{dst}"

From killvxk/cybersecurity-skills-zh, Apache-2.0.

More from killvxk/cybersecurity-skills-zh

Signals

Stars
57
Forks
14
Open issues
1
Last commit (this folder)
Mar 17, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from killvxk

Cite this page

analyzing-network-covert-channels-in-malware skill. Agent Mart. https://agentmart.dev/skills/killvxk-analyzing-network-covert-channels-in-malware (last updated 2026-10-24)