2021-10-30 18:34:14 +02:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home ](./index.md ) > [bitburner ](./bitburner.md ) > [NS ](./bitburner.ns.md )
## NS interface
2021-10-30 21:46:34 +02:00
Collection of all functions passed to scripts
2021-10-30 18:34:14 +02:00
< b > Signature:< / b >
```typescript
export interface NS extends Singularity
```
< b > Extends:</ b > [Singularity ](./bitburner.singularity.md )
## Properties
| Property | Type | Description |
| --- | --- | --- |
2021-10-30 21:46:34 +02:00
| [args ](./bitburner.ns.args.md ) | (string \| number)\[\] | Arguments passed into the script. |
2021-11-04 01:19:52 +01:00
| [bladeburner ](./bitburner.ns.bladeburner.md ) | [Bladeburner ](./bitburner.bladeburner.md ) | Namespace for bladeburner functions. |
| [codingcontract ](./bitburner.ns.codingcontract.md ) | [CodingContract ](./bitburner.codingcontract.md ) | Namespace for codingcontract functions. |
| [formulas ](./bitburner.ns.formulas.md ) | [Formulas ](./bitburner.formulas.md ) | Namespace for formulas functions. |
| [gang ](./bitburner.ns.gang.md ) | [Gang ](./bitburner.gang.md ) | Namespace for gang functions. |
| [hacknet ](./bitburner.ns.hacknet.md ) | [Hacknet ](./bitburner.hacknet.md ) | Namespace for hacknet functions. |
| [sleeve ](./bitburner.ns.sleeve.md ) | [Sleeve ](./bitburner.sleeve.md ) | Namespace for sleeve functions. |
| [stock ](./bitburner.ns.stock.md ) | [TIX ](./bitburner.tix.md ) | Namespace for stock functions. |
2021-10-30 18:34:14 +02:00
## Methods
| Method | Description |
| --- | --- |
2021-11-04 01:19:52 +01:00
| [alert(msg) ](./bitburner.ns.alert.md ) | Open up a message box. |
| [asleep(millis) ](./bitburner.ns.asleep.md ) | Suspends the script for n milliseconds. Doesn't block with concurrent calls. |
| [atExit(f) ](./bitburner.ns.atexit.md ) | Add callback function when the script dies |
2021-11-03 23:16:10 +01:00
| [brutessh(host) ](./bitburner.ns.brutessh.md ) | Runs BruteSSH.exe on a server. |
2021-11-04 01:19:52 +01:00
| [clear(handle) ](./bitburner.ns.clear.md ) | Clear data from a file. |
2021-10-30 18:34:14 +02:00
| [clearLog() ](./bitburner.ns.clearlog.md ) | Clears the script’ s logs. |
2021-11-04 01:19:52 +01:00
| [clearPort(handle) ](./bitburner.ns.clearport.md ) | Clear data from a port. |
2021-11-03 23:16:10 +01:00
| [deleteServer(host) ](./bitburner.ns.deleteserver.md ) | Delete a purchased server. |
2021-10-30 21:46:34 +02:00
| [disableLog(fn) ](./bitburner.ns.disablelog.md ) | Disables logging for the given function. |
2021-11-03 23:16:10 +01:00
| [enableLog(fn) ](./bitburner.ns.enablelog.md ) | Enable logging for a certain function. |
| [exec(script, host, numThreads, args) ](./bitburner.ns.exec.md ) | Start another script on any server. |
2021-10-30 18:34:14 +02:00
| [exit() ](./bitburner.ns.exit.md ) | Terminates the current script immediately. |
2021-11-03 23:16:10 +01:00
| [fileExists(filename, host) ](./bitburner.ns.fileexists.md ) | Check if a file exists. |
2021-11-04 01:19:52 +01:00
| [flags(schema) ](./bitburner.ns.flags.md ) | Parse command line flags. |
2021-11-03 23:16:10 +01:00
| [ftpcrack(host) ](./bitburner.ns.ftpcrack.md ) | Runs FTPCrack.exe on a server. |
| [getBitNodeMultipliers() ](./bitburner.ns.getbitnodemultipliers.md ) | Get the current Bitnode multipliers. |
2021-10-30 18:34:14 +02:00
| [getFavorToDonate() ](./bitburner.ns.getfavortodonate.md ) | Returns the amount of Faction favor required to be able to donate to a faction. |
2021-11-03 23:16:10 +01:00
| [getGrowTime(host) ](./bitburner.ns.getgrowtime.md ) | Get the execution time of a grow() call. |
2021-10-30 18:34:14 +02:00
| [getHackingLevel() ](./bitburner.ns.gethackinglevel.md ) | Returns the player’ s current hacking level. |
2021-11-03 23:16:10 +01:00
| [getHackingMultipliers() ](./bitburner.ns.gethackingmultipliers.md ) | Get hacking related multipliers. |
| [getHacknetMultipliers() ](./bitburner.ns.gethacknetmultipliers.md ) | Get hacknet related multipliers. |
| [getHackTime(host) ](./bitburner.ns.gethacktime.md ) | Get the execution time of a hack() call. |
2021-10-30 18:34:14 +02:00
| [getHostname() ](./bitburner.ns.gethostname.md ) | Returns a string with the hostname of the server that the script is running on. |
2021-11-04 01:19:52 +01:00
| [getPlayer() ](./bitburner.ns.getplayer.md ) | Get information about the player. |
2021-11-03 23:16:10 +01:00
| [getPortHandle(port) ](./bitburner.ns.getporthandle.md ) | Get all data on a port. |
| [getPurchasedServerCost(ram) ](./bitburner.ns.getpurchasedservercost.md ) | Get cost of purchasing a server. |
2021-10-30 18:34:14 +02:00
| [getPurchasedServerLimit() ](./bitburner.ns.getpurchasedserverlimit.md ) | Returns the maximum number of servers you can purchase. |
| [getPurchasedServerMaxRam() ](./bitburner.ns.getpurchasedservermaxram.md ) | Returns the maximum RAM that a purchased server can have. |
| [getPurchasedServers(hostnameMode) ](./bitburner.ns.getpurchasedservers.md ) | Returns an array with either the hostnames or IPs of all of the servers you have purchased. |
2021-11-04 01:19:52 +01:00
| [getRunningScript(fn, hostname, args) ](./bitburner.ns.getrunningscript.md ) | Get general info about a running script. |
2021-11-03 23:16:10 +01:00
| [getScriptExpGain(script, host, args) ](./bitburner.ns.getscriptexpgain.md ) | Get the exp gain of a script. |
| [getScriptIncome(script, host, args) ](./bitburner.ns.getscriptincome.md ) | Get the income of a script. |
| [getScriptLogs(fn, host, args) ](./bitburner.ns.getscriptlogs.md ) | Get all the logs of a script. |
2021-10-30 18:34:14 +02:00
| [getScriptName() ](./bitburner.ns.getscriptname.md ) | Returns the current script name. |
2021-11-03 23:16:10 +01:00
| [getScriptRam(script, host) ](./bitburner.ns.getscriptram.md ) | Get the ram cost of a script. |
2021-10-30 18:34:14 +02:00
| [getServer(host) ](./bitburner.ns.getserver.md ) | Returns a server object for the given server. Defaults to the running script's server if host is not specified. |
2021-11-04 01:19:52 +01:00
| [getServerBaseSecurityLevel(host) ](./bitburner.ns.getserverbasesecuritylevel.md ) | |
2021-11-03 23:16:10 +01:00
| [getServerGrowth(host) ](./bitburner.ns.getservergrowth.md ) | Get a server growth parameter. |
| [getServerMaxMoney(host) ](./bitburner.ns.getservermaxmoney.md ) | Get maximum money available on a server. |
2021-11-04 01:19:52 +01:00
| [getServerMaxRam(host) ](./bitburner.ns.getservermaxram.md ) | Get the max RAM on a server. |
2021-10-30 18:34:14 +02:00
| [getServerMinSecurityLevel(host) ](./bitburner.ns.getserverminsecuritylevel.md ) | Returns the minimum security level of the target server. |
2021-11-03 23:16:10 +01:00
| [getServerMoneyAvailable(host) ](./bitburner.ns.getservermoneyavailable.md ) | Get money available on a server. |
2021-10-30 18:34:14 +02:00
| [getServerNumPortsRequired(host) ](./bitburner.ns.getservernumportsrequired.md ) | Returns the number of open ports required to successfully run NUKE.exe on the specified server. |
2021-11-04 01:19:52 +01:00
| [getServerRam(host) ](./bitburner.ns.getserverram.md ) | |
2021-10-30 18:34:14 +02:00
| [getServerRequiredHackingLevel(host) ](./bitburner.ns.getserverrequiredhackinglevel.md ) | Returns the required hacking level of the target server. |
2021-11-03 23:16:10 +01:00
| [getServerSecurityLevel(host) ](./bitburner.ns.getserversecuritylevel.md ) | Get server security level. |
2021-11-04 01:19:52 +01:00
| [getServerUsedRam(host) ](./bitburner.ns.getserverusedram.md ) | Get the used RAM on a server. |
2021-10-30 18:34:14 +02:00
| [getTimeSinceLastAug() ](./bitburner.ns.gettimesincelastaug.md ) | Returns the amount of time in milliseconds that have passed since you last installed Augmentations. |
2021-11-03 23:16:10 +01:00
| [getWeakenTime(host) ](./bitburner.ns.getweakentime.md ) | Get the execution time of a weaken() call. |
2021-11-03 05:27:21 +01:00
| [grow(host, opts) ](./bitburner.ns.grow.md ) | Spoof money in a servers bank account, increasing the amount available. |
2021-11-03 23:16:10 +01:00
| [growthAnalyze(host, growthAmount) ](./bitburner.ns.growthanalyze.md ) | Calculate the number of grow thread needed to grow a server by a certain multiplier. |
| [growthAnalyzeSecurity(threads) ](./bitburner.ns.growthanalyzesecurity.md ) | Calculate the security increase for a number of thread. |
2021-11-03 05:27:21 +01:00
| [hack(host, opts) ](./bitburner.ns.hack.md ) | Steal a servers money. |
2021-11-04 01:19:52 +01:00
| [hackAnalyze(host) ](./bitburner.ns.hackanalyze.md ) | Get the percent of money stolen with a single thread. |
| [hackAnalyzeChance(host) ](./bitburner.ns.hackanalyzechance.md ) | Get the chance of successfully hacking a server. |
2021-11-03 23:16:10 +01:00
| [hackAnalyzeSecurity(threads) ](./bitburner.ns.hackanalyzesecurity.md ) | Get the security increase for a number of thread. |
2021-11-03 05:27:21 +01:00
| [hackAnalyzeThreads(host, hackAmount) ](./bitburner.ns.hackanalyzethreads.md ) | Predict the effect of hack. |
2021-11-03 23:16:10 +01:00
| [hasRootAccess(host) ](./bitburner.ns.hasrootaccess.md ) | Check if your have root access on a server. |
| [httpworm(host) ](./bitburner.ns.httpworm.md ) | Runs HTTPWorm.exe on a server. |
2021-10-30 18:34:14 +02:00
| [isLogEnabled(fn) ](./bitburner.ns.islogenabled.md ) | Checks the status of the logging for the given function. |
2021-11-03 23:16:10 +01:00
| [isRunning(script, host, args) ](./bitburner.ns.isrunning.md ) | Check if a script is running. |
| [kill(script, host, args) ](./bitburner.ns.kill.md ) | Terminate another script. |
| [killall(host) ](./bitburner.ns.killall.md ) | Terminate all scripts on a server. |
| [ls(host, grep) ](./bitburner.ns.ls.md ) | List files on a server. |
| [nFormat(n, format) ](./bitburner.ns.nformat.md ) | Format a number |
| [nuke(host) ](./bitburner.ns.nuke.md ) | Runs NUKE.exe on a server. |
| [peek(port) ](./bitburner.ns.peek.md ) | Get a copy of the data from a port without popping it. |
2021-10-30 18:34:14 +02:00
| [print(msg) ](./bitburner.ns.print.md ) | Prints a value or a variable to the script’ s logs. |
2021-11-03 23:16:10 +01:00
| [prompt(txt) ](./bitburner.ns.prompt.md ) | Prompt the player with a Yes/No modal. |
| [ps(host) ](./bitburner.ns.ps.md ) | List running scripts on a server. |
| [purchaseServer(hostname, ram) ](./bitburner.ns.purchaseserver.md ) | Purchase a server. |
| [read(handle) ](./bitburner.ns.read.md ) | Read content of a file. |
2021-11-04 01:19:52 +01:00
| [readPort(port) ](./bitburner.ns.readport.md ) | Read data from a port. |
2021-11-03 23:16:10 +01:00
| [relaysmtp(host) ](./bitburner.ns.relaysmtp.md ) | Runs relaySMTP.exe on a server. |
| [rm(name, host) ](./bitburner.ns.rm.md ) | Delete a file. |
| [run(script, numThreads, args) ](./bitburner.ns.run.md ) | Start another script on the current server. |
| [scan(host, hostnames) ](./bitburner.ns.scan.md ) | Get the list servers connected to a server. |
2021-11-04 01:19:52 +01:00
| [scp(files, source, destination) ](./bitburner.ns.scp.md ) | Copy file between servers. |
2021-11-03 23:16:10 +01:00
| [scriptKill(script, host) ](./bitburner.ns.scriptkill.md ) | Kill all scripts with a filename. |
| [scriptRunning(script, host) ](./bitburner.ns.scriptrunning.md ) | Check if any script with a filename is running. |
2021-10-30 18:34:14 +02:00
| [serverExists(host) ](./bitburner.ns.serverexists.md ) | Returns a boolean denoting whether or not the specified server exists. |
| [sleep(millis) ](./bitburner.ns.sleep.md ) | Suspends the script for n milliseconds. |
2021-11-03 23:16:10 +01:00
| [spawn(script, numThreads, args) ](./bitburner.ns.spawn.md ) | Terminate current script and start another in 10s. |
| [sprintf(format, args) ](./bitburner.ns.sprintf.md ) | Format a string. |
| [sqlinject(host) ](./bitburner.ns.sqlinject.md ) | Runs SQLInject.exe on a server. |
| [tail(fn, host, args) ](./bitburner.ns.tail.md ) | Open the tail window of a script. |
2021-11-04 01:19:52 +01:00
| [tFormat(milliseconds, milliPrecision) ](./bitburner.ns.tformat.md ) | Format time to readable string |
| [toast(msg, variant) ](./bitburner.ns.toast.md ) | Queue a toast (bottom-right notification). |
2021-10-30 18:34:14 +02:00
| [tprint(msg) ](./bitburner.ns.tprint.md ) | Prints a value or a variable to the Terminal. |
2021-11-04 01:19:52 +01:00
| [tprintf(msg) ](./bitburner.ns.tprintf.md ) | Prints a raw value or a variable to the Terminal. |
2021-11-12 21:42:57 +01:00
| [tryWritePort(port, data) ](./bitburner.ns.trywriteport.md ) | Attempt to write to a port. |
2021-11-03 23:16:10 +01:00
| [vsprintf(format, args) ](./bitburner.ns.vsprintf.md ) | Format a string with an array of arguments. |
2021-11-03 05:27:21 +01:00
| [weaken(host, opts) ](./bitburner.ns.weaken.md ) | Reduce a server security level. |
| [weakenAnalyze(threads, cores) ](./bitburner.ns.weakenanalyze.md ) | Predict the effect of weaken. |
2021-11-03 23:16:10 +01:00
| [wget(url, target, host) ](./bitburner.ns.wget.md ) | Download a file from the internet. |
| [write(handle, data, mode) ](./bitburner.ns.write.md ) | Write data to a file. |
2021-11-04 01:19:52 +01:00
| [writePort(port, data) ](./bitburner.ns.writeport.md ) | Write data to a port. |
2021-10-30 18:34:14 +02:00