Attempts to gain root access to all servers and present them in an easy-to-see and use format.
개요
This script gets all servers, opens all ports possible, and attempts to gain root access, all while presenting the user with easy-to-read and useful information.
사용방법
Create each script below and paste the code appropriately.
Run the script!
명령:
run RootAccessor.ns
Runs the script against all servers. Displays results.
run RootAccessor.ns -h
brings up the help menu for the script. The script does not process any further if it contains “-시간” as an argument.
run RootAccessor.ns -s
lists all servers with root access as a space-separated list if users want to utilize them as arguments in other scripts.
run RootAccessor.ns joesguns n00dles max-hardware
attempts to gain root access on target servers (each argument is a server name).
run RootAccessor.ns joesguns n00dles max-hardware -s
run RootAccessor.ns -s joesguns n00dles max-hardware
run RootAccessor.ns joesguns n00dles -s max-hardware
“-에스” can be added as an argument at any time.
RootAccessor.ns Script
Create a new script with whatever name you’d like. I called mine “RootAccessor.ns”. Paste the below code into it. It contains 3 functions that make up the entire script.
/** @param {NS} ns **/ 수입 {allServers} ~에서 "./lib-getServers.ns"; 비동기 함수 메인 내보내기(ns) { var approved = []; var deniedhack = []; var deniedports = []; var denied = []; var other = []; var files = [0, 0, 0, 0, 0]; var maxPorts = 0; //suppress all default log messages ns.tail(); ns.disableLog('모두'); ns.clearLog(); //check for help argument. 만약에 (ns.args.includes("-시간")) {돕다(ns); 반품;} ns.print("For script help use argument '-h' "); ns.print("Executing..."); //process argument calls var target = []; 만약에 (ns.args.length > 0) { 만약에 (ns.args[0] === "-에스") { target = await allServers(ns); } 또 다른 { target = ns.args; } } 또 다른 { target = await allServers(ns); } //check max ports available to open if (ns.FileExists("BruteSSH.exe")) {파일[0] = 1; maxPorts++; ns.print("BruteSSH.exe file exists");} 또 다른 {ns.print("BruteSSH.exe not found");} 만약에 (ns.FileExists("FTPCrack.exe")) {파일[1] = 1; maxPorts++; ns.print("FTPCrack.exe file exists");} 또 다른 {ns.print("FTPCrack.exe not found");} 만약에 (ns.FileExists("relaySMTP.exe")) {파일[2] = 1; maxPorts++; ns.print("relaySMTP.exe file exists");} 또 다른 {ns.print("relaySMTP.exe not found");} 만약에 (ns.FileExists("HTTPWorm.exe")) {파일[3] = 1; maxPorts++; ns.print("HTTPWorm.exe file exists");} 또 다른 {ns.print("HTTPWorm.exe not found");} 만약에 (ns.FileExists("SQLInject.exe")) {파일[4] = 1; maxPorts++; ns.print("SQLInject.exe file exists");} 또 다른 {ns.print("SQLInject.exe not found");} ns.print("Maximum ports able to open: [" + maxPorts + "]\N"); //open all ports and attempt root access for (const n of target) { 만약에 (ns.serverExists(N)) { const serverHackLvl = ns.getServerRequiredHackingLevel(N); const playerHackingLvl = ns.getHackingLevel(); 만약에 (playerHackingLvl >= serverHackLvl) { 만약에 (파일[0]) { Ns.Brutessh(N); } 만약에 (파일[1]) { ns.ftpcrack(N); } 만약에 (파일[2]) { ns.relaysmtp(N);} 만약에 (파일[3]) { ns.httpworm(N); } 만약에 (파일[4]) { ns.sqlinject(N);} gainRootAccess(N, maxPorts, approved, deniedports, denied, other, ns); } 또 다른 { denied.push(N); deniedhack.push("[DENIED] - hack level too low [" + playerHackingLvl + '/' + serverHackLvl + "] ~을 위한 " + N); } } } //output results if (deniedhack.length>0) ns.print(deniedhack.join("\N")); 만약에 (deniedports.length>0) ns.print(deniedports.join("\N")); 만약에 (other.length>0) ns.print("[ALREADY ACQUIRED ROOT ACCESS] ~을 위한 " + other.join("\N[ALREADY ACQUIRED ROOT ACCESS] ~을 위한 ")); 만약에 (approved.length>0) ns.print("[ROOT ACCESS APPROVED] ~을 위한 " + approved.join("\N[ROOT ACCESS APPROVED] ~을 위한 ")); 만약에 (ns.args.includes("-에스")) { ns.print("Copiable list of rooted servers:\N" + approved.join(" ") + other.join(" ")); } } function gainRootAccess(server, portCount, approved, deniedports, denied, other, ns) { 만약에 (!ns.hasRootAccess(server)) { 만약에 (portCount >= ns.getServerNumPortsRequired(server)) { ns.wull(server); approved.push(server); } 또 다른 { denied.push(server); deniedports.push("[ROOT ACCESS DENIED] ~을 위한 " + server + " - Not enough open PORTS"); } } 또 다른 { other.push(server); } } function help(ns) { const text = [ "<========================HELP=====================>\N", "- Script takes in [N] arguments or none at all.", " [N]: server names that you wish to be rooted.", " 예를 들어: run rootAccessor.ns n00dles joesguns zer0\n", "- No args will attempt root access on all servers\n", "- include argument '-s' as an argument to print", " copiable list of all rooted servers\n", "<=================================================>" ]; ns.print(text.join("\N")); }
lib-getServers.ns Script
Create a new script named “lib-getServers.ns” and paste the below helper function.
/** @param {NS} ns **/ export function allServers(ns, removePurchased=true) { 만약에 (removePurchased) var pservs = ns.getPurchasedServers(); const nodes = new Set; function dfs(마디) { nodes.add(마디); ~을 위한 (const neighbor of ns.scan(마디)) { 만약에 (removePurchased) { 만약에 (!pservs.includes(neighbor)) { 만약에 (!nodes.has(neighbor)) { dfs(neighbor); } } } 또 다른 { 만약에 (!nodes.has(neighbor)) { dfs(neighbor); } } } } dfs("집"); 반품 [...노드]; }
이것이 오늘 우리가 공유하는 모든 것입니다. 비트버너 가이드. 이 가이드는 원래 작성자가 작성하고 작성했습니다. Crunchynut. 이 가이드를 업데이트하지 못한 경우, 다음을 수행하여 최신 업데이트를 찾을 수 있습니다. 링크.