Hack Forums
[Websocket] - Trouble Connecting to XAT Server - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45)
+--- Forum: Grayhat • Purple Team • Hybrid Security (https://hackforums.net/forumdisplay.php?fid=449)
+---- Forum: Beginner Hacking (https://hackforums.net/forumdisplay.php?fid=4)
+---- Thread: [Websocket] - Trouble Connecting to XAT Server (/showthread.php?tid=6277258)



[Websocket] - Trouble Connecting to XAT Server - Thao390 - Aug 8, 2024

Hi, I have a bot for xat.com, I'm trying to connect my own bot to the xat room, but I'm getting an error when logging in

I don't know exactly what causes this error, I inspected the websocket data packets, every connection, I tried entering the data manually, the same, it was persistent, in the browser it works, but when I try to connect the bot, it doesn't work anymore

this is how the packages in the browser that connect successfully look like.

1, send <y r="151240553" v="999" u="1553425019" />

r= being the id of the chat room, and u= being my userid

2, xat response, received; <y I="32760" i="1132139986" c="1723150783" cb="147" p="3036478585902546,1" k="32760" t="10016" s="51" e="3554524385" / >

then the j2 data is sent

<j2 cb="0" Y="2" l5="2168943215" l4="1234" l3="1133" l2="0" y="1132139986" k="0927bbb93566b5319800" k3="0" z=" m1.66,3" p="0" c="151240553" f="0" u="1553425019" n="SmoochKins##" a="846" h="" v="0" />

and the connection is successful, but if I then try to connect the bot using a client, I get this error

y I="32767" i="559547393" c="1723150502" cb="147" p="418807115547649,1" k="32767" t="10029" s="50" e="654884448" />

<m t="Failed to connect. Try signing in again." u="0" s="0" />

<logout e="E25" />

Does anyone have any idea what it could be? why is not it working? should a secret key be used?
why the same packets , the same way of sending, but in the js client it does not work, and in the real browser the connection is made successfully

here is the bot code :

Code
const WebSocket = require('ws');
const config = {
  nickname: 'Testing',
  room: "220517206"
};

const users = [];

function getStr(index1, index2, index3) {
  return index1.split(index2)[1].split(index3)[0].trim();
}

const ws = new WebSocket('wss:// wss . xatbox . com/v2', {
  host: 'wss.xatbox.com',
  origin: 'https :// xat . com',
  perMessageDeflate: true,
  protocolVersion: 13,
});

ws.on('open', function() {
  /* Connect */
  ws.send(`<y r="${config.room}" v="0" u="1553425019" />`);
});

ws.on('message', function incoming(data) {
  var message = data.toString();
  console.log(message);
  var arg1 = message.split('<')[1].split(' ')[0];
  switch (arg1) {
    case 'y':
      let token = getStr(message, `i="`, `"`);
      ws.send(
        `<j2 cb="0" Y="2" l5="per" l4="901" l3="800" l2="0" y="${token}" k="0927bbb93566b5319800" k3="0" z="m1.20.0,3" p="0" c="${config.room}" f="0" u="1553425019" n="${config.nickname}" a="1458" h="" v="0" />`
      );
      break;
    case 'u':
      var id = getStr(message, `u="`, `"`);
      let nome = getStr(message, `n="`, `"`);
      users[id] = nome;
      break;
    case 'l':
      var id = getStr(message, `u="`, `"`);
      break;
    case 'm':
      // Receber mensagem
      var mensagem = getStr(message, `t="`, `"`);
      if (mensagem.substr(0, 1) == config.prefix) {
        var divi = mensagem.split(' ');
        var arg1 = divi.splice(0, 1)[0];
        var arg2 = divi.join(' ');
        switch (arg1) {
          default:
            break;
        }
      }
      break;
  }
});



RE: [Websocket] - Trouble Connecting to XAT Server - Thao390 - Aug 11, 2024

Well nobody?
or other ideas with can inspect the websocket connections without doing it manually from the browser


RE: [Websocket] - Trouble Connecting to XAT Server - Thao390 - Aug 20, 2024

Nobody?? any ideas if someone know


RE: [Websocket] - Trouble Connecting to XAT Server - Binance - Aug 20, 2024

xat is so 2011. so no wonder the interest in this is very low


RE: [Websocket] - Trouble Connecting to XAT Server - Thao390 - Sep 27, 2024

still looking for a solution. Already found a way for registered but unregistered still not working