CortexPrism/cortex-plugin-hexstrike
GitHub: CortexPrism/cortex-plugin-hexstrike
HexStrike 是 Cortex 平台的安全插件,整合 70 余款攻击性安全工具,提供从枚举到报告的自主化渗透测试能力并支持沙箱与人工审批。
Stars: 0 | Forks: 0
# 示例插件
关于此插件功能的简短一行描述。
## 安装说明
```
# 从 marketplace
cortex plugin install marketplace:example-plugin
# 从 GitHub(用于开发)
cortex plugin install github:CortexPrism/cortex-plugin-example
# 本地安装(用于开发)
cortex plugin install ./manifest.json
```
## 快速开始
安装完成后,列出可用工具:
```
cortex tools list
```
在 agent 会话中使用工具:
```
cortex chat --plugin example-plugin
```
## 工具
### hello
通过姓名向某人打招呼。
**参数:**
- `name` (string, required) — 人员姓名
**示例:**
```
cortex tool call hello --name Alice
# 输出:Hello, Alice! Welcome to Cortex.
```
### add
将两个数字相加。
**参数:**
- `a` (number, required) — 第一个数字
- `b` (number, required) — 第二个数字
**示例:**
```
cortex tool call add --a 5 --b 3
# 输出:8
```
### fetch_data
从外部 API 获取数据(仅限 HTTPS)。
**参数:**
- `url` (string, required) — 要获取数据的 URL
**示例:**
```
cortex tool call fetch_data --url https://api.example.com/data
```
## 配置
在 `~/.cortex/config.json` 中配置此插件:
```
{
"plugins": {
"example-plugin": {
"enabled": true,
"config": {}
}
}
}
```
## 权限
此插件声明了:
- `network:fetch` — 向外部 API 发起 HTTPS 请求
## 开发
### 环境设置
```
# 安装依赖
deno cache mod.ts
# 运行测试
deno task test
# 格式化代码
deno fmt
# Lint
deno lint
```
### 构建
```
# 验证 plugin
deno task validate
# 本地测试
cortex plugin install ./manifest.json
cortex tool call hello --name Test
# 在 chat 中使用
cortex chat --plugin example-plugin
```
### 测试
测试位于 `test/` 目录中:
```
# 运行所有测试
deno task test
# 运行特定测试
deno test --allow-all test/unit/mod.test.ts --filter "hello tool"
# 运行 with coverage
deno test --coverage=.coverage --allow-all test/
```
## 市场发布
准备好发布时:
1. 更新 `manifest.json` 中的 version
2. 在 `CHANGELOG.md` 中更新更改内容
3. 提交并打标签:`git tag v1.0.0`
4. 推送到 GitHub:`git push origin main --tags`
5. GitHub Actions 会自动发布到市场
有关详细的发布说明,请参阅[发布插件](../docs/publishing.md)。
## 故障排除
### 插件加载失败
**错误:** `Plugin failed to load: Invalid manifest`
**解决方案:** 验证您的 `manifest.json`:
```
deno task validate
```
### 工具未显示
**错误:** `Tool not found`
**解决方案:** 确保该工具已:
1. 在 `mod.ts` 的 `tools` 数组中导出
2. 在 `manifest.json` 的 `tools` 下声明
3. 启用插件:`cortex plugin enable example-plugin`
### 权限被拒绝
**错误:** `Permission denied: network:fetch`
**解决方案:** `network:fetch` capability 必须包含在 manifest 中,并由用户批准。
## 最佳实践
请参阅[最佳实践](../docs/best-practices.md)获取完整指南:
✅ **推荐做法:**
- 验证所有工具参数
- 优雅地处理错误
- 返回带有 `success` 和 `output`/`error` 的 ToolResult
- 遵守超时限制
- 声明最小权限
- 编写全面的测试
❌ **避免做法:**
- 硬编码 API keys 或 secrets
- 请求过宽的权限
- 忽略错误
- 在代码中遗留 console.log
- 跳过输入验证
## 许可证
MIT — 请参阅 [LICENSE](./LICENSE) 文件
## 贡献
请参阅 [CONTRIBUTING.md](../CONTRIBUTING.md) 了解开发标准。
## 支持
- 📖 [开发插件](../docs/developing.md)
- 📖 [插件最佳实践](../docs/best-practices.md)
- 📖 [Manifest 参考](../docs/manifest-reference.md)
- 💬 [Discord 社区](https://discord.gg/y7DkaEbPQC)
- 🐛 [报告问题](https://github.com/CortexPrism/cortex/issues)
标签:Deno, Web报告查看器, XXE攻击, 人工智能, 威胁模拟, 实时处理, 密码管理, 插件框架, 用户模式Hook绕过, 网络调试, 自动化, 自动化攻击