一个网络安全意识平台。粘贴一条可疑的短信、电子邮件、聊天消息或 链接,它就会告诉你发现了哪些诈骗手法、每种手法为何重要,以及 接下来该怎么做。
在线演示: https://threatripper.onrender.com(Render 免费套餐——在闲置后 首次访问可能需要一分钟才能唤醒。)
它是一个教学工具,而非安全产品。它没有杀毒引擎、没有恶意软件 扫描、没有发件人验证,也没有域名信誉服务。链接永远不会被打开。
目的与范围。 Threatripper 是一个防御性的教育工具,用于检测文本中的 诈骗迹象。它不包含恶意软件、漏洞利用代码、钓鱼工具包、 凭据列表或任何攻击性能力,并且它从不发起网络请求。 仓库中的所有示例消息和域名均使用虚构的保留
.example名称,仅用于演示检测逻辑。请仅用它来保护自己和他人。滥用行为违背本项目的 宗旨;请通过官方渠道举报欺诈(参见局限性)。
四个页面,无需构建步骤,不使用 JavaScript 框架,不使用 CDN:
| 页面 | 路径 | 用途 |
|---|---|---|
| 分析 | / | 粘贴消息或链接,获得带评分和解释的判定结果 |
| 意识 | /awareness.html | 七类诈骗指南以及举报建议 |
| 测验 | /quiz.html | 十二个场景,由服务端评分并附解释 |
| 历史 | /history.html | 你最近的分析记录,标识符已脱敏 |
分析结果刻意做到可解释而非权威。评分刻度上的每一分都对应 一条具名规则,带有严重程度、置信度以及一句解释其为何重要的 说明。界面会展示完整的计算过程,包括组合 加分,因此输出结果可以被质疑,而不是只能被信任。
它不做以下事情:
需要 Python 3.11 或更高版本。
git clone <your-repo-url> threatripper
cd threatripper
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Use "python3 -m pip", not a bare "pip": on a hardened distro (Kali, Debian,
# Fedora) pip may be an externally managed system binary that is blocked by
# PEP 668, and a bare "pip" will not resolve to the venv.
python3 -m pip install -r requirements.txt
python3 -m uvicorn backend.main:app --reload
整个产品——API、规则目录、数据库和 Web 界面——都在同一个源上由这一个进程运行。交互式 API 文档位于 /docs,原始 OpenAPI schema 位于 /openapi.json。
运行测试:
python3 -m pip install -r requirements-dev.txt
python3 -m pytest
同样的分析也可以在终端中运行。这是第二个前端,而不是第二套实现:每一条规则、评分、解释和建议操作都来自 Web 应用所使用的同一个 AnalysisService,因此两者对“什么是危险的”不可能产生分歧。
无需服务器、无需端口、无需网络——当你正在查看的消息本身就是事件时,这一点非常有用。
# Analyse a pasted message
./threatripper.sh "URGENT: your account will be closed, share the OTP"
# Or pipe it in, which is the natural way to use it
pbpaste | ./threatripper.sh
# A bare link
./threatripper.sh "http://verify-account.example/login"
# The API payload, for scripts
./threatripper.sh "share your OTP" --json | jq .result.risk_level
# Only fail when it is serious
./threatripper.sh --fail-on critical "see you tomorrow" ; echo $? # 0
./threatripper.sh --fail-on critical "your bank account will be suspended in 24 hours, verify at http://bank-verify.example/login and share the OTP" ; echo $? # 1
# Stored history, shared with the web app
./threatripper.sh history
./threatripper.sh history --level critical --json
# Analyse without keeping any record
./threatripper.sh "share your OTP" --no-store
交互式运行开始时,会打印一条红色的 THREATRIPPER 横幅,采用 ANSI Shadow 字体绘制。它输出到 stderr,在 --json 模式下以及输出被管道传输或重定向时会被跳过,因此它绝不会写入日志或破坏管道。--no-color 会保留横幅但去掉颜色。
ANSI Shadow 中的每个字形都是东亚模糊宽度字符,因此在某些终端上——通常是 CJK 区域设置,或窗口宽度小于 78 列时——各行会以不同宽度渲染,字母会错位分离。在这种情况下,横幅会静默回退到纯 ASCII 字体。可通过 --banner shadow|ascii|none 覆盖此选择:
./threatripper.sh --banner shadow "message" # force the block letters
./threatripper.sh --banner ascii "message" # force the terminal-safe face
./threatripper.sh --banner none "message" # no banner at all
与 Web 应用一样,分析结果默认会被添加到共享历史记录中——同样是经过脱敏的预览,绝不会是原始文本。传入 --no-store 即可在不保留记录的情况下进行分析。
./threatripper.sh analyze --help 和 ./threatripper.sh history --help 会列出所有选项。启动器优先使用项目的 .venv 解释器,并会解析自身所在位置,因此它可以在任意目录下运行,无论虚拟环境是否已激活。python3 -m backend.cli 与之等效。
终端工具会被用于脚本中,因此“这次是否发现了问题?”必须能够在不解析文字描述的情况下得到回答。
| 代码 | 含义 |
|---|---|
0 | 未发现任何内容,或未超过 --fail-on 阈值 |
1 | 发现了达到或超过阈值的内容 |
2 | 命令行有误 |
3 | 没有可分析的内容,或分析无法运行 |
阈值默认为 suspicious。传入 --fail-on 并指定任意等级(low、suspicious、medium、high、critical)即可更改。
# Fail a deploy pipeline only on a serious finding
./threatripper.sh --fail-on critical "$MESSAGE" || echo "review this message"
使用错误故意从不与发现共享退出码,因此脚本可以区分“这条消息是危险的”和“你把标志打错了”。无法识别的风险等级也会以非零码退出,而不是报告一切正常。
| 分数 | 等级 | 含义 |
|---|---|---|
| 0–20 | LOW | 几乎没有或没有诈骗指标。不保证安全。 |
| 21–40 | SUSPICIOUS | 存在一些可疑特征。请独立核实。 |
| 41–60 | MEDIUM | 多个诈骗信号。不要对此消息采取行动。 |
| 61–80 | HIGH | 强烈的欺诈指标。视为恶意。 |
| 81–100 | CRITICAL | 存在非常强烈的活跃欺诈尝试指标。 |
id、category、severity、confidence 和 explanation。suspicious_link 指标,而不是同一结构性问题的多份副本。/api/scoring。URGENT: Your bank account will be SUSPENDED within 24 hours.
Verify now at http://kyc-update.example/verify
Share the OTP sent to your mobile. Do not tell your family.
| 指标 | 类别 | 严重程度 | 贡献值 |
|---|---|---|---|
| 请求提供 OTP 或验证码 | credential_request | 20 | 19.0 |
| 可疑链接结构 | malicious_url | 20 | 18.0 |
| 账户停用威胁 | threat | 15 | 12.8 |
| 要求对此事保密 | isolation | 15 | 12.8 |
| KYC 到期施压 | fake_kyc | 12 | 8.4 |
| 紧迫性 / 立即行动措辞 | urgency | 10 | 7.0 |
即 78.0 原始指标分,加上组合加分(紧迫性 + 威胁、紧迫性 + 凭据、凭据 + 链接,以及多个威胁类别),经 100 分上限截断后为 CRITICAL(该示例实际运行时值为 100)。
请注意,嵌入的链接只产生单个 suspicious_link 指标,而不是每个结构性问题一行。消息中的单个链接严重程度上限为 20,以免一个不完美的地址主导一条原本普通的消息;同一 URL 单独提交时会被完整详细分析。
同一条消息在界面中呈现时,会显示上述每一行及其分值。你可以自行核对算术。
.
├── backend/
│ ├── main.py FastAPI app, middleware, error handlers, static mount
│ ├── cli.py terminal front end (no web imports)
│ ├── analyzers/ text, URL, digital-arrest and app detection
│ ├── api/ analyze, history, awareness and quiz routers
│ ├── core/ settings, logging, privacy helpers
│ ├── database/ SQLAlchemy models and session handling
│ ├── engine/ scoring config, risk engine, recommendations
│ ├── schemas/ Pydantic request/response models
│ └── services/ analysis orchestration
├── data/ rule catalogues and awareness content (JSON)
│ ├── phishing_patterns.json
│ ├── digital_arrest_patterns.json
│ ├── app_patterns.json
│ ├── risk_scoring.json
│ ├── recommended_actions.json
│ ├── awareness_content.json
│ └── quiz_questions.json
├── frontend/ static web app (no build step)
│ ├── index.html awareness.html quiz.html history.html 404.html
│ ├── css/style.css
│ └── js/ api.js, ui.js, app.js, awareness.js, quiz.js, history.js
├── tests/ pytest suite
├── threatripper.sh launcher for the terminal interface
├── requirements.txt
├── requirements-dev.txt
├── pytest.ini
└── .env.example
data/ 中的规则目录是事实来源。编辑 JSON 文件会在重启后改变行为,无需修改 Python 代码。
每项设置都有可用的默认值,因此应用完全无需 .env 即可运行。要覆盖默认值,请复制示例并编辑它:
cp .env.example .env