.io & Agar.io Clone Bots - 2022!

The best open sourced & proxyless bots for .io & agar.io clone games.

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

  1. // ==UserScript==
  2. // @name .io & Agar.io Clone Bots - 2022!
  3. // @namespace https://greasyfork.org/en/scripts/433283-agar-io-clone-bots-and-io-bots-2021
  4. // @version 22
  5. // @description The best open sourced & proxyless bots for .io & agar.io clone games.
  6. // @author Tatsuya
  7. // @match *.cubedot.kr/*
  8. // @match *.agar.cc/*
  9. // @match *.aquar.io/*
  10. // @match *.oceanar.io/*
  11. // @match *.agar.rip/*
  12. // @match *.agario.network/*
  13. // @match *.agario.work/*
  14. // @match *.agario.zafer2.com/*
  15. // @match *.agarabi.net/*
  16. // @match *.agario.boston/*
  17. // @match *.agar.chat/*
  18. // @match *.agario.nl/*
  19. // @match *.agariomoddedserver.com/*
  20. // @match *.agario.in/*
  21. // @match *.agario.id/*
  22. // @match *.agariomodded.com/*
  23. // @match *.bestagario.org/*
  24. // @match *.agariohub.cc/*
  25. // @match *.agar.team/*
  26. // @match *.agarprivateservers.org/*
  27. // @match *.agarprivateservers.net/*
  28. // @match *.agarprivateserver.com/*
  29. // @match *.agario.cc/*
  30. // @match *.easyagario.icu/*
  31. // @run-at document-start
  32. // @icon https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTJNVczs2oU6qdgJBw2ZSSe4ibVAGjaZMgWosjYzjXZU1B6Lp9MHoQ27ARzAtofWYHxz3U&usqp=CAU
  33. // @grant none
  34. // ==/UserScript==
  35.  
  36. class Client {
  37. constructor() {
  38. this.serverIP = '';
  39. this.spawned = 0;
  40. this.BotAmount = 60;
  41. this.positioning = {
  42. 'x': 0,
  43. 'y': 0
  44. };
  45. this.movebuf = null;
  46. this.countInt = null;
  47. this.started = false;
  48. this.bots = [];
  49. this.gui = new GUI(this.startBots.bind(this), this.stopBots.bind(this), this.split.bind(this), this.eject.bind(this));
  50. this.setup();
  51. }
  52.  
  53. setup() {
  54. alert("Thanks for using the bots. Make sure to join my discord for any updates. These bots are up to date as of Jan 1, 2022. More games coming soon, make sure to check the greasyfork page for more updates. Chatspam will be fixed and added back soon.")
  55. for(let i = 0; i < this.BotAmount; i++) {this.bots.push(new Bot())}
  56. this.UpdateCount();
  57. this.HookMouse();
  58. }
  59.  
  60. HookMouse() {
  61. this.countInt = setInterval(() => {this.bots.forEach(bot => {bot.sendmouse(this.movebuf)})}, 50);
  62. }
  63.  
  64. UpdateCount() {
  65. this.countInt = setInterval(() => {this.gui.updateCount(this.spawned, this.BotAmount)}, 1000);
  66. }
  67.  
  68. split() {this.bots.forEach((bot, i) => {bot.split()})}
  69.  
  70. eject() {this.bots.forEach((bot, i) => {bot.eject()})}
  71.  
  72. startBots() {
  73. if (this.started || !this.serverIP) return;
  74. this.bots.forEach((bot, i) => {
  75. bot.connect(this.serverIP);
  76. });
  77. this.started = true;
  78. }
  79.  
  80. stopBots() {
  81. if(!this.started) return;
  82. this.bots.forEach((bot, i) => {
  83. bot.close();
  84. });
  85. this.started = false;
  86. }
  87. }
  88.  
  89. class GUI {
  90. constructor(start, stop, split, eject) {
  91. this.IDs = {
  92. 'startButton': 'startbtn',
  93. 'stopButton': 'stopbtn',
  94. 'botCount': 'botAmount',
  95. 'DiscordURL': 'discord'
  96. };
  97. this.injected = false;
  98. this.startBots = start;
  99. this.stopBots = stop;
  100. this.splitBots = split;
  101. this.ejectBots = eject;
  102. this.inject();
  103. this.setupKeys();
  104. }
  105. inject() {
  106. this.uiCode =
  107. `
  108. <div div="" id="mainUI" style='margin-left: 10px; top: 50%; transform: translateY(-50%); position: absolute; border: 2px solid rgb(255, 255, 255); border-radius: 2px;
  109. text-align: center; z-index: 999999; background-color: rgba(0, 0, 0, 0.7); font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;' > <h4 style="color: rgb(255,255,255); margin: 4px;">.io Bots!</h4>
  110. <div div = ""; id = "discord" style="color: white; margin: 1px; font-size: 12px; cursor: pointer; ">discord.gg/bAstbAfem9</div>
  111. <div><p div="" id="botAmount" style="color: rgb(50, 255, 88);">0 / 0</p></div> <div style="margin: 5px;">
  112. <button div="" id="startbtn" style="background-color: rgb(50, 255, 88); color: white; border: rgb(56, 211, 84); padding: 5px; border-radius: 2px;" >
  113. Start Bots</button ><button div="" id="stopbtn" style="margin-left: 3px; background-color: rgb(255, 66, 66); color: white; border: rgb(199, 52, 52); padding: 5px; border-radius: 2px;" > Stop Bots </button>
  114. </div> </div>
  115. `
  116. this.append(this.uiCode);
  117. }
  118. append(html) {
  119. const BOTUI = document.createElement('div');
  120. BOTUI.innerHTML = html;
  121. document.body.appendChild(BOTUI);
  122. this.injected = true;
  123. document.getElementById(this.IDs.startButton).onclick = this.startBots;
  124. document.getElementById(this.IDs.stopButton).onclick = this.stopBots;
  125. document.getElementById(this.IDs.DiscordURL).onclick =() => {window.location.href = 'https://discord.gg/bAstbAfem9'};
  126. }
  127. setupKeys() {
  128. window.addEventListener('keypress', (event) => {
  129. switch(event.key) {
  130. case 'q':
  131. this.splitBots();
  132. break;
  133. case 'w':
  134. this.ejectBots();
  135. break;
  136. }
  137. });
  138. }
  139. updateCount(spawned, max) {
  140. document.getElementById(this.IDs.botCount).innerText = spawned + " / " + max;
  141. }
  142. }
  143.  
  144. window.addEventListener('load', () => {
  145. const client = new Client();
  146. WebSocket.prototype.realSend = WebSocket.prototype.send;
  147. WebSocket.prototype.send = function(pkt) {
  148. this.realSend(pkt);
  149. if(typeof pkt == 'string') return;
  150. if(this.url.includes('localhost')) return;
  151. if(pkt instanceof ArrayBuffer) pkt = new DataView(pkt);
  152. else if(pkt instanceof DataView) pkt = pkt;
  153. else pkt = new DataView(pkt.buffer);
  154. let offset = 0;
  155. switch(pkt.getUint8(0, true)) {
  156. case 16:
  157. client.positioning.x = pkt.getFloat64(1, true);
  158. client.positioning.y = pkt.getFloat64(9, true);
  159. break;
  160. case 5:
  161. case 14:
  162. client.movebuf = pkt.buffer;
  163. break;
  164. }
  165. client.serverIP = this.url;
  166. }
  167. Hooks.run(client);
  168. });
  169.  
  170. var Hooks = {
  171. Client: 'function'
  172. };
  173.  
  174. Hooks.run = (func) => {
  175. Hooks.Client = func;
  176. }
  177.  
  178. class Bot {
  179. constructor() {
  180. this.ws = null;
  181. this.sprkcore = null;
  182. this.spawnInt = null;
  183. this.mouseInt = null;
  184. this.started = false;
  185. this.BotAppearance = 255;
  186. this.botName = 'Free Bots!';
  187. this.server = '';
  188. this.skins = [
  189. '26', '30', '32', '40', '60', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
  190. '21', '22', '23'
  191. ];
  192. this.botSkin = this.skins[~~(Math.random() * this.skins.length)];
  193. this.SkinName = `{${this.botSkin}}` + this.botName;
  194. }
  195.  
  196. Buffer(buf) {
  197. return new DataView(new ArrayBuffer(!buf ? 1 : buf));
  198. }
  199.  
  200. connect(wss) {
  201. this.server = wss;
  202. this.ws = new WebSocket(this.server);
  203. this.ws.binaryType = "arraybuffer";
  204. this.ws.onopen = this.onopen.bind(this);
  205. this.ws.onclose = this.onclose.bind(this);
  206. }
  207.  
  208. Proto5(version, key) {
  209. let init = this.Buffer(0x5);
  210. init.setUint8(
  211. 0x0, 0xfe
  212. )
  213. init.setUint32(
  214. 0x1, version
  215. );
  216.  
  217. this.send(init);
  218.  
  219. init = this.Buffer(0x5);
  220.  
  221. init.setUint8(
  222. 0x0, 0xff
  223. )
  224. init.setUint32(
  225. 0x1, key
  226. );
  227.  
  228. this.send(init)
  229. }
  230.  
  231. onopen() {
  232. Hooks.Client.spawned++
  233. let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
  234. if(parseOrigin == "aquar.io" || parseOrigin == "oceanar.io") {
  235. this.spawn();
  236. this.ping();
  237. } else if(parseOrigin == "cubedot.kr") {
  238. this.Proto5(0x6, 0x1);
  239. this.spawn();
  240. } else {
  241. this.Proto5(0x5, 0x75BCD15);
  242. this.spawn();
  243. }
  244.  
  245. this.spawnInt = setInterval(() => {this.spawn()}, 3000);
  246. this.mouseInt = setInterval(() => {this.sendmouse()}, 150);
  247. }
  248.  
  249. spawn() {
  250. let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
  251. if(parseOrigin == "aquar.io" || parseOrigin == "oceanar.io") {
  252.  
  253. let spawnBuf = this.Buffer(52);
  254. spawnBuf.setUint8(0, 22);
  255. var o = 0;
  256. for(; o < 25; ++o) {
  257. spawnBuf.setUint16(1 + 2 * o, o < this.botName.length ? this.botName.charCodeAt(o) : 0, true);
  258. }
  259. spawnBuf.setUint8(51, this.BotAppearance)
  260. this.send(spawnBuf);
  261.  
  262. } else if(parseOrigin == "cubedot.kr") {
  263.  
  264. var msg = this.Buffer(1 + 2 * this.botName.length);
  265. msg.setUint8(0, 0);
  266. for(var ii = 0; ii < this.botName.length; ++ii) {
  267. msg.setUint16(1 + 2 * ii, this.botName.charCodeAt(ii), true);
  268. }
  269. this.send(msg);
  270.  
  271. } else {
  272.  
  273. var spawnbuf = this.Buffer(1 + 2 * this.SkinName.length);
  274. spawnbuf.setUint8(0, 192);
  275. for(var i = 0; i < this.SkinName.length; ++i) {
  276. spawnbuf.setUint16(1 + 2 * i, this.SkinName.charCodeAt(i), true);
  277. };
  278. this.send(spawnbuf);
  279.  
  280. }
  281. }
  282.  
  283. split() {
  284. let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
  285. if(parseOrigin == "aquar.io" || parseOrigin == "oceanar.io") {
  286. return;
  287. } else {
  288. this.send(new Uint8Array([17]));
  289. }
  290. }
  291.  
  292. eject() {
  293. let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
  294. if(parseOrigin == "aquar.io" || parseOrigin == "oceanar.io") {
  295. return;
  296. } else {
  297. this.send(new Uint8Array([21]));
  298. }
  299. }
  300.  
  301. get open() {return this.ws && this.ws.readyState === WebSocket.OPEN}
  302.  
  303. send(data) {if(this.open) {this.ws.send(data)}}
  304.  
  305. sendmouse() {
  306. let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
  307. if(parseOrigin == "aquar.io" || parseOrigin == "oceanar.io") {
  308. this.send(Hooks.Client.movebuf)
  309. } else {
  310. let movebuf = this.Buffer(0x15);
  311. movebuf.setUint8(
  312. 0x0, 0x10
  313. )
  314. movebuf.setFloat64(
  315. 0x1, Hooks.Client.positioning.x, true
  316. )
  317. movebuf.setFloat64(
  318. 0x9, Hooks.Client.positioning.y, true
  319. )
  320. movebuf.setUint32(
  321. 0x11, 0x0, true
  322. );
  323. this.send(movebuf);
  324. }
  325. }
  326.  
  327. sendchat(msg) {
  328. let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
  329. if(parseOrigin == "aquar.io" || parseOrigin == "oceanar.io" || parseOrigin == "cubedot.kr") {
  330. return;
  331. } else {
  332. return;
  333. }
  334. }
  335.  
  336. ping() {
  337. let ParseTime = 268435455 & Date.now();
  338. let oneByte = this.Buffer(0x5);
  339. oneByte.setUint8(
  340. 0x0, 0x1
  341. )
  342. oneByte.setUint32(
  343. 0x1, ParseTime
  344. );
  345. this.send(oneByte);
  346. }
  347.  
  348. close() {
  349. if(this.ws) this.ws.close();
  350. this.onclose();
  351. Hooks.Client.spawned--
  352. }
  353.  
  354. onclose() {
  355. clearInterval(this.spawnInt);
  356. clearInterval(this.mouseInt);
  357. clearInterval(this.sprkcore);
  358. setTimeout(() => {this.connect()}, 5000);
  359. }
  360. }