Bot Script

MineMoore

  1. // ==UserScript==
  2. // @name Bot Script
  3. // @namespace a
  4. // @version 1.1
  5. // @description MineMoore
  6. // @match *.dual-agar.me/*
  7. // @match *.flaresserver.tk/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.1.1/jquery.min.js
  9. // @require https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.5/socket.io.min.js
  10. // @grant none
  11. // @run-at document-start
  12. // ==/UserScript==
  13.  
  14. $(document).ready(function () {
  15. window.__WebSocket = window.WebSocket;
  16. window.fakeWebSocket = function(){return {readyState: 0}};
  17. window._WebSocket = window.WebSocket = function(ip){return new window.fakeWebSocket(ip);};
  18. window.__botclonsData = {};
  19. window.__botclonsData.mx = 0;
  20. window.__botclonsData.my = 0;
  21. window.__botclonsData.ml = 0;
  22. window.__botclonsData.ma = 0;
  23. window.__botclonsData.mb = 0;
  24. window.__botclonsData.wa = false;
  25. window.__botclonsData.sa = false;
  26. window.__botclonsData.w = null;
  27. window.__botclonsData.s = null;
  28. window.__botclonsData.aX = -1;
  29. window.__botclonsData.aY = -1;
  30. window.__botclonsData.p = 0;
  31. window.__botclonsData.q=false;
  32. window.__botclonsData.socketaddr = null;
  33. window.addEventListener("load",function(){
  34. // код инжектинга
  35. if(!window.OldSocket)
  36. OldSocket = window.__WebSocket;
  37. window._WebSocket = window.WebSocket = window.fakeWebSocket = function(ip){
  38. var ws = new OldSocket(ip);
  39. ws.binaryType="arraybuffer";
  40. var fakeWS = {};
  41. for(var i in ws)
  42. fakeWS[i] = ws[i];
  43. fakeWS.send = function(){
  44. //console.log("перехватили передачу! " + arguments[0]);
  45. var msg = new DataView(arguments[0]);
  46. if((msg.byteLength>0)&&(msg.getUint8(0)!=16)){
  47. var f="";
  48.  
  49. for(var i=0;i<msg.byteLength;i++){
  50. var a=msg.getUint8(i);
  51. f=f+a+" ";
  52. }
  53. console.log(f);
  54. }else{
  55. window.__botclonsData.mx = msg.getInt16(1, true);
  56. window.__botclonsData.my = msg.getInt16(3, true);
  57. window.__botclonsData.ml = msg.byteLength;
  58. }
  59. if(msg.byteLength==21){ // Most clones
  60. if(msg.getInt8(0, true) == 16){
  61. window.__botclonsData.mx = msg.getFloat64(1, true);
  62. window.__botclonsData.my = msg.getFloat64(9, true);
  63. window.__botclonsData.ml = msg.byteLength;
  64. }
  65. } else {
  66. if(msg.byteLength==13){ // Agar.re, agarioforums.io, alis.io
  67. if(msg.getUint8(0, true) == 16){
  68. window.__botclonsData.mx = msg.getInt32(1, true);
  69. window.__botclonsData.my = msg.getInt32(5, true);
  70. window.__botclonsData.ml = msg.byteLength;
  71. }else{
  72. if(msg.byteLength>4){ // gota.io
  73. if(msg.getUint8(0, true) == 16){
  74. window.__botclonsData.mx = msg.getInt16(1, true);
  75. window.__botclonsData.my = msg.getInt16(3, true);
  76. window.__botclonsData.ml = msg.byteLength;
  77. }
  78. }
  79. }
  80. }
  81. }
  82. return ws.send.apply(ws, arguments);
  83. };
  84. ws.onmessage = function(){
  85. //console.log("перехватили прием! " + arguments[0].data);
  86. var msg = new DataView(arguments[0].data);
  87. if(msg.byteLength>16){ // Most clones
  88. if(msg.getUint8(0, true) == 64){
  89. window.__botclonsData.ma = msg.getFloat64(1, true);
  90. window.__botclonsData.mb = msg.getFloat64(9, true);
  91. }
  92. }
  93. fakeWS.onmessage && fakeWS.onmessage.apply(ws, arguments);
  94. };
  95. ws.onopen = function(){
  96. window.__botclonsData.socketaddr = ws.url;
  97. //console.log("перехватили подключение!");
  98. fakeWS.readyState = 1;
  99. fakeWS.onopen.apply(ws, arguments);
  100. };
  101. ws.onclose = function(){
  102. fakeWS.onclose.apply(ws, arguments);
  103. };
  104. return fakeWS;
  105. }
  106. if(location.origin=="http://cellcraft.io")connect("");
  107. })
  108. var real_minx = -7071;
  109. var real_miny = -7071;
  110. var real_maxx = 7071;
  111. var real_maxy = 7071;
  112. var lastsent = {
  113. minx: 0,
  114. miny: 0,
  115. maxx: 0,
  116. maxy: 0
  117. };
  118.  
  119. function valcompare(Y, Z) {
  120. return 0.01 > Y - Z && -0.01 < Y - Z
  121. }
  122. var socket = io.connect('ws://127.0.0.1:8081');
  123. var canMove = true;
  124. var movetoMouse = true;
  125. var moveEvent = new Array(2);
  126. var canvas = document.getElementById("canvas");
  127. last_transmited_game_server = null;
  128. socket.on('force-login', function(data) {
  129. socket.emit("login", {
  130. "uuid": client_uuid,
  131. "type": "client"
  132. });
  133. transmit_game_server()
  134. });
  135. $( "#canvas" ).after( "<div style='z-index: 10000000; border-radius: 4px;position: fixed; top: 300px; left: 10px; text-align: center; width: 200px; background-color: #000; opacity: 0.9; padding: 7px;'> <div style='border-radius: 25px; text-indent:0; border:3px solid #fff; display:inline-block; color:#000; font-family:arial; font-size:15px; font-weight:bold; font-style:normal; height:30px; -webkit-box-shadow: 0px 0px 52px -6px rgba(46,204,113,1); -moz-box-shadow: 0px 0px 52px -6px rgba(46,204,113,1); box-shadow: 0px 0px 52px -6px rgb(202, 202, 202); line-height:1.5em; text-decoration:none; text-align:center; width: 190px; color: #fff;'> B O T S </div><br><br> <a style='color: #fff; font-family: arial;'>Bots: </a><a style='color: #fff; font-family: arial;' id='minionCount'>0</a><br> <a style='color: #fff; font-family: arial;'>X/Y: </a><a style='color: #fff; font-family: arial;'id='gh45nmvsy'>0,0</a><br><br><a style='color: #fff; font-family: arial;'>E - Split Bots</a><br><a style='color: #fff; font-family: arial;'>R - Bots Feed </a> </div>" );
  136. socket.on('spawn-count', function(data) {
  137. console.log(data);
  138. document.getElementById('minionCount').innerHTML = data
  139. });
  140. var client_uuid = localStorage.getItem('client_uuid');
  141. if (client_uuid == null) {
  142. console.log("generating a uuid for this user");
  143. client_uuid = ""; var ranStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  144. for (var ii = 0; ii < 15; ii++) client_uuid += ranStr.charAt(Math.floor(Math.random() * ranStr.length));
  145. localStorage.setItem('client_uuid', client_uuid)
  146. }
  147. socket.emit("login", client_uuid);
  148. $("#instructions").replaceWith('<br><div class="input-group"><span class="input-group-addon" id="basic-addon1">UUID</span><input type="text" value="' + client_uuid + '" readonly class="form-control"</div>');
  149.  
  150. function isMe(cell) {
  151. for (var i = 0; i < window.agar.myCells.length; i++) {
  152. if (window.agar.myCells[i] == cell.id) {
  153. return true
  154. }
  155. }
  156. return false
  157. }
  158.  
  159. function getCell() {
  160. var me = [];
  161. for (var key in window.agar.allCells) {
  162. var cell = window.agar.allCells[key];
  163. if (isMe(cell)) {
  164. me.push(cell)
  165. }
  166. }
  167. return me[0]
  168. }
  169. var skin_var = 0;
  170.  
  171. function emitPosition() {
  172. console.log(client_uuid);
  173. document.getElementById('gh45nmvsy').innerHTML=(~~(window.__botclonsData.mx-window.__botclonsData.ma))+","+(~~(window.__botclonsData.my-window.__botclonsData.mb));
  174. socket.emit("pos", {
  175. "x": window.__botclonsData.mx-window.__botclonsData.ma,
  176. "y": window.__botclonsData.my-window.__botclonsData.mb,
  177. "l": window.__botclonsData.ml,
  178. "p": window.__botclonsData.p,
  179. "c": window.__botclonsData.q
  180. })
  181. }
  182.  
  183. function toggleMovement() {
  184. canMove = !canMove;
  185. switch (canMove) {
  186. case true:
  187. canvas.onmousemove = moveEvent[0];
  188. moveEvent[0] = null;
  189. canvas.onmousedown = moveEvent[1];
  190. moveEvent[1] = null;
  191. break;
  192. case false:
  193. canvas.onmousemove({
  194. clientX: innerWidth / 2,
  195. clientY: innerHeight / 2
  196. });
  197. moveEvent[0] = canvas.onmousemove;
  198. canvas.onmousemove = null;
  199. moveEvent[1] = canvas.onmousedown;
  200. canvas.onmousedown = null;
  201. break
  202. }
  203. }
  204. interval_id = setInterval(function() {
  205. emitPosition()
  206. }, 100);
  207. interval_id2 = setInterval(function() {
  208. transmit_game_server_if_changed()
  209. }, 5000);
  210. document.addEventListener('keydown', function(e) {
  211. var key = e.keyCode || e.which;
  212. switch (key) {
  213. case 16:
  214. if(!window.__botclonsData.sa){
  215. window.__botclonsData.sa=true;
  216. window.__botclonsData.s = setInterval(function() {
  217. $("body").trigger($.Event("keydown", { keyCode: 32}));
  218. $("body").trigger($.Event("keyup", { keyCode: 32}));
  219. }, 10);
  220. }
  221. break;
  222. case 87:
  223. if(!window.__botclonsData.wa){
  224. window.__botclonsData.wa=true;
  225. window.__botclonsData.w = setInterval(function() {
  226. $("body").trigger($.Event("keydown", { keyCode: 87}));
  227. $("body").trigger($.Event("keyup", { keyCode: 87}));
  228. }, 10);
  229. }
  230. break;
  231. case 65:
  232. window.__botclonsData.p--;
  233. document.getElementById('ismoveToMouse').innerHTML = window.__botclonsData.p;
  234. break;
  235. case 45:
  236. window.__botclonsData.q=!window.__botclonsData.q;
  237. if(window.__botclonsData.q) { document.getElementById('dfdghehfj').innerHTML = "On"; } else { document.getElementById('dfdghehfj').innerHTML = "Off"; }
  238. break;
  239. case 69:
  240. socket.emit("cmd", {
  241. "name": "split"
  242. })
  243. break;
  244. case 82:
  245. socket.emit("cmd", {
  246. "name": "eject"
  247. })
  248. break;
  249. case 80:
  250. window.__botclonsData.p++;
  251. document.getElementById('ismoveToMouse').innerHTML = window.__botclonsData.p;
  252. break
  253. }
  254. });
  255. document.addEventListener('keyup', function(e) {
  256. var key = e.keyCode || e.which;
  257. console.log(key);
  258. switch (key) {
  259. case 87:
  260. clearInterval(window.__botclonsData.w);
  261. window.__botclonsData.wa=false;
  262. break;
  263. case 16:
  264. clearInterval(window.__botclonsData.s);
  265. window.__botclonsData.sa=false;
  266. break;
  267. }
  268. });
  269.  
  270. function transmit_game_server_if_changed() {
  271. if (last_transmited_game_server != window.__botclonsData.socketaddr) {
  272. transmit_game_server()
  273. }
  274. }
  275.  
  276. function transmit_game_server() {
  277. last_transmited_game_server = window.__botclonsData.socketaddr;
  278. socket.emit("cmd", {
  279. "name": "connect_server",
  280. "ip": window.__botclonsData.socketaddr,
  281. "origin": location.origin
  282. })
  283. }
  284. var mouseX = 0;
  285. var mouseY = 0;
  286. $("body").mousemove(function(event) {
  287. mouseX = event.clientX;
  288. mouseY = event.clientY
  289. });
  290. setInterval (function() {
  291. $(".header").replaceWith("<div class='header' id='lb_caption' style='color: rgb(8, 73, 212);'>MineMoore</div>"); },100);
  292. client_uuid = "aaa";
  293. setTimeout (function() {
  294. function addGlobalStyle(css) {
  295. var head, style;
  296. head = document.getElementsByTagName('head')[0];
  297. if (!head) { return; }
  298. style = document.createElement('style');
  299. style.type = 'text/css';
  300. style.innerHTML = css;
  301. head.appendChild(style);
  302. }
  303. addGlobalStyle(" .btn { box-shadow: 0 3px 6px rgba(255, 255, 255, 0.16), 0 3px 6px rgba(255, 255, 255, 0.23) !important;}.btn-spectate { box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); width: 100%; border: 1px solid white !important; background-color: transparent !important; transition: all 0.5s;} .btn-play-guest {width: 100% !important; border: 1px solid white !important; background-color: transparent !important; transition: all 0.5s;} .adbox300{display: none !important;} .right_side_panel {width: 241px !important;padding: 6px;} #mainPanel { width: 354px !important; } .nav > li > a {color: #fff !important; transition: all 0.2s;} .nav > li > a:hover {border-bottom: 2px solid blue; color: #fff !important; transform: scale(1.15);} hr {display: none !important;} .base::-webkit-scrollbar-track { background-color: transparent; }.base::-webkit-scrollbar { width: 10px; background-color: #F5F5F5; }.base::-webkit-scrollbar-thumb { background-color: #0ae; background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent)); } .agario-side-panel{ margin-bottom: 0px; } #server_instruction_text {display: none !Important;} #server_debug_status_texts_box {display: none !important;}"); },100);
  304. });