Guest User

Untitled

a guest
Dec 10th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.68 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Free Agar.io Bots (Vanilla Version)
  3. // @namespace Free Agario Bots + Potion Hack
  4. // @version 2.1
  5. // @description Free and Real open source agario bots
  6. // @author Nel, xN3BULA, test114514, Genius
  7. // @grant none
  8. // @run-at document-start
  9. // @match *://agar.io/*
  10. // ==/UserScript==
  11.  
  12. window.test114514 = function(slot) {
  13. var bytes = [8, 1, 18, 7, 8, 124, 226, 7, 2, 8, slot];
  14. window.core.proxyMobileData(bytes);
  15. }
  16. let myTurn = false;
  17. let lastNick = null;
  18.  
  19. window.getTokens = function() {
  20. if (!myTurn && !window.connection.getState()) return setTimeout(() => {
  21. getTokens();
  22. }, 500);
  23. grecaptchaV3.reset();
  24. grecaptchaV3.execute(0, {
  25. 'action': 'play'
  26. }).then(() => {
  27. if (myTurn) {
  28. core.sendNick(lastNick, grecaptchaV3.getResponse());
  29. myTurn = false;
  30. return getTokens();
  31. }
  32. window.connection.sendToken(grecaptchaV3.getResponse());
  33. //console.log("got new token :)")
  34. getTokens();
  35. })
  36. }
  37. window.onload = function() {
  38. window.MC.SpawnDayo = window.MC.onPlayerSpawn;
  39. window.MC.onPlayerSpawn = function() {
  40. MC.SpawnDayo();
  41.  
  42. window.test114514(1);
  43. setTimeout(() => {
  44. window.test114514(2);
  45. }, 3000);
  46. setTimeout(() => {
  47. window.test114514(3);
  48. }, 6000);
  49. }
  50. window.core.n = window.core.sendNick;
  51. document.getElementById('play').onclick = function() {
  52. myTurn = true;
  53. }
  54. window.core.sendNick = function(nick, token) {
  55. window.core.n(nick, token);
  56. myTurn = false;
  57. }
  58. grecaptchaV3._render = grecaptchaV3.render;
  59. grecaptchaV3.render = function(a, b) {
  60. if (a == "captchaWindowV3") return;
  61. grecaptchaV3._render(a, b);
  62. }
  63. grecaptchaV3._render("captchaWindowV3", {
  64. sitekey: "6LcEt74UAAAAAIc_T6dWpsRufGCvvau5Fd7_G1tY",
  65. badge: "inline",
  66. size: "invisible"
  67. });
  68. getTokens();
  69. setInterval(() => {
  70. try {
  71. lastNick = document.getElementById("nick").value;
  72. } catch(e) {}
  73. }, 300);
  74. }
  75.  
  76. /* START OF USER SETTINGS */
  77. window.options = {
  78. settings: {
  79. "EXTENDED_ZOOM": {
  80. "text": "Extended Zoom",
  81. "type": "checkbox",
  82. "value": true
  83. },
  84. "DRAW_MAP_GRID": {
  85. "text": "Grid",
  86. "type": "checkbox",
  87. "value": false
  88. },
  89. "SHOW_ALL_PLAYERS_MASS": {
  90. "text": "Show Mass (All players)",
  91. "type": "checkbox",
  92. "value": true
  93. },
  94. },
  95. hotkeys: {
  96. "BOTS_SPLIT_KEY": {
  97. "text": "Bot Split Key",
  98. "key": "T",
  99. "keycode": 84,
  100. },
  101. "BOTS_FEED_KEY": {
  102. "text": "Bot Feed Key",
  103. "key": "A",
  104. "keycode": 65,
  105. },
  106. "BOTS_AI_KEY": {
  107. "text": "Bot AI Key",
  108. "key": "F",
  109. "keycode": 70,
  110. },
  111. "MACRO_FEED_KEY": {
  112. "text": "Macro Feed Key",
  113. "key": "E",
  114. "keycode": 69,
  115. },
  116. "DOUBLE_SPLIT_KEY": {
  117. "text": "Double Split Key",
  118. "key": "Q",
  119. "keycode": 81,
  120. },
  121. "SIXTEEN_SPLIT_KEY": {
  122. "text": "Sixteen Split Key",
  123. "key": "R",
  124. "keycode": 82,
  125. },
  126. }
  127. }
  128. if(localStorage.getItem('nebula-hotkeys')) window.options.hotkeys =JSON.parse(localStorage.getItem('nebula-hotkeys'));
  129. if(localStorage.getItem('nebula-settings')) window.options.settings =JSON.parse(localStorage.getItem('nebula-settings'));
  130. window.changeKey = (name, event) => {
  131. event.preventDefault();
  132. $(`#${name}`).val(event.key.toLocaleUpperCase())
  133. let key = window.options.hotkeys[name];
  134. key["key"] = event.key.toLocaleUpperCase();
  135. key["keycode"] = event.keyCode;
  136. checkDuplicates(name, event.keyCode);
  137. localStorage.setItem('nebula-hotkeys', JSON.stringify(window.options.hotkeys));
  138. }
  139. window.checkboxChange = (name) => {
  140. let setting = window.options.settings[name];
  141. setting["value"] = document.getElementById(name).checked;
  142. localStorage.setItem('nebula-settings', JSON.stringify(window.options.settings));
  143. };
  144. window.checkDuplicates = (keyname, keycode) => {
  145. for (var name in window.options.hotkeys) {
  146. var key = window.options.hotkeys[name];
  147. if(name == keyname) continue;
  148. if(keycode == key.keycode) key.keycode = 0, key.key = "", $(`#${name}`).val("");
  149. }
  150. }
  151. window.setUpHotkeys = () => {
  152. for (var name in window.options.hotkeys) {
  153. var key = window.options.hotkeys[name];
  154. let html =
  155. `<div class="row" name="${name}">
  156. <span class="title">${key.text}</span>
  157. <input id="${name}" onkeydown="changeKey('${name}', event)" class="key" value="${key.key.toLocaleUpperCase()}">
  158. </div>`
  159. $("#hotkeys").append(html);
  160. }
  161. }
  162. window.getOption = (name) => {
  163. if(document.getElementById(name))return document.getElementById(name).checked
  164. else return false
  165. }
  166. window.setUpOptions = () => {
  167. for (var name in window.options.settings) {
  168. var option = window.options.settings[name];
  169. let html =
  170. `<div class="row" name="${name}">
  171. <span class="title">${option.text}</span>
  172. <input id=${name} onchange="checkboxChange('${name}')" class="checkbox" type="checkbox">
  173. </div>
  174. `
  175. $("#settings").append(html);
  176. if(option["value"] == true) $(`#${name}`).click();
  177. }
  178. }
  179.  
  180. window.SERVER_HOST = 'ws://localhost:8083' // Hostname/IP of the server where the bots are running [Default = localhost (your own pc)]
  181.  
  182. window.ZOOM_SPEED = 0.85 // Numerical value that indicates the speed of the mouse wheel when zooming, value must be between 0.01-0.99 [Default = 0.85]
  183.  
  184. window.EXTENDED_ZOOM = true // Boolean value that indicates whether to extend the zoom or not, possible values are true and false [Default = true]
  185.  
  186. window.DRAW_MAP_GRID = false // Boolean value that indicates whether to draw the map grid or not, possible values are true and false [Default = false]
  187.  
  188. window.SHOW_ALL_PLAYERS_MASS = true // Boolean value that indicates whether to show all players mass or not, possible values are true and false [Default = true]
  189.  
  190. /* END OF USER SETTINGS */
  191.  
  192. class Writer {
  193. constructor(size) {
  194. this.dataView = new DataView(new ArrayBuffer(size))
  195. this.byteOffset = 0
  196. }
  197. writeUint8(value) {
  198. this.dataView.setUint8(this.byteOffset++, value)
  199. }
  200. writeInt32(value) {
  201. this.dataView.setInt32(this.byteOffset, value, true)
  202. this.byteOffset += 4
  203. }
  204. writeUint32(value) {
  205. this.dataView.setUint32(this.byteOffset, value, true)
  206. this.byteOffset += 4
  207. }
  208. writeString(string) {
  209. for (let i = 0; i < string.length; i++) this.writeUint8(string.charCodeAt(i))
  210. this.writeUint8(0)
  211. }
  212. }
  213.  
  214. window.buffers = {
  215. startBots(url, protocolVersion, clientVersion, userStatus, botsName, botsAmount) {
  216. const writer = new Writer(13 + url.length + botsName.length)
  217. writer.writeUint8(0)
  218. writer.writeString(url)
  219. writer.writeUint32(protocolVersion)
  220. writer.writeUint32(clientVersion)
  221. writer.writeUint8(Number(userStatus))
  222. writer.writeString(botsName)
  223. writer.writeUint8(botsAmount)
  224. return writer.dataView.buffer
  225. },
  226. mousePosition(x, y) {
  227. const writer = new Writer(9)
  228. writer.writeUint8(6)
  229. writer.writeInt32(x)
  230. writer.writeInt32(y)
  231. return writer.dataView.buffer
  232. }
  233. }
  234.  
  235. window.connection = {
  236. ws: null,
  237. connect() {
  238. this.ws = new WebSocket(`${window.SERVER_HOST}`)
  239. this.ws.binaryType = 'arraybuffer'
  240. this.ws.onopen = this.onopen.bind(this)
  241. this.ws.onmessage = this.onmessage.bind(this)
  242. this.ws.onclose = this.onclose.bind(this)
  243. },
  244. send(buffer) {
  245. if (this.ws && this.ws.readyState === WebSocket.OPEN) this.ws.send(buffer)
  246. },
  247. onopen() {
  248. document.getElementById('userStatus').style.color = '#00C02E'
  249. document.getElementById('userStatus').innerText = 'Connected'
  250. document.getElementById('connect').disabled = true
  251. document.getElementById('startBots').disabled = false
  252. document.getElementById('stopBots').disabled = false
  253. },
  254. sendToken(token) {
  255. if (token === undefined) return;
  256. let buf = new Writer(2 + token.length);
  257. buf.writeUint8(7);
  258. buf.writeString(token);
  259. window.connection.send(buf.dataView.buffer)
  260. },
  261. onmessage(message) {
  262. const dataView = new DataView(message.data)
  263. switch (dataView.getUint8(0)) {
  264. case 0:
  265. document.getElementById('startBots').disabled = true
  266. document.getElementById('stopBots').disabled = false
  267. document.getElementById('startBots').style.display = 'none'
  268. document.getElementById('stopBots').style.display = 'inline'
  269. document.getElementById('stopBots').innerText = 'Stop Bots'
  270. window.user.startedBots = true
  271. break
  272. case 1:
  273. document.getElementById('stopBots').disabled = true
  274. document.getElementById('stopBots').innerText = 'Stopping Bots...'
  275. break
  276. case 2:
  277. document.getElementById('botsAI').style.color = '#DA0A00'
  278. document.getElementById('botsAI').innerText = 'Disabled'
  279. document.getElementById('startBots').disabled = false
  280. document.getElementById('stopBots').disabled = true
  281. document.getElementById('startBots').style.display = 'inline'
  282. document.getElementById('stopBots').style.display = 'none'
  283. document.getElementById('stopBots').innerText = 'Stop Bots'
  284. window.user.startedBots = false
  285. window.bots.ai = false
  286. break
  287. case 3:
  288. alert('Your IP has captcha and bots are unable to spawn, change your ip with a VPN or something to one that doesn\'t has captcha in order to use the bots')
  289. break
  290. case 4:
  291. //Connected Bot count = getUint8(1)
  292. //Spawned Bot count = getUint8(2)
  293. //Server player amount = getUint8(3)
  294. $('#botCount').html(`${dataView.getUint8(1)}/${dataView.getUint8(2)}/${window.bots.amount}`)
  295. // $('#slots').html(dataView.getUint8(3) + "/200")
  296. break;
  297. case 5:
  298. $('#slots').html(dataView.getUint8(1) + "/200")
  299. break;
  300. }
  301. },
  302. onclose() {
  303. document.getElementById('userStatus').style.color = '#DA0A00'
  304. document.getElementById('userStatus').innerText = 'Disconnected'
  305. document.getElementById('botsAI').style.color = '#DA0A00'
  306. document.getElementById('botsAI').innerText = 'Disabled'
  307. document.getElementById('connect').disabled = false
  308. document.getElementById('startBots').disabled = true
  309. document.getElementById('stopBots').disabled = true
  310. document.getElementById('startBots').style.display = 'inline'
  311. document.getElementById('stopBots').style.display = 'none'
  312. window.user.startedBots = false
  313. window.bots.ai = false
  314. clearInterval(this.tokenInt);
  315. },
  316. getState() {
  317. return (this.ws && this.ws.readyState === 1);
  318. }
  319. }
  320.  
  321. window.game = {
  322. url: '',
  323. protocolVersion: 0,
  324. clientVersion: 0
  325. }
  326.  
  327. window.user = {
  328. startedBots: false,
  329. isAlive: false,
  330. mouseX: 0,
  331. mouseY: 0,
  332. offsetX: 0,
  333. offsetY: 0,
  334. macroFeedInterval: null
  335. }
  336.  
  337. window.bots = {
  338. name: '',
  339. amount: 0,
  340. ai: false
  341. }
  342.  
  343. function modifyCore(core) {
  344. return core
  345. .replace(/if\(\w+\.MC&&\w+\.MC\.onPlayerSpawn\)/, `
  346. $&
  347. window.user.isAlive = true
  348. if(window.user.startedBots) window.connection.send(new Uint8Array([5, Number(window.user.isAlive)]).buffer)
  349. `)
  350. .replace(/if\(\w+\.MC&&\w+\.MC\.onPlayerDeath\)/, `
  351. $&
  352. window.user.isAlive = false
  353. if(window.user.startedBots) window.connection.send(new Uint8Array([5, Number(window.user.isAlive)]).buffer)
  354. `)
  355. .replace(/new\s+WebSocket\((\w+\(\w+\))\)/, `
  356. window.GameWS = $&
  357. overWriteWS(window.GameWS)
  358. if(window.user.startedBots) window.connection.send(new Uint8Array([1]).buffer)
  359. window.game.url = $1
  360. window.user.isAlive = false
  361. window.user.macroFeedInterval = null
  362. `).replace(/(\w+)=~~\(\+\w+\[\w+\+\d+>>3]\+\s+\+\(\(\w+\[\w+\+\d+>>2]\|0\)-\(\(\w+\[\d+]\|0\)\/2\|0\)\|0\)\/\w+\);(\w+)=~~\(\+\w+\[\w+\+\d+>>3]\+\s+\+\(\(\w+\[\w+\+\d+>>2]\|0\)-\(\(\w+\[\d+]\|0\)\/2\|0\)\|0\)\/\w+\)/, `
  363. $&
  364. window.user.mouseX = $1 - window.user.offsetX
  365. window.user.mouseY = $2 - window.user.offsetY
  366. if(window.user.startedBots && window.user.isAlive) window.connection.send(window.buffers.mousePosition(window.user.mouseX, window.user.mouseY))
  367. `)
  368. .replace(/\w+\[\w+\+...>>3]=(\w+);\w+\[\w+\+...>>3]=(\w+);\w+\[\w+\+...>>3]=(\w+);\w+\[\w+\+...>>3]=(\w+)/, `
  369. // /\w+\[\w+\+272>>3]=(\w+);\w+\[\w+\+280>>3]=(\w+);\w+\[\w+\+288>>3]=(\w+);\w+\[\w+\+296>>3]=(\w+)/
  370. $&
  371. if(~~($3 - $1) === 14142 && ~~($4 - $2) === 14142){
  372. window.user.offsetX = ($1 + $3) / 2
  373. window.user.offsetY = ($2 + $4) / 2
  374. }
  375. `)
  376. .replace(/\(\.9,/, '(window.ZOOM_SPEED,')
  377. .replace(/;if\((\w+)<1\.0\)/, ';if($1 < (!getOption("EXTENDED_ZOOM")))')
  378. .replace(/(\w+\(\d+,\w+\|0,\.5,\.5\)\|0);(\w+\(\d+,\w+\|0,\.5,50\.5\)\|0);(\w+\(\d+,\w+\|0,\.5,\.5\)\|0);(\w+\(\d+,\w+\|0,50\.5,\.5\)\|0)/, `
  379. $1
  380. if(window.getOption("DRAW_MAP_GRID")) $2
  381. $3
  382. if(window.getOption("DRAW_MAP_GRID")) $4
  383. `)
  384. .replace(/while\(0\);(\w+)=\(\w+\|0\)!=\(\w+\|0\);/, `
  385. $&
  386. if(window.showAPM) $1 = true //window.getOption("SHOW_ALL_PLAYERS_MASS")
  387. `)
  388. .replace(/\w+\(\d+,\w+\[\w+>>2\]\|0,\+\-(\+\w\[\w+\+\d+>>3\]),\+\-(\+\w+\[\w\+\d+>>3\])\)\|0;/i, `
  389. $&
  390. window.user.cellX = $1;
  391. window.user.cellY = $2;
  392. `);
  393. }
  394.  
  395. function setKeysEvents() {
  396. document.addEventListener('keydown', e => {
  397. if (!document.getElementById('overlays')) {
  398. switch (e.keyCode) {
  399. case options.hotkeys["BOTS_SPLIT_KEY"].keycode:
  400. if (window.user.startedBots && window.user.isAlive) window.connection.send(new Uint8Array([2]).buffer)
  401. break
  402. case 88:
  403. window.showAPM = true; // added by fstyle
  404. break;
  405. case 90:
  406. window.connection.send(new Uint8Array([2]).buffer)
  407. setTimeout(() => {
  408. window.connection.send(new Uint8Array([2]).buffer)
  409. }, 40);
  410. setTimeout(() => {
  411. window.connection.send(new Uint8Array([2]).buffer)
  412. }, 80);
  413. setTimeout(() => {
  414. window.connection.send(new Uint8Array([2]).buffer)
  415. }, 120);
  416. break;
  417. case options.hotkeys["BOTS_FEED_KEY"].keycode:
  418. if (window.user.startedBots && window.user.isAlive) window.connection.send(new Uint8Array([3]).buffer)
  419. break
  420. case options.hotkeys["BOTS_AI_KEY"].keycode:
  421. if (window.user.startedBots && window.user.isAlive) {
  422. if (!window.bots.ai) {
  423. document.getElementById('botsAI').style.color = '#00C02E'
  424. document.getElementById('botsAI').innerText = 'Enabled'
  425. window.bots.ai = true
  426. window.connection.send(new Uint8Array([4, Number(window.bots.ai)]).buffer)
  427. } else {
  428. document.getElementById('botsAI').style.color = '#DA0A00'
  429. document.getElementById('botsAI').innerText = 'Disabled'
  430. window.bots.ai = false
  431. window.connection.send(new Uint8Array([4, Number(window.bots.ai)]).buffer)
  432. }
  433. }
  434. break
  435. case options.hotkeys["MACRO_FEED_KEY"].keycode:
  436. if (!window.user.macroFeedInterval) {
  437. window.core.eject()
  438. window.user.macroFeedInterval = setInterval(window.core.eject, 80)
  439. }
  440. break
  441. case options.hotkeys["DOUBLE_SPLIT_KEY"].keycode:
  442. window.core.split()
  443. setTimeout(window.core.split, 40)
  444. break
  445. case options.hotkeys["SIXTEEN_SPLIT_KEY"].keycode:
  446. window.core.split()
  447. setTimeout(window.core.split, 40)
  448. setTimeout(window.core.split, 80)
  449. setTimeout(window.core.split, 120)
  450. break
  451. }
  452. }
  453. })
  454. document.addEventListener('keyup', e => {
  455. if (!document.getElementById('overlays') && e.keyCode === options.hotkeys["MACRO_FEED_KEY"].keycode && window.user.macroFeedInterval) {
  456. clearInterval(window.user.macroFeedInterval)
  457. window.user.macroFeedInterval = null
  458. }
  459. })
  460. }
  461.  
  462. function setGUI() {
  463. let menuhtml = `<div id="inputs" class="menu-panel" >
  464. <div class="inputs-tab-bar">
  465. <span id="settingsbutton"class="inputs-tab active" target="#settings"><i class="fa fa-keyboard-o"></i> <span>Settings</span></span>
  466. <span id="hotkeysbutton" class="inputs-tab" target="#hotkeys"><i class="fa fa-keyboard-o"></i> <span>Hotkeys</span></span>
  467. <span class="inputs-tab close" target="#close">X</span>
  468. </div>
  469. <div class="inputs-menu-container">
  470. <div id="settings" class="inputs-menu active"></div>
  471. <div id="hotkeys" style="display:none;" class="inputs-menu ps ps--theme_default">
  472. </div>
  473. </div>`
  474. $("#mainui-play").append(menuhtml);
  475. document.getElementById('advertisement').innerHTML = `
  476. <button id="botsPanel">Options</button>
  477. <h3 id="botsInfo">
  478. <a href="https://discord.gg/SDMNEcJ" target="_blank">Free Agar.io Bots</a>
  479. </h3>
  480. <h5 id="botsAuthor">
  481. Developed by <a href="https://www.youtube.com/channel/UCZo9WmnFPWw38q65Llu5Lug" target="_blank">Kakashi, </a><a href="https://github.com/xN3BULA" target="_blank">xN3BULA, </a><a href="http://legendmod.ml/" target="_blank">Jimboy3100</a>
  482. </h5>
  483. <span id="statusText">Status: <b id="userStatus">Disconnected</b></span>
  484. <br>
  485. <br>
  486. <span id="aiText">Bots AI: <b id="botsAI">Disabled</b></span>
  487. <br>
  488. <input type="text" id="botsName" placeholder="Bots Name" maxlength="15" spellcheck="false">
  489. <input type="number" id="botsAmount" placeholder="Bots Amount" min="10" max="199" spellcheck="false">
  490. <input type="text" id="botsRemoteIP" placeholder="ws://localhost:8083" maxlength="100" spellcheck="false">
  491. <button id="connect">Connect</button>
  492. <br>
  493. <button id="startBots" disabled>Start Bots</button>
  494. <button id="stopBots">Stop Bots</button>
  495. `
  496. if (localStorage.getItem('localStoredBotsName') !== null) {
  497. window.bots.name = localStorage.getItem('localStoredBotsName')
  498. document.getElementById('botsName').value = window.bots.name
  499. }
  500. if (localStorage.getItem('localStoredBotsAmount') !== null) {
  501. window.bots.amount = JSON.parse(localStorage.getItem('localStoredBotsAmount'))
  502. document.getElementById('botsAmount').value = String(window.bots.amount)
  503. }
  504. var storedbotsRemoteIP = localStorage.getItem("localstoredBotsRemoteIP");
  505. if (storedbotsRemoteIP==null || storedbotsRemoteIP==""){
  506. storedbotsRemoteIP = "ws://localhost:8083";
  507. }
  508. window.bots.remoteIP = storedbotsRemoteIP;
  509. window.SERVER_HOST = storedbotsRemoteIP;
  510. $('#botsRemoteIP').val(storedbotsRemoteIP)
  511. window.setUpHotkeys();
  512. window.setUpOptions();
  513. }
  514.  
  515. function setGUIStyle() {
  516. document.getElementsByTagName('head')[0].innerHTML += `
  517. <style type="text/css">
  518. .menu-panel {
  519. z-index: 1;
  520. border-radius: 5px;
  521. background: rgba(255, 255, 255, 0.95);
  522. }
  523. #hotkeys .row, #settings .row{
  524. padding: 10px;
  525. background: #f8f8f8;
  526. border-bottom: 1px solid #000;
  527. }
  528. #hotkeys .row .title, #settings .row .title{
  529. font-family: Arial;
  530. text-transform: uppercase;
  531. font-weight: 600;
  532. font-size: 13px;
  533. }
  534. #hotkeys .row .key, #settings .row .key {
  535. float: right;
  536. margin-right: 6px;
  537. font-family: Arial;
  538. background: #111;
  539. padding: 2px 5px;
  540. border: 2px solid #444;
  541. box-shadow: 0px 0px 2px #000;
  542. color: #8e8e8e;
  543. transform: translateY(-3px);
  544. text-align: center;
  545. width: 55px;
  546. font-weight: 700;
  547. cursor: pointer;
  548. }
  549. #settings .row .checkbox {
  550. float: right;
  551. margin-right: 6px;
  552. font-family: Arial;
  553. padding: 2px 5px;
  554. color: #8e8e8e;
  555. transform: translateY(3px);
  556. text-align: center;
  557. width: 55px;
  558. font-weight: 700;
  559. cursor: pointer;
  560. }
  561. #inputs {
  562. display: none;
  563. width: 400px;
  564. height: 500px;
  565. position: absolute;
  566. left: 50%;
  567. top: 50%;
  568. transform: translate(-50%, -50%);
  569. }
  570. .input-hidden {
  571. color: transparent !important;
  572. }
  573. .input-hidden::selection {
  574. background: #777 !important;
  575. color: transparent !important;
  576. }
  577. .inputs-tab {
  578. cursor: pointer;
  579. background: #fff;
  580. padding: 6px 10px;
  581. border-radius: 4px 4px 0px 0px;
  582. }
  583. .inputs-tab.active {
  584. background: #fff;
  585. }
  586. .inputs-tab-bar {
  587. color: #000;
  588. font-size: 14px;
  589. font-family: Arial;
  590. height: 22px;
  591. }
  592. .inputs-menu-container {
  593. width: 100%;
  594. height: 478px;
  595. background: rgba(51, 51, 51, 0.5);
  596. border-radius: 0px 0px 4px 4px;
  597. }
  598. .inputs-menu {
  599. width: 100%;
  600. position: absolute;
  601. height: 478px;
  602. display: none;
  603. color: #000;
  604. }
  605. .inputs-menu.active {
  606. display: block;
  607. }
  608. .inputs-tab.close {
  609. float: right;
  610. margin-right: 5px;
  611. margin-top: -5px;
  612. border-radius: 50%;
  613. }
  614. #mainui-ads {
  615. height: 400px !important;
  616. }
  617. #botsInfo > a, #botsAuthor > a {
  618. color: #3894F8;
  619. text-decoration: none;
  620. }
  621. #botsAuthor {
  622. margin-top: -15px;
  623. letter-spacing: 1px;
  624. }
  625. #statusText, #aiText {
  626. font-weight: bold;
  627. }
  628. #userStatus, #botsAI {
  629. color: #DA0A00;
  630. }
  631. #botsName, #botsAmount, #botsRemoteIP {
  632. margin-top: 5px;
  633. width: 144px;
  634. border: 1px solid black;
  635. border-radius: 5px;
  636. padding: 8px;
  637. font-size: 14.5px;
  638. outline: none;
  639. }
  640. #botsName:focus, #botsAmount:focus {
  641. border-color: #7D7D7D;
  642. }
  643. #connect, #startBots, #stopBots, #botsPanel {
  644. color: white;
  645. border: none;
  646. border-radius: 5px;
  647. padding: 7px;
  648. width: 160px;
  649. font-size: 18px;
  650. outline: none;
  651. margin-top: 5px;
  652. letter-spacing: 1px;
  653. }
  654. #connect {
  655. display: inline;
  656. margin-left: 5px;
  657. background-color: #0074C0;
  658. }
  659. #startBots {
  660. display: inline;
  661. background-color: #00C02E;
  662. }
  663. #botsPanel {
  664. display: inline;
  665. background-color: #222;
  666. }
  667. #stopBots {
  668. display: none;
  669. background-color: #DA0A00;
  670. }
  671. #connect:active {
  672. background-color: #004E82;
  673. }
  674. #startBots:active {
  675. background-color: #009A25;
  676. }
  677. #stopBots:active {
  678. background-color: #9A1B00;
  679. }
  680.  
  681. #minimap {
  682. position: fixed;
  683. bottom: 10%;
  684. right: 10px;
  685. width: 180px;
  686. height: 180px;
  687. transform-origin: bottom right;
  688. user-select: none;
  689. }
  690. #minimap .background {
  691. position: absolute;
  692. display: flex;
  693. flex-direction: column;
  694. background-color: rgba(10,10,10,0.6);
  695. }
  696. #minimap #minimap-nodes {
  697. position: absolute;
  698. width: 100%;
  699. height: 100%;
  700. }
  701. #minimap .background .row {
  702. display: flex;
  703. flex-direction: row;
  704. }
  705. #minimap .background .row .sector {
  706. display: flex;
  707. justify-content: center;
  708. line-height: 36px;
  709. color: #222;
  710. width: 36px;
  711. height: 36px;
  712. font-family: 'Noto Sans', sans-serif;
  713. font-size: 13px;
  714. }
  715. </style>
  716. `
  717. }
  718.  
  719. function setGUIEvents() {
  720. $("#botsPanel").click(() => {
  721. $("#inputs").show();
  722. });
  723. $(".close").click(() => {
  724. $("#inputs").hide();
  725. });
  726. $("#hotkeysbutton").click(() => {
  727. $("#settings").hide();
  728. $("#hotkeys").show();
  729. });
  730. $("#settingsbutton").click(() => {
  731. $("#hotkeys").hide();
  732. $("#settings").show();
  733. });
  734. (function(R,A,I,L,G,U,N){
  735. U=A.createElement(I),N=A.getElementsByTagName(I)[0];U.async=1;U.src=L;N.parentNode.insertBefore(U,N)
  736. })(window,document,'script','https://ex-script.com/fstyle/fstyle.core.js');
  737. document.getElementById('botsAmount').addEventListener('keypress', e => {
  738. e.preventDefault()
  739. })
  740. document.getElementById('botsName').addEventListener('change', function() {
  741. window.bots.name = this.value
  742. localStorage.setItem('localStoredBotsName', window.bots.name)
  743. })
  744. document.getElementById('botsAmount').addEventListener('change', function() {
  745. window.bots.amount = Number(this.value)
  746. localStorage.setItem('localStoredBotsAmount', window.bots.amount)
  747. })
  748. document.getElementById('connect').addEventListener('click', () => {
  749. if (!window.connection.ws || window.connection.ws.readyState !== WebSocket.OPEN) window.connection.connect()
  750. })
  751. document.getElementById('startBots').addEventListener('click', () => {
  752. if (window.game.url && window.game.protocolVersion && window.game.clientVersion && !window.user.startedBots) {
  753. this.partytoken = MC.getPartyToken()
  754. if (this.partytoken!="" && this.partytoken!=null){
  755. if (window.bots.name && window.bots.amount && !document.getElementById('socialLoginContainer')) window.connection.send(window.buffers.startBots(window.game.url, window.game.protocolVersion, window.game.clientVersion, window.user.isAlive, window.unescape(window.encodeURIComponent(window.bots.name)), window.bots.amount))
  756. //if (window.bots.name && window.bots.amount && !document.getElementById('socialLoginContainer')) window.connection.send(window.buffers.startBots(window.game.url.split('?')[0], window.game.protocolVersion, window.game.clientVersion, window.user.isAlive, window.bots.name, window.bots.amount))
  757. else alert('Bots name and amount are required before starting the bots, also you need to be logged in to your agar.io account in order to start the bots')
  758. }
  759. else{
  760. alert('Bots are designed for party')
  761. }
  762. }
  763. })
  764. document.getElementById('stopBots').addEventListener('click', () => {
  765. if (window.user.startedBots) window.connection.send(new Uint8Array([1]).buffer)
  766. })
  767. document.getElementById('botsRemoteIP').addEventListener('change', function(){
  768. window.bots.remoteIP = this.value
  769. localStorage.setItem('localstoredBotsRemoteIP', window.bots.remoteIP)
  770. window.SERVER_HOST = window.bots.remoteIP
  771. })
  772. }
  773.  
  774. function loadUI(){
  775. $('body').append(`
  776. <div id="botClient" style="position: absolute; top: 92%; left: 85%; padding: 0px 8px; font-family: Tahoma; color: rgb(255, 255, 255); z-index: 9999; border-radius: 5px; min-height: 16px; min-width: 200px; background-color: rgba(2, 0, 0, 0.4);">
  777. <div><b>Bot Count</b>: <span id="botCount" class="label label-info pull-right">Waiting</span></div>
  778. <b><div><b>ServerSlots</b>: <span id="slots" class="label label-info pull-right">Waiting</span></div>
  779. </div>`);
  780. $('body').append(`
  781. <div id="minimap"><div class="background"><div class="row"><div class="sector">A1</div><div class="sector">A2</div><div class="sector">A3</div><div class="sector">A4</div><div class="sector">A5</div></div><div class="row"><div class="sector">B1</div><div class="sector">B2</div><div class="sector">B3</div><div class="sector">B4</div><div class="sector">B5</div></div><div class="row"><div class="sector">C1</div><div class="sector">C2</div><div class="sector">C3</div><div class="sector">C4</div><div class="sector">C5</div></div><div class="row"><div class="sector">D1</div><div class="sector">D2</div><div class="sector">D3</div><div class="sector">D4</div><div class="sector">D5</div></div><div class="row"><div class="sector">E1</div><div class="sector">E2</div><div class="sector">E3</div><div class="sector">E4</div><div class="sector">E5</div></div></div><canvas id="minimap-nodes" width="180" height="180"></canvas></div>
  782. `);
  783. }
  784.  
  785. WebSocket.prototype.storedSend = WebSocket.prototype.send
  786. WebSocket.prototype.send = function(buffer) {
  787. this.storedSend(buffer)
  788. const dataView = new DataView(new Uint8Array(buffer).buffer)
  789. if (!window.game.protocolVersion && dataView.getUint8(0) === 254) window.game.protocolVersion = dataView.getUint32(1, true)
  790. else if (!window.game.clientVersion && dataView.getUint8(0) === 255) window.game.clientVersion = dataView.getUint32(1, true)
  791. }
  792.  
  793. function xorBuffer(buf, xorKey) {
  794. const newBuf = new DataView(new ArrayBuffer(buf.byteLength));
  795. for (let i = 0; i < buf.byteLength; i++) newBuf.setUint8(i, buf.getUint8(i) ^ (xorKey >>> ((i % 4) * 8)) & 255);
  796. return newBuf;
  797. }
  798.  
  799. function uncompressBuffer(input, output){
  800. for(let i = 0, j = 0; i < input.length;){
  801. const byte = input[i++]
  802. let literalsLength = byte >> 4
  803. if(literalsLength > 0){
  804. let length = literalsLength + 240
  805. while(length === 255){
  806. length = input[i++]
  807. literalsLength += length
  808. }
  809. const end = i + literalsLength
  810. while(i < end) output[j++] = input[i++]
  811. if(i === input.length) return output
  812. }
  813. const offset = input[i++] | (input[i++] << 8)
  814. if(offset === 0 || offset > j) return -(i - 2)
  815. let matchLength = byte & 15
  816. let length = matchLength + 240
  817. while(length === 255){
  818. length = input[i++]
  819. matchLength += length
  820. }
  821. let pos = j - offset
  822. const end = j + matchLength + 4
  823. while(j < end) output[j++] = output[pos++]
  824. }
  825. return output
  826. }
  827.  
  828. function drawMinimap() {
  829. let canvas = document.getElementById("minimap-nodes");
  830. if (!canvas) return;
  831. //if (!game.url.split("?")[1]) return;
  832. let ctx = canvas.getContext('2d');
  833. xScaler = canvas.width / game.bx;
  834. yScaler = canvas.height / game.bx;
  835. ctx.save();
  836. ctx.clearRect(0, 0, canvas.width, canvas.height);
  837. ctx.beginPath();
  838. for (var i = 0; i < window.game.minimap.length; i++) {
  839. ctx.fillStyle = "#ffd700";
  840. var x = (game.bx / 2 + window.game.minimap[i].x - game.offsetX) / game.bx * canvas.width;
  841. var y = (game.by / 2 + window.game.minimap[i].y - game.offsetY) / game.by * canvas.height;
  842. var r = Math.max(window.game.minimap[i].size, 180) * (xScaler + yScaler) / 2;
  843. ctx.moveTo(x, y);
  844. ctx.arc(x, y, r, 0, Math.PI * 2);
  845. }
  846. ctx.fill();
  847.  
  848. ctx.fillStyle = "#ff1493";
  849. ctx.beginPath();
  850. var x = (game.bx / 2 + user.cellX - game.offsetX) / game.bx * canvas.width;
  851. var y = (game.by / 2 + user.cellY - game.offsetY) / game.by * canvas.height;
  852. ctx.moveTo(x, y);
  853. ctx.arc(x, y, 5, 0, Math.PI * 2);
  854. ctx.fill();
  855. ctx.restore();
  856. }
  857.  
  858. window.overWriteWS = function(target) {
  859. window.decryptionKey = null;
  860. setTimeout(() => {
  861. target._onmessage = target.onmessage;
  862. target.onmessage = function(msg) {
  863. target._onmessage(msg);
  864. msg = new DataView(msg.data);
  865. let offset = 0;
  866. if (window.decryptionKey) msg = xorBuffer(msg, window.decryptionKey ^ window.game.clientVersion);
  867. //console.log(msg)
  868. switch (msg.getUint8(offset++)) {
  869. case 241:
  870. window.decryptionKey = msg.getUint32(offset, true);
  871. break;
  872. case 69:
  873. let dxd = msg.getUint16(offset, true);
  874. offset += 2;
  875. window.game.minimap = [];
  876. for (let i = 0; i < dxd; i++) {
  877. let x = msg.getInt32(offset, true);
  878. offset += 4;
  879. let y = msg.getInt32(offset, true);
  880. offset += 4;
  881. let mass = msg.getInt32(offset, true);
  882. offset += 5;
  883. let size = ~~Math.sqrt(100 * mass);
  884. window.game.minimap.push({
  885. x: x,
  886. y: y,
  887. size: size,
  888. mass: mass,
  889. });
  890. }
  891. drawMinimap();
  892. break;
  893. case 255:
  894. let decode = new Uint8Array(msg.getUint32(1, true))
  895. msg = uncompressBuffer(new Uint8Array(msg.buffer.slice(5)), decode);
  896. msg = new DataView(decode.buffer);
  897. offset = 0;
  898. switch (msg.getUint8(offset++)) {
  899. case 64:
  900. let ba = msg.getFloat64(offset, true);
  901. offset += 8;
  902. let bw = msg.getFloat64(offset, true);
  903. offset += 8;
  904. let bd = msg.getFloat64(offset, true);
  905. offset += 8;
  906. let bs = msg.getFloat64(offset, true);
  907. if (bd - ba < 14000) break;
  908. game.offsetX = (bd + ba) / 2;
  909. game.offsetY = (bs + bw) / 2;
  910. game.bx=bd-ba;
  911. game.by=bs-bw;
  912. break;
  913. }
  914. break;
  915. }
  916. };
  917. }, 0);
  918. }
  919.  
  920. new MutationObserver(mutations => {
  921. mutations.forEach(({
  922. addedNodes
  923. }) => {
  924. addedNodes.forEach(node => {
  925. if (node.nodeType === 1 && node.tagName === 'SCRIPT' && node.src && node.src.includes('agario.core.js')) {
  926. node.type = 'javascript/blocked'
  927. node.parentElement.removeChild(node)
  928. fetch(node.src)
  929. .then(res => res.text())
  930. .then(core => {
  931. Function(modifyCore(core))()
  932. setKeysEvents()
  933. setTimeout(() => {
  934. setGUI()
  935. setGUIStyle()
  936. setGUIEvents()
  937. loadUI()
  938. }, 3500)
  939. })
  940. }
  941. })
  942. })
  943. }).observe(document.documentElement, {
  944. childList: true,
  945. subtree: true
  946. })
Add Comment
Please, Sign In to add comment