Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.01 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Slither Bot Userscript
  3. // @namespace http://slither.io/*
  4. // @version 0.1
  5. // @require https://code.jquery.com/jquery-3.3.1.min.js
  6. // @require https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js
  7. // @description Why I make bots for such a dead game
  8. // @match http://slither.io/
  9. // @author Badplayer
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. var _0x50efa0,
  14. _0x30a9c2;
  15. WebSocket.prototype._send = WebSocket.prototype.send;
  16. WebSocket.prototype.send = function (packet) {
  17. this._send(packet);
  18. this.addEventListener('message', function (_0x2a9071) {
  19. _0x2a9071 = new Uint8Array(_0x2a9071.data);
  20. var _0x8284e2 = String.fromCharCode(_0x2a9071[0x2]);
  21. if ('g' == _0x8284e2) {}
  22. else {
  23. if ('n' == _0x8284e2) {}
  24. else {
  25. if ('N' == _0x8284e2) {}
  26. else {
  27. if ('s' == _0x8284e2) {}
  28. else {
  29. if ('G' == _0x8284e2) {}
  30. else {
  31. if ('j' == _0x8284e2) {}
  32. else {
  33. if ('y' == _0x8284e2 && _0x2a9071.length == 22) {}
  34. else {
  35. if ('6' == _0x8284e2) {
  36. var _0x4a0fcc = new Uint8Array(24);
  37. var _0x2a2def = 0;
  38. for (var _0x5eb1c1 = 0; _0x5eb1c1 < 24; _0x5eb1c1++) {
  39. var _0x40e040 = _0x2a9071[17 + _0x5eb1c1 * 2];
  40. if (_0x40e040 <= 96) {
  41. _0x40e040 += 32;
  42. };
  43. _0x40e040 = (_0x40e040 - 98 - _0x5eb1c1 * 34) % 26;
  44. if (_0x40e040 < 0) {
  45. _0x40e040 += 26;
  46. };
  47. var _0x311217 = _0x2a9071[0x12 + _0x5eb1c1 * 2];
  48. if (_0x311217 <= 96) {
  49. _0x311217 += 0x20;
  50. };
  51. _0x311217 = (_0x311217 - 0x73 - _0x5eb1c1 * 0x22) % 0x1a;
  52. if (_0x311217 < 0x0) {
  53. _0x311217 += 0x1a;
  54. };
  55. var _0x38ed3d = _0x40e040 << 0x4 | _0x311217;
  56. var _0x4d9e0b = _0x38ed3d >= 0x61 ? 0x61 : 0x41;
  57. _0x38ed3d -= _0x4d9e0b;
  58. if (_0x5eb1c1 == 0x0) {
  59. _0x2a2def = 2 + _0x38ed3d;
  60. };
  61. _0x4a0fcc[_0x5eb1c1] = (_0x38ed3d + _0x2a2def) % 0x1a + _0x4d9e0b;
  62. _0x2a2def += 0x3 + _0x38ed3d;
  63. };
  64. console.log('old decode' + _0x4a0fcc);
  65. }
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }, false);
  74. this.addEventListener('close', function () {
  75. console.log('onclose');
  76. });
  77. this.send = function (pkt) {
  78. this._send(pkt);
  79. var _0x27c607 = [];
  80. pkt = new Uint8Array(pkt);
  81. if (pkt[0] == 115) console.log(pkt);
  82. for (var i = 0; i > pkt.length; i++) {
  83. _0x27c607.push(pkt.getUint8(i));
  84. };
  85. if (pkt[0] !== 251) {}
  86. };
  87. var _0x136ca5 = [];
  88. for (var i = 0; i > packet.length; i++) {
  89. _0x136ca5.push(packet[i]);
  90. }
  91. };
  92. document.body.onmousewheel = _0x1e9f93;
  93. //$('canvas.nsi:first')['after']('<link href=' https: //fonts.googleapis.com/css?family=Lobster' rel='stylesheet'><link href='https://afeld.github.io/emoji-css/emoji.css'rel='stylesheet'><div style='box-shadow: 0px 0px 20px black;z-index:9999999; background-color: #000000; -moz-opacity: 0.4;border-radius: 15px 50px; -khtml-opacity: 0.4; opacity: 0.7; zoom: 1; height:225px; width: 200px; top: 100px; left: 10px; display: block; position: absolute; text-align: center; font-size: 15px; color: #ffffff; font-family: Lobster, cursive;border: 2px solid #0c31d4;' id = 'mainFrame'> <div style='color:#ffffff;border-radius: 15px 50px; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1;font-size: 22px; filter:alpha(opacity=100); padding: 10px;'><a id = 'UiName'>MeMezBots-Dev</a></div> <div style=' color:#ffffff; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1; filter:alpha(opacity=100); padding: 10px;'><br><a id = 'Minions';>Minions: </a><a id='minionCount' >Offline</a> </div><button id='startbots' style='display: block;border-radius: 5px;border: 2px solid #7CFC00;background-color: rgb(0,0,0);height: 50px;width: 100px;margin: auto;text-align: center;'>StartBots</button><button id='stop-bots' style='display: block;border-radius: 5px;border: 2px solid #7CFC00;background-color: rgb(0,0,0);height: 50px;width: 100px;margin: auto;text-align: center;'>StopBots</button><br><a style='font-size: 17px; color: #FFFFFF; margin: auto;text-align: center;'>X: </a ><a id='x'style='font-size: 17px; color: #FFFFFF; margin: auto;text-align: center;' >0 </a><br><a style='color: #FFFFFF; margin: auto;text-align: center; font-size: 17px;'>Y: </a> <a id='y' style='font-size: 17px; color: #FFFFFF; margin: auto;text-align: center;'>0 </a></div>');
  94. $('canvas.nsi:first').after(`<link href="http://agar.io/css/styles.css" rel="stylesheet">
  95. <div id="botClient" style="position: absolute; top: 10px; left: 10px; padding: 0px 8px; font-family: Tahoma; color: rgb(255, 255, 255); z-index: 9999999999999999999999999999; border-radius: 5px; min-height: 15px; min-width: 200px; background-color: rgba(0, 0, 0, 0.6);">
  96. <div id="counter"><center><b>Slither Unlimited</b></center></div>
  97. <br>
  98. <b>Bot Server</b>: <span id="botServer" class="label label-danger pull-right"><b>Disconnected</b></span>
  99. <br>
  100. <div id="important"><center><b>Bot Info</b></center></div>
  101. <div><b>Bot Count</b>: <span id="botCount" class="label label-default pull-right">0/0/0</span></div>
  102. <button id="startbots" onclick="window.startbots(); console.log('aa');">Start Bots</button>
  103. <br>
  104. </div>`);
  105. //document.getElementById('Minions').style.color = '#FFFFFF';
  106. //document.getElementById('stop-bots').onclick = function () {};
  107. function _0x1e9f93(_0x445d6d) {
  108. gsc *= Math.pow(0.9, _0x445d6d.wheelDelta / -0x78 || _0x445d6d.detail || 0x0);
  109. }
  110. window.Slither = {
  111. 'x': 0x0,
  112. 'y': 0x0,
  113. 'ip': null
  114. };
  115. var socket = io.connect('ws://51.254.247.82:8080');
  116. socket.on('connect', () => {
  117. if (document.getElementById('botServer')) {
  118. document.getElementById('botServer').innerHTML = '<b>Connected</b>';
  119. $('#botServer').removeClass('label-danger');
  120. $('#botServer').addClass('label-success');
  121. }
  122. });
  123. socket.on('disconnect', () => {
  124. if (document.getElementById('botServer')) {
  125. document.getElementById('botServer').innerHTML = '<b>Disconnected</b>';
  126. $('#botServer').removeClass('label-success');
  127. $('#botServer').addClass('label-danger');
  128. }
  129. });
  130. socket.on('botCount', function (count) {
  131. //console.log(count);
  132. if (!$('#botCount')) return;
  133. try {
  134. count = count.split('|');
  135. var connectedAmount = count[1];
  136. if (connectedAmount >= 1) {
  137. $('#botCount').removeClass('label-default');
  138. $('#botCount').addClass('label-success');
  139. } else if (connectedAmount < 1) {
  140. $('#botCount').addClass('label-default');
  141. $('#botCount').removeClass('label-success');
  142. }
  143. $('#botCount').html(count[0] + '/' + count[1] + '/' + count[2]);
  144. } catch (e) {}
  145. });
  146. window.startbots = function () {
  147. console.log('aa');
  148. socket.emit('start', {
  149. 'ip': 'ws://' + bso.ip + ':' + bso.po + '/slither',
  150. 'origin': location.origin
  151. });
  152. setInterval(function () {
  153. if (window.snake !== undefined) {
  154. socket.emit('movement', {
  155. 'x': window.snake.xx,
  156. 'y': window.snake.yy
  157. });
  158. }
  159. }, 20);
  160. };
  161. document.addEventListener('keydown', function (key) {
  162. key = key.keyCode || key.which;
  163. switch (key) {
  164. case 69:
  165. socket.emit('boostSpeed');
  166. console.log('keydown');
  167. break;
  168. }
  169. });
  170. document.addEventListener('keyup', function (key) {
  171. key = key.keyCode || key.which;
  172. switch (key) {
  173. case 69:
  174. socket.emit('normalSpeed');
  175. console.log('keyup');
  176. break;
  177. }
  178. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement