Skip to main content
Glama

mythic-mcp

将 Mythic C2 框架暴露为 MCP 服务器,使 LLM(Claude 等)能够以对话方式操作代理、下发任务和查询平台数据。

功能

  • 代理管理 — 列出所有活跃回调的详细信息,查看单个代理,杀死代理,更改休眠定时器

  • 任务执行 — shell 命令、文件读取/下载/上传、mimikatz、make_token,以及任何 Mythic 命令的通用调度器

  • 平台数据 — 凭据存储、工件日志、事件日志、文件浏览器、载荷列表、C2 配置文件状态

  • 结构化响应 — 每个工具返回 {"status":"ok","data":...} 或 {"status":"error","message":...},便于 LLM 可靠解析

  • 内置提示 — start_pentest 和 start_recon 提示模板

Related MCP server: caldera-mcp

要求

  • Python 3.10+

  • uv 包管理器

  • 运行中的 Mythic 服务器(v3.x+)

安装

git clone <this-repo>
cd mythic-mcp
uv sync

运行

位置参数

uv run main.py <username> <password> [host] [port]
uv run main.py mythic_admin mythic_admin_password localhost 7443

环境变量

export MYTHIC_USERNAME=mythic_admin
export MYTHIC_PASSWORD=mythic_admin_password
export MYTHIC_HOST=localhost
export MYTHIC_PORT=7443
uv run main.py

不使用 TLS

uv run main.py mythic_admin password localhost 7443 --no-ssl

如果服务器静默启动且无输出,则表示正在工作——它在标准输入上等待 MCP 消息。

连接到 Claude Desktop

找到配置文件:

操作系统

路径

Linux

~/.config/Claude/claude_desktop_config.json

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

首先获取 uv 路径:

which uv

在 mcpServers 下添加条目:

{
  "mcpServers": {
    "mythic_mcp": {
      "command": "/home/user/.local/bin/uv",
      "args": [
        "--directory",
        "/path/to/mythic-mcp",
        "run",
        "main.py"
      ],
      "env": {
        "MYTHIC_USERNAME": "mythic_admin",
        "MYTHIC_PASSWORD": "mythic_admin_password",
        "MYTHIC_HOST": "localhost",
        "MYTHIC_PORT": "7443"
      }
    }
  }
}

完全退出并重新启动 Claude Desktop。一旦服务器连接,聊天界面中的工具图标将列出所有已注册的工具。

工具

代理 / 回调管理

工具

描述

get_all_agents()

列出所有活跃回调的详细信息(操作系统、架构、PID、IP、休眠、进程、载荷类型等)

get_agent_details(agent_id)

按显示 ID 获取单个代理的详细信息

kill_agent(agent_id)

在 Mythic 中将代理标记为不活跃

set_sleep(agent_id, interval, jitter)

更改休眠间隔(秒)和抖动(%)

任务执行

工具

描述

run_shell_command(agent_id, command_line)

通过代理的默认解释器运行 shell 命令

read_file(agent_id, file_path)

从目标读取文件(使用 cat)

download_file(agent_id, file_path)

下载文件并以 base64 格式返回

upload_file(agent_id, file_name, remote_path, content_b64)

将 base64 编码的文件上传到目标

run_as_user(agent_id, username, password)

make_token — 以其他用户身份进行网络调用身份验证

execute_mimikatz(agent_id, mimikatz_arguments)

运行 mimikatz(例如 sekurlsa::logonpasswords)

execute_command(agent_id, command_name, parameters)

通用调度器 — 按名称调用任何 Mythic 命令

平台数据

工具

描述

get_credentials()

Mythic 凭据存储中的所有凭据

get_artifacts(limit)

工件日志(文件、注册表键、创建的进程)

get_event_log(limit)

操作事件日志

browse_files(agent_id, path)

目标上目录的文件浏览器条目

list_payloads()

所有未删除的载荷及其构建状态和 C2 配置文件

list_c2_profiles()

所有 C2 配置文件及其运行状态

提示

提示

描述

start_pentest(threat_actor, objective)

引导 Claude 模拟特定威胁行为者以实现目标

start_recon()

引导 Claude 在所有活跃代理上执行初始侦察

在 Claude 中的使用示例

Use the start_recon prompt.
List all active agents, then run whoami on agent 1.
Download /etc/passwd from agent 2 and show me its contents.
Run mimikatz sekurlsa::logonpasswords on agent 3.
Use execute_command to run 'ps' on agent 1 with parameters {"host": "."}.

架构

Claude Desktop
     │  MCP stdio
     ▼
main.py  (FastMCP tools + prompts)
     │
     ▼
lib/mythic_api.py  (MythicAPI class)
     ├─ mythic Python library  →  Mythic GraphQL/REST API
     └─ httpx (raw GraphQL)   →  Mythic GraphQL endpoint

所有任务调用使用 asyncio.wait_for 并设置 60 秒超时。GraphQL 请求跳过 TLS 验证(verify=False)以处理 Mythic 的自签名证书。

环境变量参考

变量

默认值

描述

MYTHIC_USERNAME

—

Mythic 操作员用户名(必填)

MYTHIC_PASSWORD

—

Mythic 操作员密码(必填)

MYTHIC_HOST

localhost

Mythic 服务器主机名或 IP

MYTHIC_PORT

7443

Mythic 服务器端口

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers