Achievement: "Exploit: edit - Open the dev menu" & how to edit your player and more ...

Achievement: "Exploit: edit - Open the dev menu" & how to edit your player and more ...

Just The Achievement

Open the terminal and create a file e.g.

nano dev.jsCopy the code from below into the file and save the file.

Then again in the terminal run the file

run dev.jsThe code:

/** @param {NS} ns **/ let getProps = (obj) => Object.entries(obj).find(entry => entry[0].startsWith("__reactProps"))[1].children.props; let hasPlayer = (obj) => { try { return getProps(obj).player ? true : false; } catch(ex) { return false; } } export async function main(ns) { let boxes = Array.from(eval("document").querySelectorAll("[class*=MuiBox-root]")); let box = boxes.find(x => hasPlayer(x)); if(box) { ns.tprintf("INFO className: \"" + box.className + "\""); let props = getProps(box); // get a 10% cash bonus props.player.money = props.player.money * 1.1; // open dev menu props.router.toDevMenu(); } }

More Details


Achievement: "Exploit: edit - Open the dev menu" & how to edit your player and more ... image 7
Achievement: "Exploit: edit - Open the dev menu" & how to edit your player and more ... image 8
Achievement: "Exploit: edit - Open the dev menu" & how to edit your player and more ... image 9
Achievement: "Exploit: edit - Open the dev menu" & how to edit your player and more ... image 10

The code tries to find the element shown below. It seems like the class prefix can differ (mine is "jss3") so the code searches all elements where class matches "*MuiBox-root*" and then selects the first where player exists.

The code can be simplified but you have to use the classname your instance created.

e.g. "jss3 MuiBox-root" in my case. The code above will show what it used.

Object.entries(eval("document").getElementsByClassName("jss3 MuiBox-root")[0]) .find(x => x[0].startsWith("__reactProps"))[1].children.props.router.toDevMenu();

The objects found can be used to edit in game values in code. Using player you could change money and hacking exp:

props.player.money = props.player.money * 1.1; props.player.hacking_exp = props.player.hacking_exp * 1.1;

Use the debug console to dig deeper and find interesting properties:

The DevMenu looks like this:

And remember "Only meant to be used for testing/debugging"

Have fun ;)

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=2709027618					

More Bitburner guilds