Advertisement
Guest User

Untitled

a guest
May 24th, 2019
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.49 KB | None | 0 0
  1. process.on('uncaughtException', function(err){
  2. var e = '' + err;
  3. if(e != 'Error: Socket Closed' && e != 'Error: Connection Timed Out' && e != 'Error: socket hang up' && e != 'Error: read ECONNRESET' && e.substr(0,24) != 'Error: Negotiation Error'){
  4. console.log('' + err);
  5. }
  6. });
  7. const proxyAgent = require('proxy-agent');
  8. var http = require('http');
  9. var SocksProxyAgent = require('socks-proxy-agent');
  10. const request = require('request');
  11. const WebSocket = require('ws');
  12. const fs = require('fs');
  13. const defaultHeaders = {};
  14. console.log('NeyBots Made by FreeTzYT Dev By Slxsher');
  15. defaultHeaders["Accept-Encoding"] = "gzip, deflate";
  16. defaultHeaders["Accept-Language"] = "en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7";
  17. defaultHeaders["Cache-Control"] = "no-cache";
  18. defaultHeaders["Connection"] = "Upgrade";
  19. defaultHeaders["Cookie"] = "__cfduid=d557d93bdc916c9975b9a56a883e425021533342031; _ga=GA1.2.115770575.1533950899";
  20. defaultHeaders["Pragma"] = "no-cache";
  21. defaultHeaders["Sec-WebSocket-Extensions"] = "permessage-deflate; client_max_window_bits";
  22. defaultHeaders["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3789.0 Safari/537.36 Edg/76.0.159.0";
  23. let allProxyAgents = [];
  24. let connectedUsers = 0;
  25. let proxyAgents = [];
  26. let config = {};
  27. let id = Math.floor(Math.random() * 1000);
  28. var clientX = 0,
  29. clientY = 0,
  30. aiMode =false;
  31. function getProxy() {
  32. if (proxyAgents.length == 0) proxyAgents = allProxyAgents;
  33. return proxyAgents.shift();
  34. }
  35. if (fs.existsSync('./config.json')) {
  36. fs.readFile('./config.json', (err, data) => {
  37. let text = Buffer.from(data).toString();
  38. config = JSON.parse(text);
  39. getProxys();
  40. });
  41. } else {
  42. let _default = {};
  43. _default.botNames = ["NeyBots-com"];
  44. _default.accounts = [""];
  45. _default.botskin = "";
  46. _default.useProxyApi = true;
  47. _default.useAccount = false;
  48. _default.maxBots = 500;
  49. fs.writeFile('config.json', Buffer.from(JSON.stringify(_default, null, 20)), () => {});
  50. config = _default;
  51. }
  52.  
  53. function getProxys() {
  54. if (config.useProxyApi) {
  55. request('https://www.proxy-list.download/api/v1/get?type=socks5', (err, req, body) => {
  56. let proxies = data.toString().replace(/\r/g, '').split('\n');
  57. proxies.forEach(proxy => {
  58. return new proxyAgent(`http://${proxy}`);
  59. });
  60. console.log(`Got ${proxies.length} proxies!`);
  61. });
  62. } else {
  63. fs.readFile('./proxies.txt', (err, data) => {
  64. let proxies = data.toString().replace(/\r/g, '').split('\n');
  65. proxies.forEach(proxy => {
  66. return new proxyAgent(`http://${proxy}`);
  67. });
  68. console.log(`Got ${proxies.length} proxies!`);
  69. });
  70. }
  71. }
  72.  
  73. class Bot {
  74.  
  75. constructor(origin, client) {
  76. this.client = client;
  77. this.pelletsMode=false;
  78. this.playerNodes = [];
  79. this.playerNodeIds = [];
  80. this.allNodes = [];
  81. this.eatingEvents = [];
  82. this.headers = JSON.parse(JSON.stringify(defaultHeaders));
  83. this.originSplit = origin.split('/')[2];
  84. this.nameInterval = null;
  85. this.name = true;
  86. this.proxy = getProxy();
  87. this.origin = origin;
  88. this.stopped = true;
  89. this.ws = true;
  90. this.ip = true;
  91. this.sId = 0;
  92. this.id = id;
  93. this.started = false;
  94. this.x = this.y = this.clientX = this.clientY = 0;
  95. this.moveTo = 'mouse';
  96. this.mouseInt = 0;
  97. global.ProtocolVersion = 20;
  98. global.ProtocolKey = 30411;
  99. var encryptionKey = createKey;
  100.  
  101. function createKey(key) {
  102.  
  103. key = Math.imul(key, 1540483477) >> 0;
  104. key = (Math.imul(key >>> 24 ^ key, 1540483477) >> 0) ^ 114296087;
  105. key = Math.imul(key >>> 13 ^ key, 1540483477) >> 0;
  106. key = key >>> 15 ^ key;
  107.  
  108. return key;
  109. }
  110. }
  111.  
  112. connect(ip, balz) {
  113. if (!balz && this.originSplit == 'balz.io') return this.balz(ip);
  114. this.stopped = false;
  115. this.ip = ip;
  116. this.headers.Origin = this.origin;
  117. this.ws = new WebSocket(this.ip, {
  118. headers: this.headers,
  119. agent: this.proxy
  120. });
  121. this.ws.binaryType = 'nodebuffer';
  122. this.ws.onopen = this.onopen.bind(this);
  123. this.ws.onmessage = this.onmessage.bind(this);
  124. this.ws.onerror = this.onerror.bind(this);
  125. this.ws.onclose = this.onclose.bind(this);
  126. }
  127.  
  128. handleWorldUpdate(buf) {
  129.  
  130. let off = 0;
  131. if (buf.readUInt8(off++) != 16) return false;
  132. let eatRecordLength = buf.readUInt16LE(off);
  133. off += 2;
  134.  
  135. this.eatingEvents = [];
  136. for (let i = 0; i < eatRecordLength; i++) {
  137. this.eatingEvents.push({
  138. eater: buf.readUInt32LE(off),
  139. victim: buf.readUInt32LE(off + 4)
  140. });
  141.  
  142. off += 8;
  143. }
  144.  
  145. while (true) {
  146. let n = new Node();
  147.  
  148. n.id = buf.readUInt32LE(off);
  149. off += 4;
  150. if (!n.id) break;
  151.  
  152. n.x = buf.readInt16LE(off);
  153. off += 2;
  154. n.y = buf.readInt16LE(off);
  155. off += 2;
  156. n.size = buf.readInt16LE(off);
  157. off += 2;
  158.  
  159. n.color = {
  160. r: buf.readUInt8(off++),
  161. g: buf.readUInt8(off++),
  162. b: buf.readUInt8(off++)
  163. };
  164.  
  165. n.flags = buf.readUInt8(off++);
  166.  
  167. if (n.flags & 2) off += 4;
  168. if (n.flags & 4) off += 8;
  169. if (n.flags & 8) off += 16;
  170.  
  171. let ch = 0;
  172. n.name = '';
  173. do {
  174. n.name += String.fromCharCode((ch = buf.readUInt16LE(off)));
  175. off += 2;
  176. } while (ch != 0);
  177.  
  178. if (this.allNodes.hasOwnProperty(n.id)) {
  179. this.allNodes[n.id] = n;
  180. } else {
  181. this.allNodes[n.id] = n;
  182. }
  183. }
  184.  
  185. let removeQueueLength = buf.readUInt32LE(off);
  186. off += 4;
  187. for (let i = 0; i < removeQueueLength; i++) {
  188. let id = buf.readUInt32LE(off);
  189. off += 4;
  190.  
  191. if (this.allNodes.hasOwnProperty(id)) {
  192. delete this.allNodes[id];
  193. }
  194. }
  195.  
  196. return true;
  197. }
  198.  
  199. collectPellets(botUserX, botUserY, byteLen) {
  200. let clientX = 0,
  201. clientY = 0,
  202. count = 0,
  203. smallestSize = 10000;
  204.  
  205. for (let i = 0; i < this.playerNodeIds.length; i++) {
  206. if (this.allNodes.hasOwnProperty(this.playerNodeIds[i])) {
  207. let node = this.allNodes[this.playerNodeIds[i]];
  208. clientX += node.x;
  209. clientY += node.y;
  210. if (node.size < smallestSize) smallestSize = node.size;
  211. count++;
  212. }
  213. }
  214.  
  215. clientX /= count;
  216. clientY /= count;
  217.  
  218. let followNode = null;
  219.  
  220. let bestDistance = 10000.0;
  221.  
  222. Object.keys(this.allNodes).forEach(key => {
  223. let node = this.allNodes[key];
  224. if (node.size < smallestSize * 0.85) {
  225. let dist = Math.abs(node.x - clientX) + Math.abs(node.y - clientY);
  226. if (dist < bestDistance) {
  227. bestDistance = dist;
  228. followNode = node;
  229. }
  230. }
  231. });
  232. if (followNode) {
  233. let moveBuffer = Buffer.alloc(byteLen);
  234. moveBuffer.writeUInt8(16, 0);
  235. switch (byteLen) {
  236. case 13:
  237. case 9:
  238. moveBuffer.writeInt32LE(followNode.x, 1);
  239. moveBuffer.writeInt32LE(followNode.y, 5);
  240. break;
  241. case 21:
  242. moveBuffer.writeDoubleLE(followNode.x, 1);
  243. moveBuffer.writeDoubleLE(followNode.y, 9);
  244. break;
  245. case 16:
  246. moveBuffer.writeIntDoubleLE(followNode.x, 1) + moveBuffer.writeInDoubleLE(followNode.x, 17) / 2;
  247. moveBuffer.writeIntDoubleLE(followNode.y, 9) + moveBuffer.writeInDoubleLE(followNode.y, 25) / 2;
  248. break;
  249. }
  250. this.send(moveBuffer);
  251. }
  252. //this.sendMoveTo(clientX, clientY);
  253. }
  254.  
  255. getBubbleToken(callback, proxyServer) {
  256. var requsetWithProxy = request.defaults({'proxy': `http://${proxyServer.proxy.host}:${proxyServer.proxy.port}`});
  257. var headers = {
  258. 'Content-Type':'text/xml'
  259. }
  260. var options = {
  261. url: 'http://bubble.am/m',
  262. method: 'POST',
  263. headers: headers,
  264. form: 'tal=1&dm=1'
  265. }
  266. requsetWithProxy.post(options, (err, res, body) => {
  267. if (err || res.statusCode !== 200) {
  268. console.log('Failed to get response');
  269. return;
  270. }
  271. if(!body) return;
  272. let token = body.split("\n")[3];
  273. let buffer = new Buffer.alloc(1 + token.length);
  274. buffer.writeUInt8(253, 0);
  275. buffer.write(token, 1);
  276. this.send(buffer);
  277. if (this.spawnInterval) return;
  278. this.spawnInterval = setInterval(function() {
  279. if(this.botsSpawnSig == 0){
  280. clearInterval(this.checkConnection);
  281. clearInterval(this.spawnInterval);
  282. } else {
  283. this.spawn();
  284. }
  285. }.bind(this), 1750 * 2);
  286. });
  287. }
  288.  
  289. balz(ip) {
  290. let finIp = ip.split('?')[0];
  291. let ws = new WebSocket('wss://balz.io/gateway', {
  292. agent: this.proxy
  293. });
  294. ws.onclose = ws.onerror = ws.onopen = () => {};
  295. ws.onmessage = msg => {
  296. msg = JSON.parse(msg.data);
  297. switch (msg[0]) {
  298. case 0:
  299. this.sId = msg[1][0];
  300. finIp += '?session=' + msg[1][1];
  301. this.connect(finIp, true);
  302. break;
  303. case 1:
  304. ws.send('[1]');
  305. break;
  306. }
  307. };
  308. }
  309.  
  310. onopen() {
  311. let inits = Buffer.alloc(5);
  312. inits.writeUInt8(254, 0); + global.ProtocolVersion;
  313. switch (this.originSplit) {
  314. case 'agocell.eu':
  315. case 'cellz.io':
  316. case 'www.agarserv.com/':
  317. case 'ultrex.io':
  318. case 'agario.top':
  319. case 'agario.us':
  320. case 'agariogame.club':
  321. case 'agar.pro':
  322. case 'cellagar.ml':
  323. case 'agar.io':
  324. case 'game.ex-script.com':
  325. case 'germs.io':
  326. case 'agar.lol':
  327. case 'mk-agario.glitch.me':
  328. case 'agix.pw':
  329. case 'Bubble.am':
  330. case 'germs.io':
  331. case 'agarios.org':
  332. case 'dummyclient.glitch.me':
  333. case 'www.agar-kicoo.tk':
  334. case 'ac-clan.glitch.me':
  335. case 'gota.io':
  336. case 'agar.red':
  337. case 'senpa.io':
  338. case 'agar.lol':
  339. case 'pok.ist':
  340. case 'ixagar.net':
  341. case 'agar.black':
  342. case 'agarcell.ml':
  343. case 'zgar.glitch.me':
  344. case 'cells.ga':
  345. case 'agar.ovh':
  346. case 'sxold.glitch.me':
  347. case 'agarx.biz' :
  348. case 'agario.fun':
  349. case 'powerline.io':
  350. case 'nagar.eu':
  351. case 'agar.bio':
  352. case 'gaver.io':
  353. case 'play.mitos.is':
  354. case 'agariocity.pro':
  355. case 'gota.io':
  356. case 'astr.io':
  357. case 'agariobox.org':
  358. case 'agar.gold':
  359. case 'ogar.be':
  360. case 'play.agario0.com':
  361. inits.writeUInt32LE(1, 1);
  362. break;
  363. case 'agarflix.com':
  364. case 'Bubble.am':
  365. case 'www.agarserv.com/':
  366. inits.writeUInt32LE(4, 1, true);
  367. break;
  368. case 'army.ovh':
  369. case 'game.ex-script.com':
  370. case 'gaver.io':
  371. case 'ixagar.net':
  372. case 'www.agarserv.com/':
  373. case 'agar.space':
  374. case 'Bubble.am':
  375. case 'senpa.io':
  376. case 'gota.io':
  377. case 'agario.us':
  378. case 'agariogame.club':
  379. case 'cellcraft.io':
  380. case 'www.cellcraft.io':
  381. case 'http://cellcraft.io':
  382. case 'ultrex.io':
  383. case 'astr.io':
  384. case 'www.agarserv.com/':
  385. case 'play.mitos.is':
  386. case 'http://agar.tv':
  387. case 'http://agar.wiki':
  388. case 'bomb.agar.bio':
  389. case 'm.agar.bio':
  390. case 'agar.bio':
  391. case 'agarz.com':
  392. case 'blobgame.io':
  393. case 'pok.ist':
  394. case 'agarioserver.club':
  395. case 'agarprivateservers.org':
  396. inits.writeUInt32LE(5, 1);
  397. break;
  398. case 'balz.io':
  399. case 'myagar.pro':
  400. inits.writeUInt32LE(6, 1);
  401. break;
  402. case 'senpa.io':
  403. let strings = [config.botNames[Math.floor(Math.random() * config.botNames.length)], '', '', '', '']; // ['onxcnk_101', Math.random().toString(36).substr(2, 5)];
  404. let stringsLen = 0;
  405. strings.map(a => stringsLen += a.length * 2);
  406. inits = Buffer.alloc(1 + strings.length * 2 + stringsLen);
  407. var i = 0;
  408. inits.writeUInt8(252, i++);
  409. strings.forEach(string => {
  410. inits.writeUInt16LE(string.length, i);
  411. i += 2;
  412. inits.write(string, i, 'utf16le');
  413. i += string.length * 2;
  414. });
  415. break;
  416. }
  417. this.send(inits);
  418. var t = Buffer.alloc(5);
  419. inits = Buffer.alloc(5); + global.Protocolkey;
  420. inits.writeUInt8(255, 0);
  421. switch (this.originSplit) {
  422. case 'wreckit.io':
  423. case 'agar.io':
  424. case 'agar.pro':
  425. case 'm.agar.bio':
  426. case 'agar.bio':
  427. case 'army.ovh':
  428. case 'agar.space':
  429. case 'cellagar.ml':
  430. case 'agocell.eu':
  431. case 'agar.one':
  432. case 'moomoo.io':
  433. case 'germs.io':
  434. case 'game.ex-script.com':
  435. case 'senpa.io':
  436. case 'mk-agario.glitch.me':
  437. case 'agix.pw':
  438. case 'Bubble.am':
  439. case 'agocell.eu':
  440. case 'agarios.org':
  441. case 'biobots.tk':
  442. case 'dummyclient.glitch.me':
  443. case 'dual-agar.me':
  444. case 'agario.us':
  445. case 'agariogame.club':
  446. case 'ac-clan.glitch.me':
  447. case 'agar.red':
  448. case 'agar.lol':
  449. case 'agar.black':
  450. case 'agarcell.ml':
  451. case 'zgar.glitch.me':
  452. case 'cells.ga':
  453. case 'www.agarserv.com/':
  454. case 'ultrex.io':
  455. case 'agar.ovh':
  456. case 'bomb.agar.bio':
  457. case 'm.agar.bio':
  458. case 'agar.bio':
  459. case 'sxold.glitch.me':
  460. case 'ixagar.net':
  461. case 'agario.fun':
  462. case 'powerline.io':
  463. case 'play.mitos.is':
  464. case 'nagar.eu':
  465. case 'agariopvp.org':
  466. case 'agarprivateservers.org':
  467. case 'www.agar-kicoo.tk':
  468. case 'gaver.io':
  469. case 'gota.io':
  470. case 'agariocity.pro':
  471. case 'agariobox.org':
  472. case 'agar.lol':
  473. case 'pok.ist':
  474. case 'agarflix.com':
  475. case 'agar.gold':
  476. case 'astr.io':
  477. case 'ogar.be':
  478. case 'agar.bio':
  479. inits.writeUInt32LE(1332175218, 1, true);
  480. if (config.useAccount && this.originSplit == 'agariohub.io') this.agarHubLogin();
  481. break;
  482. case 'agarioserver.club':
  483. case 'Bubble.am':
  484. case 'www.agarserv.com/':
  485. inits.writeUInt32LE(2200049715, 1);
  486. break;
  487. case 'bomb.agar.bio':
  488. case 'm.agar.bio':
  489. case 'Bubble.am':
  490. case 'www.agarserv.com/':
  491. case 'game.ex-script.com':
  492. case 'agar.bio':
  493. case 'play.mitos.is':
  494. case 'http://agario.se/':
  495. case 'pok.ist':
  496. case 'ultrex.io':
  497. case 'http://targ.io/':
  498. case 'agar.gold':
  499. case 'http://agar.tv':
  500. case 'http://agar.wiki':
  501. case 'agario.us':
  502. case 'agariogame.club':
  503. case 'ixagar.net':
  504. case 'www.agarserv.com/':
  505. case 'senpa.io':
  506. case 'http://agario.tech/':
  507. inits.writeUInt32LE(1, 123456789, true);
  508. break;
  509. case 'Bubble.am':
  510. case 'cellcraft.io':
  511. case 'www.cellcraft.io':
  512. case 'http://cellcraft.io':
  513. case 'www.agarserv.com/':
  514. case 'play.mitos.is':
  515. case 'game.ex-script.com':
  516. case 'ultrex.io':
  517. inits.writeUInt32LE(1332775218, 1);
  518. break;
  519. case 'myagar.pro':
  520. case 'balz.io':
  521. inits.writeUInt32LE(1, 1);
  522. break;
  523. case 'agarz.com':
  524. case 'bomb.agar.bio':
  525. case 'm.agar.bio':
  526. case 'agar.bio':
  527. case 'www.agarserv.com/':
  528. case 'blobgame.io':
  529. case 'ultrex.io':
  530. inits.writeUInt32LE(154669603, 1);
  531. break;
  532. case 'ixagar.net':
  533. let strings = [config.botNames[Math.floor(Math.random() * config.botNames.length)], '', '', '', ''];
  534. let stringsLen = 0;
  535. strings.map(a => stringsLen += a.length * 2);
  536. inits = Buffer.alloc(1 + strings.length * 2 + stringsLen);
  537. var i = 0;
  538. inits.writeUInt8(30, i++);
  539. strings.forEach(string => {
  540. inits.writeUInt16LE(string.length, i);
  541. i += 2;
  542. inits.write(string, i, 'utf16le');
  543. i += string.length * 2;
  544. });
  545. this.send(new Buffer.from([130]));
  546. break;
  547. }
  548. this.send(inits);
  549.  
  550. switch (this.originSplit) {
  551. case 'cellcraft.io':
  552. case 'www.cellcraft.io':
  553. case 'http://cellcraft.io':
  554. this.send(Buffer.from([42]));
  555. this.send(Buffer.from([254,5,0,0,0]));
  556. this.send(Buffer.from([255,50,137,112,79]));
  557. this.send(Buffer.from([90,51,24,34,131]));
  558. break;
  559. case 'cellz.io':
  560. this.send(Buffer.from([254, 5, 0, 0, 0]));
  561. this.send(Buffer.from([255, 0, 0, 0, 0]));
  562. this.send(Buffer.from([5]));
  563. this.send(Buffer.from([32, 0]));
  564. this.send(Buffer.from([2,0,0,0,0,0]));
  565. this.send(Buffer.from([2]));
  566. setInterval(function() {
  567. this.send(Buffer.from([0,123,0,34,0,110,0,97,0,109,0,101,0,34,0,58,0,34,0,70,0,114,0,101,0,101,0,84,0,122,0,89,0,84,0,34,0,44,0,34,0,115,0,107,0,105,0,110,0,34,0,58,0,34,0,34,0,44,0,34,0,115,0,107,0,105,0,110,0,50,0,34,0,58,0,34,0,34,0,125,0]));
  568. }.bind(this), 1750 * 2)
  569. break;
  570. case 'us.biome3d.com':
  571. this.send(Buffer.from([1,0,0,0,0,0,0,0,0]));
  572. break;
  573. case 'agariobox.org':
  574. this.send(Buffer.from([254]));
  575. break;
  576. case 'agario.top':
  577. this.send(Buffer.from([19]));
  578. break;
  579. case 'agarx.biz' :
  580. this.send(Buffer.from([254, 1, 0, 0, 0]));
  581. this.send(Buffer.from([255, 114, 97, 103, 79]));
  582. this.send(Buffer.from([19]));
  583. break;
  584. case 'agar.lol':
  585. this.send(Buffer.from([254, 5, 0, 0, 0]));
  586. this.send(Buffer.from([255, 51, 24, 34, 131]));
  587. break;
  588. case 'gaver.io':
  589. this.send(Buffer.from([80]));
  590. break;
  591. case 'agarflix.com':
  592. this.send(Buffer.from([254,4,0,0,0]));
  593. this.send(Buffer.from([255,114,97,103,79]));
  594. this.send(Buffer.from([17]));
  595. // this.send(Buffer.from([192,78,0,101,0,121,0,66,0,111,0,116,0,115,0,46,0,99,0,111,0,109,0]));
  596. break;
  597. case 'agariocity.pro':
  598. this.send(Buffer.from([254,1,0,0,0]));
  599. this.send(Buffer.from([255,114,97,103,79]));
  600. this.send(Buffer.from([19]));
  601. break;
  602. case 'ixagar.net':
  603. this.send(Buffer.from([252,8,0,108,0,119,0,103,0,97,0,45,0,49,0,49,0,48,0,6,0,69,0,55,0,57,0,111,0,118,0,81,0]));
  604. this.send(Buffer.from([30,8,0,80,0,114,0,111,0,102,0,105,0,108,0,101,0,49,0,0,0,32,0,104,0,116,0,116,0,112,0,58,0,47,0,47,0,105,0,120,0,97,0,103,0,97,0,114,0,46,0,110,0,101,0,116,0,47,0,115,0,107,0,105,0,110,0,115,0,47,0,114,0,105,0,110,0,103,0,46,0,112,0,110,0,103,0,6,0,69,0,55,0,57,0,111,0,118,0,81,0,32,0,104,0,116,0,116,0,112,0,58,0,47,0,47,0,105,0,120,0,97,0,103,0,97,0,114,0,46,0,110,0,101,0,116,0,47,0,115,0,107,0,105,0,110,0,115,0,47,0,114,0,105,0,110,0,103,0,46,0,112,0,110,0,103,0]));
  605. this.send(Buffer.from([1]));
  606. break;
  607. case 'www.agar-kicoo.tk':
  608. this.send(Buffer.from([254, 6, 0, 0, 0]));
  609. this.send(Buffer.from([255, 1, 0, 0, 0]));
  610. this.send(Buffer.from([1]));
  611. this.send(Buffer.from([19]));
  612. this.send(Buffer.from([254]));
  613. break;
  614. case 'gota.io':
  615. this.send(Buffer.from([255, 6, 71, 111, 116, 97, 32, 87, 101, 98, 32, 50, 46, 52, 46, 49, 0]));
  616. this.send(Buffer.from([255, 1, 0, 0, 0]));
  617. // this.send(Buffer.from([100, 48, 51, 65, 79, 76, 84, 66, 76, 84, 66, 69, 77, 81, 116, 97, 111, 72, 49, 110, 114, 73, 122, 106, 52, 73, 102, 81, 85, 112, 122, 114, 48, 54, 80, 80, 112, 84, 75, 70, 89, 49, 76, 117, 87, 50, 56, 117, 113, 87, 116, 78, 67, 120, 52, 102, 52, 119, 66, 45, 85, 97, 120, 82, 122, 121, 53, 66, 110, 109, 102, 56, 101, 70, 50, 76, 98, 65, 76, 113, 116, 54, 54, 56, 116, 56, 83, 78, 109, 78, 111, 105, 57, 75, 113, 117, 107, 98 48 82 50 119 71 50 111 65 69 79 113 83 75 80 52 110 68 51 106 76 72 72 111 97 99 71 53 99 78 74 101 120 103 84 85 49 76 121 52 74 117 69 75 77 82 121 56 66 90 57 106 68 98 74 111 65 106 114 51 78 69 70 76 68 121 102 50 95 53 78 75 102 49 55 99 51 85 95 77 95 77 81 55 57 65 53 113 57 45 51 65 97 105 71 117 65 99 104 100 118 76 101 110 45 104 75 112 97 111 84 52 82 51 55 78 48 121 114 83 111 90 107 83 80 77 78 104 45 77 67 87 54 119 114 114 99 77 115 100 69 99 86 83 78 97 55 48 83 99 88 121 120 97 98 118 84 100 78 97 100 52 45 54 52 55 97 66 83 86 113 100 104 101 69 82 103 95 102 105 57 83 56 72 50 48 73 71 121 74 48 80 82 49 88 56 99 104 51 48 73 121 88 117 111 81 97 52 112 52 116 89 45 56 99 120 99 48 95 121 55 87 75 84 79 78 117 118 68 72 88 68 97 108 90 80 77 67 0]));
  618. // this.send(Buffer.from([19]));
  619. this.send(Buffer.from([71]));
  620. break;
  621. case 'biobots.tk':
  622. this.send(Buffer.from([19]));
  623. break;
  624. case 'play.mitos.is':
  625. this.send(Buffer.from([0,0,0,4,0,0,0,4,64,0,0,0,0]));
  626. this.send(Buffer.from([0,0,0,20,0,0,0,19,48,39,163,162,165,132,112,203,217,216,227,251,23,40,66,114,7,171,225,229,8]));
  627. // this.send(Buffer.from([254]));
  628. break;
  629. case 'agario.fun':
  630. this.send(Buffer.from([19]));
  631. break;
  632. case 'agar.pro':
  633. this.send(Buffer.from([254, 5, 0, 0, 0]));
  634. this.send(Buffer.from([255, 1, 0, 0, 0]));
  635. this.send(Buffer.from([19]));
  636. break;
  637. case 'myagar.pro':
  638. this.send(Buffer.from([254, 6, 0, 0, 0]));
  639. this.send(Buffer.from([255, 0, 0, 0, 0]));
  640. // this.send(Buffer.from([88,168,203,203,72,168,203,203,72,168,203,203,72]));
  641. setInterval(() => {
  642. this.send(Buffer.from([254]));
  643. }, 500);
  644. break;
  645. case 'germs.io':
  646. this.send(Buffer.from([255]));
  647. this.send(Buffer.from([123]));
  648. break
  649. case 'ogar.be':
  650. this.send(Buffer.from([254,1,0,0,0]));
  651. this.send(Buffer.from([255,114,97,103,79]));
  652. this.send(Buffer.from([19]));
  653. break;
  654. case 'agar.red':
  655. this.send(Buffer.from([254,6,0,0,0]));
  656. this.send(Buffer.from([255,1,0,0,0]));
  657. this.send(Buffer.from([99,0,115,0]));
  658. setInterval(() => {
  659. this.send(Buffer.from([254]));
  660. }, 500);
  661. break;
  662. case 'powerline.io':
  663. this.send(Buffer.from([191, 160, 0, 78, 0]));
  664. this.send(Buffer.from([0]));
  665. this.send(Buffer.from([7, 94, 0, 78, 0]));
  666. setInterval(function() {
  667. this.send(Buffer.from([3, 78, 0, 101, 0, 121, 0, 66, 0, 111, 0, 116, 0, 115, 0, 45, 0, 99, 0, 111, 0, 109, 0, 0, 0]));
  668. this.send(Buffer.from([12, Math.floor(Math.random() *9)]));
  669. }.bind(this), 1750 * 2)
  670. break;
  671. case 'agar.black':
  672. this.send(Buffer.from([19]));
  673.  
  674. case 'mk-agario.glitch.me':
  675. case 'dummyclient.glitch.me':
  676. case 'ac-clan.glitch.me':
  677. case 'dummyclient.glitch.me':
  678. case 'ac-clan.glitch.me':
  679. case 'agarcell.ml':
  680. case 'sxold.glitch.me':
  681. this.send(Buffer.from([254, 6, 0, 0, 0]));
  682. this.send(Buffer.from([255, 1, 0, 0, 0]));
  683. break;
  684. case 'game.ex-script.com':
  685. this.send(Buffer.from([254,19,0,0,0]));
  686. this.send(Buffer.from([255,114,5,1,4]));
  687. setInterval(() => {
  688. this.send(Buffer.from([254]));
  689. }, 500);
  690. break;
  691. case 'cells.ga':
  692. this.send(Buffer.from([254, 5, 0, 0, 0]));
  693. this.send(Buffer.from([255, 114, 97, 103, 79]));
  694. this.send(Buffer.from([19]));
  695. case 'agariopvp.org':
  696. this.send(Buffer.from([254, 1, 0, 0, 0]));
  697. this.send(Buffer.from([255, 114, 97, 103, 79]));
  698. this.send(Buffer.from([19]));
  699. break;
  700. case 'bomb.agar.bio':
  701. this.send(Buffer.from([254, 1, 0, 0, 0]));
  702. this.send(Buffer.from([255 ,114 ,97 ,103 ,79]));
  703. this.send(Buffer.from([19]));
  704. break;
  705. case 'nagar.eu':
  706. // this.send(Buffer.from([254, 6, 0, 0, 0]));
  707. // this.send(Buffer.from([255, 1, 0, 0, 0]));
  708. setInterval(() => {
  709. this.send(Buffer.from([254]));
  710. }, 500);
  711. break;
  712. case 'agar.gold':
  713. this.send(Buffer.from([254, 5, 0, 0, 0]));
  714. this.send(Buffer.from([255 ,35 ,18 ,56 ,9]));
  715. this.send(Buffer.from([90 ,176 ,33 ,231 ,85]));
  716. this.send(Buffer.from([0, 78 ,0 ,101 ,0 ,121 ,0 ,66 ,0 ,111 ,0 ,116 ,0 ,115 ,0 ,46 ,0 ,99 ,0 ,111 ,0 ,109 ,0 ,42 ,0 ,50 ,0 ,53 ,0 ,52 ,0]));
  717. this.send(Buffer.from([19]));
  718. this.send(Buffer.from([1]));
  719. break;
  720. case 'pok.ist':
  721. this.send(Buffer.from([254,4,0,0,0]));
  722. this.send(Buffer.from([255,114,97,103,79]));
  723. break;
  724. case 'www.agar-kicoo.tk':
  725. this.send(Buffer.from([254, 6, 0, 0, 0]));
  726. // this.send(Buffer.from([123,103,114,101,97,116,95,122,105,108,108,97,125,78,101,121,66,111,116,115,45,99,111,109,0]));
  727. this.send(Buffer.from([255, 1, 0, 0, 0]));
  728. setInterval(() => {
  729. this.send(Buffer.from([254]));
  730. }, 500);
  731. break;
  732. case 'army.ovh':
  733. setInterval(() => {
  734. this.send(Buffer.from([254]));
  735. }, 500);
  736. break;
  737. case 'agarioserver.club':
  738. this.send(Buffer.from([254,5,0,0,0]));
  739. this.send(Buffer.from([255,51,24,34,131]));
  740. // this.send(Buffer.from([80]));
  741. // this.send(Buffer.from([19]));
  742. break;
  743. case 'agix.pw':
  744. this.send(Buffer.from([0, 100, 0, 117, 0, 109, 0, 109, 0, 121, 0, 98, 0, 111, 0, 116, 0, 115, 0, 46, 0, 110, 0, 101, 0, 116, 0]));
  745. break;
  746. case 'www.agarserv.com/':
  747. this.send(Buffer.from([254, 1, 0, 0, 0]));
  748. this.send(Buffer.from([255,114,97,103,79]));
  749. break;
  750. case 'Bubble.am':
  751. this.send(Buffer.from([255,51,24,146,131]));
  752. this.send(Buffer.from([254,4,0,0,0]));
  753. this.send(Buffer.from([253,55,100,49,54,57,50,100,49,98,57,56,49,57,57,101,102,99,100,53,52,52,53,57,55,53,52,55,49,57,55,57,55,56,98,102,51,49,100,53,50]));
  754. break;
  755. case 'gaver.io':
  756. this.send(Buffer.from([254, 5, 0, 0, 0]));
  757. this.send(Buffer.from([255, 35, 18, 56, 9]));
  758. this.send(Buffer.from([19]));
  759. break;
  760. case 'agar.io':
  761. this.send(Buffer.from([254, 20, 0, 0, 0]));
  762. this.send(Buffer.from([255, 203, 118, 0, 0]));
  763. this.send(Buffer.from([409])); //encrypted spawn
  764. console.log(40);
  765. break;
  766. case 'agarprivateservers.org':
  767. this.send(Buffer.from([19]));
  768. break;
  769. case 'ultrex.io':
  770. this.send(Buffer.from([254,6,0,0,0]));
  771. this.send(Buffer.from([145,110,111,116,97,98,111,116,0]));
  772. this.send(Buffer.from([146,116,114,117,101,0]));
  773. this.send(Buffer.from([255,1,0,0,0]));
  774. this.send(Buffer.from([0,60,110,111,110,101,62,102,114,101,101,116,122,121,116,42,33,42,0]));
  775. setInterval(() => {
  776. this.send(Buffer.from([254]));
  777. }, 500);
  778. break;
  779. case 'balz.io':
  780. // this.send(Buffer.from([255,1,0,0,0]));
  781. // this.send(Buffer.from([254,6,0,0,0]));
  782. this.send(Buffer.from([0,0,0,0,3,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,1,0,7,0,0,5,0,0,0,0,0,0,0,0]));
  783. this.send(Buffer.from([0,2,0,0,0]));
  784. this.send(Buffer.from([0,6,0,0,0,0,0,0,0]));
  785. this.send(Buffer.from([0,1,0]));
  786. setInterval(() => {
  787. this.send(Buffer.from([254]));
  788. }, 500);
  789. break;
  790. }
  791.  
  792. this.spawn();
  793. this.nameInterval = setInterval(() => {
  794. //console.log('Spawned');
  795. // this.sendChat('-');
  796. this.spawn();
  797. }, 1000);
  798. }
  799.  
  800. agarHubLogin() {
  801. let account = config.accounts[Math.floor(Math.random() * config.accounts.length)];
  802. let loginBuffer = Buffer.alloc(1 + Buffer.byteLength(account, 'utf16le'));
  803.  
  804. loginBuffer.writeUInt8(30, 0);
  805. loginBuffer.write(account, 1, 'utf16le');
  806. this.send(loginBuffer);
  807. }
  808.  
  809. nameBypass() {
  810. function _0x67e0x24(_0x67e0x3) {
  811. for (var _0x67e0x4 = _0x67e0x3; _0x67e0x4 >= 36;) {
  812. _0x67e0x4 = ~~(_0x67e0x4 / 36) + _0x67e0x4 % 36
  813. };
  814. return _0x67e0x4.toString(36)
  815. }
  816. var _0x67e0x3 = Math.round(Date.now() / 1e3) % 1e3,
  817. _0x67e0x4 = 1e3 * (1e3 * (100 + Math.floor(900 * Math.random())) + _0x67e0x3) + (100 + Math.floor(900 * Math.random()));
  818. return _0x67e0x24(_0x67e0x4) + _0x67e0x4.toString(36) + function (_0x67e0x3) {
  819. var _0x67e0x4 = 1 / _0x67e0x3;
  820. for (; _0x67e0x4 < 100;) {
  821. _0x67e0x4 *= 19
  822. };
  823. return _0x67e0x24(~~_0x67e0x4)
  824. }(_0x67e0x4)
  825. }
  826.  
  827. spawn() {
  828. let inits = Buffer.alloc(5);
  829. inits.writeUInt8(254, 0);
  830. let name = config.botNames[Math.floor(Math.random() * config.botNames.length)];
  831. let spawnBuffer = null;
  832. switch (this.originSplit) {
  833. case 'agar.bio':
  834. case 'bomb.agar.bio':
  835. case 'm.agar.bio':
  836. name = name + id;
  837. spawnBuffer = Buffer.alloc(1 + Buffer.byteLength(name, 'ucs2'));
  838. spawnBuffer.write(name, 1, 'ucs2');
  839. break;
  840. case 'agar.bio':
  841. name = this.nameBypass() + '&' + name;
  842. case 'agar.pro':
  843. case 'dual-agar.me':
  844. case 'cellagar.ml':
  845. name = name + id;
  846. case 'agario.top':
  847. name = name + id;
  848. case 'gaver.io':
  849. case 'gota.io':
  850. name = name + Math.floor(Math.random() * 1000);
  851. // spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  852. // spawnBuffer.write(name, 3, 'utf16le');
  853. spawnBuffer = Buffer.alloc(3 * Buffer.byteLength(name, 'utf16le'));
  854. spawnBuffer.write(name, 1, 'utf16le');
  855. break;
  856. case 'ogar.be':
  857. case 'www.agarserv.com/':
  858. case 'game.ex-script.com':
  859. case 'Bubble.am':
  860. name = name + Math.floor(Math.random() * 1000);
  861. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  862. spawnBuffer.write(name, 1, 'utf16le');
  863. break;
  864. case 'agario.fun':
  865. case 'agar.lol' :
  866. case 'ogar.be':
  867. case 'play.agario0.com':
  868. case 'ultrex.io':
  869. case 'agarioserver.club':
  870. name = name + Math.floor(Math.random() * 1000);
  871. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  872. spawnBuffer.write(name, 1, 'utf16le');
  873. break;
  874. case 'sxold.glitch.me':
  875. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  876. spawnBuffer.write(name, 5, 'utf16le');
  877. break;
  878. case 'blobgame.io':
  879. // name = name;
  880. // spawnBuffer = Buffer.alloc(1 + Buffer.byteLength(name, 'utf16le'));
  881. // spawnBuffer.write(name, 1, 'utf16le');
  882. var skins = ['fly', 'fish', 'amber', 'spider', 'small_chick', 'carp', 'lobster', 'wasp', 'gopher', 'chick', 'sea_turtle', 'octopus', 'lizard', 'rabbit', 'pug', 'mouse', 'birdie', 'bat', 'owl', 'squirrel', 'rooster', 'cat', 'snake', 'crow', 'parrot', 'prey', 'chihuahua', 'fox', 'desert_fox', 'pig', 'dog', 'blackcat', 'coyote', 'goat', 'deer', 'bullking', 'seal', 'fury_cat', 'penguin', 'blueswirl', 'sly', 'husky', 'sheep', 'panda', 'cute_panda', 'angry_panda', 'bear', 'bear_', 'bearr', 'rhino_boxer', 'cougar', 'wolf', 'wolff', 'spirxo', 'sabertooth', 'panther', 'kempo_tiger', 'dark_wings', 'firebird', 'wolf_', 'lion_', 'yeti', 'lion', 'leo', 'king_lion', 'crocodile', 'croc', 'jackal', 'taurus', 'shark', 'colossus', 'orc_grunt', 'behemoth', 'mammoth', 'silver_tusk', 'dragon', 'beast', 'raptor', 't_rex', 'godzilla', 'basilisk', 'sentinel', 'poseidon', 'kraken', 'red_fiend', 'wendigo', 'jotun', 'ice_lord', 'medusa', 'reaper'];
  883. var skin = skins[~~(Math.random() * skins.length)];
  884. var rand = Math.random().toString(36).slice(2 + ~~(Math.random() * 6)); // temporary
  885. name = `<${skin}>${rand}`;
  886. spawnBuffer = Buffer.alloc(1 + Buffer.byteLength(name, 'utf16le'));
  887. spawnBuffer.write(name, 1, 'utf16le');
  888. // this.send(spawnBuffer);
  889. spawnBuffer = Buffer.alloc(1);
  890. spawnBuffer.writeUInt8(1, 0);
  891. // this.send(spawnBuffer);
  892. break;
  893. case 'agariobox.org':
  894. name = name + id;
  895. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  896. spawnBuffer.write(name, 1, 'utf16le');
  897. break;
  898. case 'agarx.biz' :
  899. name = name + id;
  900. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf8'));
  901. spawnBuffer.write(name, 3, 'utf8');
  902. break;
  903. case 'army.ovh':
  904. name = name + Math.floor(Math.random() * 1000);
  905. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  906. // spawnBuffer.writeUInt16LE(59, 1);
  907. spawnBuffer.write(name, 3, 'utf16le');
  908. break;
  909. case 'www.agar-kicoo.tk':
  910. name = name + id;
  911. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  912. spawnBuffer.writeUInt16LE(59, 1);
  913. spawnBuffer.write(name, 3, 'utf16le');
  914. break;
  915. case 'germs.io':
  916. name = name + Math.floor(Math.random() * 1000);
  917. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'ucs2'));
  918. spawnBuffer.write(name, 1, 'ucs2');
  919. break
  920. case 'cells.ga':
  921. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  922. spawnBuffer.write(name, 5, 'utf16le');
  923. break;
  924. case 'agar.ovh':
  925. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf8le'));
  926. spawnBuffer.write(name, 1, 'utf8le');
  927. break;
  928. case 'agar.io':
  929. name = name + id;
  930. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf8'));
  931. spawnBuffer.write(name, 3, 'utf8');
  932. break;
  933. case 'agarprivateservers.org':
  934. name = this.nameBypass() + '&' + name + id;
  935. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf8'));
  936. spawnBuffer.write(name, 3, 'utf8');
  937. break;
  938. case 'dummyclient.glitch.me':
  939. case 'agario.us':
  940. case 'agariogame.club':
  941. name = name + Math.floor(Math.random() * 1000);
  942. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  943. spawnBuffer.write(name, 1, 'utf16le');
  944. break;
  945. case 'agarflix.com':
  946. name = name + Math.floor(Math.random() * 1000);
  947. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  948. spawnBuffer.writeUInt16LE(192, 0);
  949. spawnBuffer.write(name, 1, 'utf16le');
  950. break;
  951. case 'www.agar-kicoo.tk':
  952. case 'agariopvp.org':
  953. name = this.nameBypass() + '&' + name + id;
  954. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  955. spawnBuffer.writeUInt16LE(59, 1);
  956. spawnBuffer.write(name, 3, 'utf16le');
  957. break;
  958. case 'pok.ist':
  959. name = name + id;
  960. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  961. spawnBuffer.writeUInt16LE(192, 0);
  962. spawnBuffer.write(name, 1, 'utf16le');
  963. break;
  964. case 'ac-clan.glitch.me':
  965. name = name + id;
  966. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  967. spawnBuffer.writeUInt16LE(59, 1);
  968. spawnBuffer.write(name, 3, 'utf16le');
  969. break;
  970. case 'biobots.tk':
  971. name = name + id;
  972. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  973. spawnBuffer.writeUInt16LE(59, 1);
  974. spawnBuffer.write(name, 3, 'utf16le');
  975. break;
  976. case 'cellcraft.io':
  977. case 'www.cellcraft.io':
  978. case 'http://cellcraft.io':
  979. name = name + id;
  980. spawnBuffer = new Buffer.alloc(3 + 2 * name.length);
  981. spawnBuffer.writeUInt8(0, 0);
  982. spawnBuffer.writeUInt16LE(59, 1);
  983. for(let i = 0; i < name.length; i++)
  984. spawnBuffer.writeUInt16LE(name.charCodeAt(i), 3 + 2 * i);
  985. this.send(new Uint8Array([29]));
  986. this.send(new Uint8Array([42]));
  987. this.send(spawnBuffer);
  988. break;
  989. case 'germs.io':
  990. name = name + id;
  991. var buffer = new Buffer(1 + 2 * name.length);
  992. // buffer.writeUInt8(123, 0);
  993. buffer.writeUInt16LE(123, 0);
  994. for (let i = 0; i < name.length; i++)
  995. buffer.writeUInt16LE(name.charCodeAt(i), 1 + 2 * i);
  996. this.send(buffer);
  997. break;
  998. case 'targ.io':
  999. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  1000. spawnBuffer.write(name, 3, 'utf16le');
  1001. break;
  1002. case 'agarcell.ml':
  1003. name = name + id;
  1004. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  1005. spawnBuffer.write(name, 3, 'utf16le');
  1006. break;
  1007. case 'agar.red':
  1008. name = name + id;
  1009. var buffer = new Buffer.alloc(1 + 2 * name.length);
  1010. buffer.writeUInt8(0, 0);
  1011. buffer.writeUInt16LE(59, 1);
  1012. for (let i = 0; i < name.length; i++)
  1013. buffer.writeUInt16LE(name.charCodeAt(i), 1 + 2 * i);
  1014. this.send(buffer);
  1015. break;
  1016. case 'mk-agario.glitch.me':
  1017. name = name + Math.floor(Math.random() * 1000);
  1018. spawnBuffer = Buffer.alloc(1 + Buffer.byteLength(name, 'ucs2'));
  1019. spawnBuffer.write(name, 1, 'ucs2');
  1020. break;
  1021. case 'agariocity.pro':
  1022. case 'ixagar.net':
  1023. name = name + Math.floor(Math.random() * 1000);
  1024. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  1025. spawnBuffer.writeUInt16LE(59, 1);
  1026. spawnBuffer.write(name, 3, 'utf16le');
  1027. break;
  1028. case 'nagar.eu':
  1029. case 'play.mitos.is':
  1030. name = name + Math.floor(Math.random() * 1000);
  1031. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  1032. spawnBuffer.write(name, 1, 'utf16le');
  1033. break;
  1034. case 'agar.black':
  1035. name = name + id;
  1036. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  1037. spawnBuffer.writeUInt16LE(59, 1);
  1038. spawnBuffer.write(name, 3, 'utf16le');
  1039. break;
  1040. case 'agar.tv':
  1041. name = name + Math.floor(Math.random() * 1000);
  1042. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  1043. spawnBuffer.writeUInt16LE(192, 0);
  1044. spawnBuffer.write(name, 1, 'utf16le');
  1045. break;
  1046. case 'agar.wiki':
  1047. name = name + Math.floor(Math.random() * 1000);
  1048. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  1049. spawnBuffer.writeUInt16LE(192, 0);
  1050. spawnBuffer.write(name, 1, 'utf16le');
  1051. break;
  1052. case 'agix.pw':
  1053. spawnBuffer = Buffer.alloc(3 + Buffer.byteLength(name, 'utf16le'));
  1054. spawnBuffer.writeUInt16LE(59, 1);
  1055. spawnBuffer.write(name, 3, 'utf16le');
  1056. break;
  1057. case 'agar.one':
  1058. name = this.nameBypass() + '&' + name + '&' + id;
  1059. spawnBuffer = Buffer.alloc(1 + Buffer.byteLength(name));
  1060. spawnBuffer.write(name, 1);
  1061. break;
  1062. case 'balz.io':
  1063. case 'myagar.pro':
  1064. name = name + Math.floor(Math.random() * 1000);
  1065. spawnBuffer = Buffer.alloc(1 + Buffer.byteLength(name, 'utf8'));
  1066. spawnBuffer.write(name, 1, 'utf8');
  1067. break;
  1068. }
  1069. this.send(spawnBuffer);
  1070. }
  1071.  
  1072. sendChat(message) {
  1073. let chatBuffer;
  1074. switch (this.originSplit) {
  1075. case 'agar.red':
  1076. case 'ixagar.net':
  1077. case 'game.ex-script.com':
  1078. case 'cellcraft.io':
  1079. case 'www.cellcraft.io':
  1080. case 'http://cellcraft.io':
  1081. case 'agar.pro':
  1082. case 'agar.bio':
  1083. case 'bomb.agar.bio':
  1084. case 'cellz.io':
  1085. case 'army.ovh':
  1086. case 'play.agario0.com':
  1087. case 'agario.top':
  1088. case 'ogar.be':
  1089. case 'agariocity.pro':
  1090. case 'agar.pro':
  1091. case 'myagar.pro':
  1092. case 'cellagar.ml':
  1093. case 'zgar.glitch.me':
  1094. case 'germs.io':
  1095. case 'mk-agario.glitch.me':
  1096. case 'agar.one':
  1097. case 'agocell.eu':
  1098. case 'agix.pw':
  1099. case 'ac-clan.glitch.me':
  1100. case 'dummyclient.glitch.me':
  1101. case 'agar.black':
  1102. case 'senpa.io':
  1103. case 'nagar.eu':
  1104. case 'gaver.io':
  1105. case 'blobgame.io':
  1106. case 'gota.io':
  1107. case 'agariobox.org':
  1108. chatBuffer = Buffer.alloc(2 + message.length * 2);
  1109. chatBuffer.writeUInt8(99, 0);
  1110. chatBuffer.write(message, 2, 'utf16le');
  1111. break;
  1112. case 'balz.io':
  1113. case 'targ.io':
  1114. case 'blobgame.io':
  1115. case 'senpa.io':
  1116. case 'game.ex-script.com':
  1117. case 'ixagar.net':
  1118. case 'mk-agario.glitch.me':
  1119. case 'zgar.glitch.me':
  1120. case 'gaver.io':
  1121.  
  1122. chatBuffer = Buffer.alloc(3 + message.length);
  1123. chatBuffer.writeUInt8(99, 0);
  1124. chatBuffer.write(message, 2);
  1125. break;
  1126. }
  1127. this.send(chatBuffer);
  1128. }
  1129.  
  1130.  
  1131. onmessage(msg) { //not needed at the moment
  1132. msg = msg.data;
  1133. let opcode = msg.readUInt8(0);
  1134. switch (opcode) {
  1135. case 16:
  1136. try {
  1137. this.handleWorldUpdate(msg);
  1138. } catch (e) {}
  1139. break;
  1140. case 32:
  1141. this.playerNodeIds.push(msg.readUInt32LE(1));
  1142. break;
  1143. }
  1144. }
  1145.  
  1146. onclose(error) {
  1147. clearInterval(this.nameInterval);
  1148. if (this.stopped) return;
  1149. this.proxy = getProxy();
  1150.  
  1151. if (this.ip)
  1152. this.connect(this.ip);
  1153. }
  1154.  
  1155. onerror(error) {}
  1156.  
  1157. /* send(buffer) {
  1158. if (this.ws && this.ws.readyState == 1)
  1159. this.ws.send(buffer);
  1160. }*/
  1161. send(buffer) {
  1162. if (!this.ws || this.ws.readyState !== WebSocket.OPEN == 1) return;
  1163. if(this.started == true) return;
  1164. if(this.origin == "http://bubble.am") this.ws.send(buffer);
  1165. else this.ws.send(buffer);
  1166. // console.log(buffer);
  1167. }
  1168.  
  1169. }
  1170.  
  1171. class Node {
  1172. constructor() {
  1173. this.x = 0;
  1174. this.y = 0;
  1175. this.size = 0;
  1176. this.id = 0;
  1177. this.color = null;
  1178. this.flags = 0;
  1179. this.name = null;
  1180. }
  1181. }
  1182.  
  1183. class Client {
  1184.  
  1185. constructor(ws, req) {
  1186. this.origin = req.headers.origin;
  1187. this.botConnectInt = [];
  1188. this.started = false;
  1189. this.bots = [];
  1190. this.pelletsMode = false;
  1191. this.ws = ws;
  1192. this.setup();
  1193. connectedUsers++;
  1194. console.log(`A user has connected! Connected users: ${connectedUsers}`);
  1195. }
  1196.  
  1197. setup() {
  1198. this.ws.on('message', this.onmessage.bind(this));
  1199. this.ws.on('close', this.onclose.bind(this));
  1200. this.ws.on('error', this.onerror.bind(this));
  1201. for (let i = 0; i < config.maxBots; i++)
  1202. this.bots.push(new Bot(this.origin, this));
  1203. this.startBotCount();
  1204. }
  1205.  
  1206. onmessage(message) {
  1207. const json = JSON.parse(message);
  1208. switch (json.type) {
  1209.  
  1210. case 'start':
  1211. this.startBots(json.ip, this.origin);
  1212. console.log('user started bots on ', this.origin, json.ip)
  1213. break;
  1214.  
  1215. case 'updatePos':
  1216. if(this.bots[0].pelletsMode) {
  1217. for(let i = 0; i < this.bots.length; i++) this.bots[i].collectPellets(json.x, json.y, json.byteLen);
  1218. break;
  1219. }
  1220. this.sendBotPos(json.x, json.y, json.byteLen);
  1221. break;
  1222.  
  1223. case 'split':
  1224. this.bots.forEach(bot => {
  1225. bot.send(Buffer.from([17]));
  1226. });
  1227. break;
  1228. case 'pellets':
  1229. this.pelletsMode = !this.pelletsMode;
  1230. for(let i = 0; i < this.bots.length; i++) {
  1231. if(this.pelletsMode) this.bots[i].pelletsMode = true;
  1232. else this.bots[i].pelletsMode = false;
  1233. }
  1234. break;
  1235. case 'chat':
  1236. this.bots.forEach(bot => {
  1237. bot.sendChat(json.msg);
  1238. });
  1239. break;
  1240.  
  1241. case 'eject':
  1242. this.bots.forEach(bot => {
  1243. bot.send(Buffer.from([21]));
  1244. bot.send(Buffer.from([36]));
  1245. });
  1246. break;
  1247. }
  1248.  
  1249. }
  1250.  
  1251. sendMitosis() {
  1252. let buffer = new Buffer(1);
  1253. buffer.writeUInt8(17, 0);
  1254.  
  1255. this.send(buffer);
  1256. }
  1257.  
  1258. sendBotPos(x, y, byteLen) {
  1259. if (!byteLen) return;
  1260. let moveBuffer = Buffer.alloc(byteLen);
  1261.  
  1262.  
  1263. moveBuffer.writeUInt8(16, 0);
  1264. switch (byteLen) {
  1265. case 13:
  1266. case 9:
  1267. moveBuffer.writeInt32LE(x, 1);
  1268. moveBuffer.writeInt32LE(y, 5);
  1269. break;
  1270. case 21:
  1271. moveBuffer.writeDoubleLE(x, 1);
  1272. moveBuffer.writeDoubleLE(y, 9);
  1273. break;
  1274. case 16:
  1275. moveBuffer.writeIntDoubleLE(x, 1) + moveBuffer.writeInDoubleLE(x, 17) / 2;
  1276. moveBuffer.writeIntDoubleLE(y, 9) + moveBuffer.writeInDoubleLE(y, 25) / 2;
  1277.  
  1278. break;
  1279. case 89:
  1280. {
  1281. /*this.botName = this.botName;
  1282. this.buffers.sInit = new Buffer(5 + 2 * this.botName.length);
  1283. var trans = message.readUInt32LE(1);
  1284. var r20 = Math.sqrt(trans - 347712);
  1285. this.buffers.sInit.writeUInt8(28, 0);
  1286. this.buffers.sInit.writeUInt32LE(r20, 1);
  1287. for (var n = 0; n < this.botName.length; n++) {
  1288. this.buffers.sInit.writeUInt16LE(this.botName.charCodeAt(n), 5 + 2 * n, true);
  1289. }
  1290. this.ws.send(this.buffers.Init.Init_3);
  1291. this.ws.send(this.buffers.Init.Init_4);
  1292. this.ws.send(this.buffers.sInit);
  1293. this.sendchat("I ROBOT I WORK!!!" + Math.random());
  1294. console.log("new spawn buffer detect", r20, trans, new Uint8Array(this.buffers.sInit));*/
  1295. }
  1296. break;
  1297. }
  1298.  
  1299. this.bots.forEach(bot => {
  1300. bot.send(moveBuffer);
  1301. });
  1302. }
  1303.  
  1304. startBotCount() {
  1305. this.botCountInt = setInterval(() => {
  1306. let json = {
  1307. type: 'botCount',
  1308. connected: 0,
  1309. maxBots: config.maxBots
  1310. };
  1311. this.bots.forEach(bot => {
  1312. if (bot.ws && bot.ws.readyState == 1)
  1313. json.connected++;
  1314. });
  1315. this.send(json);
  1316. }, 100);
  1317. }
  1318.  
  1319. stopBotCount() {
  1320. clearInterval(this.botCountInt);
  1321. }
  1322.  
  1323. onclose() {
  1324. this.stopBotCount();
  1325. connectedUsers--;
  1326. console.log(`A user has disconnected! Connected users: ${connectedUsers}`);
  1327. }
  1328.  
  1329. startBots(serverip) {
  1330. if (this.started) return;
  1331. this.bots.forEach((bot, i) => {
  1332. this.botConnectInt.push(setTimeout(() => {
  1333. if (!this.started) return;
  1334. bot.connect(serverip.replace('https', 'wss'));
  1335. // console.log(serverip);
  1336. }, 70* i));
  1337. });
  1338. this.started = true;
  1339. }
  1340.  
  1341. onerror() {}
  1342.  
  1343. send(message) {
  1344. if (this.ws && this.ws.readyState == 1) this.ws.send(JSON.stringify(message));
  1345. }
  1346.  
  1347. }
  1348.  
  1349. /*const wss = new WebSocket.Server({
  1350. port: 8080
  1351. });
  1352.  
  1353. wss.on('connection', (ws, req) => {
  1354. ws.Client = new Client(ws, req);
  1355. });*/
  1356. var useSSL = false;
  1357.  
  1358. if (useSSL) {
  1359. var https = require('https');
  1360.  
  1361. var app = https.createServer({
  1362. key: fs.readFileSync('/root/key.pem'),
  1363. cert: fs.readFileSync('/root/cert.pem')
  1364. }).listen(8443);
  1365.  
  1366. const wss = new WebSocket.Server({ server: app });
  1367.  
  1368. wss.on('connection', (ws, req) => {
  1369. ws.Client = new Client(ws, req);
  1370. });
  1371. } else {
  1372. const wss = new WebSocket.Server({ port: 8081 });
  1373. var clients = [];
  1374. wss.on('connection', (ws, req) => {
  1375. ws.Client = new Client(ws, req);
  1376. });
  1377. wss.on('connection', function connection(ws) {
  1378. ws.on('message', function incoming(message) {
  1379. let opcode = message.readUInt8;
  1380. // console.log(message);
  1381. let off = 1;
  1382. switch (opcode) {
  1383. case 0x10:
  1384. clientX = message.readDoubleLE(1);
  1385. clientY = message.readDoubleLE(9);
  1386. break;
  1387. case 0x20:
  1388. for (let i = 0; i < clients.length; i++) {
  1389. clients[i].sendMitosis();
  1390. }
  1391. break;
  1392. case 0x21:
  1393. for (let i = 0; i < clients.length; i++) {
  1394. clients[i].sendEject();
  1395. }
  1396. break;
  1397. case 0x22:
  1398. aiMode = !aiMode;
  1399. break;
  1400. case 0xff:
  1401. if (clients.length > 0) {
  1402. break;
  1403. }
  1404.  
  1405. let ip = '',
  1406. ch = 0;
  1407. let amount = 0;
  1408.  
  1409. amount = Math.min(message.readUInt16LE(off), 500);
  1410. off += 2;
  1411.  
  1412. while (true) {
  1413. ch = message.readUInt16LE(off);
  1414. off += 2;
  1415. if (!ch) break;
  1416. ip += String.fromCharCode(ch);
  1417. }
  1418.  
  1419. console.log(ip, amount);
  1420.  
  1421. for (let i = 0; i < amount; i++) {
  1422. let c = new Client();
  1423.  
  1424. c.connect(ip);
  1425. clients.push(c);
  1426. }
  1427. break;
  1428. case 0xfe:
  1429. clients = [];
  1430.  
  1431. break;
  1432. }
  1433. });
  1434. });
  1435. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement