Advertisement
battlefrite

Untitled

Nov 28th, 2019
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Krunker WheelChair
  3. // @namespace    https://github.com/hrt
  4. // @version      1.9.0
  5. // @description  WheelChair
  6. // @author       hrt x ttap
  7. // @match        https://krunker.io/*
  8. // @run-at       document-start
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. // note:    this script gets injected into its own isolated context/iframe
  13. //          to console.log we would have to call window.top.console.log
  14. // Custom hub Edits the game status
  15. alert("INJECTED KRUNKER ZARES")
  16. // Starts the game
  17. document.title = "Krunker Zares";
  18. // Edits the game status to zaresplusx more changes gonna come toh
  19. document.getElementById("instructions").style.color = "Yellow";
  20. document.getElementById('instructions').innerHTML = 'Loading Krunker_Zares by NoS Team';
  21. document.getElementById('modVote').innerHTML = 'YT: ZaresPlus X';
  22. document.getElementById("modVote").style.color = "Yellow";
  23. document.getElementById("texts3DHolder").innerHTML = 'GET MORE HACKS AT ZaresPlus X channel';
  24. // Adblock
  25. document.getElementById("krunkerio_728x90_1").remove();
  26. // more shit
  27. document.getElementById("subLogoButtons").innerHTML = '<div class="button small buttonP" id="menuBtnHost" onmouseenter="playTick()" onclick="openHostWindow()">Host Game</div><div class="button small buttonR" id="menuBtnBrowser" onmouseenter="playTick()" onclick="showWindow(2)">Server Browser</div><div id="inviteButton" class="button small" onmouseenter="playTick()" onclick="copyInviteLink()">Invite</div><div class="button small" id="menuBtnJoin" onmouseenter="playTick()" onclick="showWindow(24)">Join</div><div class="button small buttonP" id="hackMenu" onmouseenter="playTick()" onclick="window.open(\'http://youtube.com/zaresplusx\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">GET MORE HACKS HERE</div></div>';
  28. document.getElementById("aContainer").innerHTML = 'YT: ZaresPlus X';
  29. document.getElementById("aContainer").style.color = "white";
  30. // Font size
  31. document.getElementById("aContainer").style.fontSize = "larger";
  32. d.style.cssText = 'width:8px;height:8px;background-color:#0BDEE8;position:absolute;margin:auto;top:0;right:0;bottom:0;left:0;z-index:200;border-radius:4px';
  33. document.body.appendChild(d);
  34. // Chat messege
  35. document.getElementById('chatList').innerHTML = '<div class="chatItem"><span style="color:#DAE110">Remembe to check out ZaresPlus X channel for more hacks<span class="chatMsg">| Krunker_Zares  <span class="chatMsg"><span style="color:#FFFF00"> | youtube.com/zaresplusx</span></span></span></div>';
  36. //Fps counter idk why to use this shit when you can have a fps counter either lol dumbass system
  37. javascript:(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//mrdoob.github.io/stats.js/build/stats.min.js';document.head.appendChild(script);})()
  38. //Full screen
  39. //<div class="chatItem" style="word-break:break-all;overflow-wrap:break-word;"><span class="chatMsg"><span style="color:#eb5656">DodgyDucks</span><img style="opacity:0.7;margin-right:9px;" class="weaponChatIcon" src="./textures/weapons/icon_1.png"><img class="headShotChatIcon" src="./img/headshot_0.png"><span style="color:#eb5656">SpoopyAmos</span></span></div>
  40. document.fullscreenEnabled =
  41.     document.fullscreenEnabled ||
  42.     document.mozFullScreenEnabled ||
  43.     document.documentElement.webkitRequestFullScreen;
  44.  
  45. function requestFullscreen(element) {
  46.     if (element.requestFullscreen) {
  47.         element.requestFullscreen();
  48.     } else if (element.mozRequestFullScreen) {
  49.         element.mozRequestFullScreen();
  50.     } else if (element.webkitRequestFullScreen) {
  51.         element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
  52.     }
  53. }
  54.  
  55. if (document.fullscreenEnabled) {
  56.     requestFullscreen(document.documentElement);
  57. }
  58.     function read(url) {
  59.     return new Promise(resolve => {
  60.         fetch(url).then(res => res.text()).then(res => {
  61.             return resolve(res);
  62.         });
  63.     });
  64. };
  65. //end editing here ps.. here tip from zaresplusx. "require needs more codes than here so catch up"
  66. cripple_window(window.parent);
  67. function cripple_window(_window) {
  68.     if (!_window) {
  69.         return;
  70.     }
  71.  
  72.     // state is shared across all frames
  73.     let shared_state = new Map(Object.entries({functions_to_hide: new WeakMap(), strings_to_hide: [], hidden_globals: [], init: false}));
  74.  
  75.     let invisible_define = function(obj, key, value) {
  76.         shared_state.get('hidden_globals').push(key);
  77.         Object.defineProperty(obj, key, {
  78.             enumberable: false,
  79.             configurable: false,
  80.             writable: true,
  81.             value: value
  82.         });
  83.     };
  84.  
  85.     // unique to each user
  86.     const master_key = 'ttap#4547';
  87.     if (!_window.top[master_key]) {
  88.         // initialise top state
  89.         invisible_define(_window.top, master_key, shared_state);
  90.     } else {
  91.         // restore
  92.         shared_state = _window.top[master_key];
  93.     }
  94.  
  95.     // hook toString to hide presence
  96.     const original_toString = _window.Function.prototype.toString;
  97.     let hook_toString = new Proxy(original_toString, {
  98.         apply: function(target, _this, _arguments) {
  99.             try {
  100.                 var ret = Function.prototype.apply.apply(target, [_this, _arguments]);
  101.             } catch (e) {
  102.                 // modify stack trace to hide proxy
  103.                 e.stack = e.stack.replace(/\n.*Object\.apply \(<.*/, '');
  104.                 throw e;
  105.             }
  106.  
  107.             let lookup_fn = shared_state.get('functions_to_hide').get(_this);
  108.             if (lookup_fn) {
  109.                 return Function.prototype.apply.apply(target, [lookup_fn, _arguments]);
  110.             }
  111.  
  112.             for (var i = 0; i < shared_state.get('strings_to_hide').length; i++) {
  113.                 ret = ret.replace(shared_state.get('strings_to_hide')[i].from, shared_state.get('strings_to_hide')[i].to);
  114.             }
  115.             return ret;
  116.         }
  117.     });
  118.     _window.Function.prototype.toString = hook_toString;
  119.  
  120.     let conceal_function = function(original_Function, hook_Function) {
  121.         shared_state.get('functions_to_hide').set(hook_Function, original_Function);
  122.     };
  123.  
  124.     let conceal_string = function(original_string, hook_string) {
  125.         shared_state.get('strings_to_hide').push({from: new RegExp(hook_string.replace(/([\[|\]|\(|\)|\*|\\|\.|\+])/g,'\\$1'), 'g'), to: original_string});
  126.     };
  127.  
  128.     // hook Object.getOwnPropertyDescriptors to hide variables from window
  129.     const original_getOwnPropertyDescriptors = _window.Object.getOwnPropertyDescriptors;
  130.     let hook_getOwnPropertyDescriptors = new Proxy(original_getOwnPropertyDescriptors, {
  131.         apply: function(target, _this, _arguments) {
  132.             try {
  133.                 var descriptors = Function.prototype.apply.apply(target, [_this, _arguments]);
  134.             } catch (e) {
  135.                 // modify stack trace to hide proxy
  136.                 e.stack = e.stack.replace(/\n.*Object\.apply \(<.*/, '');
  137.                 throw e;
  138.             }
  139.             for (var i = 0; i < shared_state.get('hidden_globals').length; i++) {
  140.                 delete descriptors[shared_state.get('hidden_globals')[i]];
  141.             }
  142.             return descriptors;
  143.         }
  144.     });
  145.     _window.Object.getOwnPropertyDescriptors = hook_getOwnPropertyDescriptors;
  146.  
  147.     // drawVisuals gets overwritten later - place hook before anti cheat loads
  148.     let drawVisuals = function() {};
  149.     const original_clearRect = _window.CanvasRenderingContext2D.prototype.clearRect;
  150.     let hook_clearRect = new Proxy(original_clearRect, {
  151.         apply: function(target, _this, _arguments) {
  152.             try {
  153.                 var ret = Function.prototype.apply.apply(target, [_this, _arguments]);
  154.             } catch (e) {
  155.                 // modify stack trace to hide proxy
  156.                 e.stack = e.stack.replace(/\n.*Object\.apply \(<.*/, '');
  157.                 throw e;
  158.             }
  159.             drawVisuals(_this);
  160.             return ret;
  161.         }
  162.     });
  163.     _window.CanvasRenderingContext2D.prototype.clearRect = hook_clearRect;
  164.  
  165.     // hook window.open to always return null
  166.     // otherwise we would have to also patch native functions in new window
  167.     const original_open = _window.open;
  168.     let hook_open = new Proxy(original_open, {
  169.         apply: function(target, _this, _arguments) {
  170.             try {
  171.                 let ret = Function.prototype.apply.apply(target, [_this, _arguments]);
  172.             } catch (e) {
  173.                 // modify stack trace to hide proxy
  174.                 e.stack = e.stack.replace(/\n.*Object\.apply \(<.*/, '');
  175.                 throw e;
  176.             }
  177.             return null;
  178.         }
  179.     });
  180.     _window.open = hook_open;
  181.  
  182.     // me, inputs, world, consts, math are objects the rest are key strings
  183.     if (!shared_state.get('hrt')) {
  184.         shared_state.set('hrt', function(me, inputs, world, consts, math) {
  185.             /******************************************************/
  186.             /* re implements code that we overwrote to place hook */
  187.             let controls = world.controls;
  188.             if (controls.scrollDelta) {
  189.                 controls.skipScroll = controls.scrollToSwap;
  190.                 if (!controls.scrollToSwap) {
  191.                     controls.fakeKey(0x4e20,0x1);
  192.                 }
  193.             }
  194.             controls.scrollDelta = 0;
  195.             controls.wSwap = 0;
  196.             /******************************************************/
  197.  
  198.             const playerHeight = 11;
  199.             const crouchDst = 3;
  200.             const headScale = 2;
  201.             const hitBoxPad = 1;
  202.             const armScale = 1.3;
  203.             const chestWidth = 2.6;
  204.             const armInset = -.1;
  205.             const playerScale = (2 * armScale + chestWidth + armInset) / 2;
  206.             const SHOOT = 5, SCOPE = 6, xDr = 3, yDr = 2, JUMP = 7, CROUCH = 8;
  207.             const PI2 = Math.PI * 2;
  208.             let isEnemy = function(player) {return !me.team || player.team != me.team};
  209.             let canHit = function(player) {return null == world[canSee](me, player.x3, player.y3 - player.crouchVal * crouchDst, player.z3)};
  210.             let normaliseYaw = function(yaw) {return (yaw % PI2 + PI2) % PI2;};
  211.             let getDir = function(a, b, c, d) {
  212.                 return Math.atan2(b - d, a - c);
  213.             };
  214.             let getD3D = function(a, b, c, d, e, f) {
  215.                 let g = a - d, h = b - e, i = c - f;
  216.                 return Math.sqrt(g * g + h * h + i * i);
  217.             };
  218.             let getXDire = function(a, b, c, d, e, f) {
  219.                 let g = Math.abs(b - e), h = getD3D(a, b, c, d, e, f);
  220.                 return Math.asin(g / h) * (b > e ? -1 : 1);
  221.             };
  222.  
  223.             let dAngleTo = function(x, y, z) {
  224.                 let ty = normaliseYaw(getDir(controls.object.position.z, controls.object.position.x, z, x));
  225.                 let tx = getXDire(controls.object.position.x, controls.object.position.y, controls.object.position.z, x, y, z);
  226.                 let oy = normaliseYaw(controls.object.rotation.y);
  227.                 let ox = controls[pchObjc].rotation.x;
  228.                 let dYaw = Math.min(Math.abs(ty - oy), Math.abs(ty - oy - PI2), Math.abs(ty - oy + PI2));
  229.                 let dPitch = tx - ox;
  230.                 return Math.hypot(dYaw, dPitch);
  231.             };
  232.             let calcAngleTo = function(player) {return dAngleTo(player.x3, player.y3 + playerHeight - (headScale + hitBoxPad) / 2 - player.crouchVal * crouchDst, player.z3);};
  233.             let calcDistanceTo = function(player) {return getD3D(player.x3, player.y3, player.z3, me.x, me.y, me.z)};
  234.             let isCloseEnough = function(player) {let distance = calcDistanceTo(player); return me.weapon.range >= distance && ("Shotgun" != me.weapon.name || distance < 70) && ("Akimbo Uzi" != me.weapon.name || distance < 100);};
  235.             let haveAmmo = function() {return !(me.ammos[me.weaponIndex] !== undefined && me.ammos[me.weaponIndex] == 0);};
  236.  
  237.             // target selector - based on closest to aim
  238.             let closest = null, closestAngle = Infinity;
  239.             let players = world.players.list;
  240.             for (var i = 0; me.active && i < players.length; i++) {
  241.                 let e = players[i];
  242.                 if (e[isYou] || !e.active || !e[objInstances] || !isEnemy(e)) {
  243.                     continue;
  244.                 }
  245.  
  246.                 // experimental prediction removed
  247.                 e.x3 = e.x;
  248.                 e.y3 = e.y;
  249.                 e.z3 = e.z;
  250.  
  251.                 if (!isCloseEnough(e) || !canHit(e)) {
  252.                     continue;
  253.                 }
  254.  
  255.                 let angle = calcAngleTo(e);
  256.                 if (angle < closestAngle) {
  257.                     closestAngle = angle;
  258.                     closest = e;
  259.                 }
  260.             }
  261.             // aimbot
  262.             let ty = controls.object.rotation.y, tx = controls[pchObjc].rotation.x;
  263.             if (closest) {
  264.                 let target = closest;
  265.                 let y = target.y3 + playerHeight - (headScale/* + hitBoxPad*/) / 2 - target.crouchVal * crouchDst;
  266.                 if (me.weapon.nAuto && me.didShoot) {
  267.                     inputs[SHOOT] = 0;
  268.                 } else if (!me.aimVal) {
  269.                     inputs[SHOOT] = 1;
  270.                     inputs[SCOPE] = 1;
  271.                 } else {
  272.                     inputs[SCOPE] = 1;
  273.                 }
  274.  
  275.                 ty = getDir(controls.object.position.z, controls.object.position.x, target.z3, target.x3);
  276.                 tx = getXDire(controls.object.position.x, controls.object.position.y, controls.object.position.z, target.x3, y, target.z3);
  277.  
  278.                 // perfect recoil control
  279.                 tx -= .3 * me[recoilAnimY];
  280.             } else {
  281.                 inputs[SHOOT] = controls[mouseDownL];
  282.                 inputs[SCOPE] = controls[mouseDownR];
  283.             }
  284.  
  285.  
  286.             // silent aim
  287.             inputs[xDr] = +(tx % PI2).toFixed(3);
  288.             inputs[yDr] = +(ty % PI2).toFixed(3);
  289.  
  290.             // auto reload
  291.             controls.keys[controls.reloadKey] = !haveAmmo() * 1;
  292.  
  293.             // bhop
  294.             inputs[JUMP] = (controls.keys[controls.jumpKey] && !me.didJump) * 1;
  295.  
  296.             // runs once
  297.             if (!shared_state.get('init')) {
  298.                 shared_state.set('init', true);
  299.  
  300.                 drawVisuals = function(c) {
  301.                     let scalingFactor = arguments.callee.caller.caller.arguments[0];
  302.                     let perspective = arguments.callee.caller.caller.arguments[2];
  303.                     let scaledWidth = c.canvas.width / scalingFactor;
  304.                     let scaledHeight = c.canvas.height / scalingFactor;
  305.                     let worldPosition = perspective.camera.getWorldPosition();
  306.                     for (var i = 0; i < world.players.list.length; i++) {
  307.                         let player = world.players.list[i];
  308.                         let e = players[i];
  309.                         if (e[isYou] || !e.active || !e[objInstances] || !isEnemy(e)) {
  310.                             continue;
  311.                         }
  312.  
  313.                         // the below variables correspond to the 2d box esps corners
  314.                         // note: we can already tell what ymin ymax is
  315.                         let xmin = Infinity;
  316.                         let xmax = -Infinity;
  317.                         let ymin = Infinity;
  318.                         let ymax = -Infinity;
  319.                         let br = false;
  320.                         for (var j = -1; !br && j < 2; j+=2) {
  321.                             for (var k = -1; !br && k < 2; k+=2) {
  322.                                 for (var l = 0; !br && l < 2; l++) {
  323.                                     let position = e[objInstances].position.clone();
  324.                                     position.x += j * playerScale;
  325.                                     position.z += k * playerScale;
  326.                                     position.y += l * (playerHeight - e.crouchVal * crouchDst);
  327.                                     if (!perspective.frustum.containsPoint(position)) {
  328.                                         br = true;
  329.                                         break;
  330.                                     }
  331.                                     position.project(perspective.camera);
  332.                                     xmin = Math.min(xmin, position.x);
  333.                                     xmax = Math.max(xmax, position.x);
  334.                                     ymin = Math.min(ymin, position.y);
  335.                                     ymax = Math.max(ymax, position.y);
  336.                                 }
  337.                             }
  338.                         }
  339.  
  340.                         if (br) {
  341.                             continue;
  342.                         }
  343.  
  344.                         xmin = (xmin + 1) / 2;
  345.                         ymin = (ymin + 1) / 2;
  346.                         xmax = (xmax + 1) / 2;
  347.                         ymax = (ymax + 1) / 2;
  348.  
  349.  
  350.                         c.save();
  351.                         // save and restore these variables later so they got nothing on us
  352.                         const original_strokeStyle = c.strokeStyle;
  353.                         const original_lineWidth = c.lineWidth;
  354.                         const original_font = c.font;
  355.                         const original_fillStyle = c.fillStyle;
  356.  
  357.                         // perfect box esp
  358.                         c.lineWidth = 5;
  359.                         c.strokeStyle = 'rgba(255,50,50,1)';
  360.  
  361.                         let distanceScale = Math.max(.3, 1 - getD3D(worldPosition.x, worldPosition.y, worldPosition.z, e.x, e.y, e.z) / 600);
  362.                         c.scale(distanceScale, distanceScale);
  363.                         let xScale = scaledWidth / distanceScale;
  364.                         let yScale = scaledHeight / distanceScale;
  365.  
  366.                         c.beginPath();
  367.                         ymin = yScale * (1 - ymin);
  368.                         ymax = yScale * (1 - ymax);
  369.                         xmin = xScale * xmin;
  370.                         xmax = xScale * xmax;
  371.                         c.moveTo(xmin, ymin);
  372.                         c.lineTo(xmin, ymax);
  373.                         c.lineTo(xmax, ymax);
  374.                         c.lineTo(xmax, ymin);
  375.                         c.lineTo(xmin, ymin);
  376.                         c.stroke();
  377.  
  378.                         // health bar
  379.                         c.fillStyle = "rgba(255,50,50,1)";
  380.                         let barMaxHeight = ymax - ymin;
  381.                         c.fillRect(xmin - 7, ymin, -10, barMaxHeight);
  382.                         c.fillStyle = "#00FFFF";
  383.                         c.fillRect(xmin - 7, ymin, -10, barMaxHeight * (e.health / e.maxHealth));
  384.  
  385.                         // info
  386.                         c.font = "60px Sans-serif";
  387.                         c.fillStyle = "white";
  388.                         c.strokeStyle='black';
  389.                         c.lineWidth = 1;
  390.                         let x = xmax + 7;
  391.                         let y = ymax;
  392.                         c.fillText(e.name, x, y);
  393.                         c.strokeText(e.name, x, y);
  394.                         c.font = "30px Sans-serif";
  395.                         y += 35;
  396.                         c.fillText(e.weapon.name, x, y);
  397.                         c.strokeText(e.weapon.name, x, y);
  398.                         y += 35;
  399.                         c.fillText(e.health + ' HP', x, y);
  400.                         c.strokeText(e.health + ' HP', x, y);
  401.  
  402.                         c.strokeStyle = original_strokeStyle;
  403.                         c.lineWidth = original_lineWidth;
  404.                         c.font = original_font;
  405.                         c.fillStyle = original_fillStyle;
  406.                         c.restore();
  407.  
  408.                         // skelly chams
  409.                         // note: this can be done better
  410.                         if (e.legMeshes[0]) {
  411.                             let material = e.legMeshes[0].material;
  412.                             material.alphaTest = 1;
  413.                             material.depthTest = false;
  414.                             material.fog = false;
  415.                             material.emissive.g = 1;
  416.                             material.wireframe = true;
  417.                         }
  418.  
  419.                     }
  420.                 };
  421.             };
  422.         })
  423.     }
  424.  
  425.     const handler = {
  426.         apply: function(target, _this, _arguments) {
  427.             try {
  428.                 var original_fn = Function.prototype.apply.apply(target, [_this, _arguments]);
  429.             } catch (e) {
  430.                 // modify stack trace to hide proxy
  431.                 e.stack = e.stack.replace(/\n.*Object\.apply \(<.*/, '');
  432.                 throw e;
  433.             }
  434.  
  435.             if (_arguments.length == 2 && _arguments[1].length > parseInt("1337 ttap#4547")) {
  436.                 let script = _arguments[1];
  437.  
  438.                 // anti anti chet & anti skid
  439.                 const version = script.match(/\w+\['exports'\]=(0[xX][0-9a-fA-F]+);/)[1];
  440.                 if (version !== "0x17e87") {
  441.                     _window[atob('ZG9jdW1lbnQ=')][atob('d3JpdGU=')](atob('VmVyc2lvbiBtaXNzbWF0Y2gg') + version);
  442.                     _window[atob('bG9jYX'+'Rpb24'+'=')][atob('aHJ'+'lZg='+'=')] = atob('aHR0cHM6'+'Ly9naXRodWIuY2'+'9tL2hydC93aGVlb'+'GNoYWly');
  443.                 }
  444.  
  445.                 // note: this window is not the main window
  446.                 window['canSee'] = script.match(/,this\['(\w+)'\]=function\(\w+,\w+,\w+,\w+,\w+\){if\(!\w+\)return!\w+;/)[1];
  447.                 window['pchObjc'] = script.match(/\(\w+,\w+,\w+\),this\['(\w+)'\]=new \w+\['\w+'\]\(\)/)[1];
  448.                 window['objInstances'] = script.match(/\[\w+\]\['\w+'\]=!\w+,this\['\w+'\]\[\w+\]\['\w+'\]&&\(this\['\w+'\]\[\w+\]\['(\w+)'\]\['\w+'\]=!\w+/)[1];
  449.                 window['isYou'] = script.match(/,this\['\w+'\]=!\w+,this\['\w+'\]=!\w+,this\['(\w+)'\]=\w+,this\['\w+'\]\['length'\]=\w+,this\[/)[1];
  450.                 window['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];
  451.                 window['mouseDownL'] = script.match(/this\['\w+'\]=function\(\){this\['(\w+)'\]=\w*0,this\['(\w+)'\]=\w*0,this\['\w+'\]={}/)[1];
  452.                 window['mouseDownR'] = script.match(/this\['\w+'\]=function\(\){this\['(\w+)'\]=\w*0,this\['(\w+)'\]=\w*0,this\['\w+'\]={}/)[2];
  453.  
  454.                 const inputs = script.match(/\(\w+,\w*1\)\),\w+\['\w+'\]=\w*0,\w+\['\w+'\]=\w*0,!(\w+)\['\w+'\]&&\w+\['\w+'\]\['push'\]\((\w+)\),(\w+)\['\w+'\]/)[2];
  455.                 const world = script.match(/\(\w+,\w*1\)\),\w+\['\w+'\]=\w*0,\w+\['\w+'\]=\w*0,!(\w+)\['\w+'\]&&\w+\['\w+'\]\['push'\]\((\w+)\),(\w+)\['\w+'\]/)[1];
  456.                 const consts = script.match(/\w+\['\w+'\]\),\w+\['\w+'\]\(\w+\['\w+'\],\w+\['\w+'\]\+\w+\['\w+'\]\*(\w+)/)[1];
  457.                 const me = script.match(/\(\w+,\w*1\)\),\w+\['\w+'\]=\w*0,\w+\['\w+'\]=\w*0,!(\w+)\['\w+'\]&&\w+\['\w+'\]\['push'\]\((\w+)\),(\w+)\['\w+'\]/)[3];
  458.                 const math = script.match(/\\x20\-50\%\)\\x20rotate\('\+\((\w+)\['\w+'\]\(\w+\[\w+\]\['\w+'\]/)[1];
  459.  
  460.  
  461.                 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];
  462.                 const ttapParams = [me, inputs, world, consts, math].toString();
  463.                 let call_hrt = `top['` + master_key + `'].get('hrt')(` + ttapParams + `)`;
  464.  
  465.                 /*
  466.                     pad to avoid stack trace line:column number detection
  467.                     the script will have the same length as it originally had
  468.                 */
  469.                 if (call_hrt.length + 4 > code_to_overwrite.length) {
  470.                     throw 'WHEELCHAIR: target function too small ' + [call_hrt.length, code_to_overwrite.length];
  471.                 }
  472.                 let whitespaces = code_to_overwrite.match(/\s/g);
  473.                 for (var i = 0; i < whitespaces && whitespaces.length; i++) {
  474.                     call_hrt += whitespaces[i];
  475.                 }
  476.                 // call_hrt += '/*';
  477.                 call_hrt += '  ';
  478.                 while (call_hrt.length < code_to_overwrite.length - 2) {
  479.                     // call_hrt += '*';
  480.                     call_hrt += ' ';
  481.                 }
  482.                 // call_hrt += '*/';
  483.                 call_hrt += '  ';
  484.  
  485.                 script = script.replace(code_to_overwrite, call_hrt);
  486.                 conceal_string(code_to_overwrite, call_hrt);
  487.  
  488.                 /***********************************************************************************************************/
  489.                 /* Below are some misc features which I wouldn't consider bannable                                         */
  490.                 // all weapons trails on
  491.                 // script = script.replace(/\w+\['weapon'\]&&\w+\['weapon'\]\['trail'\]/g, "true")
  492.  
  493.                 // color blind mode
  494.                 // script = script.replace(/#9eeb56/g, '#00FFFF');
  495.  
  496.                 // no zoom
  497.                 // script = script.replace(/,'zoom':.+?(?=,)/g, ",'zoom':1");
  498.                 /***********************************************************************************************************/
  499.                 // bypass modification check of returned function
  500.                 const original_script = _arguments[1];
  501.                 _arguments[1] = script;
  502.                 let mod_fn = Function.prototype.apply.apply(target, [_this, _arguments]);
  503.                 _arguments[1] = original_script;
  504.                 conceal_function(original_fn, mod_fn);
  505.  
  506.                 return mod_fn;
  507.             }
  508.             return original_fn;
  509.         }
  510.     };
  511.  
  512.     // we intercept game.js at the `Function` generation level
  513.     const original_Function = _window.Function;
  514.     let hook_Function = new Proxy(original_Function, handler);
  515.     _window.Function = hook_Function;
  516.  
  517.     conceal_function(original_open, hook_open);
  518.     conceal_function(original_clearRect, hook_clearRect);
  519.     conceal_function(original_getOwnPropertyDescriptors, hook_getOwnPropertyDescriptors);
  520.     conceal_function(original_toString, hook_toString);
  521.     conceal_function(original_Function, hook_Function);
  522. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement