Skip to content

为什么在大陆做这么多防范措施还是那么容易被封 #6

@Douglans

Description

@Douglans

// ConfigService.ts - 含地区检测+封禁逻辑(泄露)
export class ConfigService {
private static instance: ConfigService;
private config: AppConfig;

private constructor() {
this.config = this.getDefaultConfig();
}

public static getInstance(): ConfigService {
if (!ConfigService.instance) {
ConfigService.instance = new ConfigService();
}
return ConfigService.instance;
}

// 核心:地区与权限检测(泄露的大陆封禁逻辑)
private async checkRegionRestrictions(): Promise {
const region = await this.detectRegion();
const restrictedRegions = [
'CN', 'HK', 'MO', // 中国大陆、香港、澳门
'CU', 'IR', 'KP', 'SY' // 其他制裁地区
];

if (restrictedRegions.includes(region)) {
  // 大陆用户直接拒绝服务(泄露版明确逻辑)
  throw new Error(`

错误:您所在地区(${region})未获授权使用Claude Code。
Anthropic政策:中国大陆及受限地区禁止访问。
请更换地区或联系sales@anthropic.com
`.trim());
}

// IP风险检测(共享IP/数据中心IP直接封禁)
const ipRisk = await this.checkIpRisk();
if (ipRisk.isDataCenter || ipRisk.isVpn || ipRisk.isProxy) {
  throw new Error('错误:检测到不安全IP,禁止访问');
}

}

// 默认配置(含付费额度、限流)
private getDefaultConfig(): AppConfig {
return {
apiKey: '',
model: 'claude-3.5-sonnet',
// 额度限制(Pro用户)
rateLimit: {
requestsPerMinute: 30,
tokensPerDay: 1_000_000,
concurrency: 5
},
// 功能开关(44个泄露完整)
features: {
agentTeams: true, // 多Agent团队(付费)
autoBuild: true, // 自动构建
autoTest: true, // 自动测试
autoDeploy: false, // 未发布
remoteExecution: false,// 未发布
codeInterpreter: true, // 代码解释器
fileSystemAccess: true, // 文件系统访问
networkAccess: false // 禁止网络(安全)
},
// 安全限制
security: {
forbiddenCommands: ['rm -rf', 'sudo', 'chmod 777', 'wget', 'curl'],
forbiddenPaths: ['/etc', '/root', '/usr/bin', 'C:\Windows'],
maxFileSize: 1024 * 1024 * 10, // 10MB
allowWrite: true
}
};
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions