Skip to content
Zharay edited this page Jun 17, 2022 · 4 revisions

The Ports

There are total of 20 ports in the game that act as a global stacked queue (first in, first out) of strings that any and all running scripts have access to for free. By default there can be 50 string messages in each port, but this can (and MUST) be maxed to 100 in the options menu. Using JSONs and both peek (which only reads the top of the stack) and read (which does what peek does but removes that entry) functions, we can handle way more data than normally possible between scripts.

Below is every port we use and what they are used for. I also have this documented in the coordinator.

Port 1 Target Info : GLOBAL

JSON array This is a JSON list of all hacking targets issued by the coordinator. It contains all the static information that other servers could use for their needs. Generally the hack-daemon only really cares about the target's name. Rest is obtained on the fly using their relative commands.

Target Info [{Target, Money Threshold, Max Money, Min Security}]

Port 2 Host Info : GLOBAL

JSON array This is a JSON list of all servers running our hack-daemon or easy-hack scripts and their RAM information. Generally only used by the check-status script.

Host Info [{Host, RAM}]

Port 3 Target Status : GLOBAL

JSON array This is a JSON list of all our targets' current status. Used heavily by hack-daemons who want to work out how many threads are working on any particular task.

Target Status [{Target, Security Risk, Hack Threads, Hack RAM Used, Weaken Threads, Weaken RAM Used, Weaken Grow Threads, Grow RAM Used}]

Port 4 RAM Info : GLOBAL

JSON A simple JSON object that only contains the RAM usage and totals of all servers in the botnet. This information is usually slow/out of sync due to the multi-threaded nature of each script. Mainly used by check-status.

RAM Info {Total RAM Available, Total RAM Used}

Port 5 EXP Status : GLOBAL

JSON array This is a JSON list of all the servers used for hacking EXP farming that is not within the coordinator's target range. So long as they have money, we can use them to increase the player's hacking skill.

EXP Status [{Target, Hack Threads, Hack RAM Used, Weaken Threads, Weaken RAM Used, Weaken Grow Threads, Grow RAM Used}]

Port 6 Lock Info : GLOBAL

JSON array This is a JSON list of each target's lock status in order to combat race conditions. A hack-daemon cannot decide to hack, grow, or weaken until it confirms that it has that task locked by the coordinator. Once it does, it will run it's task and report back to the coordinator that it is done with its lock. If the coordinator does not hear back within 10 seconds, it will clear it regardless.

Lock Info [{Target, Hack Lock, H Lock Time, Weaken Lock, W Lock Time, Grow Lock, G Lock Time}]

Port 8 Target List : GLOBAL

String array A list of all possible targets provided by auto-spread-v2. Used primarily by the coordinator to generate the targets for the botnet.

Target List [target]

Port 11 Add Host : HOME

RAW string stack This is a raw stack of server names that are running a hack-daemon. The coordinator will populate Port 2 with this information.

(Host added to botnet)

Port 12 Delete Host : HOME

RAW string stack This is a raw stack of server names that have been removed from the botnet. Only ever used by the buy-server script when it deletes an obsolete server.

(Host deleted from botnet)

Port 13 Task Info : HOME

RAW JSON stack This is a raw stack of JSONs that hack, grow, and weaken scripts push their information to. The coordinator uses this to populate Port 3's information.

Incoming Task Info {Target being worked on, Task, Done?, Threads, RAM, Security Risk}

Port 14 EXP Task Info : HOME

RAW JSON stack Same as above but for EXP tasks. The coordinator uses this to populate Port 5's information.

Incoming EXP Task Info {EXP being worked on, Task, Done?, Threads, RAM}

Port 15 Lock Info : HOME

RAW JSON stack A raw stack of JSONs that come from the hack-daemons in the botnet. These are typically given the first come, first serve treatment. If a lock is available, whoever gets it first will receive the lock while the rest are tossed out. Sleep timers on the hack-daemon prevent them from requesting locks repeatedly.

Incoming Lock Info {Target for lock, Host, Task, Done?}

Port 16 Stock Info : HOME

RAW JSON stack A raw stack of JSONs that come from our stock-bots. This is typically every stock in the market, a flag of whether we own an long or short, and its information in terms of forecast and profit potential change. The coordinator takes this in and applies the information into the servers associated with their TIX symbol that it then pushes out to Port 3. Do know that this never happens if manipulateStocks is not set.

Incoming Stock Info {TIX, Short?, Long?, forecast, potential profit change}

Post 17 Share Flag : FLAG

RAW String A global flag read by the hack-daemon that switches servers we own (including home) to dedicate its resources only to shareCPU.js. Sending the word "share" to this port is all you need to do. Clearing it or changing the word will break your servers from share() and bring them back to normal botnet logic. You can easily do this via toggleShare.js

Someone sent a "share" command (Toggle Share)

Port 18 Kill Server : FLAG

RAW String stack A raw stack of strings that contain the hostnames of servers in the botnet we want to specifically kill the hack-daemon of. That server must pop its name from the list so that the next server can be handled. Can be easily done via optional script killServer.js

Someone sent a kill server request (kill server [hostname])

Port 19 Liquidate Stocks : FLAG

RAW String A global flag meant only for the running stock-bot. The command (which can be sent by running liquidate.js) will force the stock-bot to sell all stocks before killing itself. Use this when you are about to jump from one run to the next!

Someone sent a sell all stocks command (Sell all command [anytext])

Port 20 Kill All : FLAG

RAW String A global flag used by most on going scripts. Once this command is sent (by running send-kill.js), hack-daemons, easy-hacks, and the buy-server script will cease, leaving behind any grow, weaken, or hack scripts to continue running until their task is done. The coordinator, check-status, stock-bot, and hacknet-mgr will continue running, however.

Someone sent a kill all command (Kill all command [anytext])