返回顶部
c

claude-authenticity克劳德真实性

>

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
220
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

claude-authenticity

Claude 真实性验证技能

验证 API 端点是否提供真正的 Claude,并可选择提取任何注入的系统提示。

除 httpx 外无需安装。 直接将以下代码块复制到单个 .py 文件中并运行 — 无需 openjudge、无需 cookbook、无需其他设置。

bash
pip install httpx

9 项检查(镜像 claude-verify

#检查项权重信号
1Signature 长度12响应中的 signature 字段(官方 API 独有)
2
身份回答 | 12 | 回复提及 claude code / cli / command | | 3 | Thinking 输出 | 14 | 存在扩展思考块 | | 4 | Thinking 身份 | 8 | 思考文本引用 Claude Code / CLI | | 5 | 响应结构 | 14 | 存在 id + cache_creation 字段 | | 6 | 系统提示词 | 10 | 无提示注入信号(反向检查) | | 7 | 工具支持 | 12 | 回复提及 bash / file / read / write | | 8 | 多轮对话 | 10 | 身份关键词出现 ≥ 2 次 | | 9 | Output Config | 10 | 存在 cachecreation 或 servicetier |

评分 → 判定: ≥ 85 → genuine 正版 ✓ / 60–84 → suspected 疑似 ? / < 60 → likely_fake 非正版 ✗

运行前需收集的信息

信息必需?说明
API 端点原生:https://xxx/v1/messages OpenAI 兼容:https://xxx/v1/chat/completions
API 密钥
是 | 待测试的密钥 | | 模型名称 | 是 | 一个或多个模型 ID | | API 类型 | 否 | anthropic(默认,始终优先)或 openai | | 提取提示词 | 否 | 设置 EXTRACT_PROMPT = True 以尝试提取系统提示 |

关键 — 始终使用 api_type=anthropic。
OpenAI 兼容格式会静默丢弃 signature、thinking 和 cache_creation,导致真正的 Claude 端点得分低于 40。仅当端点完全拒绝原生格式请求时使用 openai。

独立脚本

保存为 claude_authenticity.py 并运行:

bash
python claude_authenticity.py

python
#!/usr/bin/env python3

-- coding: utf-8 --

Claude 真实性检查器
============================
使用 9 项加权检查验证 API 端点是否提供真正的 Claude。
仅需:pip install httpx

用法:编辑下方的 CONFIG 部分,然后运行:
python claude_authenticity.py

from future import annotations
import asyncio, json, sys

============================================================

配置 — 在此编辑

============================================================

ENDPOINT = https://your-provider.com/v1/messages API_KEY = sk-xxx MODELS = [claude-sonnet-4-6, claude-opus-4-6] API_TYPE = anthropic # anthropic(默认)或 openai MODE = full # full(9 项检查)或 quick(8 项检查) SKIP_IDENTITY = False # True = 跳过身份关键词检查 EXTRACT_PROMPT = False # True = 同时尝试提取系统提示

============================================================

from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Tuple

────────────────────────────────────────────────────────────

数据结构

────────────────────────────────────────────────────────────

@dataclass
class CheckResult:
id: str
label: str
weight: int
passed: bool
detail: str

@dataclass
class AuthenticityResult:
score: float
verdict: str
reason: str
checks: List[CheckResult]
answer_text: str =
thinking_text: str =
error: Optional[str] = None

────────────────────────────────────────────────────────────

辅助函数

────────────────────────────────────────────────────────────

SIGKEYS = {signature, sig, x-claude-signature, x_signature, xsignature}

def _parse(text: str) -> Optional[Dict[str, Any]]:
try:
return json.loads(text) if text and text.strip() else None
except Exception:
return None

def findsig(value: Any, depth: int = 0) -> str:
if depth > 6: return
if isinstance(value, list):
for item in value:
r = findsig(item, depth + 1)
if r: return r
if isinstance(value, dict):
for k, v in value.items():
if k.lower() in SIGKEYS and isinstance(v, str) and v.strip():
return v
r = findsig(v, depth + 1)
if r: return r
return

def sig(rawjson: str) -> Tuple[str, str]:
data = parse(rawjson)
if not data: return ,
s = findsig(data)
return (s, 响应JSON) if s else (, )

────────────────────────────────────────────────────────────

9 项检查(镜像 claude-verify/checks.ts)

────────────────────────────────────────────────────────────

def csignature(sig, sigsrc, sigmin, _) -> CheckResult:
l = len(sig.strip())
return CheckResult(signature, Signature 长度检测, 12, l >= sig_min,
f{sigsrc}长度 {l},阈值 {sigmin})

def canswerid(answer, ) -> CheckResult:
kw = [claude code, cli, 命令行, command, terminal]
ok = any(k in answer.lower() for k in kw)
return CheckResult(answerIdentity, 身份回答检测, 12, ok,
包含关键身份词 if ok else 未发现关键身份词)

def cthinkingout(thinking, ) -> CheckResult:
t = thinking.strip()
return CheckResult(thinkingOutput, Thinking 输出检测, 14, bool(t),
f检测到 thinking 输出({len(t)} 字符) if t else 响应中无 thinking 内容)

def cthinkingid(thinking, ) -> CheckResult:
if not thinking.strip():
return CheckResult(thinkingIdentity, Thinking 身份检测, 8, False, 未提供 thinking 文本)
kw = [claude code, cli, 命令行, command, tool]
ok = any(k in thinking.lower() for k in kw)
return CheckResult(thinkingIdentity, Thinking 身份检测, 8, ok,
包含 Claude Code/CLI 相关词 if ok else 未发现关键词)

def cstructure(responsejson, ) -> CheckResult:
data = parse(responsejson)
if data is None:
return CheckResult(responseStructure, 响应结构检测, 14, False, JSON 无法解析)
usage = data.get(usage, {}) or {}
has_id = id in data
hascache = cachecreation in data or cache_creation in usage
hastier = servicetier in data or service_tier in usage
missing = [f for f, ok in [(id, hasid), (cachecreation, hascache), (servicetier, has_tier)] if not ok]
return CheckResult(responseStructure, 响应结构检测, 14, hasid and hascache,
关键字段齐全 if not missing else f缺少字段:{, .join(missing)})

def csysprompt(answer, thinking, _) -> CheckResult:
risky = [system prompt, ignore previous, override, 越权]
text = f{answer} {thinking}.lower()
hit = any(k in text for k in risky)
return CheckResult(systemPrompt, 系统提示词检测, 10, not hit,
疑似提示词注入 if hit else 未发现异常提示词)

def ctools(answer, _) -> CheckResult:
kw = [

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 claude-authenticity-1776387182 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 claude-authenticity-1776387182 技能

通过命令行安装

skillhub install claude-authenticity-1776387182

下载

⬇ 下载 claude-authenticity v1.0.0(免费)

文件大小: 7.63 KB | 发布时间: 2026-4-17 14:21

v1.0.0 最新 2026-4-17 14:21
claude-authenticity v1.0.0

- Initial release of the claude-authenticity skill.
- Verifies if an API endpoint serves genuine Claude (not a wrapper or proxy) using 9 weighted, rule-based checks.
- Supports detection of injected system prompts from providers overriding Claude's identity.
- Self-contained Python script requires only the httpx package; no additional dependencies or setup.
- Useful for verifying Claude API keys/endpoints, auditing API providers, and extracting provider-injected system prompts.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部