swatiicfai/PhishGuard-Voice-

GitHub: swatiicfai/PhishGuard-Voice-

基于 Gemini Live 的 AI 反诈语音沙盒,通过自主语音智能体拖延诈骗者并实时分析提取威胁情报。

Stars: 0 | Forks: 0

# PhishGuard Voice 🛡️🎙️ ### 反诈沙盒与实时威胁情报仪表盘 ![Python](https://img.shields.io/badge/Python-3.12-blue?logo=python) ![FastAPI](https://img.shields.io/badge/FastAPI-0.111-green?logo=fastapi) ![Firebase](https://img.shields.io/badge/Firebase-Firestore-orange?logo=firebase) ![Gemini](https://img.shields.io/badge/Gemini-Live-purple?logo=google) ![License](https://img.shields.io/badge/License-Apache%202.0-lightgrey) 🔴 **[在线演示 →](https://phishguard-voice.vercel.app)**  |  📖 **[尝试演示模式](#5-demo-mode-no-infrastructure-needed)** — 无需注册 ## ✨ 功能 | 功能 | 描述 | |---------|-------------| | 🎭 **Doris — 拖延智能体** | Gemini Live 角色,通过逼真的老年人说话模式、拖延战术和自然的停顿来消耗骗子的资源 | | 🔍 **静默安全审计员** | 并发的后台智能体,扫描音频流中的 9 类欺诈分类,全程不发一言 | | ⚡ **600ms 以内的对话** | 通过 Vertex AI Gemini Live 的原生音频到音频 WebSocket pipeline — 无需 STT→LLM→TTS 链条 | | 🌐 **实时威胁 Grounding** | 实时通过 Google Search 验证伪造的电话号码和虚假的企业身份 | | 📊 **实时仪表盘** | Firebase Firestore 推送更新,将威胁事件、风险评分和 grounding 结果流式传输到 UI | | 🎯 **9 类欺诈分类法** | IMPERSONATION · WIRE_TRANSFER · GIFT_CARD · REMOTE_ACCESS · LEGAL_THREAT · PERSONAL_DATA · URGENCY_PRESSURE · ACCOUNT_SUSPENSION · CALLBACK_NUMBER | ## 🏗️ 架构 ``` Browser (WebRTC mic) ──┐ ▼ Cloud Run WebSocket Proxy (FastAPI / Python) │ │ Audio │ │ Function Calls stream ▼ ▼ Vertex AI Gemini Live API ┌─────────────────────────────┐ │ Agent 1: Time-Waster │ ← speaks audio back to caller │ Agent 2: Silent Auditor │ ← fires structured JSON tool calls └─────────────────────────────┘ │ ▼ log_threat_event() Cloud Firestore │ onSnapshot listener ▼ Firebase Hosted Dashboard ``` ## 📁 项目结构 ``` phishguard-voice/ ├── backend/ │ ├── main.py # FastAPI WebSocket server (REST + WS endpoints) │ ├── agents/ │ │ ├── __init__.py │ │ ├── time_waster.py # "Doris" persona system prompt │ │ └── security_auditor.py # Auditor prompt + Gemini tool declarations │ ├── services/ │ │ ├── __init__.py │ │ ├── gemini_live.py # Vertex AI Gemini Live WebSocket client │ │ ├── firestore_client.py # Firebase Admin SDK wrapper │ │ └── search_grounding.py # Google Search verification │ ├── Dockerfile │ ├── .env.example # Environment variable template │ └── requirements.txt │ ├── frontend/ │ ├── index.html # Self-contained single-page dashboard (all JS/CSS inline) │ ├── css/ │ │ └── dashboard.css # Dark glassmorphism stylesheet │ └── js/ │ ├── app.js # Main controller + demo mode simulation │ ├── firestore-listener.js # Real-time Firestore → UI events │ ├── audio-stream.js # WebRTC audio capture + PCM relay │ └── threat-visualizer.js # Waveform · Gauge · Particles │ ├── firebase/ │ ├── firestore.rules # Firestore security rules │ └── firestore.indexes.json # Composite index definitions │ ├── firebase.json # Firebase hosting + Firestore config ├── deploy.ps1 # One-click Cloud Run deploy script └── dev.ps1 # Local development launcher ``` ## 🚀 快速开始 ### 前置条件 - 启用了结算功能的 Google Cloud 项目 - 已启用的 API:**Vertex AI**、**Cloud Run**、**Firestore**、**Firebase Hosting** - 已通过身份验证的 `gcloud` CLI - 全局安装了 `firebase-tools`(`npm install -g firebase-tools`) ### 1. 配置环境 ``` cd backend cp .env.example .env # 使用您的 GCP project ID、location 和 Firebase credentials 编辑 .env ``` ### 2. 将后端部署到 Cloud Run ``` cd backend # 构建并推送 container gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/phishguard-backend # 部署到 Cloud Run gcloud run deploy phishguard-backend \ --image gcr.io/YOUR_PROJECT_ID/phishguard-backend \ --region us-central1 \ --allow-unauthenticated \ --set-env-vars GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID \ --memory 512Mi \ --timeout 3600 ``` ### 3. 部署 Firestore 规则 ``` firebase deploy --only firestore ``` ### 4. 配置并部署仪表盘 打开 `frontend/index.html` 并设置 Firebase 配置。然后: ``` firebase deploy --only hosting ``` 或者使用 Firebase 模拟器在本地运行: ``` firebase emulators:start --only hosting,firestore # Dashboard 可通过 http://localhost:5000 访问 ``` ### 5. 演示模式(无需任何基础设施) 在设置弹窗中点击 **Demo Mode**。一个预录制的 30 秒诈骗电话模拟将完全在浏览器中运行,无需任何后端即可展示完整的仪表盘体验。 ## 🛡️ 欺诈分类法 | 类别 | 信号示例 | 严重程度 | |----------|----------------|----------| | `IMPERSONATION` | “我是从 IRS / SSA / Microsoft 打来的” | 高 | | `WIRE_TRANSFER` | “立即电汇 2,000 美元” | 高 | | `GIFT_CARD` | “购买 iTunes 礼品卡作为付款” | 严重 | | `REMOTE_ACCESS` | “下载 AnyDesk / TeamViewer” | 严重 | | `LEGAL_THREAT` | “联邦法警将被派往你处” | 严重 | | `PERSONAL_DATA` | “提供你的社会安全号码” | 高 | | `URGENCY_PRESSURE` | “不要挂断,立即行动” | 中 | | `ACCOUNT_SUSPENSION` | “你的账户已被暂停” | 中 | | `CALLBACK_NUMBER` | 提供伪造的回拨号码 | 低 | ## ⚙️ 配置参考 ### 后端 `.env` | 变量 | 描述 | |----------|-------------| | `GOOGLE_CLOUD_PROJECT` | GCP 项目 ID | | `GOOGLE_CLOUD_LOCATION` | 区域(默认:`us-central1`) | | `GEMINI_LIVE_MODEL` | Gemini 模型(默认:`gemini-2.0-flash-live-001`) | | `ALLOWED_ORIGINS` | 逗号分隔的 CORS 允许来源 | | `GOOGLE_CUSTOM_SEARCH_API_KEY` | (可选)用于 Google Search grounding | | `GOOGLE_CUSTOM_SEARCH_CX` | (可选)Custom Search Engine ID | ## 🧱 技术栈 | 层级 | 技术 | |-------|-----------| | **Voice AI** | Vertex AI Gemini Live (`gemini-2.0-flash-live-001`) — 音频到音频 | | **后端** | Python 3.12 · FastAPI · uvicorn · WebSockets | | **实时数据库** | Cloud Firestore (Firebase Admin SDK) | | **前端** | 原生 HTML/CSS/JS · Firebase JS SDK v10 | | **托管** | Firebase Hosting (前端) · Cloud Run (后端) | | **搜索** | Google Custom Search API (grounding) | | **容器** | Docker · Cloud Build · Artifact Registry | ## 💻 本地开发 ``` # 1. Clone 仓库 git clone https://github.com/swatiicfai/PhishGuard-Voice-.git cd PhishGuard-Voice- # 2. 安装 backend 依赖 cd backend pip install -r requirements.txt # 3. 设置环境 cp .env.example .env # 使用您的 GCP credentials 编辑 .env # 4. 启动 backend python -m uvicorn main:app --host 0.0.0.0 --port 8080 # 5. 运行 frontend(新终端) cd ../frontend python -m http.server 5000 # 打开 http://localhost:5000 → 点击 Demo Mode(无需 credentials) ``` ## 📜 许可证 Apache 2.0 — 开源。为 Google Cloud 黑客松演示目的而构建。 *使用 ❤️ 构建,采用 Vertex AI Gemini Live · Cloud Run · Firebase · Google Search Grounding*
标签:AI智能体, AV绕过, FastAPI, Firebase, WebRTC, 反诈防骗, 后端开发, 威胁情报, 开发者工具, 语音AI, 请求拦截, 逆向工具