2019-03-03 04:08:54 +01:00
|
|
|
hasRootAccess() Netscript Function
|
|
|
|
==================================
|
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
.. js:function:: hasRootAccess(hostname)
|
2019-03-03 04:08:54 +01:00
|
|
|
|
|
|
|
: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.
|
2019-03-03 04:08:54 +01:00
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
Example:
|
2019-03-03 04:08:54 +01:00
|
|
|
|
2021-03-12 08:51:56 +01:00
|
|
|
.. code-block:: javascript
|
2019-03-03 04:08:54 +01:00
|
|
|
|
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");
|
2019-03-03 04:08:54 +01:00
|
|
|
}
|