-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChat指纹重置_1.0.js
276 lines (250 loc) · 9.87 KB
/
Chat指纹重置_1.0.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
// ==UserScript==
// @name Chat指纹重置
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 全维度环境隔离+指纹伪装,支持多域名
// @author YourName
// @match https://chat100.ai/*
// @match https://chatai.baizebb.buzz/*
// @grant GM_xmlhttpRequest
// @grant GM_download
// @grant GM_addStyle
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_registerMenuCommand
// @run-at document-start
// @require https://cdn.jsdelivr.net/npm/fingerprintjs2@latest/dist/fingerprint2.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js
// ==/UserScript==
(function() {
'use strict';
// Define domain configurations
const DOMAIN_CONFIG = {
'chat100.ai': {
baseUrl: 'https://chat100.ai/zh-CN/app',
cleanUrl: 'https://chat100.ai/zh-CN/app/7daeec0724d85cde5bde0600a05df738'
},
'chatai.baizebb.buzz': {
baseUrl: 'https://chatai.baizebb.buzz/app',
cleanUrl: 'https://chatai.baizebb.buzz/app'
}
};
// Get current domain configuration
const getCurrentDomainConfig = () => {
const hostname = window.location.hostname;
return DOMAIN_CONFIG[hostname] || DOMAIN_CONFIG['chat100.ai']; // fallback to chat100.ai
};
// 环境隔离容器
class EnvIsolator {
constructor() {
this.sessionID = Date.now().toString(36) + Math.random().toString(36).substr(2);
this.init();
}
async init() {
await this.cleanLegacyData();
this.injectFakeParameters();
this.blockAdvancedAPIs();
this.setupNetworkProxy();
}
// 清除所有历史痕迹
async cleanLegacyData() {
// 递归清理所有存储
const cleanupTasks = [
() => localStorage.clear(),
() => sessionStorage.clear(),
() => caches.keys().then(keys => keys.forEach(k => caches.delete(k))),
() => indexedDB.databases().then(dbs => dbs.forEach(db => indexedDB.deleteDatabase(db.name))),
async () => {
const registrations = await navigator.serviceWorker.getRegistrations();
registrations.forEach(reg => reg.unregister());
},
() => {
document.cookie.split(";").forEach(cookie => {
const domains = [
window.location.hostname,
`.${window.location.hostname}`,
window.location.hostname.split('.').slice(-2).join('.')
];
domains.forEach(domain => {
document.cookie = `${cookie.split('=')[0]}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=${domain}; path=/`;
});
});
}
];
for (const task of cleanupTasks) {
await (typeof task === 'function' ? task() : task);
}
}
// 注入伪造参数
injectFakeParameters() {
// 动态硬件参数
const hardwareProfile = {
deviceMemory: _.sample([4, 8, 16]),
hardwareConcurrency: _.random(2, 8),
renderer: `ANGLE (${_.sample(['NVIDIA', 'AMD'])} ${_.sample(['RTX 3080', 'RX 6900 XT'])} Direct3D11 vs_5_0 ps_5_0)`,
audioContextHash: _.random(1000000, 9999999).toString(16)
};
Object.defineProperties(navigator, {
deviceMemory: { value: hardwareProfile.deviceMemory },
hardwareConcurrency: { value: hardwareProfile.hardwareConcurrency },
userAgent: { value: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${_.random(120, 125)}.0.0.0 Safari/537.36` }
});
// WebGL参数覆盖
const getParameterProxy = (target, ctx) => new Proxy(target, {
apply: (t, thisArg, args) => {
if (args[0] === 37445) return hardwareProfile.renderer;
if (args[0] === 7937) return 'WebKit'; // UNMASKED_VENDOR_WEBGL
return Reflect.apply(t, thisArg, args);
}
});
WebGLRenderingContext.prototype.getParameter = getParameterProxy(WebGLRenderingContext.prototype.getParameter);
WebGL2RenderingContext.prototype.getParameter = getParameterProxy(WebGL2RenderingContext.prototype.getParameter);
// 音频指纹干扰
const originalCreateOscillator = AudioContext.prototype.createOscillator;
AudioContext.prototype.createOscillator = function() {
const oscillator = originalCreateOscillator.call(this);
oscillator.frequency.value += _.random(-10, 10);
return oscillator;
};
}
// 拦截高级API
blockAdvancedAPIs() {
// WebGPU拦截
if ('gpu' in navigator) {
navigator.gpu.requestAdapter = () => Promise.reject('WebGPU disabled');
}
// 字体枚举拦截
const originalFonts = window.FontFace;
window.FontFace = function() {
throw new Error('FontFace API disabled');
};
window.FontFace.prototype = originalFonts.prototype;
}
// 网络层代理
setupNetworkProxy() {
const proxyConfig = {
proxyServer: 'socks5://127.0.0.1:1080',
rotateInterval: 300000 // 5分钟切换一次IP
};
// 动态切换代理(需本地代理客户端支持)
GM_registerMenuCommand("切换代理节点", () => {
GM_xmlhttpRequest({
method: 'POST',
url: 'http://localhost:8080/rotate',
onload: () => window.location.reload()
});
});
}
}
// 初始化环境隔离
new EnvIsolator();
// 添加控制面板
GM_addStyle(`
#env-control-trigger {
position: fixed;
bottom: 20px;
right: 20px;
width: 40px;
height: 40px;
background: rgba(30,30,30,0.9);
border-radius: 50%;
color: white;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 99999;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
transition: all 0.3s;
}
#env-control-trigger:hover {
transform: scale(1.1);
}
#env-control-panel {
position: fixed;
bottom: 70px;
right: 20px;
background: rgba(30,30,30,0.9);
border-radius: 8px;
padding: 8px;
color: white;
z-index: 99998;
box-shadow: 0 4px 16px rgba(0,0,0,0.2);
display: none;
transition: all 0.3s;
}
.env-control-btn {
display: block;
width: 150px;
padding: 8px;
margin: 4px 0;
background: #444;
border: none;
border-radius: 4px;
color: white;
cursor: pointer;
transition: all 0.2s;
text-align: left;
font-size: 13px;
}
.env-control-btn:hover {
background: #666;
transform: translateX(3px);
}
`);
// 创建触发按钮和面板
const trigger = document.createElement('div');
trigger.id = 'env-control-trigger';
trigger.innerHTML = '⚙️';
document.body.appendChild(trigger);
const panel = document.createElement('div');
panel.id = 'env-control-panel';
panel.innerHTML = `
<button class="env-control-btn" id="hard-reset">🔄 硬核环境重置</button>
<button class="env-control-btn" id="new-identity">🎭 切换新身份</button>
<button class="env-control-btn" id="flush-dns">🌐 刷新DNS缓存</button>
<button class="env-control-btn" id="home-page">🏠 回到首页</button>
`;
document.body.appendChild(panel);
// 点击触发按钮显示/隐藏面板
let isPanelVisible = false;
trigger.addEventListener('click', () => {
isPanelVisible = !isPanelVisible;
panel.style.display = isPanelVisible ? 'block' : 'none';
});
// 点击面板外区域隐藏面板
document.addEventListener('click', (e) => {
if (!panel.contains(e.target) && e.target !== trigger) {
isPanelVisible = false;
panel.style.display = 'none';
}
});
// 功能绑定
document.getElementById('hard-reset').addEventListener('click', () => {
const config = getCurrentDomainConfig();
window.location.href = `${config.cleanUrl}?_clean=${Date.now()}`;
});
document.getElementById('new-identity').addEventListener('click', () => {
GM_download({
url: 'http://localhost:8080/rotate',
name: 'proxy_rotate',
onload: () => window.location.reload()
});
});
document.getElementById('flush-dns').addEventListener('click', () => {
// DNS刷新逻辑可以在这里添加
fetch('http://localhost:8080/flush-dns', {
method: 'POST'
}).then(() => {
console.log('DNS cache flushed');
window.location.reload();
}).catch(err => {
console.error('Failed to flush DNS:', err);
});
});
// 添加回到首页按钮的功能
document.getElementById('home-page').addEventListener('click', () => {
const config = getCurrentDomainConfig();
window.location.href = config.baseUrl;
});
})();