Advertisement
Guest User

Untitled

a guest
Jan 9th, 2020
7,261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.42 KB | None | 0 0
  1. // ==UserScript==
  2. // @name krunker hack 1.9.6 aimbot wallhack 2020 new hack cheat krunker.io bug unblocked
  3. // @namespace https://www.communityenterprisefoundation.com.au/make-a-donation/bushfire-disaster-appeal/
  4. // @version 1.9.6.4
  5. // @description the first working hack in 1.9.6
  6. // @author ZeusLUAP
  7. // @match *://krunker.io/*
  8. // @run-at document-start
  9. // @grant none
  10. // @noframes
  11. // ==/UserScript==
  12. //******************************************************************************************************************
  13. // If you steal my script and pretend you made it IDC as long as you leave the link to donate to the bushfire appeal
  14. // and this notice, thankyou - ZeusLUAP-.
  15. //******************************************************************************************************************
  16. (function() {
  17. //'use strict';
  18. //======================================================================================>
  19. var count = 0,
  20. vars = {};
  21. const downKeys = new Set();
  22. const upKeys = new Set();
  23. const defined = object => typeof object !== "undefined";
  24. console.json = object => console.log(JSON.stringify(object, undefined, 2));
  25. let toJson = object => console.log(JSON.stringify(object, undefined, 2));
  26. let getDistance3D = (fromX, fromY, fromZ, toX, toY, toZ) => {
  27. var distX = fromX - toX,
  28. distY = fromY - toY,
  29. distZ = fromZ - toZ;
  30. return Math.sqrt(distX * distX + distY * distY + distZ * distZ);
  31. }
  32.  
  33. let getDistance = (player1, player2) => {
  34. return getDistance3D(player1.x, player1.y, player1.z, player2.x, player2.y, player2.z);
  35. }
  36.  
  37. let getDirection = (fromZ, fromX, toZ, toX) => {
  38. return Math.atan2(fromX - toX, fromZ - toZ);
  39. }
  40.  
  41. let getXDir = (fromX, fromY, fromZ, toX, toY, toZ) => {
  42. var dirY = Math.abs(fromY - toY),
  43. dist = getDistance3D(fromX, fromY, fromZ, toX, toY, toZ);
  44. return Math.asin(dirY / dist) * (fromY > toY ? -1 : 1);
  45. }
  46.  
  47. let getAngleDist = (start, end) => {
  48. return Math.atan2(Math.sin(end - start), Math.cos(start - end));
  49. }
  50.  
  51. addEventListener("keydown", e => {
  52. if ("INPUT" == window.document.activeElement.tagName) return;
  53. const key = e.key.toUpperCase();
  54. const code = e.code;
  55. if (!downKeys.has(code)) downKeys.add(code);
  56. });
  57.  
  58. addEventListener("keyup", e => {
  59. const key = e.key.toUpperCase();
  60. const code = e.code;
  61. if (downKeys.has(code)) downKeys.delete(code);
  62. if (!upKeys.has(code)) upKeys.add(code);
  63. })
  64.  
  65. const Pi = Math.PI / 2;
  66. const PI2 = 2 * Math.PI;
  67. const consts = {
  68. cameraHeight: 1.5,
  69. playerHeight: 11,
  70. cameraHeight: 1.5,
  71. headScale: 2,
  72. crouchDst: 3,
  73. camChaseTrn: 0.0022,
  74. camChaseSpd: 0.0012,
  75. camChaseSen: 0.2,
  76. camChaseDst: 24,
  77. recoilMlt: 0.3,
  78. nameOffset: 0.6,
  79. nameOffsetHat: 0.8,
  80. verClans: [
  81. "DEV",
  82. "FaZe",
  83. "Lore",
  84. "nV",
  85. "Oxic",
  86. "Verb",
  87. "Omen",
  88. "ロリ幼女",
  89. "VOID",
  90. "JBP",
  91. "PHIL",
  92. "TIMP",
  93. "24/7",
  94. "g59",
  95. "GLXY",
  96. "MMOK",
  97. "ODTY"
  98. ],
  99. };
  100. const input = {
  101. speed: 1,
  102. ydir: 2,
  103. xdir: 3,
  104. shoot: 5,
  105. scope: 6,
  106. jump: 7,
  107. crouch: 8,
  108. reload: 9,
  109. weapon: 10,
  110. };
  111. let settings = {
  112. isSliding: false,
  113. distance: Infinity,
  114. scopingOut: false,
  115. canShoot: true,
  116. }
  117.  
  118. function onTick(me, world, inputs, renderer) {
  119. 'use strict';
  120. const controls = world.controls;
  121. let inView = (entity) => (null == world[vars.canSee](me, entity.x, entity.y, entity.z)) && (null == world[vars.canSee](renderer.camera[vars.getWorldPosition](), entity.x, entity.y, entity.z, 10));
  122. let isFriendly = (entity) => (me && me.team ? me.team : me.spectating ? 0x1 : 0x0) == entity.team;
  123. let keyDown = (code) => {
  124. return downKeys.has(code);
  125. }
  126. let keyUp = (code) => {
  127. if (upKeys.has(code)) {
  128. upKeys.delete(code);
  129. return true;
  130. }
  131. return false;
  132. }
  133.  
  134. // AutoAim
  135. let ty = controls.object.rotation.y;
  136. let tx = controls[vars.pchObjc].rotation.x;
  137. let target = world.players.list.filter(x => {
  138. x[vars.cnBSeen] = true;
  139. return defined(x[vars.objInstances]) && x[vars.objInstances] && x.active && !x.renderYou && inView(x) && !isFriendly(x)
  140. }).sort((p1, p2) => p1[vars.objInstances].position.distanceTo(me) - p2[vars.objInstances].position.distanceTo(me)).shift();
  141. if (target) {
  142. if (me.weapon[vars.nAuto] && me[vars.didShoot]) {
  143. inputs[input.shoot] = 0;
  144. } else if (!me.aimVal) {
  145. inputs[input.shoot] = 1;
  146. inputs[input.scope] = 1;
  147. } else {
  148. inputs[input.scope] = 1;
  149. }
  150. let offset1 = ((consts.playerHeight - consts.cameraHeight) - (target.crouchVal * consts.crouchDst));
  151. let offset2 = consts.playerHeight - consts.headScale / 2 - target.crouchVal * consts.crouchDst;
  152. ty = getDirection(controls.object.position.z, controls.object.position.x, target.z, target.x);
  153. tx = getXDir(controls.object.position.x, controls.object.position.y, controls.object.position.z, target.x, target.y + offset2, target.z);
  154. tx -= consts.recoilMlt * me[vars.recoilAnimY];
  155. } else {
  156. inputs[input.shoot] = controls[vars.mouseDownL];
  157. inputs[input.scope] = controls[vars.mouseDownR];
  158. }
  159.  
  160. // silent aim
  161. inputs[input.xdir] = +(tx % PI2).toFixed(3);
  162. inputs[input.ydir] = +(ty % PI2).toFixed(3);
  163.  
  164. // auto bHop
  165. let autoBhop = (value) => {
  166. if (!value) return;
  167. if (keyDown("Space") || value == 1 || value == 3) {
  168. controls.keys[controls.jumpKey] = !controls.keys[controls.jumpKey];
  169. if (value >= 2) {
  170. if (settings.isSliding) {
  171. controls.keys[controls.crouchKey] = 1;
  172. return;
  173. }
  174. if (me.yVel < -0.04 && me.canSlide) {
  175. settings.isSliding = true;
  176. setTimeout(() => {
  177. settings.isSliding = false;
  178. controls.keys[controls.crouchKey] = 0;
  179. }, 350);
  180. controls.keys[controls.crouchKey] = 1;
  181. }
  182. }
  183. }
  184. }
  185. autoBhop(2);
  186.  
  187. // auto reload
  188. const ammoLeft = me[vars.ammos][me[vars.weaponIndex]];
  189. if (!ammoLeft) inputs[input.reload] = 1;
  190.  
  191. }
  192.  
  193. function onRender(canvas, scale, world, renderer, me, scale2) {
  194. if (world && world.players) {
  195. world.players.list.map((entity, index, array)=> {
  196. if (defined(entity[vars.objInstances]) && entity[vars.objInstances]) {
  197. for (let i = 0; i < entity[vars.objInstances].children.length; i++) {
  198. const object3d = entity[vars.objInstances].children[i];
  199. for (let j = 0; j < object3d.children.length; j++) {
  200. const mesh = object3d.children[j];
  201. if (mesh && mesh.type == "Mesh") {
  202. const material = mesh.material;
  203. material.depthTest = false;
  204. material.colorWrite = true;
  205. material.transparent = true;
  206. material.opacity = 1.0;
  207. material.wireframe = 1;
  208. }
  209. }
  210. }
  211. }
  212. });
  213. }
  214. if (me) {
  215. // onTick Hook
  216. if (!defined(me.procInputs)) {
  217. // Do once:
  218. me.procInputs = me[vars.procInputs];
  219. me[vars.procInputs] = function() {
  220. const inputs = arguments[0];
  221. //const world = arguments[1];
  222. onTick(this, world, inputs, renderer);
  223. return me.procInputs(...arguments);
  224. }
  225. }
  226. }
  227. }
  228.  
  229. function findVariables(script) {
  230. const regex = new Map()
  231. .set("procInputs", /this\['(\w+)']=function\((\w+),(\w+),\w+,\w+\){(this)/)
  232. .set("objInstances", /\[\w+\]\['\w+'\]=!\w+,this\['\w+'\]\[\w+\]\['\w+'\]&&\(this\['\w+'\]\[\w+\]\['(\w+)'\]\['\w+'\]=!\w+/)
  233. //renderYou //.set("isYou", /,this\['\w+'\]=!\w+,this\['\w+'\]=!\w+,this\['(\w+)'\]=\w+,this\['\w+'\]\['length'\]=\w+,this\[/)
  234. .set("cnBSeen", /\['(\w+)']=!0x0,!spectating/)
  235. .set("canSee", /,this\['(\w+)'\]=function\(\w+,\w+,\w+,\w+,\w+\){if\(!\w+\)return!\w+;/)
  236. .set("pchObjc", /\(\w+,\w+,\w+\),this\['(\w+)'\]=new \w+\['\w+'\]\(\)/)
  237. .set("recoilAnimY", /\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,/)
  238. .set("mouseDownL", /this\['\w+'\]=function\(\){this\['(\w+)'\]=\w*0,this\['(\w+)'\]=\w*0,this\['\w+'\]={}/)
  239. .set("mouseDownR", /this\['(\w+)']=0x0,this\['keys']=/)
  240. .set("getWorldPosition", /\['camera']\['(\w+)']\(\);if/)
  241. .set("maxHealth", /this\['health']\/this\['(\w+)']\?/)
  242. .set("didShoot", /\w+\['(\w+)']=!0x1,\w+\['burstCount']=0x0/)
  243. .set("ammos", /{!\w+\['reloadTimer']&&\w+\['(\w+)']/)
  244. .set("nAuto", /'(\w+)':!0x0,'burst':/)
  245. .set("weaponIndex", /\['reloadTimer']&&\w+\['\w+']\[\w+\['(\w+)']/)
  246. for (const [name, search] of regex) {
  247. const found = search.exec(script);
  248. if (!found) {
  249. alert(`Failed to find ${name}`);
  250. vars[name] = null;
  251. continue;
  252. } else {
  253. console.log("found ", name, " - ", found[1]);
  254. vars[name] = found[1];
  255. }
  256. }
  257. }
  258.  
  259. class Hook {
  260. constructor(target, fn, blocking = false) {
  261. this.hook = {
  262. apply: function(_target, _this, _arguments) {
  263. let _returnValue = _target.apply(_this, _arguments);
  264. // uncomment for hook logs - skid
  265. /*
  266. console.log('//======================================================================================>');
  267. console.log('HOOKED: ', _target.name, '\n');
  268. console.log('Parent: ', _this);
  269. console.log('Arguments: ', _arguments);
  270. console.log('ReturnValue: ', _returnValue);
  271. console.log('//======================================================================================>');
  272. */
  273.  
  274. fn({
  275. main: _this,
  276. args: _arguments,
  277. rv: _returnValue
  278. });
  279.  
  280. if (!blocking) return _returnValue;
  281. }
  282. };
  283. return new Proxy(target, this.hook);
  284. }
  285. };
  286.  
  287. //======================================================================================>
  288.  
  289. TextEncoder.prototype.encodeInto = new Hook(TextEncoder.prototype.encodeInto, (params) => {
  290. const data = params.args;
  291. if (!count) {
  292. findVariables(data[0]);
  293. }
  294. count++;
  295. });
  296.  
  297. const original_CRC2dSave = CanvasRenderingContext2D.prototype.save;
  298. CanvasRenderingContext2D.prototype.save = function() {
  299. const args = arguments.callee.caller.arguments;
  300. onRender(this.canvas, args[0], args[1], args[2], args[3], args[4]);
  301. return original_CRC2dSave.apply(this, arguments);
  302. }
  303.  
  304. //======================================================================================>
  305. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement