krunker io wallhack
krunker io wallhack from Pastebin
Krunker io wallhack Pastebin Krunker io wallhack and aimbot paste
// ==UserScript==
// @name SYSTEM BCC - Krunker.io HACK WALL, RELOAD, BHOP
// @namespace Roogybot
// @version 1.0.1
// @description Aimbot desabilitado temporariamente devido a nova atualização, Auto Reload, Auto BHop and Wall Hack for Krunker.io
// @author Roogybot
// @include https://krunker.io/
// @include https://krunker.io/?game=*
// @grant GM_xmlhttpRequest
// @run-at document-start
// ==/UserScript==
var OnOffMode;
(function (OnOffMode) {
OnOffMode["On"] = "On";
OnOffMode["Off"] = "Off";
})(OnOffMode || (OnOffMode = {}));
class Module {
constructor() {
this.allStates = this.getAllModes();
this.currentModeIndex = this.allStates.indexOf(this.getInitialMode());
}
onModeChanged() {
// Let implementations override this if needed
}
onTick() {
// Let implementations override this if needed
}
getInitialMode() {
return this.allStates[0];
}
onKeyPressed() {
this.currentModeIndex++;
if (this.currentModeIndex >= this.allStates.length) {
this.currentModeIndex = 0;
}
this.onModeChanged();
}
isEnabled() {
return this.currentModeIndex !== 0;
}
getStatus() {
return this.allStates[this.currentModeIndex].toString();
}
getCurrentMode() {
return this.allStates[this.currentModeIndex];
}
}
var BHopMode;
(function (BHopMode) {
BHopMode["Off"] = "Off";
BHopMode["Jump"] = "Jump";
BHopMode["SlideJump"] = "Slide Jump";
})(BHopMode || (BHopMode = {}));
class AutoBHop extends Module {
constructor() {
super(...arguments);
this.isSliding = false;
}
getName() {
return 'Auto BHop';
}
getKey() {
return 'B';
}
getAllModes() {
return [BHopMode.Off, BHopMode.Jump, BHopMode.SlideJump];
}
onTick() {
this.control.keys[32] = !this.control.keys[32];
if (this.getCurrentMode() === BHopMode.SlideJump) {
if (this.isSliding) {
this.inputs[8] = 1;
return;
}
if (this.me.yVel < -0.04 && this.me.canSlide) {
this.isSliding = true;
setTimeout(() => {
this.isSliding = false;
}, 350);
this.inputs[8] = 1;
}
}
}
}
class AutoReload extends Module {
getName() {
return 'Auto Reload';
}
getKey() {
return 'J';
}
getAllModes() {
return [OnOffMode.Off, OnOffMode.On];
}
getInitialMode() {
return OnOffMode.On;
}
onTick() {
if (this.me.ammos[this.me.weaponIndex] === 0) {
this.inputs[9] = 1;
}
}
}
class WallHack extends Module {
getName() {
return 'Wall Hack';
}
getKey() {
return 'O';
}
getAllModes() {
return [OnOffMode.Off, OnOffMode.On];
}
getInitialMode() {
unsafeWindow.wallHackEnabled = true;
return OnOffMode.On;
}
onModeChanged() {
unsafeWindow.wallHackEnabled = this.getCurrentMode() === OnOffMode.On;
}
}
class Krunkbot {
constructor() {
this.modules = [];
}
init() {
this.modules.push(new AutoReload());
this.modules.push(new WallHack());
this.modules.push(new AutoBHop());
const initInfoBoxInterval = setInterval(() => {
if (this.canInjectInfoBox()) {
clearInterval(initInfoBoxInterval);
this.injectInfoBox();
this.updateInfoBox();
}
}, 100);
}
onTick(me, inputs) {
this.modules.forEach(module => {
if (module.isEnabled()) {
module.me = me;
module.inputs = inputs;
module.control = unsafeWindow.control;
module.players = unsafeWindow.players;
module.onTick();
}
});
}
onKeyPressed(e) {
let shouldUpdateInfoBox = false;
this.modules.forEach(module => {
if (module.getKey().toUpperCase() === e.key.toUpperCase()) {
module.onKeyPressed();
shouldUpdateInfoBox = true;
}
});
if (shouldUpdateInfoBox) {
this.updateInfoBox();
}
}
updateInfoBox() {
const infoBox = unsafeWindow.document.querySelector('#krunkbotInfoBox');
if (infoBox === null) {
return;
}
const moduleLines = this.modules.map(module => {
return `
[${module.getKey().toUpperCase()}] ${module.getName()}
${module.getStatus()}
`;
});
infoBox.innerHTML = `
Confronted
${moduleLines.join('')}
`.trim();
}
injectInfoBox() {
const infoBox = unsafeWindow.document.createElement('div');
infoBox.innerHTML = `
`.trim();
const leaderDisplay = unsafeWindow.document.querySelector('#leaderDisplay');
leaderDisplay.parentNode.insertBefore(infoBox.firstChild, leaderDisplay.nextSibling);
}
canInjectInfoBox() {
return unsafeWindow.document.querySelector('#leaderDisplay') !== null;
}
}
// tslint:disable no-console
class Logger {
constructor(prefix) {
this.prefix = prefix;
}
log(...message) {
console.log(this.prefix, ...message);
}
error(...message) {
console.error(this.prefix, ...message);
}
crash(message) {
document.open();
document.write(`
Krunkbot has crashed!
Krunkbot has crashed!
`);
document.close();
throw new Error(`${this.prefix} ${message}`);
}
}
const logger = new Logger('[Krunkbot]');
function applyPatch(script, method, regex, replacer) {
const newScript = script.replace(regex, replacer);
if (script === newScript) {
logger.crash(`${method} was not successful`);
}
return newScript;
}
function patchControl(script) {
return applyPatch(script, 'patchControl', /var ([a-zA-Z0-9]+)=this,([a-zA-Z0-9]+)=([a-zA-Z0-9]+)\.renderer\.domElement/, ($0, $1, $2, $3) => {
return `var ${$1} = window.control = this, ${$2} = ${$3}.renderer.domElement;`;
});
}
function patchPlayers(script) {
return applyPatch(script, 'patchPlayers', /if\(this\.now/, 'window.players = this.players.list; if (this.now');
}
function patchOnTick(script) {
return applyPatch(script, 'patchOnTick', /,([a-zA-Z0-9]+)\.procInputs\(([a-zA-Z0-9]+)/, ($0, $1, $2) => {
return `, window.onTick(${$1}, ${$2}), ${$1}.procInputs(${$2}`;
});
}
function patchOnKeyPressed(script) {
return applyPatch(script, 'patchOnKeyPressed', /"keyup",function\(([a-zA-Z0-9]+)\){/, ($0, $1) => {
return `"keyup", function (${$1}) { if (document.activeElement !== chatInput) { window.onKeyPressed(${$1}); }`;
});
}
function patchForWallHack(script) {
return applyPatch(script, 'patchForWallHack', /if\(([a-zA-Z0-9]+)\.inView\){(.+)}else ([a-zA-Z0-9]+)\.style\.display="none"}var ([a-zA-Z0-9]+);/, ($0, $1, $2, $3, $4) => {
return `
if (${$1}.inView || window.wallHackEnabled) {
${$2}
} else ${$3}.style.display = "none"
} var ${$4};
`;
});
}
function patchIsHacker(script) {
return applyPatch(script, 'patchIsHacker', /&&([a-zA-Z0-9]+)\.isHacker&&/, `&& 1 === 0 &&`);
}
function patchLastHack(script) {
return applyPatch(script, 'patchIsHacker', /&&([a-zA-Z0-9]+)\.lastHack&&/, `&& 1 === 0 &&`);
}
function patchServerSearch(script) {
return applyPatch(script, 'patchServerSearch', /([a-zA-Z0-9]+)\.data\.([a-zA-Z0-9]+)\.toLowerCase/, ($0, $1, $2) => {
return `(${$1}.data.${$2} || '').toLowerCase`;
});
}
function patchStyleErrors(script) {
return applyPatch(script, 'patchStyleErrors', /else document\.getElementById\("healthBarE"\+([a-zA-Z0-9]+)\)\.style\.width=([a-zA-Z0-9]+)\+"%"/, ($0, $1, $2) => {
return `else (document.getElementById("healthBarE" + ${$1}) || { style: {} }).style.width = ${$2} + "%"`;
});
}
function patchGameScript(script) {
logger.log('Patching the game script...');
script = patchControl(script);
script = patchPlayers(script);
script = patchOnTick(script);
script = patchOnKeyPressed(script);
script = patchForWallHack(script);
script = patchIsHacker(script);
script = patchLastHack(script);
script = patchServerSearch(script);
script = patchStyleErrors(script);
logger.log('Successfully patched the game script!');
return script;
}
function request(url) {
return new Promise(resolve => {
logger.log(`Retrieving ${url}`);
GM_xmlhttpRequest({
url,
method: 'GET',
onload: response => resolve(response.responseText),
});
});
}
function replaceRemoteScriptWithInline(html, partialSrc, script) {
const inline = ``;
const regExp = new RegExp(``);
const withoutScriptTag = html.replace(regExp, '');
return withoutScriptTag + inline;
}
async function inlineRemoteScript(html, partialSrc) {
const regExp = new RegExp(``);
const [, prefix, suffix] = regExp.exec(html);
const script = await request(prefix + partialSrc + suffix);
return replaceRemoteScriptWithInline(html, partialSrc, script);
}
(async () => {
if (unsafeWindow.navigator.userAgent.includes('Firefox')) {
alert('Krunkbot does not work on Firefox.');
return;
}
window.stop();
logger.log('Loading Krunkbot...');
let newHtml = await request(document.location.href);
const gameScriptHash = /game\.([^\.]+)\.js/.exec(newHtml)[1];
const gameScript = await request(`https://krunker.io/js/game.${gameScriptHash}.js`);
newHtml = await inlineRemoteScript(newHtml, 'libs/zip.js');
newHtml = await inlineRemoteScript(newHtml, 'libs/zip-ext.js');
newHtml = replaceRemoteScriptWithInline(newHtml, 'js/game', patchGameScript(gameScript));
const bot = new Krunkbot();
bot.init();
unsafeWindow.onTick = (me, inputs) => bot.onTick(me, inputs);
unsafeWindow.onKeyPressed = (e) => bot.onKeyPressed(e);
document.open();
document.write(newHtml);
document.close();
logger.log('Successfully loaded Krunkbot!');
})();