Compare commits
1 Commits
develop
...
laptop-bac
Author | SHA1 | Date | |
---|---|---|---|
ff4cc47e60 |
30
.github/issue_template/bug.md
vendored
30
.github/issue_template/bug.md
vendored
@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
name: "Bug report"
|
|
||||||
about: "Encountered an issue"
|
|
||||||
ref: "develop"
|
|
||||||
labels:
|
|
||||||
- Type/Bug
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Bug Report
|
|
||||||
<!-- Description of problem -->
|
|
||||||
I tried to ...
|
|
||||||
|
|
||||||
But instead ...
|
|
||||||
|
|
||||||
## Steps to Reproduce
|
|
||||||
<!-- How can developers replicate & test the problem? -->
|
|
||||||
1.
|
|
||||||
2.
|
|
||||||
3.
|
|
||||||
|
|
||||||
## Logs
|
|
||||||
<!-- Any logs that accompenied the error -->
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
<!-- Screenshots (annoted if possible) of the problem -->
|
|
22
.github/issue_template/enhancement.md
vendored
22
.github/issue_template/enhancement.md
vendored
@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
name: "Enhancement"
|
|
||||||
about: "Request a feature"
|
|
||||||
ref: "develop"
|
|
||||||
labels:
|
|
||||||
- Type/Enhancement
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Feature Request
|
|
||||||
<!-- Detailed description -->
|
|
||||||
...
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
<!-- Bullet list of requirments -->
|
|
||||||
1. ...
|
|
||||||
2. ...
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
<!-- Any additional considerations, solutions or design choices -->
|
|
||||||
...
|
|
14
.github/pull_request_template.md
vendored
14
.github/pull_request_template.md
vendored
@ -1,14 +0,0 @@
|
|||||||
## Description
|
|
||||||
<!-- Adition information & context -->
|
|
||||||
...
|
|
||||||
|
|
||||||
## Issues
|
|
||||||
<!-- Issues this PR will address -->
|
|
||||||
- closes #___
|
|
||||||
- owner/repo#___
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
<!-- Compelte after creating PR -->
|
|
||||||
- [ ] Linked issues
|
|
||||||
- [ ] Reviewed changes
|
|
||||||
- [ ] Updated comments/documentation
|
|
7
LICENSE
7
LICENSE
@ -1,7 +0,0 @@
|
|||||||
Copyright (c) 2023 Zakary Timson
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
238
README.md
238
README.md
@ -1,65 +1,33 @@
|
|||||||
<!-- Header -->
|
# BitBurner - Scripts
|
||||||
<div id="top" align="center">
|
A collection of scripts & information pertaining to the [open source](https://github.com/danielyxie/bitburner) game
|
||||||
<br />
|
[BitBurner](https://danielyxie.github.io/bitburner/).
|
||||||
|
|
||||||
<!-- Logo -->
|
|
||||||
<img src="https://git.zakscode.com/repo-avatars/9b25b57330ba3a1d9da80dad4051be68373e52c4bfffc6f6ba9e89f7392f5f7d" alt="Logo" width="200" height="200">
|
|
||||||
|
|
||||||
<!-- Title -->
|
|
||||||
### Bitburner
|
|
||||||
|
|
||||||
<!-- Description -->
|
|
||||||
Collection of Bitburner scipts
|
|
||||||
|
|
||||||
<!-- Repo badges -->
|
|
||||||
[![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/bitburner/tags&query=$[0].name)](https://git.zakscode.com/ztimson/bitburner/tags)
|
|
||||||
[![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/bitburner&query=open_pr_counter)](https://git.zakscode.com/ztimson/bitburner/pulls)
|
|
||||||
[![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/bitburner&query=open_issues_count)](https://git.zakscode.com/ztimson/bitburner/issues)
|
|
||||||
|
|
||||||
<!-- Links -->
|
|
||||||
|
|
||||||
---
|
|
||||||
<div>
|
|
||||||
<a href="https://git.zakscode.com/ztimson/bitburner/releases" target="_blank">Release Notes</a>
|
|
||||||
• <a href="https://git.zakscode.com/ztimson/bitburner/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
|
|
||||||
• <a href="https://git.zakscode.com/ztimson/bitburner/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
---
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
- [Bitburner](#top)
|
- [BitBurner - Scripts](#bitburner-scripts)
|
||||||
- [About](#about)
|
- [Table of Contents](#table-of-contents)
|
||||||
- [Built With](#built-with)
|
- [Quick Start](#quick-start)
|
||||||
- [Quick Start](#qiuck-start)
|
- [Guide](#guide)
|
||||||
- [Scripts](#scripts)
|
- [BitNode 1](#bitnode-1)
|
||||||
- [banner.js](#banner)
|
- [Scripts](#scripts)
|
||||||
- [botnet-manager.js (WIP)](#botnet)
|
- [banner.js](#bannerjs)
|
||||||
- [connect.js](#connect)
|
- [botnet-manager.js (WIP)](#botnet-managerjs-wip)
|
||||||
- [copy.js](#copy)
|
- [connect.js](#connectjs)
|
||||||
- [crawler.js](#crawler)
|
- [copy.js](#copyjs)
|
||||||
- [find-target.js](#find-target)
|
- [crawler.js](#crawlerjs)
|
||||||
- [hacknet-manager.js](#hacknet)
|
- [find-target.js](#find-targetjs)
|
||||||
- [miner.js](#miner)
|
- [hacknet-manager.js](#hacknet-managerjs)
|
||||||
- [network-graph.js](#network-graph)
|
- [miner.js](#minerjs)
|
||||||
- [rm.js](#rm)
|
- [network-graph.js](#network-graphjs)
|
||||||
- [rootkit.js](#rootkit)
|
- [rm.js](#rmjs)
|
||||||
- [server-manager.js](#server-manager)
|
- [rootkit.js](#rootkitjs)
|
||||||
- [update.js](#update)
|
- [server-manager.js](#server-managerjs)
|
||||||
- [License](#license)
|
- [update.js](#updatejs)
|
||||||
|
|
||||||
## About
|
|
||||||
A collection of scripts & information pertaining to the [open source](https://github.com/danielyxie/bitburner) game [Bitburner](https://danielyxie.github.io/bitburner/)
|
|
||||||
|
|
||||||
### Built with
|
|
||||||
[![JavaScript](https://img.shields.io/badge/JavaScript-000000?style=for-the-badge&logo=javascript)](https://javascript.com/)
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Download the update script in-game & run it
|
# Download the update script in-game & run it
|
||||||
wget https://gitlab.zakscode.com/ztimson/Bitburner/-/raw/develop/scripts/update.js scripts/update.js
|
wget https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/update.js scripts/update.js
|
||||||
run scripts/update.js # Repeat to pull the latest
|
run scripts/update.js # Repeat to pull the latest
|
||||||
|
|
||||||
# View the network
|
# View the network
|
||||||
@ -82,15 +50,31 @@ run scripts/connect.js CSEC
|
|||||||
backdoor
|
backdoor
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Learn more about the [available scripts](#scripts) bellow or pass the `--help` flag to any of the included scripts in-game.
|
||||||
|
|
||||||
|
## Guide
|
||||||
|
This guide documents how you can use this repository to progress through the game. You should complete the tutorial
|
||||||
|
first if you haven't already.
|
||||||
|
|
||||||
|
### BitNode 1
|
||||||
|
1. First you need to download this repo into the game. Manually download `update.js` & run it:
|
||||||
|
`wget https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/update.js scripts/update.js; run scripts/update.js`
|
||||||
|
2. Scan the network to figure out your bearings, take note of discovered server's required hack level:
|
||||||
|
`run scripts/network-graph.js -vd 3`
|
||||||
|
3. Root the lowest level server (probably n00dles) & make it hack itself for money. You should repeat this step when
|
||||||
|
ever your hack level is high enough to hack another a new server. `run scripts/rootkit.js n00dles /scripts/miner.js`
|
||||||
|
4. Start `hacknet-manger.js`. You won't have enough *RAM* in the beginning to run the manager & hack servers. It's
|
||||||
|
recommended you `tail` the manager, so you can easily start/stop it as needed. `run script/hacknet-manager.js -a`
|
||||||
|
5. Once you have enough money ($??,???.??), upgrade your home severs *RAM*:
|
||||||
|
`City > alpha ent. > Upgrade 'home' RAM (8.00GB -> 16.00GB)`
|
||||||
|
6. At this point you have enough *RAM* to use `crawler.js` to automatically discover servers & hack them. Continue to
|
||||||
|
run this periodically as your hack level increases & you unlock more exploits:
|
||||||
|
`run scripts/crawler.js -n /scripts/rootkit.js {{TARGET}} /scripts/miner.js`
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
|
|
||||||
<details>
|
### [banner.js](./scripts/banner.js)
|
||||||
<summary>
|
**RAM:** 1.60 GB
|
||||||
<h3 id="banner" style="display: inline">banner.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 1.60 GB | [Code](./src/banner.js)
|
|
||||||
|
|
||||||
Aesthetic & serves no real purpose. Prints a banner to the terminal & can repeat after game restarts.
|
Aesthetic & serves no real purpose. Prints a banner to the terminal & can repeat after game restarts.
|
||||||
```
|
```
|
||||||
@ -107,15 +91,9 @@ Options:
|
|||||||
-r, --reboot Automatically display after game reboots
|
-r, --reboot Automatically display after game reboots
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [botnet-manager.js (WIP)](./scripts/botnet-manager.js)
|
||||||
<summary>
|
**RAM:** 7.15 GB
|
||||||
<h3 id="botnet" style="display: inline">botnet-manager.js (WIP)</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 7.15 GB | [Code](./scripts/botnet-manager.js)
|
|
||||||
|
|
||||||
Late-game solution to hack servers. It orchestrates an unlimited number of servers to carry out distributed batched
|
Late-game solution to hack servers. It orchestrates an unlimited number of servers to carry out distributed batched
|
||||||
attacks against targets. It includes a bunch of utilities to quickly dispatch single commands to all workers. Manger
|
attacks against targets. It includes a bunch of utilities to quickly dispatch single commands to all workers. Manger
|
||||||
@ -143,15 +121,9 @@ Commands:
|
|||||||
run Copy & run script on all worker nodes
|
run Copy & run script on all worker nodes
|
||||||
start Start this device as the swarm manager
|
start Start this device as the swarm manager
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [connect.js](./scripts/connect.js)
|
||||||
<summary>
|
**RAM:** 1.85 GB
|
||||||
<h3 id="connect" style="display: inline">connect.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 1.85 GB | [Code](./scripts/connect.js)
|
|
||||||
|
|
||||||
The built in `connect` command only allows you to connect to devices in the immediate vicinity or servers that have
|
The built in `connect` command only allows you to connect to devices in the immediate vicinity or servers that have
|
||||||
backdoors installed requiring you to make several jumps. This script will automatically find a path & connect you saving
|
backdoors installed requiring you to make several jumps. This script will automatically find a path & connect you saving
|
||||||
@ -171,15 +143,9 @@ Usage: run connect.js [OPTIONS] SERVER
|
|||||||
Options:
|
Options:
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [copy.js](./scripts/copy.js)
|
||||||
<summary>
|
**RAM:** 4.20 GB
|
||||||
<h3 id="copy" style="display: inline">copy.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 4.20 GB | [Code](./scripts/copy.js)
|
|
||||||
|
|
||||||
Scripts often import other scripts requiring multiple `scp` calls before it can be run on a remote machine. This script
|
Scripts often import other scripts requiring multiple `scp` calls before it can be run on a remote machine. This script
|
||||||
will automatically scan the file being copied for imports & recursively scan & copy the dependencies. Plus it has a
|
will automatically scan the file being copied for imports & recursively scan & copy the dependencies. Plus it has a
|
||||||
@ -205,15 +171,9 @@ Options:
|
|||||||
-q, --quite Suppress program output
|
-q, --quite Suppress program output
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [crawler.js](./scripts/crawler.js)
|
||||||
<summary>
|
**RAM:** 5.80 GB
|
||||||
<h3 id="crawler" style="display: inline">crawler.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 5.80 GB | [Code](./scripts/crawler.js)
|
|
||||||
|
|
||||||
Mid-game solution to distribute & run scripts across the network.
|
Mid-game solution to distribute & run scripts across the network.
|
||||||
```
|
```
|
||||||
@ -242,15 +202,9 @@ Options:
|
|||||||
-v, --verbose Display the server names in the final report
|
-v, --verbose Display the server names in the final report
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [find-target.js](./scripts/find-target.js)
|
||||||
<summary>
|
**RAM:** 4.05 GB
|
||||||
<h3 id="find-target" style="display: inline">find-target.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 4.05 GB | [Code](./scripts/find-target.js)
|
|
||||||
|
|
||||||
A utility to help figure out which server is worth hacking the most. It does this by estimating the financial yield per
|
A utility to help figure out which server is worth hacking the most. It does this by estimating the financial yield per
|
||||||
minute for each server & returns the servers in a sorted list.
|
minute for each server & returns the servers in a sorted list.
|
||||||
@ -271,15 +225,9 @@ Options:
|
|||||||
-v, --verbose Display the estimated income per minute per core
|
-v, --verbose Display the estimated income per minute per core
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [hacknet-manager.js](./scripts/hacknet-manager.js)
|
||||||
<summary>
|
**RAM:** 5.70 GB
|
||||||
<h3 id="hacknet" style="display: inline">hacknet-manager.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 5.70 GB | [Code](./scripts/hacknet-manager.js)
|
|
||||||
|
|
||||||
An early game solution to automate the hacknet & get easy money.
|
An early game solution to automate the hacknet & get easy money.
|
||||||
```
|
```
|
||||||
@ -300,18 +248,12 @@ Options:
|
|||||||
-s, --sleep Amount of time to wait between purchases, defaults to 1 (second)
|
-s, --sleep Amount of time to wait between purchases, defaults to 1 (second)
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [miner.js](./scripts/miner.js)
|
||||||
<summary>
|
**RAM:** 2.45 GB
|
||||||
<h3 id="miner" style="display: inline">miner.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 2.45 GB | [Code](./scripts/miner.js)
|
|
||||||
|
|
||||||
An early-game HGW script to steal money from servers. You can deploy this on each server and have them hack themselves,
|
An early-game HGW script to steal money from servers. You can deploy this on each server and have them hack themselves,
|
||||||
or they can all target the server with the most money which is more efficient (see [find-target.js](#find-target)).
|
or they can all target the server with the most money which is more efficient (see [find-target.js](#find-targetjs)).
|
||||||
```
|
```
|
||||||
[home ~/]> run scripts/miner.js --help
|
[home ~/]> run scripts/miner.js --help
|
||||||
Running script with 1 thread(s), pid 1 and args: ["--help"].
|
Running script with 1 thread(s), pid 1 and args: ["--help"].
|
||||||
@ -330,15 +272,9 @@ Options:
|
|||||||
-s, --sleep Amount of time to wait between purchases, defaults to 1 (second)
|
-s, --sleep Amount of time to wait between purchases, defaults to 1 (second)
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [network-graph.js](./scripts/network-graph.js)
|
||||||
<summary>
|
**RAM:** 3.85 GB
|
||||||
<h3 id="network-graph" style="display: inline">network-graph.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 3.85 GB | [Code](./scripts/network-graph.js)
|
|
||||||
|
|
||||||
A utility to scan the network & build a visual tree of all the devices. It comes with lots of flags to narrow down the
|
A utility to scan the network & build a visual tree of all the devices. It comes with lots of flags to narrow down the
|
||||||
results. It's useful for figuring out where you are, manually finding targets & discovering the path to a server &
|
results. It's useful for figuring out where you are, manually finding targets & discovering the path to a server &
|
||||||
@ -368,17 +304,11 @@ Options:
|
|||||||
-v, --verbose Display level, specs & usage in that order: [HL|P] {CPU|RAM} (USG%)
|
-v, --verbose Display level, specs & usage in that order: [HL|P] {CPU|RAM} (USG%)
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [rm.js](./scripts/rm.js)
|
||||||
<summary>
|
**RAM:** 2.85 GB
|
||||||
<h3 id="rm" style="display: inline">rm.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 2.85 GB | [Code](./scripts/rm.js)
|
[BitBurner-Connector](https://plugins.jetbrains.com/plugin/18338-bitburner-connector) would occasionally push my IDE
|
||||||
|
|
||||||
[bitburner-connector](https://plugins.jetbrains.com/plugin/18338-bitburner-connector) would occasionally push my IDE
|
|
||||||
files to the game, so I created this simple script to recursively search & delete files from a directory to save me
|
files to the game, so I created this simple script to recursively search & delete files from a directory to save me
|
||||||
from having to delete files one-by-one.
|
from having to delete files one-by-one.
|
||||||
```
|
```
|
||||||
@ -399,15 +329,9 @@ Options:
|
|||||||
-r, --recursive Delete everything inside directory
|
-r, --recursive Delete everything inside directory
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [rootkit.js](./scripts/rootkit.js)
|
||||||
<summary>
|
**RAM:** 4.65 GB
|
||||||
<h3 id="rootkit" style="display: inline">rootkit.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 4.65 GB | [Code](./scripts/rootkit.js)
|
|
||||||
|
|
||||||
Automatically gains root on the local or remote server. A script can be passed as an additional argument; it will be
|
Automatically gains root on the local or remote server. A script can be passed as an additional argument; it will be
|
||||||
copied and automatically executed with the maximum number of threads after being rooted.
|
copied and automatically executed with the maximum number of threads after being rooted.
|
||||||
@ -435,15 +359,9 @@ Options:
|
|||||||
-v, --verbose Display level, specs & usage in that order: [HL|P] {CPU|RAM} (USG%)
|
-v, --verbose Display level, specs & usage in that order: [HL|P] {CPU|RAM} (USG%)
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [server-manager.js](./scripts/server-manager.js)
|
||||||
<summary>
|
**RAM:** 11.35 GB
|
||||||
<h3 id="server-miner" style="display: inline">server-miner.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 11.35 GB | [Code](./scripts/server-manager.js)
|
|
||||||
|
|
||||||
Mid-game script to handle purchasing and upgrading servers for more computer power. You can also set a script to run
|
Mid-game script to handle purchasing and upgrading servers for more computer power. You can also set a script to run
|
||||||
automatically after purchase. Useful to chain with `miner.js` or `botnet.js`.
|
automatically after purchase. Useful to chain with `miner.js` or `botnet.js`.
|
||||||
@ -468,15 +386,9 @@ Options:
|
|||||||
-s, --sleep Amount of time to wait between purchases, defaults to 1 (second)
|
-s, --sleep Amount of time to wait between purchases, defaults to 1 (second)
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
### [update.js](./scripts/update.js)
|
||||||
<summary>
|
**RAM:** 2.65 GB
|
||||||
<h3 id="update" style="display: inline">update.js</h3>
|
|
||||||
</summary>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
**RAM:** 2.65 GB | [Code](./scripts/update.js)
|
|
||||||
|
|
||||||
Uses the in-game `wget` to download all the scripts in this repository. Can target remote servers to quickly copy the
|
Uses the in-game `wget` to download all the scripts in this repository. Can target remote servers to quickly copy the
|
||||||
entire toolkit to the target.
|
entire toolkit to the target.
|
||||||
@ -497,9 +409,3 @@ Options:
|
|||||||
--no-banner Hide the banner (Used internally)
|
--no-banner Hide the banner (Used internally)
|
||||||
-h, --help Display this help message
|
-h, --help Display this help message
|
||||||
```
|
```
|
||||||
</details>
|
|
||||||
|
|
||||||
## License
|
|
||||||
Copyright © 2023 Zakary Timson | Available under MIT Licensing
|
|
||||||
|
|
||||||
See the [license](./LICENSE) for more information.
|
|
||||||
|
34
scripts/bitburner.js
Normal file
34
scripts/bitburner.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* Automatically complete the current BitNode.
|
||||||
|
*
|
||||||
|
* @param {NS} ns - BitBurner API
|
||||||
|
*/
|
||||||
|
export function main(ns) {
|
||||||
|
let modules = [
|
||||||
|
'auto-root',
|
||||||
|
'auto-hack',
|
||||||
|
'botnet-manager',
|
||||||
|
'hacknet-manager',
|
||||||
|
'server-manager'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Banner
|
||||||
|
ns.run('/scripts/banner.js', 1, '-r');
|
||||||
|
ns.tprint(`Starting BitBurner with ${modules.length} enabled: `);
|
||||||
|
ns.tprint(modules.join(', '));
|
||||||
|
|
||||||
|
// botnet-manager
|
||||||
|
|
||||||
|
// hacknet-manager
|
||||||
|
ns.run('/scripts/hacknet-manager', 1, '-a');
|
||||||
|
|
||||||
|
// server-manager
|
||||||
|
ns.run('/scripts/server-manager', 1, '');
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
// auto-hack
|
||||||
|
|
||||||
|
|
||||||
|
ns.sleep(1000);
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,20 @@
|
|||||||
import {ArgParser} from '/scripts/lib/arg-parser';
|
import {ArgParser} from '/scripts/lib/arg-parser';
|
||||||
|
import {Config} from '/scripts/lib/data-file';
|
||||||
import {Logger} from '/scripts/lib/logger';
|
import {Logger} from '/scripts/lib/logger';
|
||||||
import {copyWithDependencies} from '/scripts/copy';
|
import {copyWithDependencies} from '/scripts/copy';
|
||||||
|
|
||||||
|
const configPath = '/etc/botnet.txt';
|
||||||
|
const port = 1;
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
running;
|
running;
|
||||||
workers = [];
|
workers = [];
|
||||||
|
|
||||||
constructor(ns, device, port, config = '/conf/botnet.txt') {
|
async constructor(ns, hostname) {
|
||||||
ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
this.ns = ns;
|
this.ns = ns;
|
||||||
this.config = config;
|
this.config = new Config(configPath);
|
||||||
this.device = device;
|
this.hostname = hostname;
|
||||||
this.logger = new Logger(this.ns, [
|
this.logger = new Logger(this.ns, [
|
||||||
() => `Botnet: ${device}`,
|
() => `Botnet: ${device}`,
|
||||||
() => `Workers: ${this.workers.length}\tCores: ${this.workers.reduce((acc, w) => acc + w.cpuCores, 0)}\tRAM: ${this.workers.reduce((acc, w) => acc + w.maxRam, 0)} GB`
|
() => `Workers: ${this.workers.length}\tCores: ${this.workers.reduce((acc, w) => acc + w.cpuCores, 0)}\tRAM: ${this.workers.reduce((acc, w) => acc + w.maxRam, 0)} GB`
|
||||||
@ -124,7 +128,8 @@ class Manager {
|
|||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
// Setup
|
// Setup
|
||||||
ns.disableLog('ALL');
|
ns.disableLog('ALL');
|
||||||
const hostname = ns.getHostname(), portNum = 1;
|
const config = await new Config(ns, configPath).load();
|
||||||
|
const hostname = ns.getHostname();
|
||||||
const argParser = new ArgParser('botnet-manager.js', 'Connect & manage a network of servers to launch distributed attacks.', [
|
const argParser = new ArgParser('botnet-manager.js', 'Connect & manage a network of servers to launch distributed attacks.', [
|
||||||
new ArgParser('copy', 'Copy file & dependencies to botnet', [
|
new ArgParser('copy', 'Copy file & dependencies to botnet', [
|
||||||
{name: 'file', desc: 'File to copy', default: false},
|
{name: 'file', desc: 'File to copy', default: false},
|
||||||
@ -139,6 +144,7 @@ export async function main(ns) {
|
|||||||
new ArgParser('leave', 'Disconnect worker node from swarm', [
|
new ArgParser('leave', 'Disconnect worker node from swarm', [
|
||||||
{name: 'device', desc: 'Device to disconnect, defaults to the current machine', optional: true, default: hostname}
|
{name: 'device', desc: 'Device to disconnect, defaults to the current machine', optional: true, default: hostname}
|
||||||
]),
|
]),
|
||||||
|
new ArgParser('list', 'List connected worker nodes'),
|
||||||
new ArgParser('run', 'Copy & run script on the botnet', [
|
new ArgParser('run', 'Copy & run script on the botnet', [
|
||||||
{name: 'script', desc: 'Script to copy & execute', type: 'string'},
|
{name: 'script', desc: 'Script to copy & execute', type: 'string'},
|
||||||
{name: 'args', desc: 'Arguments for script. Forward the current target with: {{TARGET}}', optional: true, extras: true},
|
{name: 'args', desc: 'Arguments for script. Forward the current target with: {{TARGET}}', optional: true, extras: true},
|
||||||
@ -154,9 +160,9 @@ export async function main(ns) {
|
|||||||
|
|
||||||
// Run command
|
// Run command
|
||||||
if(args['_command'] == 'start') { // Start botnet manager
|
if(args['_command'] == 'start') { // Start botnet manager
|
||||||
ns.tprint(`Starting ${hostname} as botnet manager`);
|
ns.tprint(`Starting botnet controller on: ${hostname}`);
|
||||||
ns.tprint(`Connect more nodes with: run botnet-manager.js join [SERVER]`);
|
ns.tprint(`Connect workers to botnet with: run botnet-manager.js join [SERVER]`);
|
||||||
await new Manager(ns, hostname, portNum).start();
|
await new Manager(ns, hostname).start();
|
||||||
} else if(args['_command'] == 'copy') { // Issue copy command
|
} else if(args['_command'] == 'copy') { // Issue copy command
|
||||||
await ns.writePort(portNum, JSON.stringify({
|
await ns.writePort(portNum, JSON.stringify({
|
||||||
command: 'copy',
|
command: 'copy',
|
||||||
@ -176,6 +182,9 @@ export async function main(ns) {
|
|||||||
command: 'leave',
|
command: 'leave',
|
||||||
value: args['device']
|
value: args['device']
|
||||||
}));
|
}));
|
||||||
|
} else if(args['_command'] == 'list') {
|
||||||
|
ns.tprint('Botnet workers:');
|
||||||
|
ns.tprint(config['workers'].map(worker => worker.hostname).join(', '));
|
||||||
} else if(args['_command'] == 'run') { // Issue run command
|
} else if(args['_command'] == 'run') { // Issue run command
|
||||||
await ns.writePort(portNum, JSON.stringify({
|
await ns.writePort(portNum, JSON.stringify({
|
||||||
command: 'run',
|
command: 'run',
|
||||||
|
31
scripts/lib/data-file.js
Normal file
31
scripts/lib/data-file.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
export class DataFile {
|
||||||
|
/**
|
||||||
|
* Read & write data to a JSON file.
|
||||||
|
*
|
||||||
|
* @param {NS} ns - Bitburner API
|
||||||
|
* @param path - Path to config file
|
||||||
|
*/
|
||||||
|
constructor(ns, path) {
|
||||||
|
this.ns = ns;
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load data file
|
||||||
|
*
|
||||||
|
* @returns {Promise<any>} - Saved data
|
||||||
|
*/
|
||||||
|
async load() {
|
||||||
|
return JSON.parse(await this.ns.read(this.path) || 'null');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save data to file
|
||||||
|
*
|
||||||
|
* @param values - Data to save
|
||||||
|
* @returns {Promise<void>} - Save complete
|
||||||
|
*/
|
||||||
|
async save(values) {
|
||||||
|
await this.ns.write(this.path, JSON.stringify(values), 'w');
|
||||||
|
}
|
||||||
|
}
|
42
scripts/lib/port-helper.js
Normal file
42
scripts/lib/port-helper.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
export class PortHelper {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ns
|
||||||
|
* @param port
|
||||||
|
* @param host
|
||||||
|
*/
|
||||||
|
constructor(ns, port, host) {
|
||||||
|
this.ns = ns;
|
||||||
|
this.host = host;
|
||||||
|
this.portNum = port;
|
||||||
|
this.port = ns.getPortHandle(port);
|
||||||
|
this.callbacks = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
const pending = [];
|
||||||
|
while(!this.port.empty()) pending.push(this.port.read());
|
||||||
|
pending.filter(p => {
|
||||||
|
try {
|
||||||
|
const payload = JSON.parse(p);
|
||||||
|
if(this.callbacks[payload.subject]) return !this.callbacks[payload.subject](payload.value);
|
||||||
|
if(this.callbacks['*']) return !this.callbacks['*'](payload.value);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}).forEach(p => this.port.write(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribe(subject, callback) { if(typeof callback == 'function') this.callbacks[subject] = callback; }
|
||||||
|
|
||||||
|
send(subject, value) {
|
||||||
|
this.ns.writePort(this.portNum, JSON.stringify({
|
||||||
|
from: this.host,
|
||||||
|
subject,
|
||||||
|
value
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
unsubscribe(subject) { delete this.callbacks[subject]; }
|
||||||
|
}
|
@ -183,7 +183,7 @@ export async function main(ns) {
|
|||||||
{name: 'no-banner', desc: 'Hide the banner (Used internally)', flags: ['--no-banner'], default: false}
|
{name: 'no-banner', desc: 'Hide the banner (Used internally)', flags: ['--no-banner'], default: false}
|
||||||
]);
|
]);
|
||||||
const args = argParser.parse(ns.args || []);
|
const args = argParser.parse(ns.args || []);
|
||||||
const src = 'https://raw.githubusercontent.com/PointyTrident/Bitburner/develop/scripts/';
|
const src = 'https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/';
|
||||||
const dest = '/scripts/';
|
const dest = '/scripts/';
|
||||||
const fileList = [
|
const fileList = [
|
||||||
'lib/arg-parser.js',
|
'lib/arg-parser.js',
|
||||||
|
Loading…
Reference in New Issue
Block a user