* save url when connected and allow toggling connection on app start (#2)

* mask ip in logs, reduce keep-alive logs frequency

* update comment about debug link, migrate prefs to ktx

* auto-connect for telemost

* fix ice ipv6 resolving

* auto-connect for vk

* refactor hooks names

* regenerate android resources

* remove stale telemost dc

* kick disconnected user from vk, refactor relay on mobile client, prevent double hook injection

* refactor constants

* set low importance for notification to avoid signals

* stop vpn/relay at app destroy, reset state at vpn disconnect

* prevent vk session close at video tunnel

* kick disconnected user from vk, refactor relay on mobile client, prevent double hook injection

* multiple tabs/calls, write android logs in file

* update ux, fix fd lifecycle in tun2socks

* increment release version

---------

Co-authored-by: HukuToc2288 <hukutoc2288@yandex.ru>
Co-authored-by: kulikov <user@Mac.lan>
This commit is contained in:
authored and kulikov committed 2026-03-26 09:54:48 +01:00
1 parent e8da07179a
commit 84da73c324
52 files changed
+1510 -479

No files matched your search

-5
View File
@@ -1,5 +0,0 @@
const { webFrame, ipcRenderer } = require('electron');
ipcRenderer.invoke('get-hook-code', window.location.href).then(function(code) {
webFrame.executeJavaScript(code);
});
+180 -83
View File
@@ -4,75 +4,201 @@
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, sans-serif; background: #1a1a1a; color: #e0e0e0; height: 100vh; display: flex; flex-direction: column; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #222; border-bottom: 1px solid #333; height: 40px; flex-shrink: 0; }
.toolbar button { padding: 4px 14px; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 500; }
.btn-home { background: #444; color: #e0e0e0; }
.tab-bar { display: flex; align-items: center; background: #222; border-bottom: 1px solid #333; height: 36px; flex-shrink: 0; overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 6px; padding: 0 12px; height: 100%; font-size: 12px; cursor: pointer; border-right: 1px solid #333; white-space: nowrap; color: #888; }
.tab.active { background: #1a1a1a; color: #e0e0e0; }
.tab .close { font-size: 14px; opacity: 0.5; cursor: pointer; margin-left: 4px; }
.tab .close:hover { opacity: 1; }
.tab-add { padding: 0 12px; height: 100%; display: flex; align-items: center; font-size: 16px; cursor: pointer; color: #888; }
.tab-add:hover { color: #e0e0e0; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #252525; border-bottom: 1px solid #333; height: 36px; flex-shrink: 0; }
.toolbar button { padding: 3px 12px; border: none; border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 500; }
.btn-vk { background: #0077ff; color: white; }
.btn-telemost { background: #fc3f1d; color: white; }
.btn-inject { background: #f59e0b; color: black; }
.link-text { font-family: monospace; font-size: 12px; color: #aaa; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { flex: 1; position: relative; }
.content webview { width: 100%; height: 100%; border: none; }
.content webview { width: 100%; height: 100%; border: none; position: absolute; top: 0; left: 0; }
.content webview.hidden { display: none; }
.welcome { display: flex; align-items: center; justify-content: center; height: 100%; flex-direction: column; gap: 16px; }
.welcome h1 { font-size: 22px; font-weight: 500; }
.welcome p { color: #888; font-size: 14px; }
.logs { display: flex; gap: 0; border-top: 1px solid #333; height: 140px; flex-shrink: 0; }
.logs { display: flex; gap: 0; border-top: 1px solid #333; height: 120px; flex-shrink: 0; }
.log-panel { flex: 1; display: flex; flex-direction: column; }
.log-panel:first-child { border-right: 1px solid #333; }
.log-title { font-size: 11px; font-weight: 600; color: #888; padding: 4px 8px; background: #1e1e1e; border-bottom: 1px solid #333; }
.log-content { flex: 1; overflow-y: auto; padding: 4px 8px; font-family: monospace; font-size: 11px; background: #111; white-space: pre-wrap; word-break: break-all; }
.log-title { font-size: 10px; font-weight: 600; color: #888; padding: 3px 8px; background: #1e1e1e; border-bottom: 1px solid #333; }
.log-content { flex: 1; overflow-y: auto; padding: 3px 8px; font-family: monospace; font-size: 10px; background: #111; white-space: pre-wrap; word-break: break-all; }
.log-content.relay { color: #4fc3f7; }
.log-content.hook { color: #66bb6a; }
</style>
</head>
<body>
<div class="toolbar">
<button class="btn-home" onclick="goHome()">Home</button>
<button class="btn-vk" onclick="loadURL('https://vk.com/im')">VK Call</button>
<div class="tab-bar" id="tabBar">
<div class="tab-add" onclick="addTab()" title="New tab">+</div>
</div>
<div class="toolbar" id="toolbar" style="display:none">
<button class="btn-vk" onclick="loadURL('https://vk.com/im')">VK</button>
<button class="btn-telemost" onclick="loadURL('https://telemost.yandex.ru/')">Telemost</button>
<span style="margin-left:auto;font-size:11px;color:#888">Tunnel:</span>
<select id="modeSelect" style="padding:3px 6px;border:1px solid #555;border-radius:6px;font-size:11px;cursor:pointer;font-weight:500;background:#333;color:#e0e0e0;outline:none" onchange="onModeChange(this.value)">
<option value="dc" selected>DC</option>
<option value="pion-video">Pion Video</option>
<select id="modeSelect" style="padding:2px 6px;border:1px solid #555;border-radius:6px;font-size:11px;cursor:pointer;font-weight:500;background:#333;color:#e0e0e0;outline:none" onchange="onModeChange(this.value)">
<option value="dc">DC</option>
<option value="pion-video">Video</option>
</select>
<span onclick="saveLogs()" style="cursor:pointer;margin-left:8px" title="Save logs"><img src="resources/icons8-download-64.png" style="height:16px;vertical-align:middle;filter:invert(1) brightness(2)"></span>
</div>
<div class="content" id="content">
<div class="welcome" id="welcome">
<h1>Whitelist Bypass - Creator</h1>
<p>Click VK Call or Telemost to start</p>
<p>Click + to add a tab</p>
</div>
</div>
<div class="logs">
<div class="logs" id="logsPanel" style="display:none">
<div class="log-panel">
<div class="log-title">Relay <span onclick="copyLog('relayLog')" style="cursor:pointer;float:right;margin-left:6px" title="Copy"><img src="resources/icons8-copy-50.png" style="height:16px;vertical-align:middle;filter:invert(1) brightness(2);padding:0 4px"></span><span onclick="saveLogs()" style="cursor:pointer;float:right;margin-left:6px" title="Save all"><img src="resources/icons8-download-64.png" style="height:19px;vertical-align:middle;filter:invert(1) brightness(2);padding:0 4px"></span><span onclick="document.getElementById('relayLog').textContent=''" style="cursor:pointer;float:right" title="Clear"><span style="font-size:16px;line-height:16px">&#x2715;</span></span></div>
<div class="log-title">Relay <span onclick="clearLog('relay')" style="cursor:pointer;float:right" title="Clear"><span style="font-size:13px;line-height:13px">&#x2715;</span></span></div>
<div class="log-content relay" id="relayLog"></div>
</div>
<div class="log-panel">
<div class="log-title">Hook <span onclick="copyLog('hookLog')" style="cursor:pointer;float:right;margin-left:6px" title="Copy"><img src="resources/icons8-copy-50.png" style="height:16px;vertical-align:middle;filter:invert(1) brightness(2);padding:0 4px"></span><span onclick="saveLogs()" style="cursor:pointer;float:right;margin-left:6px" title="Save all"><img src="resources/icons8-download-64.png" style="height:19px;vertical-align:middle;filter:invert(1) brightness(2);padding:0 4px"></span><span onclick="document.getElementById('hookLog').textContent=''" style="cursor:pointer;float:right" title="Clear"><span style="font-size:16px;line-height:16px">&#x2715;</span></span></div>
<div class="log-title">Hook <span onclick="clearLog('hook')" style="cursor:pointer;float:right" title="Clear"><span style="font-size:13px;line-height:13px">&#x2715;</span></span></div>
<div class="log-content hook" id="hookLog"></div>
</div>
</div>
<script>
var wv = null;
var currentMode = 'dc';
var tabsState = {}; // tabId -> { wv, mode, relayLogs, hookLogs }
var activeTabId = null;
var nextTabId = 1;
function addTab() {
var tabId = 'tab-' + (nextTabId++);
tabsState[tabId] = { wv: null, url: '', mode: 'dc', relayLogs: '', hookLogs: '' };
window.bridge.startRelay(tabId);
renderTabs();
selectTab(tabId);
}
function closeTab(tabId, e) {
if (e) e.stopPropagation();
var t = tabsState[tabId];
if (t && t.wv) t.wv.remove();
window.bridge.closeTab(tabId);
delete tabsState[tabId];
if (activeTabId === tabId) {
var ids = Object.keys(tabsState);
activeTabId = ids.length > 0 ? ids[ids.length - 1] : null;
}
renderTabs();
renderContent();
}
function selectTab(tabId) {
if (activeTabId && tabsState[activeTabId]) {
tabsState[activeTabId].relayLogs = document.getElementById('relayLog').textContent;
tabsState[activeTabId].hookLogs = document.getElementById('hookLog').textContent;
}
activeTabId = tabId;
renderTabs();
renderContent();
}
function renderTabs() {
var bar = document.getElementById('tabBar');
var html = '';
Object.keys(tabsState).forEach(function(id) {
var t = tabsState[id];
var label = 'New';
if (t.url) {
if (t.url.includes('vk.com')) label = 'VK';
else if (t.url.includes('telemost')) label = 'Telemost';
}
var cls = id === activeTabId ? 'tab active' : 'tab';
html += '<div class="' + cls + '" onclick="selectTab(\'' + id + '\')">' + label + ' <span class="close" onclick="closeTab(\'' + id + '\', event)">&#x2715;</span></div>';
});
html += '<div class="tab-add" onclick="addTab()" title="New tab">+</div>';
bar.innerHTML = html;
}
function renderContent() {
var content = document.getElementById('content');
var welcome = document.getElementById('welcome');
var toolbar = document.getElementById('toolbar');
var logsPanel = document.getElementById('logsPanel');
// Hide all webviews
var wvs = content.querySelectorAll('webview');
for (var i = 0; i < wvs.length; i++) wvs[i].classList.add('hidden');
if (!activeTabId || !tabsState[activeTabId]) {
welcome.style.display = 'flex';
toolbar.style.display = 'none';
logsPanel.style.display = 'none';
return;
}
welcome.style.display = 'none';
toolbar.style.display = 'flex';
logsPanel.style.display = 'flex';
var t = tabsState[activeTabId];
document.getElementById('modeSelect').value = t.mode;
document.getElementById('relayLog').textContent = t.relayLogs || '';
document.getElementById('hookLog').textContent = t.hookLogs || '';
if (t.wv) t.wv.classList.remove('hidden');
scrollLogs();
}
function scrollLogs() {
var r = document.getElementById('relayLog');
var h = document.getElementById('hookLog');
r.scrollTop = r.scrollHeight;
h.scrollTop = h.scrollHeight;
}
function loadURL(url) {
if (!activeTabId) return;
var t = tabsState[activeTabId];
if (t.wv) t.wv.remove();
var wv = document.createElement('webview');
wv.setAttribute('src', url);
wv.setAttribute('partition', 'persist:creator');
wv.setAttribute('nodeintegration', '');
wv.setAttribute('nodeintegrationinsubframes', '');
wv.style.width = '100%';
wv.style.height = '100%';
wv.style.position = 'absolute';
wv.style.top = '0';
wv.style.left = '0';
wv.dataset.tabId = activeTabId;
document.getElementById('content').appendChild(wv);
wv.addEventListener('dom-ready', function() {
wv.setAudioMuted(true);
var tabId = wv.dataset.tabId;
window.bridge.getHookCode(tabId, wv.getURL()).then(function(code) {
wv.executeJavaScript(code).catch(function() {});
});
});
wv.addEventListener('did-navigate', function() {
t.url = wv.getURL() || t.url;
renderTabs();
var tabId = wv.dataset.tabId;
wv.executeJavaScript('window.__hookInstalled = false').catch(function() {});
window.bridge.getHookCode(tabId, wv.getURL()).then(function(code) {
wv.executeJavaScript(code).catch(function() {});
});
});
t.wv = wv;
t.url = url;
renderTabs();
}
function onModeChange(mode) {
currentMode = mode;
var sel = document.getElementById('modeSelect');
sel.disabled = true;
window.bridge.setTunnelMode(mode).then(function() {
if (wv) {
var url = wv.getURL();
if (url && url !== 'about:blank') {
wv.reload();
}
if (!activeTabId) return;
var t = tabsState[activeTabId];
t.mode = mode;
window.bridge.setTunnelMode(activeTabId, mode).then(function() {
if (t.wv) {
t.wv.executeJavaScript('window.__hookInstalled = false').catch(function() {});
t.wv.reload();
}
setTimeout(function() { sel.disabled = false; }, 1000);
});
}
function copyLog(id) {
navigator.clipboard.writeText(document.getElementById(id).textContent);
function clearLog(type) {
document.getElementById(type === 'relay' ? 'relayLog' : 'hookLog').textContent = '';
}
function saveLogs() {
@@ -86,61 +212,32 @@ function saveLogs() {
a.click();
}
function appendHookLog(msg) {
var el = document.getElementById('hookLog');
if (el.textContent.length > 0) el.textContent += '\n';
el.textContent += msg.replace('[HOOK] ', '');
el.scrollTop = el.scrollHeight;
}
function goHome() {
if (wv) { wv.remove(); wv = null; }
document.getElementById('welcome').style.display = 'flex';
}
function injectHook() {
if (!wv) return;
var url = wv.getURL();
window.bridge.getHookCode(url).then(function(code) {
wv.executeJavaScript(code).catch(function(e) {
appendHookLog('Inject error: ' + e.message);
});
});
}
function loadURL(url) {
document.getElementById('welcome').style.display = 'none';
if (wv) wv.remove();
wv = document.createElement('webview');
wv.setAttribute('src', url);
wv.setAttribute('partition', 'persist:creator');
wv.setAttribute('preload', './call-preload.js');
wv.setAttribute('nodeintegration', '');
wv.setAttribute('nodeintegrationinsubframes', '');
wv.style.width = '100%';
wv.style.height = '100%';
document.getElementById('content').appendChild(wv);
wv.addEventListener('dom-ready', function() { wv.setAudioMuted(true); });
}
// Poll hook logs from webview
// Poll hook logs from active tab's webview
setInterval(function() {
if (!wv) return;
wv.executeJavaScript('(window.__hookLogs && window.__hookLogs.length) ? window.__hookLogs.splice(0) : []')
if (!activeTabId || !tabsState[activeTabId] || !tabsState[activeTabId].wv) return;
tabsState[activeTabId].wv.executeJavaScript('(window.__hookLogs && window.__hookLogs.length) ? window.__hookLogs.splice(0) : []')
.then(function(logs) {
logs.forEach(function(msg) { appendHookLog(msg); });
if (!logs.length) return;
var el = document.getElementById('hookLog');
logs.forEach(function(msg) {
if (el.textContent.length > 0) el.textContent += '\n';
el.textContent += msg.replace('[HOOK] ', '');
});
el.scrollTop = el.scrollHeight;
}).catch(function() {});
}, 500);
window.bridge.onRelayLog(function(msg) {
var el = document.getElementById('relayLog');
if (el.textContent.length > 0) el.textContent += '\n';
el.textContent += msg;
el.scrollTop = el.scrollHeight;
// Relay logs from main process
window.bridge.onRelayLog(function(tabId, msg) {
if (tabsState[tabId]) {
tabsState[tabId].relayLogs += (tabsState[tabId].relayLogs ? '\n' : '') + msg;
}
if (tabId === activeTabId) {
var el = document.getElementById('relayLog');
if (el.textContent.length > 0) el.textContent += '\n';
el.textContent += msg;
el.scrollTop = el.scrollHeight;
}
});
</script>
</body>
+142 -108
View File
@@ -2,95 +2,101 @@ const { app, BrowserWindow, session, ipcMain } = require('electron');
const { spawn } = require('child_process');
const path = require('path');
const fs = require('fs');
const TelemostAutoclick = require('./telemost-autoclick');
const VkAutoclick = require('./vk-autoclick');
var hooksDir = app.isPackaged
? path.join(process.resourcesPath, 'hooks')
: path.join(__dirname, '..', 'hooks');
var logCapture = "window.__hookLogs=window.__hookLogs||[];var _ol=console.log;console.log=function(){_ol.apply(console,arguments);var m=Array.prototype.slice.call(arguments).join(' ');if(m.indexOf('[HOOK]')!==-1)window.__hookLogs.push(m)};";
var logCapture = "if(!window.__logCaptureInstalled){window.__logCaptureInstalled=true;window.__hookLogs=[];var _ol=console.log.bind(console);console.log=function(){_ol.apply(null,arguments);var m=Array.prototype.slice.call(arguments).join(' ');if(m.indexOf('[HOOK]')!==-1)window.__hookLogs.push(m)}}";
var relayPath = app.isPackaged
? path.join(process.resourcesPath, process.platform === 'win32' ? 'relay.exe' : 'relay')
: path.join(__dirname, '..', 'relay', process.platform === 'win32' ? 'relay.exe' : 'relay');
// Tunnel mode: 'dc' (DataChannel) or 'pion' (VP8 video)
var tunnelMode = 'dc';
var currentPlatform = 'vk';
var tabs = new Map(); // tabId -> { relay, tunnelMode, platform, dcPort, pionPort }
var nextPortBase = 10000;
var mainWindow = null;
function loadHook(url) {
function allocPorts() {
var dc = nextPortBase;
var pion = nextPortBase + 1;
nextPortBase += 2;
return { dc: dc, pion: pion };
}
function getTab(tabId) {
if (!tabs.has(tabId)) {
var ports = allocPorts();
tabs.set(tabId, { relay: null, tunnelMode: 'dc', platform: 'vk', dcPort: ports.dc, pionPort: ports.pion });
}
return tabs.get(tabId);
}
function loadHook(url, tab) {
var isTelemost = url.includes('telemost.yandex');
var newPlatform = isTelemost ? 'telemost' : 'vk';
if (newPlatform !== currentPlatform && tunnelMode.startsWith('pion')) {
currentPlatform = newPlatform;
killRelay();
setTimeout(startRelay, 500);
if (newPlatform !== tab.platform && tab.tunnelMode.startsWith('pion')) {
tab.platform = newPlatform;
killRelay(tab);
setTimeout(function() { startRelay(tab); }, 500);
} else {
currentPlatform = newPlatform;
tab.platform = newPlatform;
}
if (tunnelMode === 'pion-video' || tunnelMode === 'pion-dc') {
var hookFile = isTelemost ? 'pion-telemost.js' : 'pion-vk.js';
if (tab.tunnelMode === 'pion-video') {
var hookFile = isTelemost ? 'video-telemost.js' : 'video-vk.js';
var hook = fs.readFileSync(path.join(hooksDir, hookFile), 'utf8');
return logCapture + 'window.PION_PORT=9002;' + hook;
return logCapture + 'window.PION_PORT=' + tab.pionPort + ';window.IS_CREATOR=true;' + hook;
}
var hook = isTelemost
? fs.readFileSync(path.join(hooksDir, 'creator-telemost.js'), 'utf8')
: fs.readFileSync(path.join(hooksDir, 'creator-vk.js'), 'utf8');
return logCapture + hook;
var hookFile = isTelemost ? 'dc-creator-telemost.js' : 'dc-creator-vk.js';
var hook = fs.readFileSync(path.join(hooksDir, hookFile), 'utf8');
return logCapture + 'window.WS_PORT=' + tab.dcPort + ';' + hook;
}
let mainWindow;
let relayProcess;
function startRelay() {
var port = tunnelMode.startsWith('pion') ? 9002 : 9000;
const net = require('net');
const sock = new net.Socket();
sock.setTimeout(1000);
sock.on('connect', () => {
sock.destroy();
console.log('[relay] already running on :' + port);
if (mainWindow) mainWindow.webContents.send('relay-log', 'Using existing relay on :' + port);
});
sock.on('error', () => {
sock.destroy();
spawnRelay();
});
sock.on('timeout', () => {
sock.destroy();
spawnRelay();
});
sock.connect(port, '127.0.0.1');
}
function spawnRelay() {
var relayName = process.platform === 'win32' ? 'relay.exe' : 'relay';
var relayPath = app.isPackaged
? path.join(process.resourcesPath, relayName)
: path.join(__dirname, '..', 'relay', relayName);
var relayMode = 'creator';
if (tunnelMode === 'pion-video') relayMode = currentPlatform === 'telemost' ? 'telemost-video-creator' : 'vk-video-creator';
var relayArgs = ['--mode', relayMode];
if (tunnelMode.startsWith('pion')) relayArgs.push('--ws-port', '9002');
relayProcess = spawn(relayPath, relayArgs, {
function startRelay(tab) {
killRelay(tab);
var port = tab.tunnelMode.startsWith('pion') ? tab.pionPort : tab.dcPort;
var relayMode = 'dc-creator';
if (tab.tunnelMode === 'pion-video') {
relayMode = tab.platform === 'telemost' ? 'telemost-video-creator' : 'vk-video-creator';
}
var proc = spawn(relayPath, ['--mode', relayMode, '--ws-port', String(port)], {
stdio: ['ignore', 'pipe', 'pipe']
});
relayProcess.stdout.on('data', (data) => {
data.toString().trim().split('\n').forEach((msg) => {
tab.relay = proc;
var tabId = null;
tabs.forEach(function(t, id) { if (t === tab) tabId = id; });
var onData = function(data) {
data.toString().trim().split('\n').forEach(function(msg) {
if (!msg) return;
console.log('[relay]', msg);
if (mainWindow) mainWindow.webContents.send('relay-log', msg);
console.log('[relay:' + tabId + ']', msg);
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('relay-log', { tabId: tabId, msg: msg });
}
});
};
proc.stdout.on('data', onData);
proc.stderr.on('data', onData);
proc.on('close', function(code) {
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('relay-log', { tabId: tabId, msg: 'Relay exited with code ' + code });
}
});
relayProcess.stderr.on('data', (data) => {
data.toString().trim().split('\n').forEach((msg) => {
if (!msg) return;
console.log('[relay]', msg);
if (mainWindow) mainWindow.webContents.send('relay-log', msg);
});
});
relayProcess.on('close', (code) => {
if (mainWindow) mainWindow.webContents.send('relay-log', 'Relay exited with code ' + code);
});
}
function killRelay(tab) {
if (tab.relay) {
tab.relay.kill();
tab.relay = null;
}
}
function killAllRelays() {
tabs.forEach(function(tab) { killRelay(tab); });
}
function stripCSP(ses) {
ses.webRequest.onHeadersReceived((details, callback) => {
var headers = { ...details.responseHeaders };
ses.webRequest.onHeadersReceived(function(details, callback) {
var headers = Object.assign({}, details.responseHeaders);
delete headers['content-security-policy'];
delete headers['Content-Security-Policy'];
delete headers['content-security-policy-report-only'];
@@ -100,12 +106,12 @@ function stripCSP(ses) {
}
function createWindow() {
const ses = session.fromPartition('persist:creator');
var ses = session.fromPartition('persist:creator');
stripCSP(ses);
ses.setPermissionRequestHandler((webContents, permission, callback) => {
callback(true);
});
ses.setPermissionCheckHandler(() => true);
ses.setPermissionRequestHandler(function(wc, perm, cb) { cb(true); });
ses.setPermissionCheckHandler(function() { return true; });
ses.setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
app.on('session-created', stripCSP);
mainWindow = new BrowserWindow({
width: 1200,
@@ -119,48 +125,76 @@ function createWindow() {
}
});
ses.setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
app.on('session-created', stripCSP);
mainWindow.loadFile('index.html');
mainWindow.on('closed', () => { mainWindow = null; });
mainWindow.on('closed', function() { mainWindow = null; });
var autoclickers = new Map(); // tabId -> { telemost, vk }
mainWindow.webContents.on('did-attach-webview', function(e, wvContents) {
wvContents.on('before-input-event', function(e, input) {
if (input.key === 'F12') wvContents.openDevTools();
});
wvContents.on('did-navigate', function(e, url) {
var tabId = wvContents.id;
if (!autoclickers.has(tabId)) {
autoclickers.set(tabId, { telemost: new TelemostAutoclick(), vk: new VkAutoclick() });
}
var ac = autoclickers.get(tabId);
if (url.includes('telemost.yandex')) {
ac.vk.stop();
ac.telemost.attach(wvContents);
} else if (url.includes('vk.com')) {
ac.telemost.stop();
ac.vk.attach(wvContents);
} else {
ac.telemost.stop();
ac.vk.stop();
}
});
wvContents.on('console-message', function(e, level, msg) {
if (msg.indexOf('state: disconnected') !== -1 || msg.indexOf('state: failed') !== -1) {
var ac = autoclickers.get(wvContents.id);
if (ac) ac.vk.kickDisconnected();
}
});
wvContents.on('destroyed', function() {
var ac = autoclickers.get(wvContents.id);
if (ac) { ac.telemost.stop(); ac.vk.stop(); autoclickers.delete(wvContents.id); }
});
});
}
function killRelay() {
if (relayProcess) {
relayProcess.kill();
relayProcess = null;
}
}
ipcMain.handle('get-hook-code', (e, url) => {
return loadHook(url);
ipcMain.handle('get-hook-code', function(e, tabId, url) {
var tab = getTab(tabId);
return loadHook(url, tab);
});
ipcMain.handle('set-tunnel-mode', (e, mode) => {
if (['dc', 'pion-video'].indexOf(mode) !== -1) {
tunnelMode = mode;
killRelay();
setTimeout(function() {
startRelay();
console.log('[main] tunnel mode:', tunnelMode);
}, 500);
ipcMain.handle('set-tunnel-mode', function(e, tabId, mode) {
var tab = tabs.get(tabId);
if (!tab) return;
if (['dc', 'pion-video'].indexOf(mode) === -1) return;
tab.tunnelMode = mode;
killRelay(tab);
setTimeout(function() { startRelay(tab); }, 500);
});
ipcMain.handle('start-relay', function(e, tabId) {
var tab = getTab(tabId);
startRelay(tab);
});
ipcMain.handle('close-tab', function(e, tabId) {
var tab = tabs.get(tabId);
if (tab) {
killRelay(tab);
tabs.delete(tabId);
}
});
app.whenReady().then(() => {
startRelay();
createWindow();
});
app.whenReady().then(createWindow);
app.on('window-all-closed', () => {
killRelay();
app.quit();
});
app.on('before-quit', killRelay);
process.on('exit', killRelay);
process.on('SIGINT', () => { killRelay(); process.exit(); });
process.on('SIGTERM', () => { killRelay(); process.exit(); });
app.on('window-all-closed', function() { killAllRelays(); app.quit(); });
app.on('before-quit', killAllRelays);
process.on('exit', killAllRelays);
process.on('SIGINT', function() { killAllRelays(); process.exit(); });
process.on('SIGTERM', function() { killAllRelays(); process.exit(); });
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "whitelist-bypass-creator",
"version": "0.1.5",
"version": "0.1.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "whitelist-bypass-creator",
"version": "0.1.5",
"version": "0.1.7",
"devDependencies": {
"electron": "^33.0.0",
"electron-builder": "^25.0.0"
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "whitelist-bypass-creator",
"version": "0.1.5",
"version": "0.1.7",
"main": "main.js",
"scripts": {
"start": "electron .",
@@ -17,10 +17,10 @@
"output": "../prebuilts"
},
"extraResources": [
{ "from": "../hooks/creator-vk.js", "to": "hooks/creator-vk.js" },
{ "from": "../hooks/creator-telemost.js", "to": "hooks/creator-telemost.js" },
{ "from": "../hooks/pion-vk.js", "to": "hooks/pion-vk.js" },
{ "from": "../hooks/pion-telemost.js", "to": "hooks/pion-telemost.js" }
{ "from": "../hooks/dc-creator-vk.js", "to": "hooks/dc-creator-vk.js" },
{ "from": "../hooks/dc-creator-telemost.js", "to": "hooks/dc-creator-telemost.js" },
{ "from": "../hooks/video-vk.js", "to": "hooks/video-vk.js" },
{ "from": "../hooks/video-telemost.js", "to": "hooks/video-telemost.js" }
],
"mac": {
"target": "dmg",
+5 -3
View File
@@ -1,7 +1,9 @@
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('bridge', {
onRelayLog: (cb) => ipcRenderer.on('relay-log', (e, msg) => cb(msg)),
getHookCode: (url) => ipcRenderer.invoke('get-hook-code', url),
setTunnelMode: (mode) => ipcRenderer.invoke('set-tunnel-mode', mode)
onRelayLog: function(cb) { ipcRenderer.on('relay-log', function(e, data) { cb(data.tabId, data.msg); }); },
getHookCode: function(tabId, url) { return ipcRenderer.invoke('get-hook-code', tabId, url); },
setTunnelMode: function(tabId, mode) { return ipcRenderer.invoke('set-tunnel-mode', tabId, mode); },
startRelay: function(tabId) { return ipcRenderer.invoke('start-relay', tabId); },
closeTab: function(tabId) { return ipcRenderer.invoke('close-tab', tabId); }
});
+96
View File
@@ -0,0 +1,96 @@
class TelemostAutoclick {
constructor() {
this._interval = null;
this._wvContents = null;
}
attach(wvContents) {
this.stop();
this._wvContents = wvContents;
this._interval = setInterval(() => this._scan(), 2000);
wvContents.on('destroyed', () => this.stop());
}
stop() {
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
this._wvContents = null;
}
_scan() {
try {
this._wvContents.mainFrame.framesInSubtree.forEach((frame) => {
frame.executeJavaScript(`
(function() {
var buttons = document.querySelectorAll('.Orb-Button, button, [role="button"], [role="link"]');
var admitBtn = null;
for (var i = 0; i < buttons.length; i++) {
var txt = buttons[i].textContent.replace(/\\s+/g, ' ').trim();
if (txt.indexOf('Впустить') !== -1) {
admitBtn = buttons[i];
break;
}
}
if (!admitBtn) return 'idle';
// Find guest's participant name
var names = document.querySelectorAll('[class*="participantName"]');
for (var j = 0; j < names.length; j++) {
if (names[j].closest('[class*="selfView"]')) continue;
var moreBtn = names[j].querySelector('[data-testid="show-moderation-popup"]');
if (moreBtn) {
moreBtn.click();
return 'kick-open';
}
}
admitBtn.click();
return 'admitted';
})()
`).then((r) => {
if (r === 'kick-open') {
setTimeout(() => this._clickRemove(frame), 500);
} else if (r === 'admitted') {
console.log('[auto-accept] guest admitted');
}
}).catch(function() {});
});
} catch(e) {}
}
_clickRemove(frame) {
frame.executeJavaScript(`
(function() {
var el = document.querySelector('[title="Удалить со встречи"]');
if (el) { el.click(); return true; }
return false;
})()
`).then((r) => {
if (r) setTimeout(() => this._confirmRemove(frame), 500);
}).catch(function() {});
}
_confirmRemove(frame) {
frame.executeJavaScript(`
(function() {
var modal = document.querySelector('[data-testid="orb-modal2"]');
if (!modal) return false;
var btns = modal.querySelectorAll('button');
for (var i = 0; i < btns.length; i++) {
var txt = btns[i].textContent.replace(/\\s+/g, ' ').trim();
if (txt === 'Удалить') {
btns[i].click();
return true;
}
}
return false;
})()
`).then((r) => {
if (r) console.log('[auto-accept] kicked previous participant');
}).catch(function() {});
}
}
module.exports = TelemostAutoclick;
+94
View File
@@ -0,0 +1,94 @@
class VkAutoclick {
constructor() {
this._interval = null;
this._wvContents = null;
}
attach(wvContents) {
this.stop();
this._wvContents = wvContents;
this._interval = setInterval(() => this._scan(), 2000);
wvContents.on('destroyed', () => this.stop());
}
stop() {
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
this._wvContents = null;
}
_scan() {
try {
this._wvContents.mainFrame.framesInSubtree.forEach((frame) => {
frame.executeJavaScript(`
(function() {
var admitBtn = document.querySelector('[data-testid="calls_waiting_hall_promote"]');
if (!admitBtn) return 'idle';
// Kick current participant first if present (skip first = owner)
var menuBtns = document.querySelectorAll('[data-testid="calls_participant_list_item_menu_button"]');
if (menuBtns.length > 1) {
menuBtns[menuBtns.length - 1].click();
return 'kick-open';
}
admitBtn.click();
return 'admitted';
})()
`).then((r) => {
if (r === 'kick-open') {
setTimeout(() => this._clickKick(frame), 500);
} else if (r === 'admitted') {
console.log('[auto-accept] VK guest admitted');
}
}).catch(function() {});
});
} catch(e) {}
}
_clickKick(frame) {
frame.executeJavaScript(`
(function() {
var btn = document.querySelector('[data-testid="calls_participant_actions_kick"]');
if (btn) { btn.click(); return true; }
return false;
})()
`).then((r) => {
if (r) setTimeout(() => this._confirmKick(frame), 500);
}).catch(function() {});
}
_confirmKick(frame) {
frame.executeJavaScript(`
(function() {
var btn = document.querySelector('[data-testid="calls_call_kick_submit"]');
if (btn) { btn.click(); return true; }
return false;
})()
`).then((r) => {
if (r) console.log('[auto-accept] VK kicked previous participant');
}).catch(function() {});
}
kickDisconnected() {
if (!this._wvContents) return;
try {
this._wvContents.mainFrame.framesInSubtree.forEach((frame) => {
frame.executeJavaScript(`
(function() {
var menuBtns = document.querySelectorAll('[data-testid="calls_participant_list_item_menu_button"]');
var menuBtn = menuBtns.length > 1 ? menuBtns[menuBtns.length - 1] : null;
if (menuBtn) { menuBtn.click(); return true; }
return false;
})()
`).then((r) => {
if (r) setTimeout(() => this._clickKick(frame), 500);
}).catch(function() {});
});
} catch(e) {}
}
}
module.exports = VkAutoclick;