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