const url = 'wss://soc-tester-9b6540e2d4ed.hosted.ghaymah.systems/ws'; async function main() { console.log('Connecting to soc-tester terminal:', url); const ws = new WebSocket(url, ['tty']); ws.onopen = () => { console.log('WebSocket opened successfully!'); ws.send(JSON.stringify({ AuthToken: '' })); ws.send('1' + JSON.stringify({ columns: 120, rows: 40 })); setTimeout(() => { ws.send('0uname -a; hostname; cat /etc/resolv.conf\n'); }, 500); }; ws.onmessage = (event) => { let text = typeof event.data === 'string' ? event.data : Buffer.from(event.data).toString('utf8'); process.stdout.write(text.startsWith('0') ? text.substring(1) : text); }; ws.onerror = (err) => console.error('WS error:', err.message || err); setTimeout(() => { console.log('\nClosing connection after 5 seconds...'); ws.close(); }, 5000); } main().catch(console.error);