تخطى الى المحتوى
أعمال الشغب

أعمال الشغب

  • بيت
  • أخبار
  • خطوط إرشاد
  • أدلة الفيديو
  • ملاحظات التصحيح
  • بلغ عن سوء معاملة
  • تبديل شكل البحث
بيتبورنر

بيتبورنر – Nuke Available Servers Automation

نشر على 01/20/2022 بواسطة koutoftimer لا تعليقات على بيتبورنر – Nuke Available Servers Automation
  • عنوان: بيتبورنر
  • تاريخ الافراج عنه:
  • المطور:
  • الناشر:
المعلومات حول Bitburner لا تزال غير كاملة. الرجاء مساعدتنا في ملء تفاصيل اللعبة باستخدام هذا نموذج الاتصال.

For those who are looking for something useful out here. I hope you will not blindly copy/paste it in your game but will find out a few new ideas for structuring your code.

Also I can see several rooms for improvements:

  • Create supervisor process that will watch for new available nodes and nuke them for you, so you need to execute something like `run nuke-all-supervisor.js` only once per installing augments.
  • Another room for improvement is installing backdoor. It needs you to progress in the game a bit though, in order to unlock the required API.

الاستخدام

run nuke-all.js

Nukes all the servers you have to meet hacking level. As simple as it looks. No further attention is required. Branding image contains my very first step after installing augments.

Memory consumption

As you can see below, memory consumption for this script is below 8G, which means you can use it at early game. I only now have recognized that the getPurchasedServers function takes half of RAM and it doesn’t really require it, so you can improve memory consumption for your needs.

[home ~/]> mem nuke-all.js 
This script requires 4.75GB of RAM to run for 1 thread(ق)
  2.25غيغابايت | getPurchasedServers (fn)
  1.60غيغابايت | baseCost (misc)
200.00MB | scan (fn)
100.00MB | getServerRequiredHackingLevel (fn)
100.00MB | getServerNumPortsRequired (fn)
100.00MB | fileExists (fn)
 50.00MB | hasRootAccess (fn)
 50.00MB | getHackingLevel (fn)
 50.00MB | nuke (fn)
 50.00MB | brutessh (fn)
 50.00MB | ftpcrack (fn)
 50.00MB | relaysmtp (fn)
 50.00MB | httpworm (fn)
 50.00MB | sqlinject (fn)

Scripts

nuke-all.js – Executable script uses library functions to clarify and simplify behavior.

import { acquireRootAccess, buildNetwork, networkToServerList } from 'utils'

/** @param {ن.س} نانوثانية **/
وظيفة التصدير غير المتزامنة الرئيسية(نانوثانية) {
	const network = buildNetwork(نانوثانية)
	const networkList = networkToServerList(network)
	const notNuked = networkList.filter((server) => !ns.hasRootAccess(server))
	ل (const host of notNuked) {
		acquireRootAccess(نانوثانية, host)
	}

	ns.toast(`${ns.getScriptName()} done`)
}

utils.js – Set of utility/library functions

/**
 * Returns list of callables you can use to open ports on specified server.
 * 
 * @param {ن.س} نانوثانية
 * @returns {Array.<(server: string): void>} 
 */
export function getAvailableMethods(نانوثانية) {
	const methods = []
	ل (const [طريقة, ملف] of [
	 	[ns.brutessh, 'BruteSSH.exe'],
		[ns.ftpcrack, 'FTPCrack.exe'],
		[ns.relaysmtp, 'relaySMTP.exe'],
		[ns.httpworm, 'HTTPWorm.exe'],
		[ns.sqlinject, 'SQLInject.exe']
	]) {
		لو (ns.fileExists(ملف)) {
			methods.push(طريقة)
		}
	}
	return methods
}

/**
 * Try to acquire Root access to the target server.
 * 
 * @param {ن.س} نانوثانية
 * @param {string} target Server name to get Root access to.
 * @returns {boolean} Was attempt successful or not.
 */
export function acquireRootAccess(نانوثانية, target) {
	لو (!ns.hasRootAccess(target)) {
		لو (ns.getHackingLevel() < ns.getServerRequiredHackingLevel(target)) {
			ns.print(`ERROR: Not enough hacking level for ${target}`)
			return false
		}
		const methods = getAvailableMethods(نانوثانية);
		لو (methods.length < ns.getServerNumPortsRequired(target)) {
			ns.print(`ERROR: Not enough breaking methods for ${target}`)
			return false
		}
		ل (const method of methods) {
			طريقة(target)
		}
		ns.nuke(target)
	}
	return true
}

/**
 * Simple directed graph representation of a network, which consists of
 * it's name and list of child nodes.
 * 
 * @typedef {{اسم: string, children: NetworkNode[]}} NetworkNode
 */

/**
 * Returns network representation in form of directed graph using DFS.
 * The most common case is that you do not care about network nodes you can 
 * not nuke right now. That is why this function only returns nodes for 
 * which you have meet hacking level.
 * 
 * @param {ن.س} نانوثانية
 * @param {string} name Name of the network node/server we are working with.
 * @param {string[]} used List of nodes we have already processed.
 * @returns {NetworkNode} Directed graph
 */
export function buildNetwork(نانوثانية, name = 'home', used = []) {
	used.push(اسم)
	const node = { اسم: اسم, children: [] }
	const serverList = ns.getPurchasedServers()
	ل (const child of ns.scan(node.name)) {
		لو (ns.getServerRequiredHackingLevel(child) <= ns.getHackingLevel() && 
		    !used.includes(child) && !serverList.includes(child)
		) {
			node.children.push(buildNetwork(نانوثانية, child, used))
		}
	}
	return node
}

/**
 * It is not strictly required to works with network in form of a graph. 
 * Sometimes we just have to know what nodes are present. This is what 
 * this function is for: to convert data structure format from directed 
 * graph to plain list of network's nodes.
 * 
 * @param {NetworkNode} node
 * @returns {string[]} List of all servers in the network.
 */
export function networkToServerList(node) {
	const list = [node.name]
	لو (node.children.length) {
		ل (const child of node.children) {
			list.push(...networkToServerList(child))
		}
	}
	return list
}

هذا كل ما نشاركه اليوم من أجل هذا بيتبورنر مرشد. تم إنشاء هذا الدليل وكتابته في الأصل بواسطة koutoftimer. في حالة فشلنا في تحديث هذا الدليل, يمكنك العثور على آخر تحديث باتباع هذا وصلة.

إذا كنت تعتقد أن أيًا من محتويات هذا الموقع ينتهك حقوقك, بما في ذلك حقوق الملكية الفكرية الخاصة بك, يرجى الاتصال بنا على الفور باستخدام نموذج الاتصال الخاص بنا.
خطوط إرشاد العلامات:بيتبورنر

آخر الملاحة

المنشور السابق: Moonlighter – General Info and Secret Rooms Guide
المشاركة التالية: Labyrinthine – مستوى 5 رسم خريطة + Collectibles Locations Guide

ترك الرد إلغاء الرد

لن يتم نشر عنوان بريدك الإلكتروني. تم وضع علامة على الحقول المطلوبة *

  • عنوان: بيتبورنر
  • تاريخ الافراج عنه:
  • المطور:
  • الناشر:
المعلومات حول Bitburner لا تزال غير كاملة. الرجاء مساعدتنا في ملء تفاصيل اللعبة باستخدام هذا نموذج الاتصال.

تنصل

ويستمد كل محتوى استشهد من مصادرها الخاصة. إذا كنت تعتقد أننا استخدمنا المحتوى الخاص بك دون إذن, تأكد من الوصول إلينا وسنأخذ الأمر على محمل الجد.
  • معلومات عنا
  • اتصل بنا
  • سياسة الخصوصية
  • شروط الخدمة

حقوق النشر © 2025 أعمال الشغب.

مشغل بواسطة PressBook News وورد موضوع