Krunker.IO Aimbot & ESP

Locks aim to the nearest player in krunker.io and shows players behind walls. Also shows a line between you and them.

Fra 21.05.2023. Se den seneste versjonen.

  1. // ==UserScript==
  2. // @name Krunker.IO Aimbot & ESP
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2.1
  5. // @description Locks aim to the nearest player in krunker.io and shows players behind walls. Also shows a line between you and them.
  6. // @author Zertalious (Zert)
  7. // @match *://krunker.io/*
  8. // @match *://browserfps.com/*
  9. // @exclude *://krunker.io/social*
  10. // @exclude *://krunker.io/editor*
  11. // @icon https://www.google.com/s2/favicons?domain=krunker.io
  12. // @grant none
  13. // @run-at document-start
  14. // @require https://unpkg.com/three@latest/build/three.min.js
  15. // @antifeature ads
  16. // ==/UserScript==
  17.  
  18. let scene;
  19.  
  20. const x = {
  21. document: document,
  22. querySelector: document.querySelector,
  23. consoleLog: console.log,
  24. ReflectApply: Reflect.apply,
  25. ArrayPrototype: Array.prototype
  26. };
  27.  
  28. x.consoleLog( 'Waiting to inject...' );
  29.  
  30. const proxied = new Proxy( Array.prototype.push, {
  31. apply( target, thisArgs, [ object ] ) {
  32.  
  33. try {
  34.  
  35. if ( typeof object === 'object' &&
  36. typeof object.parent === 'object' &&
  37. object.parent.type === 'Scene' &&
  38. object.parent.name === 'Main' ) {
  39.  
  40. scene = object.parent;
  41.  
  42. }
  43.  
  44. } catch ( error ) {}
  45.  
  46. return x.ReflectApply( ...arguments );
  47.  
  48. }
  49. } );
  50.  
  51. const interval = setInterval( function () {
  52.  
  53. const el = x.querySelector.call( x.document, '#loadingBg' );
  54.  
  55. if ( el && el.offsetHeight === 0 ) {
  56.  
  57. x.consoleLog( 'Injecting!' );
  58.  
  59. x.ArrayPrototype.push = proxied;
  60.  
  61. clearInterval( interval );
  62.  
  63. }
  64.  
  65. }, 1 );
  66.  
  67. let espEnabled = true;
  68. let aimbotEnabled = true;
  69. let aimbotOnRightMouse = false;
  70. let espLinesEnabled = true;
  71.  
  72. const tempVector = new THREE.Vector3();
  73.  
  74. const tempObject = new THREE.Object3D();
  75. tempObject.rotation.order = 'YXZ';
  76.  
  77. const geometry = new THREE.EdgesGeometry( new THREE.BoxGeometry( 5, 15, 5 ).translate( 0, 7.5, 0 ) );
  78.  
  79. const material = new THREE.RawShaderMaterial( {
  80. vertexShader: `
  81.  
  82. attribute vec3 position;
  83.  
  84. uniform mat4 projectionMatrix;
  85. uniform mat4 modelViewMatrix;
  86.  
  87. void main() {
  88.  
  89. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  90. gl_Position.z = 1.0;
  91.  
  92. }
  93.  
  94. `,
  95. fragmentShader: `
  96.  
  97. void main() {
  98.  
  99. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  100.  
  101. }
  102.  
  103. `
  104. } );
  105.  
  106. const line = new THREE.LineSegments( new THREE.BufferGeometry(), material );
  107.  
  108. line.frustumCulled = false;
  109.  
  110. const linePositions = new THREE.BufferAttribute( new Float32Array( 100 * 2 * 3 ), 3 );
  111. line.geometry.setAttribute( 'position', linePositions );
  112.  
  113. function animate() {
  114.  
  115. window.requestAnimationFrame( animate );
  116.  
  117. if ( typeof shouldShowAd === 'undefined' || shouldShowAd === true || scene === undefined ) {
  118.  
  119. return;
  120.  
  121. }
  122.  
  123. const players = [];
  124.  
  125. let myPlayer;
  126.  
  127. for ( let i = 0; i < scene.children.length; i ++ ) {
  128.  
  129. const child = scene.children[ i ];
  130.  
  131. if ( child.type === 'Object3D' ) {
  132.  
  133. try {
  134.  
  135. if ( child.children[ 0 ].children[ 0 ].type === 'PerspectiveCamera' ) {
  136.  
  137. myPlayer = child;
  138.  
  139. } else {
  140.  
  141. players.push( child );
  142.  
  143. }
  144.  
  145. } catch ( err ) {}
  146.  
  147. }
  148.  
  149. }
  150.  
  151. let counter = 0;
  152.  
  153. let targetPlayer;
  154. let minDistance = Infinity;
  155.  
  156. tempObject.matrix.copy( myPlayer.matrix ).invert()
  157.  
  158. for ( let i = 0; i < players.length; i ++ ) {
  159.  
  160. const player = players[ i ];
  161.  
  162. if ( ! player.box ) {
  163.  
  164. const box = new THREE.LineSegments( geometry, material );
  165. box.frustumCulled = false;
  166.  
  167. player.add( box );
  168.  
  169. player.box = box;
  170.  
  171. }
  172.  
  173. if ( player.position.x === myPlayer.position.x && player.position.z === myPlayer.position.z ) {
  174.  
  175. player.box.visible = false;
  176.  
  177. if ( line.parent !== player ) {
  178.  
  179. player.add( line );
  180.  
  181. }
  182.  
  183. continue;
  184.  
  185. }
  186.  
  187. linePositions.setXYZ( counter ++, 0, 10, - 5 );
  188.  
  189. tempVector.copy( player.position );
  190.  
  191. tempVector.y += 9;
  192.  
  193. tempVector.applyMatrix4( tempObject.matrix );
  194.  
  195. linePositions.setXYZ(
  196. counter ++,
  197. tempVector.x,
  198. tempVector.y,
  199. tempVector.z
  200. );
  201.  
  202. player.visible = espEnabled || player.visible;
  203.  
  204. player.box.visible = espEnabled;
  205.  
  206. const distance = player.position.distanceTo( myPlayer.position );
  207.  
  208. if ( distance < minDistance ) {
  209.  
  210. targetPlayer = player;
  211.  
  212. minDistance = distance;
  213.  
  214. }
  215.  
  216. }
  217.  
  218. linePositions.needsUpdate = true;
  219. line.geometry.setDrawRange( 0, counter );
  220.  
  221. line.visible = espLinesEnabled;
  222.  
  223. if ( aimbotEnabled === false || ( aimbotOnRightMouse && ! rightMouseDown ) || targetPlayer === undefined ) {
  224.  
  225. return;
  226.  
  227. }
  228.  
  229. tempVector.setScalar( 0 );
  230.  
  231. targetPlayer.children[ 0 ].children[ 0 ].localToWorld( tempVector );
  232.  
  233. tempObject.position.copy( myPlayer.position );
  234.  
  235. tempObject.lookAt( tempVector );
  236.  
  237. myPlayer.children[ 0 ].rotation.x = - tempObject.rotation.x;
  238. myPlayer.rotation.y = tempObject.rotation.y + Math.PI;
  239.  
  240. }
  241.  
  242. const value = parseInt( new URLSearchParams( window.location.search ).get( 'showAd' ), 16 );
  243.  
  244. const shouldShowAd = isNaN( value ) || Date.now() - value < 0 || Date.now() - value > 10 * 60 * 1000;
  245.  
  246. const el = document.createElement( 'div' );
  247.  
  248. el.innerHTML = `<style>
  249.  
  250. .dialog {
  251. position: absolute;
  252. left: 50%;
  253. top: 50%;
  254. padding: 20px;
  255. background: rgba(0, 0, 0, 0.8);
  256. border: 6px solid rgba(0, 0, 0, 0.2);
  257. color: #fff;
  258. transform: translate(-50%, -50%);
  259. text-align: center;
  260. z-index: 999999;
  261. }
  262.  
  263. .dialog * {
  264. color: #fff;
  265. }
  266.  
  267. .close {
  268. position: absolute;
  269. right: 5px;
  270. top: 5px;
  271. width: 20px;
  272. height: 20px;
  273. opacity: 0.5;
  274. cursor: pointer;
  275. }
  276.  
  277. .close:before, .close:after {
  278. content: ' ';
  279. position: absolute;
  280. left: 50%;
  281. top: 50%;
  282. width: 100%;
  283. height: 20%;
  284. transform: translate(-50%, -50%) rotate(-45deg);
  285. background: #fff;
  286. }
  287.  
  288. .close:after {
  289. transform: translate(-50%, -50%) rotate(45deg);
  290. }
  291.  
  292. .close:hover {
  293. opacity: 1;
  294. }
  295.  
  296. .btn {
  297. cursor: pointer;
  298. padding: 0.5em;
  299. background: red;
  300. border: 3px solid rgba(0, 0, 0, 0.2);
  301. }
  302.  
  303. .btn:active {
  304. transform: scale(0.8);
  305. }
  306.  
  307. .msg {
  308. position: absolute;
  309. left: 10px;
  310. bottom: 10px;
  311. color: #fff;
  312. background: rgba(0, 0, 0, 0.6);
  313. font-weight: bolder;
  314. padding: 15px;
  315. animation: msg 0.5s forwards, msg 0.5s reverse forwards 3s;
  316. z-index: 999999;
  317. pointer-events: none;
  318. }
  319.  
  320. @keyframes msg {
  321. from {
  322. transform: translate(-120%, 0);
  323. }
  324.  
  325. to {
  326. transform: none;
  327. }
  328. }
  329.  
  330. </style>
  331. <div class="msg" style="display: none;"></div>
  332. <div class="dialog">${shouldShowAd ? `<big>Loading ad...</big>` : `<div class="close" onclick="this.parentNode.style.display='none';"></div>
  333. <big>== Aimbot & ESP ==</big>
  334. <br>
  335. <br>
  336. [B] to toggle aimbot
  337. <br>
  338. [V] to toggle ESP
  339. <br>
  340. [N] to toggle ESP Lines
  341. <br>
  342. [L] to toggle aimbot on <br>right mouse hold
  343. <br>
  344. [H] to show/hide help
  345. <br>
  346. <br>
  347. By Zertalious
  348. <br>
  349. <br>
  350. <div style="display: grid; grid-template-columns: 1fr 1fr; grid-gap: 5px;">
  351. <div class="btn" onclick="window.open('https://discord.gg/K24Zxy88VM', '_blank')">Discord</div>
  352. <div class="btn" onclick="window.open('https://www.instagram.com/zertalious/', '_blank')">Instagram</div>
  353. <div class="btn" onclick="window.open('https://twitter.com/Zertalious', '_blank')">Twitter</div>
  354. <div class="btn" onclick="window.open('https://greatest.deepsurf.us/en/users/662330-zertalious', '_blank')">More scripts</div>
  355. </div>
  356. ` }
  357. </div>`;
  358.  
  359. const msgEl = el.querySelector( '.msg' );
  360. const dialogEl = el.querySelector( '.dialog' );
  361.  
  362. window.addEventListener( 'DOMContentLoaded', function () {
  363.  
  364. while ( el.children.length > 0 ) {
  365.  
  366. document.body.appendChild( el.children[ 0 ] );
  367.  
  368. }
  369.  
  370. } );
  371.  
  372. if ( shouldShowAd ) {
  373.  
  374. const url = new URL( window.location.href );
  375.  
  376. url.searchParams.set( 'showAd', Date.now().toString( 16 ) );
  377. url.searchParams.set( 'scriptVersion', GM.info.script.version );
  378.  
  379. window.location.href = 'https://zertalious.xyz?ref=' + new TextEncoder().encode( url.href ).toString();
  380.  
  381. }
  382.  
  383. let rightMouseDown = false;
  384.  
  385. function handleMouse( event ) {
  386.  
  387. if ( event.button === 2 ) {
  388.  
  389. rightMouseDown = event.type === 'pointerdown' ? true : false;
  390.  
  391. }
  392.  
  393. }
  394.  
  395. window.addEventListener( 'pointerdown', handleMouse );
  396. window.addEventListener( 'pointerup', handleMouse );
  397.  
  398. window.addEventListener( 'keyup', function ( event ) {
  399.  
  400. switch ( event.code ) {
  401.  
  402. case 'KeyV' :
  403.  
  404. espEnabled = ! espEnabled;
  405.  
  406. showMsg( 'ESP', espEnabled );
  407.  
  408. break;
  409.  
  410. case 'KeyB' :
  411.  
  412. aimbotEnabled = ! aimbotEnabled;
  413.  
  414. showMsg( 'Aimbot', aimbotEnabled );
  415.  
  416. break;
  417.  
  418. case 'KeyH' :
  419.  
  420. dialogEl.style.display = dialogEl.style.display === '' ? 'none' : '';
  421.  
  422. break;
  423.  
  424. case 'KeyL' :
  425.  
  426. aimbotOnRightMouse = ! aimbotOnRightMouse;
  427.  
  428. showMsg( 'Aimbot On Right Mouse Hold', aimbotOnRightMouse );
  429.  
  430. break;
  431.  
  432. case 'KeyN' :
  433.  
  434. espLinesEnabled = ! espLinesEnabled;
  435.  
  436. showMsg( 'ESP Lines', espLinesEnabled );
  437.  
  438. break;
  439.  
  440. }
  441.  
  442. } );
  443.  
  444. function showMsg( name, bool ) {
  445.  
  446. msgEl.innerText = name + ': ' + ( bool ? 'ON' : 'OFF' );
  447.  
  448. msgEl.style.display = 'none';
  449.  
  450. void msgEl.offsetWidth;
  451.  
  452. msgEl.style.display = '';
  453.  
  454. }
  455.  
  456. animate();