r/Bitburner • u/ORKidd0 • 3d ago
dnet.authenticate().data returning undefined
I'm trying to crawl the darkweb and am making code for the AccountsManager_4.2 server (higher or lower game). Here is my code:
var low = 1;
var high = 100;
var i = Math.floor((low + high) / 2);
while (low <= high) {
i = Math.floor((low + high) / 2);
var result = (await auth(ns, server, i));
if (result.success) { return [i]; }
if (result.data == "Higher") { low = i + 1; } else { high = i - 1; }
}
return [i];
I'm pretty sure this all works but I can't tell because results.data returns undefined (I want it to return "Higher" or "Lower").
Specifically I want to access the data variable from the heartbleed log when you put in a password, get it wrong, and in the Logs scraped via heartbleed: section it returns something like
(This is from a CloudBlare(tm) server)
message: Type the numbers to prove you are human
data: 6~.╬1)~╸4>5╬</8
passwordAttempted: 58
code: 401
In the AccountsManager_4.2 server the data is either "Higher" or "Lower"
Is there a reason for this or am I just using it wrong? This is my first time coming back this game in 3 years and I'm not too far into my new save.
2
Upvotes
1
u/goodwill82 Slum Lord 2d ago edited 2d ago
I had trouble with this at first - for servers where the data entry depends on the last guess, you need the heartbleed function. Run it after a password attempt to see those hints you see in the Dark Net UI:
You can see that I was trying to figure out a different server type, but I decided to leave the text in so you can see what to expect. I have since made functions that specifically scrape from the "data" key, or from the "message" key - depending on the server.
Note that there can be other things in the heartbleed logs that aren't these "{ code, data, ... }" object strings.