Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.74 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Krunker WheelChair
  3. // @namespace https://github.com/hrt
  4. // @version 1.8.9
  5. // @description WheelChair
  6. // @author hrt x ttap x MasterP(Menu)
  7. // @match *://krunker.io/*
  8. // @run-at document-start
  9. // @grant none
  10. // @require https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js
  11. // @require https://krunkr.com/assets/js/canvas.gui.js?ver=0.6
  12. // ==/UserScript==
  13. WebFont.load({
  14. google: {
  15. families: ['Roboto']
  16. }
  17. });
  18. (function () {
  19. const replace = String.prototype.replace;
  20. const original_call = Function.prototype.call;
  21.  
  22. let anti_map = [];
  23.  
  24. const options = {
  25. aimbot: true,
  26. silentAim: false,
  27. boxEsp: true,
  28. boxColor: "rgba(244,100,80,1)",
  29. weaponEsp: true,
  30. healthEsp: true,
  31. nameEsp: true,
  32. chams: true,
  33. autoReload: true,
  34. autoJump: true,
  35. chamsColorStr: "rgba(255,0,0,1)",
  36. chamsRed: 255,
  37. chamsBlue: 0,
  38. chamsGreen: 0,
  39. };
  40. const styles = {
  41. fontFamily: "Roboto",
  42. itemHeight: 28,
  43. setup: {
  44. background: "#0B132B",
  45. color: "#4c698d",
  46. fontSize: "16px",
  47. header: {
  48. color: "#839cbc",
  49. fontSize: "20px",
  50. borderBottom: "#3A506B",
  51. paddingBottom: 20
  52. },
  53. steps: {
  54. background: "white",
  55. selected: "#5BC0BE",
  56. }
  57. },
  58. profiles: {
  59. background: "#090F22",
  60. borderBottom: "#4c698d"
  61. },
  62. folder: {
  63. header: {
  64. color: "#4c698d",
  65. fontSize: "15.4px",
  66. background: "#0B132B"
  67. }
  68. },
  69. item: {
  70. color: "#839cbc",
  71. fontSize: "13.2px",
  72. background: "#1C2541"
  73. },
  74. button: {
  75. background: "#1C2541",
  76. lineTop: "#5BC0BE",
  77. color: "#4c698d",
  78. hovered: "#5BC0BE",
  79. hoveredColor: "#242f53"
  80. },
  81. checkbox: {
  82. background: "#242f53",
  83. checkedBg: "#5BC0BE",
  84. hovered: "rgba(91,192,190,0.3)",
  85. width: 18,
  86. height: 18
  87. },
  88. input: {
  89. background: "#242f53",
  90. color: "#4c698d",
  91. cursor: "#839cbc",
  92. width: 120,
  93. height: 22
  94. },
  95. select: {
  96. background: "#242f53",
  97. color: "#4c698d",
  98. hovered: "#3A506B",
  99. width: 80,
  100. height: 20,
  101. },
  102. option: {
  103. background: "#242f53",
  104. color: "#4c698d",
  105. hovered: "#3A506B",
  106. hoveredColor: "white",
  107. outline: "#0B132B"
  108. },
  109. slider: {
  110. background: "#242f53",
  111. color: "#5BC0BE",
  112. slider: "#5BC0BE",
  113. hovered: "#3A506B",
  114. width: 89,
  115. height: 20,
  116. leftPadding: 100,
  117. input: {
  118. width: 43,
  119. }
  120. }
  121. }
  122.  
  123. // hook toString to conceal all hooks
  124. const original_toString = Function.prototype.toString;
  125. let hook_toString = new Proxy(original_toString, {
  126. apply: function (target, _this, _arguments) {
  127. for (var i = 0; i < anti_map.length; i++) {
  128. if (anti_map[i].from === _this) {
  129. return target.apply(anti_map[i].to, _arguments);
  130. }
  131. }
  132. return target.apply(_this, _arguments);
  133. }
  134. });
  135. // hide toString hook itself
  136. anti_map.push({
  137. from: hook_toString,
  138. to: original_toString
  139. });
  140. Function.prototype.toString = hook_toString;
  141.  
  142. let conceal_function = function (original_Function, hook_Function) {
  143. anti_map.push({
  144. from: hook_Function,
  145. to: original_Function
  146. });
  147. };
  148.  
  149. // hook Object.getOwnPropertyDescriptors to hide variables from window
  150. let hidden_globals = [];
  151. const original_getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors;
  152. let hook_getOwnPropertyDescriptors = new Proxy(original_getOwnPropertyDescriptors, {
  153. apply: function (target, _this, _arguments) {
  154. let descriptors = target.apply(_this, _arguments);
  155. for (var i = 0; i < hidden_globals.length; i++) {
  156. delete descriptors[hidden_globals[i]];
  157. }
  158. return descriptors;
  159. }
  160. });
  161. Object.getOwnPropertyDescriptors = hook_getOwnPropertyDescriptors;
  162. conceal_function(original_getOwnPropertyDescriptors, hook_getOwnPropertyDescriptors);
  163.  
  164. let invisible_define = function (obj, key, value) {
  165. hidden_globals.push(key);
  166. Object.defineProperty(obj, key, {
  167. enumberable: false,
  168. configurable: false,
  169. writable: true,
  170. value: value
  171. });
  172. };
  173.  
  174. let global_invisible_define = function (key, value) {
  175. invisible_define(window, key, value);
  176. };
  177.  
  178. // we generate random keys for global variables and make it almost impossible(?)
  179. // for outsiders to find programatically
  180. let keyMap = {};
  181. let genKey = function () {
  182. // https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
  183. let a = new Uint8Array(20);
  184. crypto.getRandomValues(a);
  185. return 'hrt' + Array.from(a, x => ('0' + x.toString(16)).substr(-2)).join('');
  186. }
  187.  
  188. keyMap['init'] = genKey();
  189. global_invisible_define(keyMap['init'], false);
  190.  
  191. keyMap['scalingFactor'] = genKey();
  192. global_invisible_define(keyMap['scalingFactor'], 0);
  193.  
  194. keyMap['options'] = genKey();
  195. global_invisible_define(keyMap['options'], options);
  196. console.log(window[keyMap['options']])
  197.  
  198. //Menu setup
  199.  
  200. keyMap['MyGUI'] = genKey();
  201. global_invisible_define(keyMap['MyGUI'], MyGUI);
  202. const menu = new window[keyMap['MyGUI']](false, 0, 0, 250, 250, styles, "wheelchair", 1)
  203.  
  204. keyMap['menu'] = genKey();
  205. global_invisible_define(keyMap['menu'], menu);
  206.  
  207. const poweredWheelAimbot = menu.addFolder("Aimbot", true)
  208. const poweredWheelVisuals = menu.addFolder("Visuals", true)
  209. const poweredWheelOther = menu.addFolder("Other", true)
  210.  
  211. poweredWheelAimbot.add("Aimbot", window[keyMap['options']], "aimbot", "Check")
  212. poweredWheelAimbot.add("Silent Aim", window[keyMap['options']], "silentAim", "Check")
  213. poweredWheelAimbot.add("Auto Reload", window[keyMap['options']], "autoReload", "Check")
  214. poweredWheelVisuals.add("Name Esp", window[keyMap['options']], "nameEsp", "Check")
  215. poweredWheelVisuals.add("Box Esp", window[keyMap['options']], "boxEsp", "Check")
  216. poweredWheelVisuals.add("Weapon Esp", window[keyMap['options']], "weaponEsp", "Check")
  217. poweredWheelVisuals.add("Health Esp", window[keyMap['options']], "healthEsp", "Check")
  218. poweredWheelVisuals.add("Chams", window[keyMap['options']], "chams", "Check")
  219. poweredWheelVisuals.add("Box Color", window[keyMap['options']], "boxColor", "Color")
  220. poweredWheelOther.add("Auto Jump", window[keyMap['options']], "autoJump", "Check")
  221. poweredWheelVisuals.add("Chams Color", window[keyMap['options']], "chamsColorStr", "Color")
  222. .onChange((val) => {
  223. const {
  224. 1: r,
  225. 2: g,
  226. 3: b
  227. } = val.match(/rgba\((\d+),(\d+),(\d+),\d+\)/)
  228. window[keyMap['options']].chamsRed = (r - 0) / (255 - 0)
  229. window[keyMap['options']].chamsGreen = (g - 0) / (255 - 0)
  230. window[keyMap['options']].chamsBlue = (b - 0) / (255 - 0)
  231. })
  232.  
  233.  
  234.  
  235. // drawVisuals gets overwritten later - place hook before anti cheat loads
  236. let drawVisuals = function () {};
  237. const original_clearRect = CanvasRenderingContext2D.prototype.clearRect;
  238. let hook_clearRect = new Proxy(original_clearRect, {
  239. apply: function (target, _this, _arguments) {
  240. if (_arguments.length === 5) {
  241. target.apply(_this, _arguments);
  242. } else {
  243. drawVisuals(_this);
  244. }
  245. }
  246. });
  247. conceal_function(original_clearRect, hook_clearRect);
  248. CanvasRenderingContext2D.prototype.clearRect = hook_clearRect;
  249.  
  250. var original_scale = CanvasRenderingContext2D.prototype.scale;
  251. let hook_scale = new Proxy(original_scale, {
  252. apply: function (target, _this, _arguments) {
  253. if (window[keyMap['scalingFactor']] === _arguments[0]) {
  254. window[keyMap['menu']].draw(_this, true)
  255. }
  256. target.apply(_this, _arguments);
  257. }
  258. });
  259. CanvasRenderingContext2D.prototype.scale = hook_scale;
  260. conceal_function(original_scale, hook_scale);
  261.  
  262. // me, inputs, world, consts, math are objects the rest are key strings
  263. let hrtCheat = function (me, inputs, world, consts, math, canSee, pchObjc, objInstances, isYou, recoilAnimY, mouseDownL, mouseDownR) {
  264. /* re implements code that we overwrote to place hook */
  265. let controls = world.controls;
  266. if (controls.scrollDelta) {
  267. controls.skipScroll = controls.scrollToSwap;
  268. if (!controls.scrollToSwap) {
  269. controls.fakeKey(0x4e20, 0x1);
  270. }
  271. }
  272. controls.scrollDelta = 0;
  273. controls.wSwap = 0;
  274. /******************************************************/
  275.  
  276. const playerHeight = 11;
  277. const crouchDst = 3;
  278. const headScale = 2;
  279. const hitBoxPad = 1;
  280. const armScale = 1.3;
  281. const chestWidth = 2.6;
  282. const armInset = -.1;
  283. const playerScale = (2 * armScale + chestWidth + armInset) / 2;
  284. const SHOOT = 5,
  285. SCOPE = 6,
  286. xDr = 3,
  287. yDr = 2,
  288. JUMP = 7,
  289. CROUCH = 8;
  290. let isEnemy = function (player) {
  291. return !me.team || player.team != me.team
  292. };
  293. let canHit = function (player) {
  294. return null == world[canSee](me, player.x3, player.y3 - player.crouchVal * crouchDst, player.z3)
  295. };
  296. let normaliseYaw = function (yaw) {
  297. return (yaw % Math.PI2 + Math.PI2) % Math.PI2;
  298. };
  299. let getDir = function (a, b, c, d) {
  300. return Math.atan2(b - d, a - c);
  301. };
  302. let getD3D = function (a, b, c, d, e, f) {
  303. let g = a - d,
  304. h = b - e,
  305. i = c - f;
  306. return Math.sqrt(g * g + h * h + i * i);
  307. };
  308. let getXDire = function (a, b, c, d, e, f) {
  309. let g = Math.abs(b - e),
  310. h = getD3D(a, b, c, d, e, f);
  311. return Math.asin(g / h) * (b > e ? -1 : 1);
  312. };
  313.  
  314. let dAngleTo = function (x, y, z) {
  315. let ty = normaliseYaw(getDir(controls.object.position.z, controls.object.position.x, z, x));
  316. let tx = getXDire(controls.object.position.x, controls.object.position.y, controls.object.position.z, x, y, z);
  317. let oy = normaliseYaw(controls.object.rotation.y);
  318. let ox = controls[pchObjc].rotation.x;
  319. let dYaw = Math.min(Math.abs(ty - oy), Math.abs(ty - oy - Math.PI2), Math.abs(ty - oy + Math.PI2));
  320. let dPitch = tx - ox;
  321. return Math.hypot(dYaw, dPitch);
  322. };
  323. let calcAngleTo = function (player) {
  324. return dAngleTo(player.x3, player.y3 + playerHeight - (headScale + hitBoxPad) / 2 - player.crouchVal * crouchDst, player.z3);
  325. };
  326. let calcDistanceTo = function (player) {
  327. return getD3D(player.x3, player.y3, player.z3, me.x, me.y, me.z)
  328. };
  329. let isCloseEnough = function (player) {
  330. let distance = calcDistanceTo(player);
  331. return me.weapon.range >= distance && ("Shotgun" != me.weapon.name || distance < 70) && ("Akimbo Uzi" != me.weapon.name || distance < 100);
  332. };
  333. let haveAmmo = function () {
  334. return !(me.ammos[me.weaponIndex] !== undefined && me.ammos[me.weaponIndex] == 0);
  335. };
  336.  
  337. let closest = null,
  338. closestAngle = Infinity;
  339. let players = world.players.list;
  340. if (window[keyMap['options']].aimbot) {
  341. // target selector - based on closest to aim
  342.  
  343. for (var i = 0; me.active && i < players.length; i++) {
  344. let e = players[i];
  345. if (e[isYou] || !e.active || !e[objInstances] || !isEnemy(e)) {
  346. continue;
  347. }
  348.  
  349. // experimental prediction removed
  350. e.x3 = e.x;
  351. e.y3 = e.y;
  352. e.z3 = e.z;
  353.  
  354. if (!isCloseEnough(e) || !canHit(e)) {
  355. continue;
  356. }
  357.  
  358. let angle = calcAngleTo(e);
  359. if (angle < closestAngle) {
  360. closestAngle = angle;
  361. closest = e;
  362. }
  363. }
  364. // aimbot
  365. let ty = controls.object.rotation.y,
  366. tx = controls[pchObjc].rotation.x;
  367. if (closest) {
  368. let target = closest;
  369. let y = target.y3 + 5 - (headScale /* + hitBoxPad*/ ) / 2 - target.crouchVal * crouchDst;
  370. if (me.weapon.nAuto && me.didShoot) {
  371. inputs[SHOOT] = 0;
  372. } else if (!me.aimVal) {
  373. inputs[SHOOT] = controls[mouseDownL];
  374. inputs[SCOPE] = controls[mouseDownR];
  375. } else {
  376. inputs[SCOPE] = controls[mouseDownR];
  377. }
  378.  
  379. ty = getDir(controls.object.position.z, controls.object.position.x, target.z3, target.x3);
  380. tx = getXDire(controls.object.position.x, controls.object.position.y, controls.object.position.z, target.x3, y, target.z3);
  381.  
  382. // perfect recoil control
  383. tx -= .3 * me[recoilAnimY];
  384. } else {
  385. inputs[SHOOT] = controls[mouseDownL];
  386. inputs[SCOPE] = controls[mouseDownR];
  387. }
  388.  
  389. // silent aim
  390. const newY = (ty % Math.PI2).round(3);
  391. const newX = (tx % Math.PI2).round(3);
  392. inputs[xDr] = newX;
  393. inputs[yDr] = newY;
  394. if (!window[keyMap['options']].silentAim) {
  395. controls.object.rotation.y = newY
  396. controls[pchObjc].rotation.x = newX
  397. }
  398. }
  399. // auto reload
  400. if (window[keyMap['options']].autoReload) controls.keys[controls.reloadKey] = !haveAmmo();
  401.  
  402. // bhop
  403. if (window[keyMap['options']].autoJump) inputs[JUMP] = (controls.keys[controls.jumpKey] && !me.didJump) * 1;
  404.  
  405. // runs once to set up renders
  406. if (!window[keyMap['init']]) {
  407. window[keyMap['init']] = true;
  408.  
  409. drawVisuals = function (c) {
  410. let scalingFactor = arguments.callee.caller.caller.arguments[0];
  411. window[keyMap['scalingFactor']] = scalingFactor;
  412. let perspective = arguments.callee.caller.caller.arguments[2];
  413. let scaledWidth = c.canvas.width / scalingFactor;
  414. let scaledHeight = c.canvas.height / scalingFactor;
  415. let worldPosition = perspective.camera.getWorldPosition();
  416. for (var i = 0; i < world.players.list.length; i++) {
  417. let player = world.players.list[i];
  418. let e = players[i];
  419. if (e[isYou] || !e.active || !e[objInstances] || !isEnemy(e)) {
  420. continue;
  421. }
  422.  
  423. // the below variables correspond to the 2d box esps corners
  424. // note: we can already tell what ymin ymax is
  425. let xmin = Infinity;
  426. let xmax = -Infinity;
  427. let ymin = Infinity;
  428. let ymax = -Infinity;
  429. let br = false;
  430. for (var j = -1; !br && j < 2; j += 2) {
  431. for (var k = -1; !br && k < 2; k += 2) {
  432. for (var l = 0; !br && l < 2; l++) {
  433. let position = e[objInstances].position.clone();
  434. position.x += j * playerScale;
  435. position.z += k * playerScale;
  436. position.y += l * (playerHeight - e.crouchVal * crouchDst);
  437. if (!perspective.frustum.containsPoint(position)) {
  438. br = true;
  439. break;
  440. }
  441. position.project(perspective.camera);
  442. xmin = Math.min(xmin, position.x);
  443. xmax = Math.max(xmax, position.x);
  444. ymin = Math.min(ymin, position.y);
  445. ymax = Math.max(ymax, position.y);
  446. }
  447. }
  448. }
  449.  
  450. if (br) {
  451. continue;
  452. }
  453.  
  454. xmin = (xmin + 1) / 2;
  455. ymin = (ymin + 1) / 2;
  456. xmax = (xmax + 1) / 2;
  457. ymax = (ymax + 1) / 2;
  458.  
  459.  
  460. c.save();
  461. // save and restore these variables later so they got nothing on us
  462. const original_strokeStyle = c.strokeStyle;
  463. const original_lineWidth = c.lineWidth;
  464. const original_font = c.font;
  465. const original_fillStyle = c.fillStyle;
  466.  
  467. // perfect box esp
  468.  
  469. let distanceScale = Math.max(.3, 1 - getD3D(worldPosition.x, worldPosition.y, worldPosition.z, e.x, e.y, e.z) / 600);
  470. c.scale(distanceScale, distanceScale);
  471. let xScale = scaledWidth / distanceScale;
  472. let yScale = scaledHeight / distanceScale;
  473. ymin = yScale * (1 - ymin);
  474. ymax = yScale * (1 - ymax);
  475. xmin = xScale * xmin;
  476. xmax = xScale * xmax;
  477. if (window[keyMap['options']].boxEsp) {
  478. c.lineWidth = 5;
  479. c.strokeStyle = window[keyMap['options']].boxColor;
  480. c.beginPath();
  481. c.moveTo(xmin, ymin);
  482. c.lineTo(xmin, ymax);
  483. c.lineTo(xmax, ymax);
  484. c.lineTo(xmax, ymin);
  485. c.lineTo(xmin, ymin);
  486. c.stroke();
  487. }
  488.  
  489. // health bar
  490. if (window[keyMap['options']].healthEsp) {
  491. c.fillStyle = "rgba(255,50,50,1)";
  492. var barMaxHeight = ymax - ymin;
  493. c.fillRect(xmin - 7, ymin, -10, barMaxHeight);
  494. c.fillStyle = "#00FFFF";
  495. c.fillRect(xmin - 7, ymin, -10, barMaxHeight * (e.health / e.maxHealth));
  496. }
  497. // info
  498. var x = xmax + 7;
  499. var y = ymax;
  500. c.fillStyle = "white";
  501. c.strokeStyle = 'black';
  502. c.lineWidth = 1;
  503. if (window[keyMap['options']].nameEsp) {
  504. c.font = "60px Roboto";
  505. c.fillText(e.name, x, y);
  506. c.strokeText(e.name, x, y);
  507. }
  508. c.font = "30px Sans-serif";
  509. if (window[keyMap['options']].weaponEsp) {
  510. y += 35;
  511. c.fillText(e.weapon.name, x, y);
  512. c.strokeText(e.weapon.name, x, y);
  513. }
  514. if (window[keyMap['options']].healthEsp) {
  515. y += 35;
  516. c.fillText(e.health + ' HP', x, y);
  517. c.strokeText(e.health + ' HP', x, y);
  518. }
  519. c.strokeStyle = original_strokeStyle;
  520. c.lineWidth = original_lineWidth;
  521. c.font = original_font;
  522. c.fillStyle = original_fillStyle;
  523. c.restore();
  524.  
  525. // skelly chams
  526. // note: this can be done better
  527. var material = e.legMeshes[0].material;
  528. if (window[keyMap['options']].chams && material) {
  529. material.alphaTest = 1;
  530. material.depthTest = false;
  531. material.fog = false;
  532. material.emissive.r = window[keyMap['options']].chamsRed
  533. material.emissive.g = window[keyMap['options']].chamsGreen
  534. material.emissive.b = window[keyMap['options']].chamsBlue
  535. material.wireframe = true;
  536. } else if (!window[keyMap['options']].chams && material) {
  537. material.alphaTest = 0;
  538. material.depthTest = true;
  539. material.fog = true;
  540. material.emissive.r = 0;
  541. material.emissive.g = 0;
  542. material.emissive.b = 0;
  543. material.wireframe = false;
  544. }
  545. }
  546. };
  547. };
  548. };
  549. keyMap['hrtCheat'] = genKey();
  550. global_invisible_define(keyMap['hrtCheat'], hrtCheat);
  551.  
  552. const handler = {
  553. construct(target, args) {
  554. // ttap#4547
  555. if (args.length == 2 && args[1].length > 1337) {
  556. let script = args[1];
  557.  
  558. // anti anti chet & anti skid
  559. const version = script.match(/\w+\['exports'\]=(0[xX][0-9a-fA-F]+);/)[1];
  560. if (version !== "0x597b") {
  561. window[atob('ZG9jdW1lbnQ=')][atob('d3JpdGU=')](atob('VmVyc2lvbiBtaXNzbWF0Y2gg') + version);
  562. window[atob('bG9jYX' + 'Rpb24' + '=')][atob('aHJ' + 'lZg=' + '=')] = atob('aHR0cHM6' + 'Ly9naXRodWIuY2' + '9tL2hydC93aGVlb' + 'GNoYWly');
  563. }
  564.  
  565. var canSee = "'" + script.match(/,this\['(\w+)'\]=function\(\w+,\w+,\w+,\w+,\w+\){if\(!\w+\)return!\w+;/)[1] + "'";
  566. var pchObjc = "'" + script.match(/\(\w+,\w+,\w+\),this\['(\w+)'\]=new \w+\['\w+'\]\(\)/)[1] + "'";
  567. var objInstances = "'" + script.match(/\[\w+\]\['\w+'\]=!\w+,this\['\w+'\]\[\w+\]\['\w+'\]&&\(this\['\w+'\]\[\w+\]\['(\w+)'\]\['\w+'\]=!\w+/)[1] + "'";
  568. var isYou = "'" + script.match(/,this\['\w+'\]=!\w+,this\['\w+'\]=!\w+,this\['(\w+)'\]=\w+,this\['\w+'\]\['length'\]=\w+,this\[/)[1] + "'";
  569. var recoilAnimY = "'" + script.match(/\w*1,this\['\w+'\]=\w*0,this\['\w+'\]=\w*0,this\['\w+'\]=\w*1,this\['\w+'\]=\w*1,this\['\w+'\]=\w*0,this\['\w+'\]=\w*0,this\['(\w+)'\]=\w*0,this\['\w+'\]=\w*0,this\['\w+'\]=\w*0,this\['\w+'\]=\w*0,/)[1] + "'";
  570. var mouseDownL = "'" + script.match(/this\['\w+'\]=function\(\){this\['(\w+)'\]=\w*0,this\['(\w+)'\]=\w*0,this\['\w+'\]={}/)[1] + "'";
  571. var mouseDownR = "'" + script.match(/this\['\w+'\]=function\(\){this\['(\w+)'\]=\w*0,this\['(\w+)'\]=\w*0,this\['\w+'\]={}/)[2] + "'";
  572.  
  573. var inputs = script.match(/\(\w+,\w*1\)\),\w+\['\w+'\]=\w*0,\w+\['\w+'\]=\w*0,!(\w+)\['\w+'\]&&\w+\['\w+'\]\['push'\]\((\w+)\),(\w+)\['\w+'\]/)[2];
  574. var world = script.match(/\(\w+,\w*1\)\),\w+\['\w+'\]=\w*0,\w+\['\w+'\]=\w*0,!(\w+)\['\w+'\]&&\w+\['\w+'\]\['push'\]\((\w+)\),(\w+)\['\w+'\]/)[1];
  575. var consts = script.match(/\w+\['\w+'\]\),\w+\['\w+'\]\(\w+\['\w+'\],\w+\['\w+'\]\+\w+\['\w+'\]\*(\w+)/)[1];
  576. var me = script.match(/\(\w+,\w*1\)\),\w+\['\w+'\]=\w*0,\w+\['\w+'\]=\w*0,!(\w+)\['\w+'\]&&\w+\['\w+'\]\['push'\]\((\w+)\),(\w+)\['\w+'\]/)[3];
  577. var math = script.match(/\\x20\-50\%\)\\x20rotate\('\+\((\w+)\['\w+'\]\(\w+\[\w+\]\['\w+'\]/)[1];
  578.  
  579.  
  580. const code_to_overwrite = script.match(/(\w+\['\w+'\]&&\(\w+\['\w+'\]=\w+\['\w+'\],!\w+\['\w+'\]&&\w+\['\w+'\]\(\w+,\w*1\)\),\w+\['\w+'\]=\w*0,\w+\['\w+'\]=\w*0),!\w+\['\w+'\]&&\w+\['\w+'\]\['push'\]\(\w+\),\w+\['\w+'\]\(\w+,\w+,!\w*1,\w+\['\w+'\]\)/)[1];
  581. const ttapParams = [me, inputs, world, consts, math, canSee, pchObjc, objInstances, isYou, recoilAnimY, mouseDownL, mouseDownR].toString();
  582. let call_hrt = `window['` + keyMap['hrtCheat'] + `'](` + ttapParams + `)`;
  583.  
  584. /*
  585. pad to avoid stack trace line number detections
  586. the script will have the same length as it originally had
  587. */
  588. while (call_hrt.length < code_to_overwrite.length) {
  589. call_hrt += ' ';
  590. }
  591.  
  592. const hooked_call = Function.prototype.call;
  593. Function.prototype.call = original_call;
  594. /* the bIg mod */
  595. script = replace.call(script, code_to_overwrite, call_hrt);
  596.  
  597. /* Below are some misc features which I wouldn't consider bannable, third party clients could be using them */
  598. // all weapons trails on
  599. script = replace.call(script, /\w+\['weapon'\]&&\w+\['weapon'\]\['trail'\]/g, "true")
  600.  
  601. // color blind mode
  602. script = replace.call(script, /#9eeb56/g, '#00FFFF');
  603.  
  604. // no zoom
  605. script = replace.call(script, /,'zoom':.+?(?=,)/g, ",'zoom':1");
  606.  
  607. // script = replace.call(script, /(void this\['sendQueue'\]\['push'\]\(\[(\w+),(\w+)\]\);)/, '$1_[$2]=$3;');
  608. Function.prototype.call = hooked_call;
  609. /***********************************************************************************************************/
  610.  
  611. // bypass modification check of returned function
  612. const original_script = args[1];
  613. args[1] = script;
  614. let mod_fn = new target(...args);
  615. args[1] = original_script;
  616. let original_fn = new target(...args);
  617. conceal_function(original_fn, mod_fn);
  618. return mod_fn;
  619. }
  620. return new target(...args);
  621. }
  622. };
  623.  
  624. // we intercept game.js at the `Function` generation level
  625. const original_Function = Function;
  626. let hook_Function = new Proxy(Function, handler);
  627. conceal_function(original_Function, hook_Function);
  628. Function = hook_Function;
  629. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement