Whispergate/Tyche
GitHub: Whispergate/Tyche
Tyche 是一个 Mythic HTTPX C2 配置文件生成器,支持从 Burpsuite 请求、Cobalt Strike Malleable C2 配置和 TOML 文件多源转换生成 Mythic 可用的 HTTPX Profile。
Stars: 29 | Forks: 1
# Tyche
Tyche 是一个 Mythic HTTPX 配置文件生成器,用于从 Burpsuite 请求、TOML 文件和 Cobalt Strike Malleable C2 配置文件创建 Malleable C2 配置文件。

## 功能
- 将 Burpsuite 保存的 HTTP 请求转换为 Mythic C2 HTTPX 配置文件
- 将 Cobalt Strike Malleable C2 配置文件转换为 HTTPX JSON 格式
- 将 TOML 配置文件转换为 JSON 格式
- 对配置文件进行 Lint 检查以确保其有效性
## 安装
```
pipx install git+https://github.com/Whispergate/Tyche.git
```
## 用法
### 将 Burpsuite 请求转换为 HTTPX 配置文件
从 Burpsuite 保存一个请求(右键单击 --> “Copy to file” 或保存原始请求),然后:
```
python main.py burp --name "MyProfile" [--output profiles/custom.json]
```
示例:
```
python main.py burp captured_request.txt --name "Corporate Portal Profile"
```
这将:
1. 解析 HTTP 请求(方法、标头、URI、Cookie、主体)
2. 生成包含适当客户端/服务器部分的 HTTPX 配置文件
3. 默认保存到 `profiles/.json`
### 将 Malleable C2 配置文件转换为 HTTPX JSON
将 Cobalt Strike Malleable C2 配置文件转换为 Mythic HTTPX 格式:
```
python main.py malleable [--name "CustomName"] [--output profiles/custom.json]
```
示例:
```
python main.py malleable amazon.profile --name "Amazon Browsing"
```
这将:
1. 解析 Malleable C2 配置文件(http-get 和 http-post 块)
2. 提取 URI、标头、参数和转换
3. 转换为 HTTPX JSON 格式
4. 默认保存到 `profiles/.json`
支持的 Malleable C2 功能:
- `http-get` 和 `http-post` 块
- 客户端和服务器标头
- URI 参数
- 消息位置(cookie、参数、主体)
- 转换(base64、base64url、prepend、append、netbios、netbiosu)
- 元数据和输出块
### 将 TOML 转换为 JSON
```
python main.py toml [--output profiles/custom.json]
```
示例:
```
python main.py toml templates/example.toml.j2 --output profiles/example.json
```
### 验证 HTTPX 配置文件 (Linter)
验证生成的 HTTPX 配置文件是否存在错误和问题,类似于 c2lint:
```
python main.py lint [--strict] [--quiet]
```
示例:
```
python main.py lint profiles/jquery2.4.9.json
```
选项:
- `--strict`: 将警告视为错误(如果存在任何警告,则验证失败)
- `--quiet`: 禁用信息消息,仅显示错误和警告
Linter 会检查:
- **结构错误**:缺少必填字段,无效的 JSON 结构
- **无效值**:错误的 HTTP 动词,无效的转换操作,错误的消息位置
- **标头问题**:缺少建议的标头,可疑的标头
- **URI 问题**:空的 URI,缺少前导斜杠,URI 中包含空格
- **转换验证**:缺少必填字段,多重编码转换
- **消息配置**:无效的位置,在需要时空白的名称
退出代码:
- `0`: 验证通过(或在非严格模式下通过但有警告)
- `1`: 验证失败(发现错误,或在严格模式下有警告)
### 将配置文件转换为 Apache、Nginx 和 Caddy 重写文件
```
# Nginx 重定向至 10.10.10.5
tyche rewrite profile.json -t nginx -b 10.10.10.5
# Apache2 自定义端口
tyche rewrite profile.json -t apache2 -b c2.example.com -p 8443 -o .htaccess
# Caddy 无 User-Agent 匹配(HTTP 后端)
tyche rewrite profile.json -t caddy -b 192.168.1.100 -s http --no-user-agent
```
## 配置文件结构
生成的配置文件遵循 Mythic HTTPX 格式:
```
{
"name": "Profile Name",
"get": {
"verb": "GET",
"uris": ["/path"],
"client": {
"headers": {...},
"parameters": {...},
"message": {
"location": "cookie|body|parameter|uri",
"name": "param_name"
},
"transforms": [...]
},
"server": {
"headers": {...},
"transforms": [...]
}
},
"post": {...}
}
```
## 示例
### Burpsuite 请求格式
```
GET /api/v1/data?token=abc123 HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: application/json
Cookie: session=xyz789
```
### 输出配置文件
该工具自动:
- 提取 HTTP 方法 (GET/POST)
- 解析标头并排除不相关的标头
- 识别消息位置(cookie、主体、参数)
- 设置默认转换(base64url 编码)
- 配置默认的服务器响应标头
## 贡献者
- [jquery-c2.3.14.profile](https://github.com/threatexpress/malleable-c2/blob/master/jquery-c2.3.14.profile)
- [其余示例](https://github.com/MythicC2Profiles/httpx/blob/main/documentation-c2/httpx/examples/_index.md)
标签:Burp Suite, C2框架, Cobalt Strike, Homebrew安装, HTTPX配置, IP 地址批量处理, Malleable C2, Mythic, Python, Python安全, 代码转换, 命令控制, 安全学习资源, 安全工具开发, 攻击诱捕, 数据采集, 无后门, 流量伪装, 红队基础设施, 网络信息收集, 逆向工具, 配置文件管理, 配置生成器