Technical comments removed

This commit is contained in:
lockbitchat
2025-08-16 21:15:03 -04:00
parent e4273f5150
commit 12de75f882
2 changed files with 22 additions and 39 deletions

View File

@@ -455,7 +455,7 @@ class EnhancedSecureWebRTCManager {
size: size, size: size,
isFakeTraffic: true, isFakeTraffic: true,
source: 'fake_traffic_generator', source: 'fake_traffic_generator',
fakeId: crypto.getRandomValues(new Uint32Array(1))[0].toString(36) // Уникальный ID fakeId: crypto.getRandomValues(new Uint32Array(1))[0].toString(36)
}; };
} }
@@ -1253,7 +1253,6 @@ async processOrderedPackets() {
return 'FAKE_MESSAGE_FILTERED'; return 'FAKE_MESSAGE_FILTERED';
} }
} catch (e) { } catch (e) {
// Не JSON - это нормально для обычных сообщений
if (window.DEBUG_MODE) { if (window.DEBUG_MODE) {
console.log('📝 Decrypted content is not JSON, treating as plain text message'); console.log('📝 Decrypted content is not JSON, treating as plain text message');
} }

View File

@@ -145,7 +145,6 @@ class PayPerSessionManager {
// IMPROVED user fingerprint generation // IMPROVED user fingerprint generation
generateAdvancedUserFingerprint() { generateAdvancedUserFingerprint() {
try { try {
// Базовые компоненты (как было)
const basicComponents = [ const basicComponents = [
navigator.userAgent || '', navigator.userAgent || '',
navigator.language || '', navigator.language || '',
@@ -161,10 +160,9 @@ class PayPerSessionManager {
navigator.onLine ? '1' : '0' navigator.onLine ? '1' : '0'
]; ];
// НОВЫЕ КОМПОНЕНТЫ ДЛЯ HARDWARE BINDING
const hardwareComponents = []; const hardwareComponents = [];
// WebGL отпечаток (очень сложно подделать) // WebGL fingerprint
try { try {
const canvas = document.createElement('canvas'); const canvas = document.createElement('canvas');
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
@@ -181,7 +179,7 @@ class PayPerSessionManager {
hardwareComponents.push('webgl_error'); hardwareComponents.push('webgl_error');
} }
// Canvas отпечаток (уникален для каждого устройства) // Canvas print
try { try {
const canvas = document.createElement('canvas'); const canvas = document.createElement('canvas');
canvas.width = 200; canvas.width = 200;
@@ -197,7 +195,7 @@ class PayPerSessionManager {
hardwareComponents.push('canvas_error'); hardwareComponents.push('canvas_error');
} }
// Аудио отпечаток (очень стабилен) // Audio fingerprint
try { try {
const audioContext = new (window.AudioContext || window.webkitAudioContext)(); const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const oscillator = audioContext.createOscillator(); const oscillator = audioContext.createOscillator();
@@ -220,14 +218,12 @@ class PayPerSessionManager {
hardwareComponents.push('audio_error'); hardwareComponents.push('audio_error');
} }
// Производительность CPU (стабильна для устройства) // CPU Performance
const cpuBenchmark = this.performCPUBenchmark(); const cpuBenchmark = this.performCPUBenchmark();
hardwareComponents.push(cpuBenchmark); hardwareComponents.push(cpuBenchmark);
// Объединяем все компоненты
const allComponents = [...basicComponents, ...hardwareComponents]; const allComponents = [...basicComponents, ...hardwareComponents];
// Создаем несколько уровней хеширования
let primaryHash = 0; let primaryHash = 0;
let secondaryHash = 0; let secondaryHash = 0;
let tertiaryHash = 0; let tertiaryHash = 0;
@@ -236,28 +232,24 @@ class PayPerSessionManager {
const secondaryStr = allComponents.slice(8, 16).join('|'); const secondaryStr = allComponents.slice(8, 16).join('|');
const tertiaryStr = allComponents.slice(16).join('|'); const tertiaryStr = allComponents.slice(16).join('|');
// Первичный хеш
for (let i = 0; i < primaryStr.length; i++) { for (let i = 0; i < primaryStr.length; i++) {
const char = primaryStr.charCodeAt(i); const char = primaryStr.charCodeAt(i);
primaryHash = ((primaryHash << 7) - primaryHash) + char; primaryHash = ((primaryHash << 7) - primaryHash) + char;
primaryHash = primaryHash & primaryHash; primaryHash = primaryHash & primaryHash;
} }
// Вторичный хеш
for (let i = 0; i < secondaryStr.length; i++) { for (let i = 0; i < secondaryStr.length; i++) {
const char = secondaryStr.charCodeAt(i); const char = secondaryStr.charCodeAt(i);
secondaryHash = ((secondaryHash << 11) - secondaryHash) + char; secondaryHash = ((secondaryHash << 11) - secondaryHash) + char;
secondaryHash = secondaryHash & secondaryHash; secondaryHash = secondaryHash & secondaryHash;
} }
// Третичный хеш
for (let i = 0; i < tertiaryStr.length; i++) { for (let i = 0; i < tertiaryStr.length; i++) {
const char = tertiaryStr.charCodeAt(i); const char = tertiaryStr.charCodeAt(i);
tertiaryHash = ((tertiaryHash << 13) - tertiaryHash) + char; tertiaryHash = ((tertiaryHash << 13) - tertiaryHash) + char;
tertiaryHash = tertiaryHash & tertiaryHash; tertiaryHash = tertiaryHash & tertiaryHash;
} }
// Комбинированный отпечаток
const combined = `${Math.abs(primaryHash).toString(36)}_${Math.abs(secondaryHash).toString(36)}_${Math.abs(tertiaryHash).toString(36)}`; const combined = `${Math.abs(primaryHash).toString(36)}_${Math.abs(secondaryHash).toString(36)}_${Math.abs(tertiaryHash).toString(36)}`;
console.log('🔒 Enhanced fingerprint generated:', { console.log('🔒 Enhanced fingerprint generated:', {
@@ -272,7 +264,6 @@ class PayPerSessionManager {
} catch (error) { } catch (error) {
console.warn('Failed to generate enhanced fingerprint:', error); console.warn('Failed to generate enhanced fingerprint:', error);
// Fallback к более простому отпечатку
return 'fallback_' + Date.now().toString(36) + '_' + Math.random().toString(36).substr(2, 9); return 'fallback_' + Date.now().toString(36) + '_' + Math.random().toString(36).substr(2, 9);
} }
} }
@@ -440,8 +431,7 @@ class PayPerSessionManager {
getHardwareFingerprint() { getHardwareFingerprint() {
const components = []; const components = [];
// CPU информация
components.push(navigator.hardwareConcurrency || 0); components.push(navigator.hardwareConcurrency || 0);
components.push(navigator.deviceMemory || 0); components.push(navigator.deviceMemory || 0);
@@ -477,10 +467,8 @@ class PayPerSessionManager {
} }
registerEnhancedDemoSessionUsage(userFingerprint, preimage) { registerEnhancedDemoSessionUsage(userFingerprint, preimage) {
// Вызываем оригинальный метод
const session = this.registerDemoSessionUsage(userFingerprint, preimage); const session = this.registerDemoSessionUsage(userFingerprint, preimage);
// Дополнительно сохраняем в persistent storage
this.savePersistentData(); this.savePersistentData();
console.log('📊 Enhanced demo session registered:', { console.log('📊 Enhanced demo session registered:', {
@@ -524,11 +512,11 @@ class PayPerSessionManager {
getAntiResetMessage(antiResetCheck) { getAntiResetMessage(antiResetCheck) {
switch (antiResetCheck.reason) { switch (antiResetCheck.reason) {
case 'hardware_mismatch': case 'hardware_mismatch':
return 'Обнаружена попытка сброса ограничений. Доступ к демо-режиму временно ограничен.'; return 'An attempt to reset restrictions was detected. Access to demo mode is temporarily restricted.';
case 'global_limit_exceeded': case 'global_limit_exceeded':
return `Глобальный лимит демо-сессий превышен (${antiResetCheck.globalCount}/10). Для продолжения требуется оплаченная сессия.`; return `Global demo session limit exceeded (${antiResetCheck.globalCount}/10). A paid session is required to continue.`;
default: default:
return 'Доступ к демо-режиму ограничен по соображениям безопасности.'; return 'Access to demo mode is restricted for security reasons.';
} }
} }
@@ -638,7 +626,7 @@ class PayPerSessionManager {
return { return {
allowed: false, allowed: false,
reason: 'multiple_tabs', reason: 'multiple_tabs',
message: 'Демо-режим доступен только в одной вкладке одновременно.' message: 'Demo mode is only available in one tab at a time..'
}; };
} }
@@ -681,7 +669,6 @@ class PayPerSessionManager {
const activeTabsStr = this.getFromStorage(activeTabsKey); const activeTabsStr = this.getFromStorage(activeTabsKey);
const activeTabs = activeTabsStr ? JSON.parse(activeTabsStr) : []; const activeTabs = activeTabsStr ? JSON.parse(activeTabsStr) : [];
// Обновляем timestamp для текущей вкладки
const updatedTabs = activeTabs.map(tab => { const updatedTabs = activeTabs.map(tab => {
if (tab.tabId === this.currentTabId) { if (tab.tabId === this.currentTabId) {
return { return {
@@ -858,7 +845,6 @@ class PayPerSessionManager {
throw new Error('Preimage must be valid hexadecimal'); throw new Error('Preimage must be valid hexadecimal');
} }
// СПЕЦИАЛЬНАЯ обработка demo preimage с УСИЛЕННЫМИ проверками
if (this.isDemoPreimage(preimage)) { if (this.isDemoPreimage(preimage)) {
console.log('🎮 Demo preimage detected - performing ENHANCED validation...'); console.log('🎮 Demo preimage detected - performing ENHANCED validation...');
@@ -885,15 +871,14 @@ class PayPerSessionManager {
if (age > 15 * 60 * 1000) { if (age > 15 * 60 * 1000) {
throw new Error(`Demo preimage expired (age: ${Math.round(age / (60 * 1000))} minutes)`); throw new Error(`Demo preimage expired (age: ${Math.round(age / (60 * 1000))} minutes)`);
} }
// Demo preimage не должен быть из будущего
if (age < -2 * 60 * 1000) { if (age < -2 * 60 * 1000) {
throw new Error('Demo preimage timestamp from future - possible clock manipulation'); throw new Error('Demo preimage timestamp from future - possible clock manipulation');
} }
// CHECK 4: ИСПРАВЛЕННЫЙ вызов лимитов - используем ПРАВИЛЬНЫЙ метод // CHECK 4: FIXED calling limits - use the CORRECT method
const userFingerprint = this.generateAdvancedUserFingerprint(); // ИСПРАВЛЕНО! const userFingerprint = this.generateAdvancedUserFingerprint();
const limitsCheck = this.checkEnhancedDemoSessionLimits(userFingerprint); // ИСПРАВЛЕНО! const limitsCheck = this.checkEnhancedDemoSessionLimits(userFingerprint);
if (!limitsCheck.allowed) { if (!limitsCheck.allowed) {
throw new Error(`Demo session limits exceeded: ${limitsCheck.message}`); throw new Error(`Demo session limits exceeded: ${limitsCheck.message}`);
@@ -901,7 +886,7 @@ class PayPerSessionManager {
// FIX: For demo sessions, do NOT add preimage to usedPreimages here, // FIX: For demo sessions, do NOT add preimage to usedPreimages here,
// as this will only be done after successful activation // as this will only be done after successful activation
this.registerEnhancedDemoSessionUsage(userFingerprint, preimage); // ИСПРАВЛЕНО! this.registerEnhancedDemoSessionUsage(userFingerprint, preimage);
console.log('✅ Demo preimage ENHANCED validation passed'); console.log('✅ Demo preimage ENHANCED validation passed');
return true; return true;
@@ -1321,7 +1306,6 @@ class PayPerSessionManager {
}; };
} }
// ИСПРАВЛЕННЫЙ вызов - используем правильные методы
const userFingerprint = this.generateAdvancedUserFingerprint(); const userFingerprint = this.generateAdvancedUserFingerprint();
const demoCheck = this.checkEnhancedDemoSessionLimits(userFingerprint); const demoCheck = this.checkEnhancedDemoSessionLimits(userFingerprint);
@@ -1503,7 +1487,7 @@ class PayPerSessionManager {
handleDemoSessionExpiry(preimage) { handleDemoSessionExpiry(preimage) {
if (this.currentSession && this.currentSession.preimage === preimage) { if (this.currentSession && this.currentSession.preimage === preimage) {
const userFingerprint = this.generateAdvancedUserFingerprint(); // ИСПРАВЛЕНО! const userFingerprint = this.generateAdvancedUserFingerprint();
const sessionDuration = Date.now() - this.currentSession.startTime; const sessionDuration = Date.now() - this.currentSession.startTime;
this.registerDemoSessionCompletion(userFingerprint, sessionDuration, preimage); this.registerDemoSessionCompletion(userFingerprint, sessionDuration, preimage);
@@ -1533,7 +1517,7 @@ class PayPerSessionManager {
const expiredSession = this.currentSession; const expiredSession = this.currentSession;
if (expiredSession && expiredSession.isDemo) { if (expiredSession && expiredSession.isDemo) {
const userFingerprint = this.generateAdvancedUserFingerprint(); // ИСПРАВЛЕНО! const userFingerprint = this.generateAdvancedUserFingerprint();
const sessionDuration = Date.now() - expiredSession.startTime; const sessionDuration = Date.now() - expiredSession.startTime;
this.registerDemoSessionCompletion(userFingerprint, sessionDuration, expiredSession.preimage); this.registerDemoSessionCompletion(userFingerprint, sessionDuration, expiredSession.preimage);
} }
@@ -1582,8 +1566,8 @@ class PayPerSessionManager {
// UPDATED demo session creation // UPDATED demo session creation
createDemoSession() { createDemoSession() {
const userFingerprint = this.generateAdvancedUserFingerprint(); // ИСПРАВЛЕНО! const userFingerprint = this.generateAdvancedUserFingerprint();
const demoCheck = this.checkEnhancedDemoSessionLimits(userFingerprint); // ИСПРАВЛЕНО! const demoCheck = this.checkEnhancedDemoSessionLimits(userFingerprint);
if (!demoCheck.allowed) { if (!demoCheck.allowed) {
return { return {
@@ -1943,7 +1927,7 @@ class PayPerSessionManager {
// IMPORTANT: We register the end of the current demo session during cleanup // IMPORTANT: We register the end of the current demo session during cleanup
if (this.currentSession && this.currentSession.isDemo) { if (this.currentSession && this.currentSession.isDemo) {
const userFingerprint = this.generateAdvancedUserFingerprint(); // ИСПРАВЛЕНО! const userFingerprint = this.generateAdvancedUserFingerprint();
const sessionDuration = Date.now() - this.currentSession.startTime; const sessionDuration = Date.now() - this.currentSession.startTime;
this.registerDemoSessionCompletion(userFingerprint, sessionDuration, this.currentSession.preimage); this.registerDemoSessionCompletion(userFingerprint, sessionDuration, this.currentSession.preimage);
} }