bitburner-src/doc/source/netscript/basicfunctions/hasRootAccess.rst

23 lines
548 B
ReStructuredText
Raw Normal View History

hasRootAccess() Netscript Function
==================================
2021-03-12 08:51:56 +01:00
.. js:function:: hasRootAccess(hostname)
:RAM cost: 0.05 GB
2021-03-12 08:51:56 +01:00
:param string hostname: Hostname of the target server.
:returns: ``true`` if you have root access on the target server.
2021-03-12 08:51:56 +01:00
Example:
2021-03-12 08:51:56 +01:00
.. code-block:: javascript
2023-01-06 13:43:09 +01:00
if (ns.hasRootAccess("foodnstuff") == false) {
ns.nuke("foodnstuff");
}
.. code-block:: javascript
if (ns.hasRootAccess("foodnstuff")) {
ns.exec("foo.js", 1, "foodnstuff");
}