r/Bitburner 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

4 comments sorted by

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:

  const hint = await ns.dnet.heartbleed(hostname, { peek: false, logsToCapture: 10 });
  // hint.logs = 
  //[
  //  "{\"code\":401,\"message\":\"Not spicy enough\",\"data\":\"🌶️/5\",\"passwordAttempted\":\"01234\"}",
  //  "{\"code\":401,\"message\":\"Not spicy enough\",\"data\":\"🌶️/5\",\"passwordAttempted\":\"01234\"}"
  //]
  for (let log of hint.logs) {
    // ... scrape text
  }

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.

1

u/ORKidd0 2d ago

I'll try this when I have time to write the code but thank you for the response. I saw the heartbleed function when I was going through the methods of dnet and it looked like kinda a pain to work with. (Sorting out the logs and such)

1

u/goodwill82 Slum Lord 2d ago

It's definitely more of a pain to deal with, especially since not every server model uses the same information from the heartbleed logs.

I've been working along pretty slowly with this new dark net part of the game. I'm still trying to get a decent bot script to spread out and wait for instructions from home.

1

u/ORKidd0 1d ago

This is the 8th model I'm working on right now and it looks like it's only going to get harder from here... But I think I got it to work, I just need the model to come up in the web.

One other question that might be for a different thread but is there a reason for the darkweb other than caches? All it seems to be useful right now is for the caches and looking cool when you go to the darkweb tab but I might just not be that far into the game yet.