arxncodes/Xploit

GitHub: arxncodes/Xploit

基于 asyncio 的轻量级 Python C2 框架,用于远程节点的集中式命令控制与任务编排。

Stars: 0 | Forks: 0

# 分布式节点编排框架 一个模块化的 Python 框架,用于对远程任务 Agent 进行集中式命令与控制编排。专为 **DevOps 自动化** 和 **安全研究** 而构建。 ## 架构 ``` ┌──────────────────────┐ ┌──────────────────────┐ │ Generator │ │ Controller │ │ (Provisioner) │ │ (Server) │ │ │ │ │ │ Reads template ───► │ │ asyncio TCP server │ │ Injects IP:PORT │ │ Interactive CLI │ │ Outputs agent .py │ │ Multi-agent mgmt │ └──────────────────────┘ └──────────┬───────────┘ │ TCP (Base64) ┌───────────────────┼───────────────────┐ │ │ │ ┌────────▼──────┐ ┌────────▼──────┐ ┌───────▼───────┐ │ Agent 1 │ │ Agent 2 │ │ Agent N │ │ recv → exec │ │ recv → exec │ │ recv → exec │ │ → send │ │ → send │ │ → send │ └───────────────┘ └───────────────┘ └───────────────┘ ``` ## 目录结构 ``` ├── server/ │ └── controller.py # Centralized control server ├── agent_templates/ │ └── agent_template.py # Tasking agent template (with placeholders) ├── generator/ │ └── generate.py # Provisioner that bakes in connection details └── README.md ``` ## 快速开始 ### 1. 生成任务 Agent ``` cd generator python generate.py --host --port # Example: python generate.py --host 192.168.1.10 --port 4444 ``` 这将读取 `agent_templates/agent_template.py`,替换 `<>` 和 `<>` 占位符,并写入 `generated_agent.py`。 ### 2. 启动 Controller ``` cd server python controller.py # Enter bind address (default 0.0.0.0) and port (default 4444) ``` ### 3. 部署并运行 Agent 将 `generated_agent.py` 复制到目标节点并执行: ``` python generated_agent.py ``` Agent 将自动回连到 Controller。如果连接断开,它将每 5 秒重试一次。 ## Controller 命令 | 命令 | 描述 | |-------------------|-----------------------------------------| | `list` | 显示所有已连接的 Agent 及其 ID | | `interact ` | 打开与指定 Agent 的交互式 Shell | | `kill ` | 断开特定 Agent 的连接 | | `exit` | 关闭 Controller 及所有 Agent | 在 `interact` 会话中,输入任何 Shell 命令。Agent 将执行该命令并返回输出。输入 `background` 返回主菜单。 ## 工作原理 1. **所有数据在传输前均进行 Base64 编码**,并在接收时解码 —— 这确保了网络透明性,并防止二进制或多行输出出现格式问题。 2. **换行符 (`\n`) 为消息分隔符** —— 每条消息都是由 `\n` 终止的单个 Base64 字符串。 3. **Controller 使用 `asyncio`** 处理并发 Agent,并在后台线程中运行交互式 CLI。 4. **任务 Agent 使用 `subprocess.run(shell=True)`** 以兼容 Windows,并捕获 `stdout` 和 `stderr`。 ## 环境要求 - **Python 3.10+**(使用 `match` 类型提示语法) - 无第三方依赖 —— 仅使用标准库(`asyncio`, `socket`, `subprocess`, `base64`, `argparse`) ## 免责声明
标签:AI合规, Asyncio, Awesome, Base64编码, C2框架, DevOps自动化, DNS 反向解析, IPv6, IP 地址批量处理, PowerShell, Python开发, TCP服务器, 代码执行, 内核驱动, 分布式节点, 后门, 命令与控制, 安全学习资源, 异步编程, 恶意软件, 木马, 横向移动, 系统管理, 编程规范, 网络信息收集, 网络协议, 网络安全, 网络通讯, 计算机取证, 远程控制, 远程管理, 逆向工具, 隐私保护