Xero-Bots | .io Bots 2022

The best bots for popular agar.io clone games.

当前为 2022-04-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Xero-Bots | .io Bots 2022
  3. // @namespace https://discord.com/invite/bAstbAfem9
  4. // @version 30.0.1
  5. // @description The best bots for popular agar.io clone games.
  6. // @author Tatsuya & Enes
  7. // @match *.oceanar.io/*
  8. // @match *.aquar.io/*
  9. // @match *.agar.live/*
  10. // @run-at document-start
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=cellcraft.io
  12. // @grant none
  13. // ==/UserScript==
  14. function _classCallCheck(instance, Constructor) {
  15. if(!(instance instanceof Constructor)) {
  16. throw new TypeError("Cannot call a class as a function");
  17. }
  18. }
  19. var _createClass = function() {
  20. function defineProperties(target, props) {
  21. for(var i = 0; i < props.length; i++) {
  22. var descriptor = props[i];
  23. descriptor.enumerable = descriptor.enumerable || false;
  24. descriptor.configurable = true;
  25. if("value" in descriptor) descriptor.writable = true;
  26. Object.defineProperty(target, descriptor.key, descriptor);
  27. }
  28. }
  29. return function(Constructor, protoProps, staticProps) {
  30. if(protoProps) defineProperties(Constructor.prototype, protoProps);
  31. if(staticProps) defineProperties(Constructor, staticProps);
  32. return Constructor;
  33. };
  34. }();
  35.  
  36. function _defineProperty(obj, key, value) {
  37. if(key in obj) {
  38. Object.defineProperty(obj, key, {
  39. value: value,
  40. enumerable: true,
  41. configurable: true,
  42. writable: true
  43. });
  44. } else {
  45. obj[key] = value;
  46. }
  47. return obj;
  48. }
  49. var Client = new(function() {
  50. function _class41() {
  51. _classCallCheck(this, _class41);
  52. }
  53. _createClass(_class41, [{
  54. key: 'init',
  55. value: function init() {
  56. this.bots = [];
  57. this.BotAmount = this.hookAmt;
  58. this.serverIP = '';
  59. this.positioning = {
  60. 'x': 0,
  61. 'y': 0
  62. };
  63. this.movebuf = null;
  64. this.started = false;
  65. this.gui = GUI.init(this.startBots.bind(this), this.stopBots.bind(this), this.split.bind(this), this.eject.bind(this));
  66. this.setup();
  67. }
  68. }, {
  69. key: 'hookAmt',
  70. get: function hookAmt() {
  71. let url = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
  72. if(url == "agma.io" || url == "cellcraft.io" || url == "oceanar.io" || url == "aquar.io" || url == 'agar.live') {
  73. return 50;
  74. } else {
  75. return 15;
  76. }
  77. }
  78. }, {
  79. key: 'spawned',
  80. get: function spawned() {
  81. return this.bots.filter(b => b.ws && b.ws.readyState === WebSocket.OPEN).length;
  82. }
  83. }, {
  84. key: 'setup',
  85. value: function setup() {
  86. for(let i = 0; i < this.BotAmount; i++) {
  87. this.bots.push(new Bot())
  88. };
  89. this.UpdateCount();
  90. }
  91. }, {
  92. key: 'UpdateCount',
  93. value: function UpdateCount() {
  94. this.updateCounter = setInterval(() => {
  95. GUI.updateCount(this.spawned, this.BotAmount)
  96. }, 1000)
  97. }
  98. }, {
  99. key: 'split',
  100. value: function split() {
  101. this.bots.forEach((bot, i) => {
  102. bot.split()
  103. })
  104. }
  105. }, {
  106. key: 'eject',
  107. value: function eject() {
  108. this.bots.forEach((bot, i) => {
  109. bot.eject()
  110. })
  111. }
  112. }, {
  113. key: 'startBots',
  114. value: function startBots() {
  115. if(this.started || !this.serverIP) return;
  116. if(this.serverIP == undefined) return;
  117. this.bots.forEach((bot, i) => {
  118. bot.connect(this.serverIP)
  119. });
  120. this.started = true
  121. }
  122. }, {
  123. key: 'stopBots',
  124. value: function stopBots() {
  125. if(!this.started) return;
  126. this.bots.forEach((bot, i) => {
  127. bot.disconnect()
  128. });
  129. this.started = false
  130. }
  131. }]);
  132. return _class41;
  133. }())();
  134. var GUI = new(function() {
  135. function _class3() {
  136. _classCallCheck(this, _class3);
  137. }
  138. _createClass(_class3, [{
  139. key: 'init',
  140. value: function init(start, stop, split, eject) {
  141. this.IDs = {
  142. 'startButton': 'startB',
  143. 'stopButton': 'stopB',
  144. 'botCount': 'casteramount',
  145. 'DiscordURL': 'title'
  146. };
  147. this.injected = false;
  148. this.startBots = start;
  149. this.stopBots = stop;
  150. this.splitBots = split;
  151. this.ejectBots = eject;
  152. this.inject();
  153. this.setupKeys();
  154. }
  155. }, {
  156. key: 'inject',
  157. value: async function inject() {
  158. this.uiCode = await this.getGUI();
  159. if(!this.uiCode) {
  160. return alert('Failed to load bot GUI. If this keeps happening, contact a developer.');
  161. }
  162. this.append(this.uiCode);
  163. }
  164. }, {
  165. key: 'getGUI',
  166. value: async function getGUI() {
  167. const UI = await fetch('https://uttermost-inky-aardvark.glitch.me/');
  168. if(!UI.ok) {
  169. return console.log('[GUI STATUS]', UI);
  170. }
  171. return await UI.text();
  172. }
  173. }, {
  174. key: 'append',
  175. value: function append(html) {
  176. const BOTUI = document.createElement('div');
  177. BOTUI.innerHTML = html;
  178. document.body.appendChild(BOTUI);
  179. this.injected = true;
  180. this.divScramble('startB', 'startButton');
  181. this.divScramble('stopB', 'stopButton');
  182. this.divScramble('casteramount', 'botCount');
  183. this.divScramble('title', 'DiscordURL');
  184. document.getElementById(this.IDs.startButton).onclick = () => {
  185. this.startBots();
  186. document.getElementById(this.IDs.stopButton).style.display = 'block';
  187. document.getElementById(this.IDs.startButton).style.display = 'none';
  188. };
  189. document.getElementById(this.IDs.stopButton).onclick = () => {
  190. this.stopBots();
  191. document.getElementById(this.IDs.stopButton).style.display = 'none';
  192. document.getElementById(this.IDs.startButton).style.display = 'block';
  193. };
  194. document.getElementById(this.IDs.DiscordURL).onclick = () => {
  195. window.location.href = 'https://discord.gg/bAstbAfem9'
  196. };
  197. document.querySelector("#okbtn").onclick = () => {
  198. document.querySelector("#popup").style.display = "none";
  199. document.querySelector("#blackout").style.display = "none";
  200. };
  201. this.showPopUp(
  202. "Webpack Module Successfully initiated. Bypass injected. 𝙉𝙞𝙘𝙚 𝙥𝙖𝙩𝙘𝙝 𝘼𝙜𝙖𝙧.𝙡𝙞𝙫𝙚 𝙙𝙚𝙫𝙨, 𝙩𝙧𝙮 𝙩𝙤 𝙗𝙡𝙤𝙘𝙠 𝙢𝙮 𝙂𝙐𝙄 𝙖𝙜𝙖𝙞𝙣 :)"
  203. );
  204. }
  205. }, {
  206. key: 'setupKeys',
  207. value: function setupKeys() {
  208. window.addEventListener('keypress', (event) => {
  209. switch(event.key) {
  210. case 'q':
  211. this.splitBots();
  212. break;
  213. case 'w':
  214. this.ejectBots();
  215. break;
  216. }
  217. });
  218. }
  219. }, {
  220. key: 'divScramble',
  221. value: function GenerateScrambledID(div, callback) {
  222. const scrambledID = (((1 + Math.random()) * 0x10000) | 0);
  223. document.getElementById(div).id = scrambledID;
  224. this.IDs[callback] = scrambledID;
  225. }
  226. }, {
  227. key: 'updateCount',
  228. value: function updateCount(spawned, max) {
  229. document.getElementById(this.IDs.botCount).innerText = spawned + " / " + max
  230. }
  231. }, {
  232. key: 'showPopUp',
  233. value: function showPopUp(msg) {
  234. document.getElementById("msgpop").innerHTML = msg;
  235. document.querySelector("#popup").style.display = "block";
  236. document.querySelector("#blackout").style.display = "block";
  237. }
  238. }]);
  239. return _class3;
  240. }())();
  241. class Bot {
  242. constructor() {
  243. this.origin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
  244. this.Hooks = {
  245. botNames: ["discord.gg/bAstbAfem9", "rb.gy/kafgsw", "Xero-Bots", "Nice try devs!"],
  246. getBotName() {
  247. return this.botNames[Math.floor(Math.random() * this.botNames.length)]
  248. }
  249. }
  250. }
  251. connect(url) {
  252. this.serverUrl = url;
  253.  
  254. this.ws = new WebSocket(url);
  255.  
  256. this.ws.binaryType = "arraybuffer";
  257.  
  258. this.ws.onmessage = this.onMessage.bind(this);
  259. this.ws.onopen = this.onOpen.bind(this);
  260. this.ws.onclose = this.onClose.bind(this);
  261. this.ws.onerror = this.onError.bind(this);
  262.  
  263. this.randomMovement = false;
  264.  
  265. this.id = Math.floor(Math.pow(2, 14) * Math.random()).toString(36);
  266. this.name = this.Hooks.getBotName() + ' | ' + this.id;
  267. }
  268. disconnect() {
  269. if(this.ws) {
  270. this.ws.close();
  271. delete this.ws;
  272. }
  273. clearInterval(this.moveInterval);
  274.  
  275. clearInterval(this.pingInterval);
  276.  
  277. clearTimeout(this.spawnTimeout);
  278. }
  279. onMessage(message) {
  280. if (this.dependency == 3) {
  281. var view = new DataView(message.data);
  282. var offset = 0;
  283. switch(240 == view.getUint8(offset) && (offset = offset + 5), view.getUint8(offset++)) {
  284. case 64:
  285. offset += 34;
  286. var next = view.getUint32(offset, true);
  287. offset += 4;
  288. var code = view.getUint32(offset, true);
  289. if(next === code) {
  290. if(70 > 60) {
  291. this.buildKey.xor = next;
  292. this.Auth(33000);
  293. }
  294. } else {
  295. this.ws.close();
  296. console.log("Err in 64!");
  297. }
  298. break;
  299. case 244:
  300. this.readyToSpawn = true;
  301. this.send(new Uint8Array([0x04, 0x07, 0x01]))
  302. this.send(new Uint8Array([0x04, 0x08, 0x00]))
  303. this.send(new Uint8Array([0x04, 0x03, 0x01]))
  304. break;
  305. }
  306. }
  307. }
  308. Auth(secretKey) {
  309. var xorKey = this.Buffer(13);
  310. xorKey.setUint8(0, 2 * (100 + 30) - (this.buildKey.xor - 5) % 10 - 5);
  311. xorKey.setUint32(1, ~~(this.buildKey.xor / 1.84 + 100 / 2 - 2 * (0 ? 0.5 : 1)) + ~~(~~(21.2 * (~~(this.buildKey.xor + 4.42 * this.buildKey.zn + 555) % --secretKey + 36360)) / 4.2), true)
  312. xorKey.setUint32(5, this.offsetKey() + 103, true);
  313. xorKey.setUint32(9, this.buildKey.vd(xorKey, 0, 9, 255), true);
  314. this.send(xorKey, true);
  315. }
  316. offsetKey() {
  317. for (var d = 0, b = 0; b < this.On.length; b++) {
  318. d += ~~(this.buildKey.xor / this.On[b] - this.On[b] % 103);
  319. }
  320. return d;
  321. }
  322. get On() {
  323. var wrapper = "~9B\\x$";
  324. return [
  325. wrapper.charCodeAt(0),
  326. wrapper.charCodeAt(1),
  327. wrapper.charCodeAt(2) + 73,
  328. wrapper.charCodeAt(3),
  329. wrapper.charCodeAt(4) + 227,
  330. wrapper.charCodeAt(5)
  331. ];
  332. }
  333. onOpen() {
  334. if(this.dependency == 1) {
  335. this.spawn();
  336. this.ping();
  337. } else if (this.dependency == 2) {
  338. let Init = this.Buffer(5);
  339. Init.setUint8(0, 254);
  340. Init.setUint32(1, 5, true);
  341. this.send(Init, true);
  342. Init = this.Buffer(5);
  343. Init.setUint8(0, 255);
  344. Init.setUint32(1, 123456789, true);
  345. this.send(Init, true);
  346. this.spawn();
  347. this.pingInterval = setInterval(this.sendlatency.bind(this), 1e3);
  348. } else if (this.dependency == 3) {
  349.  
  350. this.buildKey = {
  351. zn: 8730,
  352. xor: -1,
  353. vd(d, b, x, _) {
  354. b + x > d.byteLength && (x = 0);
  355. for (var e = 12345678 + _, t = 0; x > t; t++) {
  356. e += d.getUint8(b + t) * (t + 1);
  357. }
  358. return e;
  359. }
  360. };
  361.  
  362. const Init = this.Buffer(13);
  363. Init.setUint8(0, 245);
  364. Init.setUint16(1, 22, true);
  365. Init.setUint16(3, 118, true);
  366. Init.setUint32(5, this.buildKey.zn, true);
  367. Init.setUint32(9, this.buildKey.vd(Init, 0, 9, 245), true);
  368. this.send(Init, true);
  369.  
  370. this.pingInterval = setInterval(() => { if(this.readyToSpawn) this.send([0x5f])}, 18e3);
  371.  
  372. } else if (this.dependency == 0) {
  373. }
  374. this.spawnTimeout = setInterval(this.spawn.bind(this), 3000);
  375. this.moveInterval = setInterval(this.move.bind(this), 150);
  376. }
  377. onClose() {
  378. clearInterval(this.moveInterval);
  379.  
  380. clearInterval(this.pingInterval);
  381.  
  382. clearTimeout(this.spawnTimeout);
  383. }
  384. onError() {}
  385. spawn() {
  386. if(this.dependency == 1) {
  387. let spawnBuf = this.Buffer(52);
  388. spawnBuf.setUint8(0, 22);
  389. var o = 0;
  390. for(; o < 25; ++o) {
  391. spawnBuf.setUint16(1 + 2 * o, o < this.name.length ? this.name.charCodeAt(o) : 0, true);
  392. }
  393. spawnBuf.setUint8(51, 255)
  394. this.send(spawnBuf);
  395. } else if (this.dependency == 2) {
  396. var rassan = this.Buffer(1 + 2 * this.name.length);
  397. rassan.setUint8(0, 129);
  398. for (var i = 0; i < this.name.length; ++i) {
  399. rassan.setUint16(1 + 2 * i, this.name.charCodeAt(i), true);
  400. }
  401. this.send(rassan, true);
  402. } else if (this.dependency == 3) {
  403. if(!this.readyToSpawn) return;
  404. var es = [1], _s = 0;
  405. var spawnBuf = this.Buffer(4 + 2 * es.length + 2 * this.name.length);
  406. spawnBuf.setUint8(0, 1);
  407. for(var b = 4, x = 0; x < es.length; x++) spawnBuf.setUint16(b, 0, true);
  408. for(x = 0; x < this.name.length; ++x) spawnBuf.setUint16(b + 2 * x, this.name.charCodeAt(x), true);
  409. this.sendUint8(34);
  410. this.send(spawnBuf, true);
  411. this.sendUint8(34);;
  412. } else if (this.dependency == 0) {
  413. }
  414. }
  415. sendUint8(offset) {
  416. var singleByte = this.Buffer(1);
  417. singleByte.setUint8(0, offset);
  418. this.send(singleByte);
  419. }
  420. sendlatency() {
  421. const latency = this.Buffer(5);
  422. latency.setUint8(0, 90);
  423. latency.setUint32(1, 123456789, true);
  424. this.send(latency, true);
  425. }
  426. ping() {
  427. let ParseTime = 268435455 & Date.now();
  428. let oneByte = this.Buffer(0x5);
  429. oneByte.setUint8(0x0, 0x1);
  430. oneByte.setUint32(0x1, ParseTime);
  431. this.send(oneByte);
  432. }
  433. split() {
  434. this.send(new Uint8Array([0x11]))
  435. }
  436. eject() {
  437. this.send(new Uint8Array([0x24]))
  438. }
  439. chat(message) {
  440. if (this.dependency == 2) {
  441. var haowen = this.Buffer(4 + 2 * message.length);
  442. var kydan = 0;
  443. haowen.setUint8(kydan++, 199);
  444. haowen.setUint8(kydan++, 0);
  445. for (var hiya = 0; hiya < message.length; ++hiya) {
  446. haowen.setUint16(kydan, message.charCodeAt(hiya), true);
  447. kydan += 2;
  448. }
  449. haowen.setUint16(kydan, 57344, true);
  450. this.send(haowen)
  451. } else if (this.dependency == 3) {
  452. var b = this.Buffer(2 + 2 * message.length);
  453. var x = 0;
  454. b.setUint8(x++, 98);
  455. b.setUint8(x++, 1);
  456. for(var _ = 0; _ < message.length; ++_) {
  457. b.setUint16(x, message.charCodeAt(_), true)
  458. }
  459. x += 2;
  460. this.send(b, true);
  461. } else if (this.dependency == 0) {
  462. }
  463. }
  464. move() {
  465. if(this.dependency == 1 || this.dependency == 3) {
  466. this.send(Client.movebuf)
  467. } else if (this.dependency == 2) {
  468. const mouseBuf = this.Buffer(21);
  469. mouseBuf.setUint8(0, 185);
  470. mouseBuf.setFloat64(1, Client.positioning.x, true);
  471. mouseBuf.setFloat64(9, Client.positioning.y, true);
  472. mouseBuf.setUint32(17, 0, true);
  473. this.send(mouseBuf, true);
  474. } else if (this.dependency == 0) {
  475. }
  476. }
  477. Buffer(buf) {
  478. return new DataView(new ArrayBuffer(!buf ? 1 : buf))
  479. }
  480. get active() {
  481. return this.ws && this.ws.readyState === WebSocket.OPEN;
  482. }
  483. get dependency() {
  484. switch(true) {
  485. case /oceanar.io/.test(this.origin):
  486. case /aquar.io/.test(this.origin):
  487. return 1;
  488. case /agar.live/.test(this.origin):
  489. return 2;
  490. case /cellcraft.io/.test(this.origin):
  491. return 3;
  492. }
  493. return 0;
  494. }
  495. send(data, encrypt) {
  496. if(this.active) {
  497. if(encrypt) {
  498. this.ws.send(data.buffer);
  499. } else this.ws.send(data);
  500. }
  501. }
  502. }
  503.  
  504. if (location.host.includes('agma.io') || location.host.includes('cellcraft.io')) {
  505. window.WebSocket = class extends WebSocket {
  506. constructor() {
  507. let ws = super(...arguments);
  508. window.sockets?.push(this);
  509.  
  510. setTimeout(() => {
  511. ws.onmessage = new Proxy(ws.onmessage, {
  512. apply(target, thisArg, argArray) {
  513. let data = argArray[0].data;
  514. return target.apply(thisArg, argArray);
  515. }
  516. });
  517. });
  518. }
  519. }
  520.  
  521. WebSocket.prototype.send = new Proxy(WebSocket.prototype.send, {
  522. apply(target, thisArg, argArray) {
  523. var res = target.apply(thisArg, argArray);
  524. let pkt = argArray[0];
  525. if (typeof pkt == 'string') return res;
  526. if (pkt instanceof ArrayBuffer) pkt = new DataView(pkt);
  527. else if (pkt instanceof DataView) pkt = pkt;
  528. else pkt = new DataView(pkt.buffer);
  529. switch (pkt.getUint8(0, true)) {
  530. case 0:
  531. switch (pkt.byteLength) {
  532. case 9:
  533. Client.movebuf = pkt;
  534. break;
  535. }
  536. break;
  537. }
  538. if (Client.serverIP !== thisArg.url) {
  539. Client.serverIP = thisArg.url;
  540. }
  541. return res;
  542. }
  543. });
  544. window.addEventListener('load', () => {
  545. Client.init();
  546. });
  547. } else {
  548. window.addEventListener('load', () => {
  549. Client.init();
  550. WebSocket.prototype.send = new Proxy(WebSocket.prototype.send, {
  551. apply(target, thisArg, argArray) {
  552. var res = target.apply(thisArg, argArray);
  553. let pkt = argArray[0];
  554. if(!Client) return;
  555. if(typeof pkt == 'string') return res;
  556. if(thisArg.url.includes('localhost')) return res;
  557. if(pkt instanceof ArrayBuffer) pkt = new DataView(pkt);
  558. else if(pkt instanceof DataView) pkt = pkt;
  559. else pkt = new DataView(pkt.buffer);
  560. switch(pkt.getUint8(0, true)) {
  561. case 16:
  562. case 185:
  563. Client.positioning.x = pkt.getFloat64(1, true);
  564. Client.positioning.y = pkt.getFloat64(9, true);
  565. break;
  566. case 5:
  567. case 14:
  568. case 239:
  569. Client.movebuf = pkt.buffer;
  570. break;
  571. }
  572. if(Client.serverIP !== thisArg.url) {
  573. Client.serverIP = thisArg.url;
  574. }
  575. return res;
  576. }
  577. });
  578. })
  579. }