juandresrodca/DorkCraft
GitHub: juandresrodca/DorkCraft
DorkCraft 是一个将自然语言查询自动转换为 Google Dork 高级搜索语法的在线辅助工具。
Stars: 2 | Forks: 0
# DorkCraft 🔍
**在线网站:** https://juandresrodca.github.io/DorkCraft/
## 什么是 DorkCraft?
DorkCraft 将自然语言查询转换为精确的 [Google dork](https://en.wikipedia.org/wiki/Google_hacking) 操作符。您只需输入以下内容,无需再记忆像 `filetype:pdf intitle:"linux malware"` 这样的语法:
DorkCraft 便会为您构建查询。
### 输入 → 输出示例
| 您输入的内容 | DorkCraft 生成的查询 |
|---|---|
| 查找关于 Linux 恶意软件的 PDF 书籍 | `filetype:pdf intitle:"linux malware"` |
| 爱尔兰 SOC 分析师的 LinkedIn 个人资料 | `site:linkedin.com/in intitle:"soc analyst" "Ireland"` |
| 暴露的 Apache 目录列表 | `intitle:"index of" "apache" -htm -html` |
| 关于威胁情报的公开 GitHub 仓库 | `site:github.com intitle:"threat intelligence"` |
## 技术栈
| 层级 | 技术 |
|---|---|
| Frontend | [Astro](https://astro.build) + TypeScript |
| Backend | [FastAPI](https://fastapi.tiangolo.com) (Python 3.9+) |
| 托管 | GitHub Pages (Frontend) |
| CI/CD | GitHub Actions |
## 项目结构
```
DorkCraft/
├── backend/
│ ├── main.py # FastAPI app + CORS + routes
│ ├── models/
│ │ └── schemas.py # Pydantic request/response models
│ ├── services/
│ │ └── dork_generator.py # Rule-based dork engine
│ └── requirements.txt
│
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── Header.astro
│ │ │ ├── Footer.astro
│ │ │ ├── SearchBox.astro
│ │ │ └── ResultCard.astro
│ │ ├── lib/
│ │ │ └── api.ts # Typed API client
│ │ ├── pages/
│ │ │ └── index.astro # Main page + all client logic
│ │ └── styles/
│ │ └── global.css # Design system
│ └── astro.config.mjs
│
├── .github/
│ └── workflows/
│ └── deploy.yml # Auto-deploy to GitHub Pages
│
└── README.md
```
## 本地运行
### Backend
```
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000
```
API 文档可在 http://localhost:8000/docs 查看
### Frontend
```
cd frontend
npm install
npm run dev
```
打开 http://localhost:4321 —— Frontend 默认会在 `http://localhost:8000` 调用 Backend。
## 部署
### Frontend (GitHub Pages)
1. 在您的 repo 中 → **Settings → Pages** → 将 source 设置为 **GitHub Actions**。
2. 推送到 `main` 分支。`deploy.yml` workflow 会自动构建并部署。
3. 您的网站将在 `https://juandresrodca.github.io/DorkCraft/` 上线。
### Backend(可选)
将 `backend/` 文件夹部署到任何 Python 主机:
| 平台 | 备注 |
|---|---|
| [Railway](https://railway.app) | 一键 Python 部署 |
| [Render](https://render.com) | 提供免费层 |
| [Fly.io](https://fly.io) | 非常适合小型 API |
部署后,将 Backend URL 添加为名为 `VITE_API_URL` 的 GitHub secret。Actions workflow 会在构建时通过 `PUBLIC_API_URL` 将其注入。
## 安全与伦理
DorkCraft 在 Backend 层面强制执行有害查询模式的屏蔽列表:
- ❌ 提取凭据或密码
- ❌ 搜索信用卡 / PII 数据
- ❌ 传播恶意软件
- ❌ 漏洞利用或注入查询
- ❌ 未经授权的访问请求
被屏蔽的查询将返回 `{"error": "Unsafe or disallowed query."}` —— 不会生成任何 dork。
**您需要对如何使用结果负责。** 请始终尊重隐私、服务条款和适用法律。
## 扩展 DorkCraft(适配 AI)
`backend/services/dork_generator.py` 中的 `DorkGenerator` 类旨在作为一个清晰的扩展点:
```
class DorkGenerator:
def generate(self, query: str) -> dict:
# Replace this body with an LLM call (Gemini, Claude, OpenAI)
# The contract (input/output dict) stays the same
...
```
通过扩展 `CATEGORIES` 字典来添加新的意图分类。
通过扩展 `BLOCKED_PATTERNS` 来添加新的安全规则。
## 许可证
MIT —— 自由使用,欢迎回馈贡献。
标签:Astro, AV绕过, FastAPI, Google Dork, 实时处理, 搜索引擎辅助, 查询生成器, 逆向工具