GreyScript API – Unofficial Documentation

Grey Hack enables players to create their own programs inside the game via the integrated scripting language called GreyScript. GreyScript is a fork of MiniScript and can be compared to another language such as JavaScript or Lua.

Programs can be created within Grey Hack via the in-game CodeEditor. Alternatively you can also use Visual Studio Code with greybel-vs which includes syntax highlighting and other helpful features. Another alternative is to use the online editor provided by greybel-js. The latter also provides a CLI which can be used for script execution outside the game and bundling of code files.

The best sources for Grey Hack scripts to get inspiration from are greyrepo.xyz and github.com.

  • aptClient

    A aptClient object can be obtained by using include_lib. The classID used for this object is "aptclientLib".

    • add_repo(
      repository: string, port: number = 1542
      ):

      stringornull

      "Unknown error: Unable to access to local computer""/etc/apt/sources.txt does not exist""${repository} it is already added to sources.txt""/etc/apt/sources.txt content is malformed."

      Inserts a repository address into the "/etc/apt/sources.txt" file. If any of the provided parameters have a type that deviates from the defined signature, the method will return null. On success, it will return an empty string. In case of failure, it will return a string with an error message.

      aptClient = include_lib("/lib/aptclient.so")
      result = aptClient.add_repo("177.202.15.132")
      if result == "" then
          print "Addition successful!"
      else
          print "Error while adding: " + result
      end if
    • check_upgrade(
      filepath: string
      ):

      stringornumberornull

      "No internet access.""Remote host is down""Unable to find service ${service}""Invalid target service port configuration.""connection rejected: port forward removed by admin""Unable to connect: missing ${library}""Unable to connect: invalid ${library}""Unexpected library found. Not a valid ${library} library.""Unknown error""Fatal error: ${filepath} corrupted!""Kernel panic: missing ${filepath} file!""Graphics error: ${filepath} not found!""Fatal error: ${filepath} not found!""Connection refused. Address unreachable""Connection refused. The target is behind a firewall.""ip address not found""can't connect: the remote server has been temporarily disabled due to non-payment""can't connect: port ${port} not found""can't connect: port closed""can't connect: There is no active machine behind the port ${port}""can't connect: service not found behind the port ${port}""Unknown error: Unable to access to local computer""apt_check_upgrade: No internet access.""/etc/apt/aptcache.bin not found. Launch apt with the update option to refresh the file""package name can not be empty""${filepath} does not exist in this filesystem""${serviceDBFile} does not exist in the server""apt folder content does not exist in the server""${filepath} does not exist in the server""${serviceDBFile} file content is malformed in the server""/etc/apt/aptcache.bin content is malformed. Launch apt with the update option to refresh the file""${filepath} not found in the server"10

      Checks if there is a newer version of the program or library in the repository. If the provided filepath value is anything other than a string, this method will return null. On success, it will return a number, which can be either zero or one. Zero indicates that there is no new version, while one indicates that there is a new version available. In case of failure, it will return a string containing an error message.

      aptClient = include_lib("/lib/aptclient.so")
      result = aptClient.check_upgrade("/bin/rshell_interface")
      if result == 0 then
          print "Program doesnt need an update!"
      else if result == 1 then
          print "Program does need an update!"
      else
          print "Error while checking version: " + result
      end if
    • del_repo(
      repository: string
      ):

      stringornull

      "Unknown error: Unable to access to local computer""/etc/apt/sources.txt does not exist""${repository} not found in sources.txt""/etc/apt/sources.txt content is malformed."

      Deletes a repository address from the "/etc/apt/sources.txt" file. If the provided repository value is anything other than a string, this method will return null. On success, it will return an empty string. In case of failure, it will return a string with an error message.

      aptClient = include_lib("/lib/aptclient.so")
      result = aptClient.del_repo("177.202.15.132")
      if result == "" then
          print "Deletion successful!"
      else
          print "Error while deleting: " + result
      end if
    • install(
      package: string, customPath: string = ""
      ):

      stringornumberornull

      "unknown error""Invalid path""${filepath} not found""permission denied""permission denied. ${filename} is protected""The copy can not be made. Reached maximum number of files in a folder""The copy can not be made. Reached maximum limit""No internet access.""Remote host is down""Unable to find service ${service}""Invalid target service port configuration.""connection rejected: port forward removed by admin""Unable to connect: missing ${library}""Unable to connect: invalid ${library}""Unexpected library found. Not a valid ${library} library.""Unknown error""can't connect: invalid or missing kernel_router.so in the target router""can't connect: unexpected library found. Not a valid kernel_router.so library in the target router.""Connection refused. Address unreachable""Connection refused. The target is behind a firewall.""Fatal error: ${filepath} corrupted!""Kernel panic: missing ${filepath} file!""Graphics error: ${filepath} not found!""Fatal error: ${filepath} not found!""ip address not found""can't connect: the remote server has been temporarily disabled due to non-payment""can't connect: port ${port} not found""can't connect: port closed""can't connect: There is no active machine behind the port ${port}""can't connect: service not found behind the port ${port}""Unknown error: Unable to access to local computer""apt_install: No internet access.""/etc/apt/aptcache.bin not found. Launch apt with the update option to refresh the file""package name can not be empty""There is not enough free space on the hard disk.""${customPath} not found.""${serviceDBFile} does not exist in the server""apt folder content does not exist in the server""${package} does not exist in the server""/etc/apt/aptcache.bin content is malformed. Launch apt with the update option to refresh the file""${package} not found in the server"1

      Installs a program or library from a remote repository listed in "/etc/apt/sources.txt". If no path is specified, the program installs in "/lib" if it is a library or in "/bin" otherwise. If any of the provided parameters have a type that deviates from the defined signature, the method will return null. On success, this method will return a number with the value one. In case of failure, it will return a string containing an error message.

      aptClient = include_lib("/lib/aptclient.so")
      result = aptClient.install("rshell_interface")
      if result == 1 then
          print "Installed program successful!"
      else
          print "Error while installing: " + result
      end if
    • Search specifically looks for a package in any of the repositories listed in "/etc/apt/sources.txt". If the provided search value is anything other than a string, this method will return null. On success, it will return a string containing all packages that partially match the provided search value. On failure, it will return a string with various error messages.

      aptClient = include_lib("/lib/aptclient.so")
      packages = aptClient.search(".so")
      packageList = packages.split(char(10) + char(10))
      for packageItem in packageList
          entry = packageItem.split(char(10))
          if entry.len != 2 then
              print "something wrong in: " + entry
              continue
          end if
          packageName = entry[0]
          packageDescription = entry[1]
          print "Title: <b>" + packageName + "</b>"
          print "Description: <i>" + packageDescription + "</i>"
          print "----------------------------"
      end for
    • show(
      repository: string
      ):

      stringornull

      "Unknown error: Unable to access to local computer""/etc/apt/aptcache.bin not found. Launch apt with the update option to refresh the file""${repository} repository not found""/etc/apt/aptcache.bin content is malformed. Launch apt with the update option to refresh the file"

      Show displays all the packages available in a repository. The repository must be listed in the "/etc/apt/sources.txt" file. If the provided repository value is anything other than a string, this method will return null. If it cannot find a repository, it will return various error messages. On success, it will return a string containing all packages and their descriptions, with each entry separated by a newline.

      aptClient = include_lib("/lib/aptclient.so")
      packages = aptClient.show("177.202.15.132")
      packageList = packages.split(char(10) + char(10))
      packageList.pop // remove last empty item
      for packageItem in packageList
          entry = packageItem.split(char(10))
          packageName = entry[0]
          packageDescription = entry[1]
          print "Title: <b>" + packageName + "</b>"
          print "Description: <i>" + packageDescription + "</i>"
          print "----------------------------"
      end for
    • update():

      stringornumber

      "Unknown error: Unable to access to local computer""apt_update: No internet access.""${source} repository not found""/etc/apt/sources.txt content is malformed"0

      Update refreshes the list of available packages after adding a new repository in "/etc/apt/sources.txt", or if the remote repository has updated its information in "/server/conf/repod.conf". If the update is successful, an empty string will be returned. In case of failure, a string with an error message will be returned. If for some reason the "/etc/apt/sources.txt" is malformed this method will return a number with the value zero.

      aptClient = include_lib("/lib/aptclient.so")
      result = aptClient.update
      if result == "" then
          print "Update successful!"
      else
          print "Error while updating: " + result
      end if
  • blockchain

    A blockchain object can be obtained by using include_lib. The classID used for this object is "blockchainLib".

    • amount_mined(
      coinName: string
      ):

      stringornumberornull

      "Unknown error: Unable to access to local computer""amount_mined: No internet access.""amount_mined: Coin does not exist."

      Returns a number representing the total amount of mined coins. In case of an error, it will return a string with the details. If the provided coinName is anything other than a string, the method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      mined = blockchain.amount_mined("test")
      if typeof(mined) == "string" then
          exit "Couldnt get amount mined due to: " + mined
      end if
      print "Your mined amount is " + mined
    • coin_price(
      coinName: string
      ):

      nullorstringornumber

      "Unknown error: Unable to access to local computer""coin_price: No internet access.""coin_price: Coin does not exist."

      Returns a number representing the current unit value of the cryptocurrency. In case of an error, a string with the error details will be returned. If the provided coinName is anything other than a string, the method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      price = blockchain.coin_price("test")
      if typeof(price) == "string" then
          exit "Couldnt get coin price due to: " + price
      end if
      print "Your coin price is " + price
    • create_wallet(
      user: string, password: string
      ):

      stringorwalletornull

      "Error: Wallet user already exists.""Error: Only one wallet per player allowed.""Unknown error: Unable to access to local computer""create_wallet: No internet access.""Error: only alphanumeric allowed as name and password""create_wallet: name and password cannot exceed the 16 character limit.""Error: It is necessary to have a bank account to be able to create a wallet."

      Creates a wallet and returns a wallet object on success, which can be used to manage cryptocurrencies. In case of an error, it will return a string with the details. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.create_wallet("test", "test")
      if typeof(wallet) == "string" then
        print "Wallet creation failed due to: " + wallet
      else
        print "Wallet creation was successful!"
      end if
    • delete_coin(
      coinName: string, user: string, password: string
      ):

      numberorstringornull

      "Error: ${coinname} does not exist""Error: incorrect user/password""Unknown error: Unable to access to local computer""delete_coin: No internet access."1

      Removes a cryptocurrency from the world. The credentials used in the creation of the cryptocurrency are required. On success, it will return a number with the value one. On failure, it will return a string containing details. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      result = blockchain.delete_coin("test", "test", "test")
      if typeof(result) == "string" then
          exit "Couldnt delete coin due to: " + result
      end if
      print "Coin got deleted"
    • get_coin(
      coinName: string, user: string, password: string
      ):

      stringorcoinornull

      "Unknown error: Unable to access to local computer""get_coin: No internet access.""get_coin: Incorrect user/password"

      Returns a coin object used to manage the currency. In case of an error, it will return a string with the details. If any of the provided parameters deviate from the defined signature, the method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      if typeof(coin) != "coin" then
          exit "Couldnt get coin object due to: " + coin
      end if
      print "Your coin address is " + coin.get_address
    • get_coin_name(
      user: string, password: string
      ):

      stringornull

      "Unknown error: Unable to access to local computer""get_coin_name: No internet access.""get_coin_name: Incorrect user/password""get_coin_name: No currency has been found"

      Returns a string with the name of the coin owned by the player. In case of an error, it returns a string with details. If any provided parameters deviate from the defined signature, this method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      coinName = blockchain.get_coin_name("test", "test")
      if not coinName.matches("^[A-Z]+$") then
          exit "Couldnt get coin name due to: " + coinName
      end if
      print "The name of the coin you're owning is " + coinName
    • login_wallet(
      user: string, password: string
      ):

      stringorwalletornull

      "Unknown error: Unable to access to local computer""login_wallet: No internet access.""login_wallet: Account not found or incorrect password"

      Returns a wallet object on success. In case of an error, it will return a string indicating the reason. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.login_wallet("test", "test")
      if typeof(wallet) == "string" then
        print "Login failed due to: " + wallet
      else
        print "Login was successful!"
      end if
    • show_history(
      coinName: string
      ):

      map<number,list<any>>orstringornull

      "Unknown error: Unable to access to local computer""show_history: No internet access."

      Returns a map with the latest changes in the value of a specific cryptocurrency. The key of the map is an index represented by a number. The value is a list, where index 0 is the historical price of the coin and index 1 is the date when the price change occurred. If the provided coinName is anything other than a string or if no coin exists with this name, the method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      history = blockchain.show_history("test")
      if typeof(history) == "string" then
          exit "Couldnt fetch history due to: " + history
      else if history == null then
          exit "There doesnt seem to be a coin"
      end if
      for entry in history.values
          price = entry[0]
          date = entry[1]
          print "The price on " + date + " was " + price
      end for
  • class

    A class or object is a map with a special __isa entry that points to the parent. This is set automatically when you use the new operator.

    Shape = { "sides": 0 }
    Square = new Shape
    Square.sides = 4
    x = new Square
    print(x.sides) // 4
  • coin

    A coin object can be obtained by using get_coin. The classID used for this object is "coin".

    • create_subwallet(
      walletID: string, pin: string, subWalletUser: string, subWalletPass: string
      ):

      stringornumberornull

      "Error: Wallet does not exists.""Error: Coin does not exist.""Error: This username already exists""Error: Incorrect PIN""Error: only a maximum of 10 subwallets per coin is allowed.""Unknown error: Unable to access to local computer""error: No internet access."1

      Registers a new account in the coin that can be used to manage services such as stores. It is necessary to provide the PIN of the owner's wallet that wants to register. In case of success, the method will return a number with the value one. If any of the provided parameters have a type that deviates from the defined signature, the method will return null. In case of an error, a string with the details is returned.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      wallet = blockchain.login_wallet("test", "test")
      result = coin.create_subwallet("test", wallet.get_pin, "test", "test")
      if typeof(result) == "string" then
          exit "Failed to create subwallet due to: " + result
      end if
      print "Successfully created subwallet!"
    • get_address():

      string

      "Error: ${coinName} does not exist""Unknown error: Unable to access to local computer""error: No internet access."

      Returns the configured address that will be shown to users who do not have the currency, indicating where they have to register. In case of an error, it returns a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.get_address
      if not is_valid_ip(result) then
          exit "Failed to get address due to: " + result
      end if
      print "address: " + result
    • get_cycle_mining():

      stringornumber

      "Unknown error: Unable to access to local computer""error: No internet access."

      Returns a number representing the defined interval in which each user receives a coin reward when mining. In case of failure, the method will return a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.get_cycle_mining
      if typeof(result) == "string" then
          exit "Failed getting cyclic mining value due to: " + result
      end if
      print "cyclic mining value: " + result
    • get_mined_coins():

      stringornumber

      "Unknown error: Unable to access to local computer""error: No internet access."

      Returns a number representing the amount of coins that have been mined so far. In case of an error, it returns a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.get_mined_coins
      if typeof(result) == "string" then
          exit "Failed to get mined coins due to: " + result
      end if
      print "mined coins: " + result
    • get_reward():

      stringornumber

      "Unknown error: Unable to access to local computer""error: No internet access."

      Returns a number representing the amount of coins that will be received as a reward after each mining cycle. In case of failure, the method will return a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.get_reward
      if typeof(result) == "string" then
          exit "Failed getting reward value due to: " + result
      end if
      print "reward value: " + result
    • get_subwallet(
      subWalletUser: string
      ):

      stringorsubWalletornull

      "Unknown error: Unable to access to local computer""error: No internet access.""get_subwallet: The account does not exist"

      Returns a subWallet object on success. In case of error, it returns a string with the details. If the provided subWalletUser is not a string, this method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.get_subwallet("test")
      if typeof(result) == "string" then
          exit "Failed to get subwallet due to: " + result
      end if
      print "Successfully received subwallet!"
    • get_subwallets():

      stringorlist<subWallet>

      "Unknown error: Unable to access to local computer""error: No internet access."

      Returns a list where each item is a subWallet object, including all the accounts registered in the cryptocurrency. In case of error, it returns a string with the details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.get_subwallets
      if typeof(result) == "string" then
          exit "Failed to get subwallets due to: " + result
      end if
      for subwallet in result
          print subwallet.get_user + " has " + subwallet.get_balance + " coins"
      end for
    • reset_password(
      newPassword: string
      ):

      numberorstring

      "Error: coin does not exist""Error: Only the account owner can change the password""Unknown error: Unable to access to local computer""error: No internet access.""reset_password: only alphanumeric characters are allowed as password""reset_password: name and password cannot exceed the 16 character limit."1

      Resets the password of the coin. It returns a number with the value one if resetting was successful; otherwise, it will return a string.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.reset_password("test")
      if typeof(result) == "string" then
          exit "Failed to reset password due to: " + result
      end if
      print "Successfully reset password"
    • set_address(
      address: string
      ):

      numberorstringornull

      "Error: ${coinName} does not exist""Unknown error: Unable to access to local computer""error: No internet access.""set_address: address ${address}not found"1

      Configures a valid address that will be shown to users who do not have the currency, indicating where to register. In case of an error, it returns a string with the details. In case of success, a number with a value of one will be returned. If the provided address is not a string, this method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.set_address("12.12.12.12")
      if typeof(result) == "string" then
          exit "Failed to set address due to: " + result
      end if
      print "Successfully set address!"
    • set_cycle_mining(
      rateHours: number = 3
      ):

      stringornumberornull

      "Unknown error: Unable to access to local computer""error: No internet access.""the mining cycle cannot exceed the maximum of 2160 hours""the mining cycle cannot be less than 1 hour"1

      Defines the interval (in-game hours) in which each user receives a coin reward when mining. The interval cannot be lower than 1 and not higher than 2160. If the provided rateHours is not a number, this method will return null. On success, it will return a number with the value one. In case of failure, the method will return a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.set_cycle_mining(20)
      if result == 1 then
          print "Successful updated mining interval"
      else
          print "Failed updating mining interval"
      end if
    • set_reward(
      coinAmount: number = 1
      ):

      numberorstringornull

      "Unknown error: Unable to access to local computer""error: No internet access.""Error: The reward cannot be less than 1 coin""Error: Coin does not exist"1

      Assigns the reward that miners will receive after each mining cycle. The reward value has to be above one. If the provided coinAmount is not a number, this method will return null. On success, it will return a number with the value one. In case of failure, the method will return a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.set_reward(-1)
      if typeof(result) == "string" then
          exit "Failed setting reward due to: " + result
      end if
      print "Successfully set reward!"
    • transaction(
      subWalletOrig: string, subWalletDest: string, valAmount: number
      ):

      stringornumberornull

      "Error: coin does not exist""Error: ${subWalletOrig} not found""Error: ${subWalletDest} not found""Error: wallet ${subWalletOrig} does not exist""Error: target wallet does not exist""${subWalletOrig} need to be registered in ${coinName} to be able to receive this coin.""Error: subwallet ${subWalletDest} does not have coins in the selected currency""Error: insufficient funds to complete the transaction""Unknown error: Unable to access to local computer""error: No internet access.""Error: amount value cannot be less than 1"1

      Facilitates a transaction of the currency between the indicated subwallets. In case of an error, a string with the details is returned. In case of success, a number with a value of one will be returned. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      result = coin.transaction("test", "test2", 20)
      if typeof(result) == "string" then
          exit "Failed transaction due to: " + result
      end if
      print "Successfully transfered!"
  • computer

    A computer object can be obtained by either using host_computer or overflow. The classID used for this object is "computer".

    • File(
      path: string
      ):

      fileornull

      Returns a file located at the path provided in the arguments. The path can be either relative or absolute. It's important to note that any file object can represent a folder as well. If the provided path cannot be resolved, meaning that no file or folder exists, this method will return null. Providing any other type than string or an empty value for the path will result in an error, interrupting the script execution.

      filePath = "/etc/passwd"
      file = get_shell.host_computer.File(filePath)
      if file != null then
         print(file.get_content)
      else
         print("File at given path " + filePath + " does not exist.")
      end if
    • active_net_card():

      string

      Returns a string which contains either the keyword "WIFI" or "ETHERNET" depending on the connection type your computer is currently using.

      hostComputer = get_shell.host_computer
      netCard = hostComputer.active_net_card
      print("Connected by: " + netCard)
    • change_password(
      username: string, password: string
      ):

      numberorstringornull

      "Error: only alphanumeric allowed as password.""Error: the password cannot exceed the limit of 15 characters.""Denied. Only root user can execute this command.""user ${username} does not exist"1

      Changes the password of an existing user on the computer. Root access is necessary to successfully change the password. Passwords can only include alphanumeric characters and cannot exceed 15 characters. If the password change fails, this method will return a string containing information on why it failed. If the change succeeds, it will return a number with the value one. If the provided username is empty, an error will be thrown, preventing any further script execution. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      hostComputer = get_shell("root", "test").host_computer
      changeResult = hostComputer.change_password("test", "newPassword")
      if typeof(changeResult) == "string" then
         print("There was an error when changing the password: " + changeResult)
      else
         print("Password got successfully changed.")
      end if
    • close_program(
      pid: number
      ):

      numberorstringornull

      "Permission denied. PID ${pid} belongs to user <b>${username}</b>""Permission denied. Process protected.""Unable to close this process. The process belongs to this script."10

      Closes a program associated with the provided PID. You can see the list of active programs by either using show_procs or typing ps into your terminal. To close a program, you need to either be the owner of the running process or root. If closing the program fails, this method will return a string containing details. On success, it will return a number with the value one. If there is no process with the provided PID, this method will return a number with the value zero. If the provided PID is anything other than a number, this method will return null.

      hostComputer = get_shell("root", "test").host_computer
      processes = hostComputer.show_procs.split(char(10))[1:]
      pid = processes[1].split(" ")[1]
      closeResult = hostComputer.close_program(pid.to_int)
      if typeof(closeResult) == "string" then
         print("There was an error when closing a program: " + closeResult)
      else
         print("Program with pid " + pid + " got successfully closed.")
      end if
    • connect_ethernet(
      netDevice: string, address: string, gateway: string
      ):

      stringornull

      "Error: Ethernet card not connected to the network""Unable to find ISP network to connect using Ethernet card""can't connect: the home network has been temporarily disabled due to non-payment""Error: the gateway cannot be the same device to connect""Error: gateway ${gateway} does not exist in the network""Error: address ${address} is already in use.""Unknown error: The current IP ${localIp} does not exist in this network""Error: unable to run command on routers/switches""connect_ethernet: permission denied. Guest users can not execute this method""Error: Invalid IP address""Error: invalid gateway""Error: the IP address and the gateway must belong to the same subnet""connect_ethernet: Network device not found""connect_ethernet: Only ethernet cards are supported"

      Sets up a new IP address on the computer through the Ethernet connection. It's not possible to set up a new IP address while being logged in as a guest. On failure, this method will either return a string with details or null. On success, it will return an empty string. If any of the provided parameters have a type that deviates from the defined signature or the computer is not connected to the internet, an error will be thrown, preventing any further script execution.

      hostComputer = get_shell.host_computer
      connectionResult = hostComputer.connect_ethernet("eth0", "192.168.0.4", get_router.local_ip)
      if typeof(connectionResult) == "string" then
         print("There was an error while connecting: " + connectionResult)
      else
         print("Connected successfully.")
      end if
    • connect_wifi(
      netDevice: string, bssid: string, essid: string, password: string
      ):

      numberorstringornull

      "connect_wifi: permission denied. Guest users can not execute this method""connect_wifi: Network device not found""connect_wifi: Only wifi cards are supported""Can't connect. Incorrect password.""Can't connect. Router not found.""can't connect: the remote server has been temporarily disabled due to non-payment""Can't connect. Target is out of reach."1

      Connects to the indicated Wi-Fi network. It's not possible to connect to a new Wi-Fi while being logged in as a guest. If connecting to a new Wi-Fi fails, this method will return a string containing details. On success, it will return a number with the value one. Wi-Fi networks can be found via wifi_networks or by typing iwlist as a command in the terminal. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      hostComputer = get_shell.host_computer
      networks = hostComputer.wifi_networks
      firstNetwork = networks[0].split(" ")
      BSSID = firstNetwork[0]
      ESSID = firstNetwork[2]
      connectionResult = hostComputer.connect_wifi("wlan0", BSSID, ESSID, "wifi-password")
      if typeof(connectionResult) == "string" then
         print("There was an error while connecting to new Wifi: " + connectionResult)
      else
         print("Connected to new Wifi successfully.")
      end if
    • create_folder(
      path: string, folder: string = "newFolder"
      ):

      stringornumber

      "Unknown error.""Error: empty destination path""Error: only alphanumeric allowed as folder name.""Error: name cannot exceed the limit of 128 characters.""permission denied""${filename} file exists""Can't create folder. Reached maximum limit""The copy can not be made. Reached maximum number of files in a folder""The maximum number of subfolders has been exceeded""create_folder: path too large""Error: invalid path"1

      Creates a folder at the path provided in the arguments. There are certain limitations to creating a folder: the folder name has to be alphanumeric and below 128 characters. Creation will fail if there is already a folder in place or if there are lacking permissions. Additionally, there is a folder limit of about 250 in each folder and 3125 folders in the computer overall. In case the folder creation fails, the method will return a string with details. In case of success, it will return a number with the value one. Providing any type that deviates from the signature or using this method in an SSH encryption process will cause an error to be thrown, aborting further script execution.

      path = "/home/" + active_user + "/Desktop"
      hostComputer = get_shell.host_computer
      createResult = hostComputer.create_folder(path, "myfolder")
      if typeof(createResult) == "string" then
         print("There was an error when creating the folder: " + createResult)
      else
         print("Folder got created at given path " + path)
      end if
    • create_group(
      username: string, group: string
      ):

      numberorstringornull

      "Error: only alphanumeric allowed as user and group names.""Denied. Only root user can execute this command.""Error: user ${username} does not exist."1

      Creates a new group associated with an existing user on the computer. Root access is necessary to successfully create a group. There are limitations when creating a group, such as a character limit of 15 and that the group name may only contain alphanumeric characters. If the group creation fails, this method will return a string containing the cause of failure. On success, it will return a number with the value one. If the provided arguments are empty or the username exceeds 15 characters, an error will be thrown, interrupting further script execution. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      hostComputer = get_shell("root", "test").host_computer
      creationResult = hostComputer.create_group("test", "staff")
      if typeof(creationResult) == "string" then
         print("There was an error when creating a group: " + creationResult)
      else
         print("Group got successfully created.")
      end if
    • create_user(
      usename: string, password: string
      ):

      numberorstringornull

      "Error: root user already exists.""Error: can't create guest user. Reserved user.""Error: can't create user. ${username} already exists.""Error: only alphanumeric allowed as user name and password.""Denied. Only root user can execute this command.""Denied. Maximum number of registered users reached."1

      Creates a user on the computer with the specified name and password. Root access is necessary to successfully create a user. Both the username and password cannot exceed more than 15 characters and must be alphanumeric. There cannot be more than 15 users created on the same computer. If the creation fails, this method will return a string containing the reason for the failure. On success, it will return a number with the value one. If the provided username is empty or either of the values exceeds 15 characters, an error will be thrown, interrupting further script execution. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      hostComputer = get_shell("root", "test").host_computer
      creationResult = hostComputer.create_user("newUser", "123")
      if typeof(creationResult) == "string" then
         print("There was an error when creating an user: " + creationResult)
      else
         print("User got successfully created.")
      end if
    • delete_group(
      username: string, group: string
      ):

      numberorstringornull

      "Denied. Only root user can execute this command.""Error: user ${username} does not exist.""Error: group ${group} not found in user ${username}"1

      Deletes an existing group associated with an existing user on the computer. Root access is necessary to successfully delete a group. If the group deletion fails, this method will return a string containing the cause of failure. On success, it will return a number with the value one. If either of the provided values is empty, an error will be thrown, preventing further script execution. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      hostComputer = get_shell("root", "test").host_computer
      deletionResult = hostComputer.delete_group("test", "staff")
      if typeof(deletionResult) == "string" then
         print("There was an error when deleting a group: " + deletionResult)
      else
         print("Group got successfully deleted.")
      end if
    • delete_user(
      username: string, removeHome: number = 0
      ):

      numberorstringornull

      "Denied. Only root user can execute this command.""can't delete user. ${username} does not exist""the root user can't be deleted.""sorry, at the moment that account can't be deleted.""user ${username} not found."1

      Deletes the indicated user from the computer. It can optionally delete the user's home folder as well, although by default the home folder will not be deleted. Root access is necessary to successfully delete a user. Keep in mind that you cannot delete the root user. If the deletion fails, this method will return a string containing the cause of failure. On success, it will return a number with the value one. If the provided username is empty, an error will be thrown, interrupting further script execution. If any of the provided parameters have a type that deviates from the defined signature, the method will return null.

      hostComputer = get_shell("root", "test").host_computer
      deletionResult = hostComputer.delete_user("test", true)
      if typeof(deletionResult) == "string" then
         print("There was an error when deleting an user: " + deletionResult)
      else
         print("User got successfully deleted.")
      end if
    • get_name():

      string

      Returns the hostname of the machine.

      computerName = get_shell.host_computer.get_name
      print("The name of your machine is " + computerName)
    • get_ports():

      list<port>

      Returns a list of ports on the computer that are active.

      router = get_router
      ports = get_shell.host_computer.get_ports
      for port in ports
          print("Info: " + router.port_info(port))
      end for
    • groups(
      username: string
      ):

      stringornull

      "Error: user ${username} does not exist."

      Returns a string containing groups associated with an existing user on the computer. If the user does not exist, a string with an error message will be returned. If the provided username is empty, an error will be thrown, preventing further script execution. If the provided username is anything other than a string, this method will return null.

      hostComputer = get_shell("root", "test").host_computer
      hostComputer.create_group("root", "staff")
      groups = hostComputer.groups("root")
      listOfGroups = groups.split(char(10))
      print(listOfGroups)
    • is_network_active():

      number

      01

      Returns a number with either the value one or zero. If the computer has internet access, the value will be one. If there is no internet access, it will return zero instead.

      hostComputer = get_shell.host_computer
      if hostComputer.is_network_active then
         print("You're connected.")
      else
         print("You're not connected.")
      end if
    • local_ip():

      string

      Returns a string with the local IP address of the computer.

      localIp = get_shell.host_computer.local_ip
      print("Local ip:" + localIp)
    • network_devices():

      string

      Returns a string containing information about all network devices available on the computer. Each item includes details about the interface name, chipset, and whether monitoring support is enabled.

      hostComputer = get_shell.host_computer
      devices = hostComputer.network_devices
      deviceList = devices.split(char(10))
      for item in deviceList
         print(item)
      end for
    • network_gateway():

      string

      Returns a string with the gateway IP address configured on the computer.

      hostComputer = get_shell.host_computer
      gatewayIp = hostComputer.network_gateway
      print("Gateway IP: " + gatewayIp)
    • public_ip():

      string

      Returns a string with the public IP address of the computer.

      publicIp = get_shell.host_computer.public_ip
      print("Public ip:" + publicIp)
    • show_procs():

      string

      Returns a string with an overview of all active processes on the computer, including information about the user, PID, CPU, memory, and command. Using this method in an SSH encryption process will cause an error to be thrown, preventing any further script execution.

      hostComputer = get_shell.host_computer
      procs = hostComputer.show_procs
      list = procs.split(char(10))[1:]
      processes = []
      for item in list
         parsedItem = item.split(" ")
         process = {}
         process.user = parsedItem[0]
         process.pid = parsedItem[1]
         process.cpu = parsedItem[2]
         process.mem = parsedItem[3]
         process.command = parsedItem[4]
         processes.push(process)
      end for
      print(processes)
    • touch(
      path: string, fileName: string
      ):

      numberorstring

      "Can't create file. Unknown error""Can't create file. Reached maximum limit""Invalid path""Can't create file ${pathFolderDest}/${filename}. Permission denied""There is not enough free space on the hard disk.""The copy can not be made. Reached maximum number of files in a folder""Error: invalid path""Error: nameFile must be string""Error: only alphanumeric allowed as file name.""Error: name cannot exceed the limit of 128 characters.""touch: path too large""The file already exists"1

      Creates an empty text file at the provided path. Certain limitations apply to file creation: the file name must be alphanumeric and below 128 characters. Creation will fail if there is already a file in place or if permissions are lacking. Additionally, there is a file limit of about 250 in each folder and 3125 files in the computer overall. In case of success, it returns a number with the value one. In case of failure, it returns a string with details. Using this method in an SSH encryption process will cause an error to be thrown, preventing any further script execution.

      path = "/home/" + active_user + "/Desktop"
      hostComputer = get_shell.host_computer
      createResult = hostComputer.touch(path, "myFile.txt")
      if typeof(createResult) == "string" then
         print("There was an error when creating the file: " + createResult)
      else
         print("File got created at given path " + path)
      end if
    • wifi_networks(
      netDevice: string
      ):

      list<string>ornull

      Returns a list of the Wi-Fi networks that are available for the provided interface. Each item in the list is a string containing information on the BSSID, PWR, and ESSID. If no matching netDevice can be found, this method will return null. If the active network card is not a Wi-Fi card, an error will be thrown, preventing any further script execution.

      hostComputer = get_shell("root", "test").host_computer
      networks = hostComputer.wifi_networks("wlan0")
      result = []
      for network in networks
         parsedItem = network.split(" ")
         item = {}
         item.BSSID = parsedItem[0]
         item.PWR = parsedItem[1]
         item.ESSID = parsedItem[2]
         result.push(item)
      end for
      print(result)
  • crypto

    A crypto object can be obtained by using include_lib. The classID used for this object is "cryptoLib".

    • aircrack(
      path: string
      ):

      stringornull

      Returns a string containing the password based on the file which was generated via aireplay. In case of failure, it will return null instead. If the provided path is empty, an error will be thrown, interrupting the script execution.

      crypto = include_lib("/lib/crypto.so")
      networks = get_shell.host_computer.wifi_networks("wlan0")
      firstNetwork = networks[1].split(" ")
      bssid = firstNetwork[0]
      pwr = firstNetwork[1][:-1].to_int
      essid = firstNetwork[2]
      aireplayResult = crypto.aireplay(bssid, essid, 300000 / pwr)
      if (aireplayResult == null) then
         result = crypto.aircrack(home_dir + "/file.cap")
         print(result)
      end if
    • aireplay(
      bssid: string, essid: string, maxAcks: number = -1
      ):

      stringornull

      "Error: wifi card is disabled""router not found!""Can't connect. Target is out of reach.""aireplay: no wifi card found with monitor mode enabled"

      Used to inject frames on wireless interfaces. Once the command with "Control+C" is stopped, it will save the captured information in a text file called "file.cap" in the path where the terminal is currently located. Alternatively, a maximum of captured acks can be specified for the command to stop automatically, saving the "file.cap" file as described above. To figure out how many ACKs are required, you can use the following formula: "300000 / (Power + 15)". If there is an error, a string will be returned with the message indicating the problem. On success, it will return null, it is advised though to verify that the capture file actually exists. In case any of the provided values deviate from the signature types or bssid/essid is empty, an error will be thrown preventing any further script execution.

      crypto = include_lib("/lib/crypto.so")
      networks = get_shell.host_computer.wifi_networks("wlan0")
      for index in range(0, networks.len - 1)
         print(index + ".) " + networks[index])
      end for
      selectedIndex = user_input("Select Wifi: ").to_int
      if (typeof(selectedIndex) == "string" or selectedIndex < 0 or selectedIndex > networks.len - 1) then
         exit("Wrong index!")
      end if
      parsed = networks[selectedIndex].split(" ")
      bssid = parsed[0]
      pwr = parsed[1][:-1].to_int
      essid = parsed[2]
      potentialAcks = 300000 / (pwr + 15)
      crypto.aireplay(bssid, essid, potentialAcks)
      wifiPassword = crypto.aircrack("/home/" + active_user + "/file.cap")
      print("Wifi password for " + essid + " is " + wifiPassword)
    • airmon(
      option: string, device: string
      ):

      numberorstring

      "Error: wifi card is disabled""airmon: monitor mode can only be activated on wifi cards""airmon: monitor mode is not supported by the chipset of this network card."01

      Enables or disables the monitor mode of a network device. The options parameter can only be "start" or "stop". Monitor mode can only be enabled on Wifi cards. If it wasn't possible to enable or disable the monitor mode, this method will return either a number with the value zero or a string with details. In case of success, it will return a number with the value one.

      crypto = include_lib("/lib/crypto.so")
      airmonResult = crypto.airmon("start", "wlan0")
      if typeof(airmonResult) == "string" then
         print("There was an error while switching monitoring mode: " + airmonResult)
      else
         print("Monitoring mode switched successfully.")
      end if
    • decipher(
      encPass: string
      ):

      stringornull

      Returns a decrypted password via the provided password MD5 hash. Keep in mind that this method is not decrypting a password but rather checking for existing passwords within the game world with a matching MD5 hash. So in case a password does not exist in the game world, the decryption will fail. On failure, this method will return null. Using this method in an SSH encryption process will cause an error to be thrown, aborting further script execution.

      crypto = include_lib("/lib/crypto.so")
      hostComputer = get_shell("root", "test").host_computer
      passwdContent = hostComputer.File("/etc/passwd").get_content
      firstAccount = passwdContent.split(char(10))[0]
      parsed = firstAccount.split(":")
      username = parsed[0]
      passwordHash = parsed[1]
      password = crypto.decipher(passwordHash)
      print("User: " + username)
      print("Password: " + password)
    • smtp_user_list(
      ip: string, port: number
      ):

      list<string>orstringornull

      "invalid IP address""host is down""host doesn't exist""ip address not found""port ${port} not found""invalid target service""service not found""Error: Invalid ip address"

      Returns a list of the existing users on the computer where the SMTP service is running. If these users also have an email account registered on the SMTP server, it will be indicated in the list. SMTP services are usually running on port 25. In case of failure, this method will return a string containing the cause. If any of the provided values deviate from the signature types, this method will return null.

      crypto = include_lib("/lib/crypto.so")
      print(crypto.smtp_user_list("192.168.0.4", 25))
  • ctfEvent

    A ctfEvent object can be obtained by using get_ctf. The classID used for this object is "ctfEvent".

    • get_creator_name():

      string

      Returns string with the name of the CTF event creator.

    • get_description():

      string

      Returns string with the CTF event description.

    • get_mail_content():

      string

      Returns string with the mail content of the CTF event.

    • get_template():

      string

      Returns string with the CTF event template.

    • player_success():

      number

      01

      Returns number with the value one if the CTF event got completed successfully. Otherwise this method will return a number with the value zero.

  • debugLibrary

    A debugLibrary object can be acquired by using debug_tools. The classID used for this object is "debugLibrary".

    • apply_patch(
      path: string
      ):

      stringornull

      "error: file not found""error: The file to apply the patch cannot be binary""error: The patch code is not correct.""The patch had already been applied.""The patch has been applied correctly."

      Applies a patch containing corrected code to the specified text file at the provided path. Returns a string with the result of the operation. If the path argument is not a string this method will return null.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      debugLib = metaLib.debug_tools("test", "test")
      print("Path result: " + debugLib.apply_patch("/etc/passwd"))
    • payload(
      memZone: string, pathFile: string = ""
      ):

      stringorlist<map<any,any>>ornull

      "Error: The file must be a library""Error: The library is patched against this vulnerability.""Failed: No vulnerabilities have been found in the specified memory area.""Error acquiring partial object file. Unable to access to resource: ${pathFile}"

      Returns a list containing a single partial computer object if zero-day vulnerabilities are detected within the specified memory zone. If a file path is provided, a partial file object associated with this path will also be included in the list. Additionally, if this file is a library, its corresponding metaLib object is added to the returned list. In case of an error, a string with details is returned. Providing arguments that deviate from the defined signature will result in null.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      debugLib = metaLib.debug_tools("test", "test")
      result = debugLib.payload("0x7A69F4C3")
      if typeof(result) == "list" and result.len > 0 then
         print("Successfully executed payload!")
      end if
    • scan():

      string

      "error: file not found""No potential issues have been found""Potential problems have been found in the following code: ${callengeDescription}"

      Scans the library in debug mode to identify potential code errors that may lead to vulnerabilities. If issues are detected, the relevant code snippets are printed. In case of an error, a string containing the error message is returned.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      debugLib = metaLib.debug_tools("test", "test")
      print("Debug Library result: " + debugLib.scan)
    • unit_testing(
      errorLines: list<number>
      ):

      stringornull

      "error: file not found""Test failed: No potential issues have been found""Starting testing in selected lines... ${methods} New vulnerability found: ${vulnerability}""Test failed: No errors have been found in one or more of the provided lines, or not all lines with errors have been provided."

      Conducts automated tests on the specified lines of code. If potential vulnerabilities are detected due to errors in these lines, this method will print partial objects that could be obtained by exploiting the vulnerability, along with the affected memory zone and detailed vulnerability information. In case of failure, this function returns a string with an error message. If the error lines argument is not a list, the method will return null.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      debugLib = metaLib.debug_tools("test", "test")
      print("Unit test results: " + debugLib.unit_testing([1, 2, 3]))
  • file

    A file object can be acquired by either using File or overflow. The classID used for this object is "file".

    • allow_import():

      number

      Returns a number. If the file is binary and can be imported by other scripts, the value will be one; otherwise, the value will be zero. In case the file gets deleted, this method will cause a crash.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      print("File can be imported: " + lsBinary.allow_import)
    • chmod(
      perms: string = "", isRecursive: number = 0
      ):

      string

      "permission denied""permission denied. File protected.""Wrong format.""${path} not found"

      Modifies the file permissions. Optionally, these permissions can also be applied recursively. The format for applying permissions is as follows: "[references][operator][modes]". The references type is defined through three possible types: user "u", group "g", and other "o". The operator is used to define if permissions get added "+" or removed "-". There are three different modes that can be modified: read "r", write "w", and execute "x". So, for example, "o-wrx" would remove all possible permissions for others. To add all permissions for others again, "o+wrx" would be used. In case the modification fails, this method will return a string containing information about the reason. Otherwise, an empty string is returned. In case any type other than number is used for the isRecursive parameter, an error will be thrown preventing further script execution.

      hostComputer = get_shell("root", "test").host_computer
      rootFolder = hostComputer.File("/bin")
      oldPermissions = rootFolder.permissions
      rootFolder.chmod("o-wrx", true)
      newPermissions = rootFolder.permissions
      print("Old permissions: " + oldPermissions)
      print("New permissions: " + newPermissions)
    • copy(
      path: string = "", name: string = ""
      ):

      stringornumberornull

      "Unknown error""Error: Invalid path""${sourceFilepath} not found""${destinationParentPath} not found""permission denied""There is not enough free space on the hard disk.""permission denied. ${filename} is protected.""A file cannot overwrite a folder or vice versa""The copy can not be made. Reached maximum number of files in a folder""The copy can not be made. Reached maximum limit""Error: only alphanumeric allowed as newname"1

      Copies the file to the provided path. Files can only be copied if the user has read and write permissions or is root. The new filename has to be below 128 characters and alphanumeric. After success, this method will return a number with the value one. Otherwise, it will return a string containing information about the reason for failure. If any of the parameter types deviate from the method signature, this method is used within an SSH encryption process, the new name exceeds 128 characters, or the path is too long, an error will be thrown, causing an interruption of script execution. In case the current file gets deleted, this method will return null.

      hostComputer = get_shell("root", "test").host_computer
      passwdFile = hostComputer.File("/etc/passwd")
      copyResult = passwdFile.copy("/etc/", "duplicate")
      if typeof(copyResult) == "string" then
         print("There was an error while copying file: " + copyResult)
      else
         print("File got copied successfully.")
      end if
    • delete():

      string

      "file not found: ${path}""permission denied""permission denied. File protected.""unknown error :/"

      Delete the current file. To delete files, write permissions are required or being root. In case of failure, a string with details will be returned. Otherwise, an empty string gets returned. Please note that deleting a file will leave a log entry.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      deletionResult = lsBinary.delete
      if typeof(deletionResult) == "string" and deletionResult.len > 0 then
         print("There was an error while deleting a file: " + deletionResult)
      else
         print("File got deleted successfully.")
      end if
    • get_content():

      stringornull

      "Error: can't find the computer of this file""can't open ${filepath}. Binary file."

      Returns a string representing the content of the file. To read a file, the user requires read access or being root. Note that you cannot read a binary file. In case of failure, null will be returned. If this method is used within an SSH encryption process, an error will be thrown, preventing any further script execution.

      hostComputer = get_shell("root", "test").host_computer
      passwdFile = hostComputer.File("/etc/passwd")
      print("File content: " + passwdFile.get_content)
    • get_files():

      list<file>ornull

      Returns a list of files. In case the current entity is a file instead of a folder this method will return null, so it is advisable to first use the is_folder function before calling this method. In case the current folder gets deleted this method will return null as well.

      hostComputer = get_shell.host_computer
      binFolder = hostComputer.File("/bin")
      files = binFolder.get_files
      for file in files
         print(file.path)
      end for
    • get_folders():

      list<file>ornull

      Returns a list of folders. In case the current entity is a file instead of a folder this method will return null, so it is advisable to first use the is_folder function before calling this method. In case the current folder gets deleted this method will return null as well.

      hostComputer = get_shell.host_computer
      binFolder = hostComputer.File("/home")
      folders = binFolder.get_folders
      for folder in folders
         print(folder.path)
      end for
    • group():

      stringornull

      Returns a string with the name of the group to which this file belongs. Group permissions get applied to whoever is the owner of a file. In case the current file gets deleted, this method will return null.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      print("File is related to following group: " + lsBinary.group)
    • has_permission(
      perms: string = ""
      ):

      numberornull

      10

      Returns a number indicating if the user who launched the script has the requested permissions. One will indicate that the user has the correct permissions. In case permissions are lacking, the value will be zero. There are three different permission types: read "r", write "w", and execute "x". In case the file gets deleted, this method will return null instead.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      print("Is able to execute ls: " + lsBinary.has_permission("x"))
    • is_binary():

      numberornull

      10

      Returns a number. If the file is a binary, the value will be one; otherwise, it will be zero. In case the file gets deleted, this method will return null instead.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      print("File is a binary: " + lsBinary.is_binary)
    • is_folder():

      numberornull

      10

      Returns a number. The value is one if the file is a folder, zero otherwise. In case the file gets deleted this method will return null instead.

      hostComputer = get_shell.host_computer
      etcFolder = hostComputer.File("/etc")
      print("Is a folder: " + etcFolder.is_folder)
    • Returns a number. If the file is a symlink, the value will be one; otherwise, it will be zero. In case the file gets deleted, this method will return null instead.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      print("File is a symlink: " + lsBinary.is_symlink)
    • move(
      path: string = "", fileName: string = ""
      ):

      stringornumberornull

      "Unknown error""Error: Invalid path""${sourceFilepath} not found""${destinationParentPath} not found""permission denied""There is not enough free space on the hard disk.""permission denied. ${filename} is protected.""A file cannot overwrite a folder or vice versa""The copy can not be made. Reached maximum number of files in a folder""The copy can not be made. Reached maximum limit""Error: only alphanumeric allowed as newname"1

      Moves the file to the provided path. Files can only be moved if the user has read and write permissions or is root. The new filename has to be below 128 characters and alphanumeric. After success, this method will return a number with the value one. Otherwise, this method will return a string with details. If any of the parameter types deviate from the method signature, this method is used within an SSH encryption process, the new name exceeds 128 characters, or the path is too long, an error will be thrown, causing an interruption of script execution. In case the current file gets deleted, this method will return null.

      hostComputer = get_shell("root", "test").host_computer
      passwdFile = hostComputer.File("/etc/passwd")
      moveResult = passwdFile.move("/root/", "newFileName")
      if typeof(moveResult) == "string" then
         print("There was an error while moving file: " + moveResult)
      else
         print("File got moved successfully.")
      end if
    • name():

      stringornull

      Returns a string with the name of the file. In case the file gets deleted this method will return null instead.

      hostComputer = get_shell.host_computer
      passwdFile = hostComputer.File("/etc/passwd")
      print("Filename: " + passwdFile.name)
    • owner():

      stringornull

      Returns a string with the name of the file owner. User permissions get applied to whoever is the owner of a file. In case the current file gets deleted, this method will return null.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      print("Owner of ls is: " + lsBinary.owner)
    • parent():

      fileornull

      Returns the parent folder of the current file or folder. In case there is no parent folder null will be returned instead. In case the file gets deleted this method will return null as well.

      hostComputer = get_shell.host_computer
      etcFolder = hostComputer.File("/etc")
      print("Parent path: " + etcFolder.parent.path)
    • path(
      symlinkOrigPath: number = 0
      ):

      string

      Returns a string containing the file path. If the file is a symlink, the optional symlinkOrigPath argument can be set to return the original path of the linked file instead. If the file has been deleted, this method will still return the path it had prior to deletion.

      hostComputer = get_shell.host_computer
      passwdFile = hostComputer.File("/etc/passwd")
      print("File location: " + passwdFile.path)
    • permissions():

      stringornull

      Returns a string with the current file permissions. In case the current file gets deleted, this method will return null. The format for this permissions string is as follows: "[fileType][wrx](u)[wrx](g)[wrx](o)". The file type is either "d" in case it's a directory or "-". The user type gets defined through three possible types: user "u", group "g", and other "o". There are three different permission types: read "r", write "w", and execute "x". An example of a string returned by this method would be "-rwxr-xr-x". Taking the latter as an example, the following things become clear:

      • The provided file is not a directory.
      • The user has full access.
      • The group and others have almost all permissions besides writing.

      hostComputer = get_shell.host_computer
      binFolder = hostComputer.File("/bin")
      permissions = binFolder.permissions
      fileType = permissions[0]
      permissionsForUser = permissions[1:4]
      permissionsForGroup = permissions[4:7]
      permissionsForOther = permissions[7:10]
      print("File type: " + fileType)
      print("User permissions: " + permissionsForUser)
      print("Group permissions: " + permissionsForGroup)
      print("Other permissions: " + permissionsForOther)
    • rename(
      name: string = ""
      ):

      stringornumber

      "Unknown error""${filepath} not found""Error: name cannot exceed the limit of 128 characters.""permission denied""permission denied. File protected""There is already a file with that name, please choose another one.""Error: only alphanumeric allowed as newname"0

      Rename the file with the name provided. Files can only be renamed if the user has write permissions or is root. The new filename has to be below 128 characters and alphanumeric. On failure, this method will return a string with details. Otherwise, this method will return an empty string. If this method is used within an SSH encryption process, an error will be thrown, causing the script execution to be interrupted. In case the provided name is null, this method will return a number with the value zero.

      hostComputer = get_shell("root", "test").host_computer
      passwdFile = hostComputer.File("/etc/passwd")
      renameResult = passwdFile.rename("renamed")
      if typeof(renameResult) == "string" then
         print("There was an error while renaming file: " + renameResult)
      else
         print("File got renamed successfully.")
      end if
    • set_content(
      content: string = ""
      ):

      stringornumberornull

      "I can't save the file. The maximum of 160,000 characters has been exceeded.""set_content: unable to use this method in encryption configuration""can't open ${filepath}. Binary file."1

      Saves text into a file. The content will not get appended to the file; therefore, existing content will be overridden. To set new content, the user requires write permissions or being root. Keep in mind that text files cannot exceed the character limit of 160,000. In case setting the content was successful, a number with the value one will be returned. Otherwise, a string with details will be returned. If this method is used within an SSH encryption process, an error will be thrown, preventing any further script execution. If the provided content is null or permissions are lacking, this method will return a number with the value zero. In case the file gets deleted this method will return null.

      hostComputer = get_shell("root", "test").host_computer
      passwdFile = hostComputer.File("/etc/passwd")
      setResult = passwdFile.set_content("moo")
      if typeof(setResult) == "string" then
         print("There was an error while setting file content: " + setResult)
      else if setResult == 0 then
         print("Unable to set content of file!")
      else
         print("File content got changed successfully.")
      end if
    • set_group(
      group: string = "", recursive: number = 0
      ):

      stringornull

      "Permission denied"

      Change the group related to this file. Optionally the group can get applied recursively. The group name cannot exceed 15 characters. Additionally either write permissions or being root is required. In case of failure, a string with details. On success, an empty string gets returned. In case the current file gets deleted or the passed group is not a string, this method will return null. If the passed group value is empty, the group value is longer than 15 characters, or the passed recursive value deviates from its original type, an error will be thrown, preventing further script execution.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      ownerResult = lsBinary.set_group("root")
      if typeof(ownerResult) == "string" then
         print("There was an error while changing group: " + ownerResult)
      else
         print("File group changed successfully.")
      end if
    • set_owner(
      owner: string = "", recursive: number = 0
      ):

      stringornull

      "Permission denied"

      Change the owner of this file. Optionally the owner can get applied recursively. The owner's name cannot exceed 15 characters. Additionally either write permissions or being root is required. In case of failure a string gets returned containing the cause. Otherwise an empty string gets returned. In case the current file gets deleted or the passed owner value is not a string, this method will return null. If the passed owner value is empty, the owner value is longer than 15 characters, or the passed recursive value deviates from its original type, an error will be thrown, interrupting further script execution.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      ownerResult = lsBinary.set_owner("root")
      if typeof(ownerResult) == "string" then
         print("There was an error while changing owner: " + ownerResult)
      else
         print("File owner changed successfully.")
      end if
    • size():

      stringornull

      Returns a string with the size of the file in bytes. There is no correlation between file size and actual file content. Instead, the file size is depending on the name of the file. In case the current file gets deleted, this method will return null.

      hostComputer = get_shell.host_computer
      lsBinary = hostComputer.File("/bin/ls")
      size = lsBinary.size
      if size.to_int > 1000 then
         print("File size is bigger than 1000 bytes.")
      else
         print("File size is below 1000 bytes.")
      end if
    • Creates a symlink to the specified path. Symlinks can only be created if the user has write permissions or is root. The new filename must be alphanumeric and under 128 characters. Upon success, this method returns a number with the value one. On failure, it returns a string with details. If any parameters deviate from the method signature, if used within an SSH encryption process, if the new name exceeds 128 characters, or if the path is too long, an error will be thrown, interrupting script execution. If the current file is deleted, this method will return null.

      hostComputer = get_shell("root", "test").host_computer
      lsFile = hostComputer.File("/bin/ls")
      symResult = lsFile.symlink("/bin", "alternativeLS")
      if typeof(symResult) == "string" then
         print("There was an error while creating symlink: " + symResult)
      else
         print("Symlink got created successfully.")
      end if
  • ftpShell

    The FTP shell behaves just like the ssh shell and can be acquired by using connect_service and using the service type "ftp". The classID used for this object is "ftpshell". The port used for FTP is usually 21.

    • host_computer():

      computer

      Returns a computer related to the shell.

      shell = get_shell
      ftpShell = shell.connect_service("172.8.0.5", 21, "test", "test", "ftp")
      ftpComputer = ftpShell.host_computer
      print("FTP public ip: " + ftpComputer.public_ip)
    • put(
      sourceFile: string, destinationFolder: string, remoteShell: shell
      ):

      numberorstringornull

      "unknown error""Invalid path""${filepath} not found""permission denied""permission denied. ${filename} is protected""The copy can not be made. Reached maximum number of files in a folder""The copy can not be made. Reached maximum limit""${sourceFile} not found""${destinationFolder} not found""${destinationFolder} it's not a folder"1

      Send a file to the computer related to the provided shell. You require permission to read the file on the computer from which you are uploading and write permissions in the folder of the computer you are trying to upload to. In case of failure, this method will return a string with the cause. Otherwise, a number with the value one gets returned. If any of the passed arguments deviates from the types of the method signature, null will be returned. In case the string for sourceFile or destinationFolder is empty, an error will be thrown, preventing further script execution.

      shell = get_shell
      ftpShell = shell.connect_service("172.8.0.5", 21, "test", "test", "ftp")
      putResult = ftpShell.put("/bin/ls", "/etc/", shell)
      if typeof(putResult) == "string" then
         print("There was an error while sending file: " + putResult)
      else
         print("File got sent successfully.")
      end if
    • start_terminal():

      null

      Launches an active terminal. The terminal's color will change, displaying the IP of the connected shell. Script execution will be stopped upon starting a new terminal, unless this is called from another script that was executed via shell.launch. In that case, you will enter the shell after closing your root-level script within that terminal window. Using this method within an SSH encryption process will cause an error to be thrown, preventing further script execution.

      shell = get_shell
      ftpShell = shell.connect_service("172.8.0.5", 21, "test", "test", "ftp")
      ftpShell.start_terminal
  • function

    Create a function with "function()", including parameters with optional default values. Assign the result to a variable. Invoke by using that variable. Use @ to reference a function without invoking.

    triple = function(n=1)
       return n * 3
    end function
    print triple // 3
    print triple(5) // 15
    f = @triple
    print f(5)
  • general

    Use if blocks to do different things depending on some condition. Include zero or more else if blocks and one optional else block. Use a while block to loop as long as a condition is true. A for loop can loop over any list, including ones easily created with the range function. The break statement jumps out of a while or for loop. The continue statement jumps to the top of the loop, skipping the rest of the current iteration.

    // if block
    if 2+2 == 4 then
       print "math works!"
    else if pi > 3 then
       print "pi is tasty"
    else if "a" < "b" then
       print "I can sort"
    else
       print "last chance"
    end if
    
    // while loop
    s = "Spam"
    while s.len < 50
       s = s + ", spam"
    end while
    print s + " and spam!"
    
    // for loop
    for i in range(10, 1)
       print i + "..."
    end for
    print "Liftoff!"
    • abs(
      value: number = 0
      ):

      number

      Returns the absolute value of number.

      a = 1
      b = 5
      difference = abs(a - b)
      print("Difference between a and b is: " + difference)
    • acos(
      value: number = 0
      ):

      number

      Returns the inverse cosine (in radians) of a number.

      adjacent = 8
      hypotenuse = 10
      calcAngle = acos(adjacent / hypotenuse)
      print("Angle: " + calcAngle)
    • active_user():

      string

      Returns a string with the name of the user who is executing the current script.

      print("Current active user: " + active_user)
    • asin(
      value: number = 0
      ):

      number

      Returns the inverse sine (in radians) of a number.

      opposite = 6
      hypotenuse = 10
      calcAngle = acos(opposite / hypotenuse)
      print("Angle: " + calcAngle)
    • atan(
      y: number = 0, x: number = 1
      ):

      number

      Returns the inverse tangent (in radians) of a number.

      opposite = 8
      hypotenuse = 10
      calcAngle = atan(opposite / hypotenuse)
      print("Angle: " + calcAngle)
    • bitAnd(
      a: number = 0, b: number = 0
      ):

      number

      Performs a bitwise AND for the provided values. Returns a number. Warning: If either operand is >= 0x80000000, it'll always return 0.

      print("Result of bitwise AND: " + bitAnd(1, 2))
    • bitOr(
      a: number = 0, b: number = 0
      ):

      number

      Performs a bitwise OR for the provided values. Returns a number. Warning: If either operand is >= 0x80000000, it'll always return 0.

      print("Result of bitwise OR: " + bitOr(1, 2))
    • bitXor(
      a: number = 0, b: number = 0
      ):

      number

      Performs a bitwise XOR for the provided values. Returns a number. Warning: If either operand is >= 0x80000000, it'll always return 0.

      print("Result of bitwise XOR: " + bitXor(1, 2))
    • bitwise(
      operator: string, left: number, right: number
      ):

      numberornull

      Returns a number by performing bitwise operations. Supported operators are: "~", "&", "|", "^", "<<", ">>", ">>>". In case you want to use the tilde operator you only need to provide the operator and the left argument. If any of the required arguments is null this method will return null. Warning: If either operand is >= 0x80000000, it'll always returns 0.

      num = params[0].to_int
      isOdd = bitwise("&", num, 1) == 1
      if isOdd then
         print("Number is odd.")
      else
         print("Number is even.")
      end if
    • ceil(
      value: number = 0
      ):

      number

      Returns number rounded up to the integer value of the provided number.

      price = 25.43467
      upperPrice = ceil(price * 100) / 100
      print("Upper price: " + upperPrice)
    • char(
      value: number = 65
      ):

      string

      Returns the UTF-16 character string related to the provided unicode number. The provided number needs to be between 0 and 65535. Any number which is outside this range will cause the script to throw a runtime error. Beware when passing non-ASCII values to intrinsics as they will likely get re-encoded as UTF-8. For example, md5(char(255)) will actually return the hash of the two-byte sequence 0xC3 0xBF.

      key = user_input("Press a key!", false, true)
      isA = key == char(97)
      if isA then
         print("You pressed A.")
      else
         print("You did not press A.")
      end if
    • clear_screen():

      null

      Removes any text existing in a Terminal prior to this point. Utilizing this method in an SSH encryption process will trigger an error, halting further script execution.

      for i in range(9)
         clear_screen
         print(("#" * (9 - i)) + ("-" * i))
         wait(0.2)
      end for
    • code(
      value: string
      ):

      number

      Returns the Unicode number of the first character of the string. In case an empty string is provided the script execution will crash.

      key = user_input("Press a key!", false, true)
      isA = key.code == 97
      if isA then
         print("You pressed A.")
      else
         print("You did not press A.")
      end if
    • command_info(
      commandName: string
      ):

      string

      "Unknown info"

      Returns a string value of a translation. Translations include commands, documentation and other game-related things. Checkout Grey-Texts for an overview of all available keys. If the provided command name is not a string or is empty this method will throw an error causing the script to stop.

      print(command_info("LS_USAGE"))
    • cos(
      value: number = 0
      ):

      number

      Returns the cosine of a number in radians.

      radians = 1
      radius = 10
      circleX = cos(radians) * radius
      print(circleX)
    • current_date():

      string

      Returns a string containing the current date and time. Ingame time passes 15 times as fast as real-time - 4 seconds per in-game minute. The initial time after every wipe will be the 1st of January 2000 at 6:00 AM. Additionally, the game time will not proceed while the server is offline.

      • Output schema: "[day]/[month]/[year] - [hours]:[minutes]"
      • Example output: "27/Jan/2000 - 08:19"

      dateStr = current_date
      dateSegments = dateStr.split(" - ")
      date = dateSegments[0].split("/")
      day = date[0]
      month = date[1]
      year = date[2]
      dateTime = dateSegments[1].split(":")
      hours = dateTime[0]
      minutes = dateTime[1]
      print("Current day: " + day)
    • current_path():

      string

      Returns a string containing the path in which script that is currently executed from.

      path = current_path
      print("PWD: " + path)
    • exit(
      message: string = ""
      ):

      null

      Stops execution of the currently running script. Optionally a message can be provided which will be shown in the Terminal. There is also the possibility of styling output by using TextMeshPro rich-text tags.

      while (true)
         shouldExit = lower(user_input("Want to exit? (Y/N)"))
         if (shouldExit == "y") then
            exit("See you!")
         end if
      end while
    • floor(
      value: number = 0
      ):

      number

      Returns number rounded down to the integer value of the provided number.

      price = 25.43467
      floored = floor(price * 100) / 100
      print("Floored price: " + floored)
    • format_columns(
      columns: string
      ):

      string

      Returns a string which is the formatted version of the provided text. Keep in mind that TextMeshPro rich-text tags might screw up the output. When using tags consider applying these after formatting. Passing anything other than a string will result in an empty string.

      text = "FIRST SECOND THIRD
      1 2 3"
      print(format_columns(text))
    • funcRef():

      map<string,function>

      Returns a map which enables to extend function references with custom methods.

      funcRef.signature = function
         return str(@self)
      end function
      print (@print).signature
    • get_ctf(
      user: string, password: string, eventName: string
      ):

      ctfEventorstring

      "get_ctf: user and password cannot be null""get_ctf: user or password incorrect"

      Returns ctfEvent object if there is one available. In case of failure this method will return a string with details.

    • get_custom_object():

      map<any,any>

      Returns map which is shared throughout script execution. Can be helpful if it desired to pass or receive values when using launch. Using this method in a SSH encryption process will cause an error to be thrown preventing further script execution.

      get_custom_object.shouldEndScript = false
      while (get_custom_object.shouldEndScript)
         print("Waiting...")
         wait(2)
      end while
    • get_router(
      ipAddress: string = ""
      ):

      routerornull

      Returns by default the router to which the executing computer is connected to. Optionally an IP address can be provided. In case of failure null is returned. If there is no active internet connection, this method will throw an error, interrupting further script execution.

      router = get_router
      if router.local_ip == get_shell.host_computer.network_gateway then
         print("Router is equal to network gateway.")
      else
         print("Router is not equal to network gateway.")
      end if
    • get_shell(
      user: string = "", pass: string = ""
      ):

      shellornull

      Returns the shell that is executing the current script. Optionally, a username and password can be provided, allowing the use of a shell with other user privileges. If the username or password does not match an existing user or if the provided values deviate from the defined signature, this method will return null.

      shell = get_shell("root", "test")
      if shell == null then
         print("Couldn't obtain root shell.")
      else
         print("Obtained root shell.")
      end if
    • get_switch(
      ipAddress: string
      ):

      routerornull

      Returns the switch on the local network whose IP address matches, otherwise it returns null.

      router = get_switch("192.168.0.2)
      print("IP address of switch: " + router.local_ip)
    • hash(
      value: any
      ):

      number

      Returns numeric hash for the provided data. Using this method within a SSH encryption process will cause an error to be thrown causing the script execution to stop.

      hashA = hash({ "a": 2, "b": 1 })
      hashB = hash({ "b": 1, "a": 2 })
      if (hashA == hashB) then
         print("Objects are alike!")
      else
         print("Objects are different!")
      end if
    • home_dir():

      string

      Returns a string with the home folder path of the user who is executing the current script.

      print("Home dir of current user: " + home_dir)
    • import_code(
      path: string
      ):

      null

      Enables to import code from different sources into one file. This is useful in case you want to split code into different files and also to avoid any limitation in regards to text file character limits. Note that import_code requires an absolute path and is called while compiling the file into a binary instead of during runtime. Additionally import_code cannot be nested. Code can be either imported from plain text files or binaries that have "allow import" enabled. import_code is also parsed wherever it is found, not even a // comment will prevent it being evaluated.

      //Content of main.src
      import_code("/home/user/my_module.src")
      print("bye")
      //Content of my_module.src
      print("hello!")
    • include_lib(
      path: string
      ):

      cryptoormetaxploitorserviceorblockchainoraptClientorsmartApplianceortrafficNetornull

      Enables the inclusion of library binaries, which can be used inside your script. If successful, an object related to the provided library will be returned; otherwise, null is returned. This function is exclusively for importing library binaries. If you want to import custom scripts or binaries into your project, use import_code instead. Passing anything other than a string for the path, or leaving the path empty, will cause an error to be thrown, interrupting further script execution.

      crypto = include_lib("/lib/crypto.so")
      if crypto == null then
         print("Crypto library couldn't get imported.")
      else
         print("Crypto library got imported.")
      end if
    • is_lan_ip(
      ip: string
      ):

      number

      Returns a number. One indicates that the provided IP address is a valid LAN IP address. Otherwise, zero will be returned.

      print("Is Lan IP: " + is_lan_ip("192.168.0.1"))
    • is_valid_ip(
      ip: string
      ):

      number

      Returns a number. If the provided IP address is valid, its value will be one. Otherwise, its value is zero.

      print("Is valid IP: " + is_valid_ip("1.1.1.1"))
    • launch_path():

      string

      Returns a string containing the path of the script that was initially executed, meaning that even when using launch, it will still return the path of the initially executed script.

      path = launch_path
      print("Script gets executed within: " + parent_path(path))
    • list():

      map<string,function>

      Returns a map which enables to extend list types with custom methods.

      list.map = function(callback)
         newList = []
         for item in self
            newList.push(callback(item, __item_idx))
         end for
         return newList
      end function
      myMapFunction = function(item, index)
         print "Mapping value at index: " + index
         return item.myValue
      end function
      print [{ "myValue": 24 }].map(@myMapFunction)
    • log(
      value: number = 0, base: number = 10
      ):

      number

      Returns the natural logarithm of a number. By default, the base is 10. Optionally the base can be changed.

      a = 2
      b = 8
      baseLog = log(a) / log(b)
      print("Base log is: " + baseLog)
    • mail_login(
      user: string, pass: string
      ):

      metaMailorstringornull

      "Unable to login into account. Wrong password.""${user} user not found""Unknown error: This email account cannot be obtained.""Unknown error: Unable to access to local computer""login: No internet access."

      Returns a MetaMail entity if the login was successful. On failure a string with details gets returned. In case any of the provided values deviate from the types defined in the signature this method will return null.

      metaMail = mail_login("test@test.com", "test")
      if metaMail == null then
         print("Loggin failed.")
      else
         print("You've got mail.")
      end if
    • map():

      map<string,function>

      Returns a map which enables to extend map types with custom methods.

      map.extend = function(value)
        for item in value
          self[item.key] = item.value
        end for
        return self
      end function
      test = {"123":123}
      test.extend({"bar": "foo"})
      print "My extended value: " + test.bar
    • md5(
      value: string
      ):

      string

      Returns the MD5 hash string of the provided string. Using this method within an SSH encryption process or passing anything other than a string will cause an error to be thrown, stopping any further script execution.

      passwordHash = md5("test")
      print("Hash for the password 'test' is " + passwordHash)
    • nslookup(
      webAddress: string
      ):

      string

      "Not found"

      Returns the IP address for the provided web address. In case the web address cannot be found a string gets returned containing the following message: "Not found". If the provided web address is not a string or empty this method will throw an error preventing further script execution.

      url = params[0]
      print("IP for website is: " + nslookup(url))
    • number():

      map<string,function>

      Returns a map which enables to extend number types with custom methods.

      number.bitwise = function(operator, right)
        return bitwise(operator, self, right)
      end function
      print (1234).bitwise(">>", 1)
    • parent_path(
      directory: string
      ):

      string

      Returns a string which is the parent path of the provided path. The path provided needs to be properly formatted. If the path is any other type than a string or is empty, this method will throw an error interrupting further script execution.

      print("Is proper parent path: " + (parent_path("/my/test/path") == "/my/test"))
    • pi():

      number

      Returns the number PI to the precision of six.

      radius = 10
      circumference = 2 * pi * radius
      print("Circumference: " + circumference)
    • print(
      value: any = "", replaceText: number = 0
      ):

      null

      Print a message on the Terminal. Optionally replacing can be enabled which will replace all previous prints. This can be useful for creating a loading bar for example. There is also the possibility of styling output by using TextMeshPro rich-text tags.

      for i in range(9)
         print(("#" * (9 - i)) + ("-" * i) , true)
         wait(0.2)
      end for
    • program_path():

      string

      Returns a string containing the path of the script that is currently executing. It will update when using launch, which makes it different from launch_path.

      path = program_path
      print("Script gets executed within: " + parent_path(path))
    • range(
      start: number = 0, end: number = 0, inc?: number
      ):

      list<number>

      Generates a list where each item is a number. By default, if only one argument is provided, the list starts at the given value and decrements by one for each item. You can optionally define a start and end value, as well as customize the incremental value. However, if the incremental value is zero, or if the list exceeds 16777215L items, or if start/end is null, the function will throw a runtime error.

      print("Countdown:")
      for num in range(10)
         print(num)
      end for
      print("Done!")
    • reset_ctf_password(
      newPassword: string
      ):

      numberorstring

      "reset_ctf_password: password cannot be null""reset_ctf_password: password can't exceed the maximum limit of 32 characters""reset_ctf_password: password must be alphanumeric""reset_ctf_password: you do not have a registered CTF account"1

      Resets the password of your CTF account. Returns a number with the value one if resetting was successful; otherwise, it will return a string containing the reason for failure.

      reset_ctf_password("mysafepassword")
    • rnd(
      seed?: number
      ):

      number

      Returns a random number between 0 and 1. Optionally a seed number can be provided.

      min = 10
      max = 20
      output = floor(rnd * (max - min + 1) + min)
      input = user_input("Guess a number between 10 and 20!").to_int
      if (input == output) then
         print("You guessed right!")
      else
         print("You failed! The number was " + output)
      end if
    • round(
      value: number = 0, fixed: number = 0
      ):

      number

      Returns number rounded to the integer value of the provided number.

      price = 25.43467
      rounded = round(price * 100) / 100
      print("Price: " + rounded)
    • sign(
      value: number = 0
      ):

      number

      Returns a one or minus one, indicating the sign of the number passed as argument. If the input is zero, it will be returned as-is.

      print(sign(40))
      print(sign(-40))
      print(sign(0))
    • sin(
      value: number = 0
      ):

      number

      Returns the sine of a number in radians.

      radians = 1
      radius = 10
      circleY = sin(radians) * radius
      print(circleY)
    • slice(
      value: list<any>orstring, startIndex: number = 0, endIndex?: number
      ):

      list<any>orstringornull

      Returns a sliced version of the passed object. Valid data types for slicing are string and list. The returned object will contain all elements related to the provided start and end index. If no start or end index is provided this method will essentially return a shallow copy of the passed object. If an invalid data type is passed, null is returned.

      myString = "not your text"
      print("my " + slice(myString, 9))
    • sqrt(
      value: number = 0
      ):

      number

      Returns the square root of a number.

      a = 3
      b = 4
      calcHypotenuse = sqrt((a * a) + (b * b))
      print("Hypotenuse: " + calcHypotenuse)
    • str(
      value: any
      ):

      string

      Returns the string value of provided data. Can be used to turn a number into a string or to get the signature of a function.

      signature = str(@user_input)
      argSegment = signature[9:signature.len - 1]
      args = argSegment.split(",")
      print("Function has " + args.len + " arguments.")
    • string():

      map<string,function>

      Returns a map which enables to extend string types with custom methods.

      string.color = function(colorValue = "red")
        return "<color=" + colorValue + ">" + self + "</color>"
      end function
      print "My text: ".color + "Hello world".color("yellow")
    • tan(
      value: number = 1
      ):

      number

      Returns the tangent of a number in radians.

      degrees = 90
      tanFromDegrees = tan(degress * pi / 180)
      print("Tan from degrees: " + tanFromDegrees)
    • time():

      number

      Returns a number of seconds representing the elapsed time since the script started.

      start = time
      for i in range(10000)
         var = i * 100
      end for
      endTime = time - start
      print("Script execution done within: " + endTime)
    • typeof(
      value: any
      ):

      string

      Returns a string containing the type of the entity provided. There are following types by default: "aptclientLib", "blockchainLib", "ctfEvent", "coin", "computer", "cryptoLib", "debugLibrary", "file", "function", "list", "map", "MetaLib", "MetaMail", "MetaxploitLib", "NetSession", "null", "number", "port", "router", "service", "shell", "ftpshell", "SmartAppliance", "string", "subwallet", "TrafficNet", "wallet". Custom types can be added as well by using the classID property in a map.

      myObj = { "classID": "myType" }
      if typeof(myObj) == "myType" then
         print("Object is myType.")
      else
         print("Object is not myType.")
      end if
    • user_bank_number():

      stringornull

      Returns a string containing the bank account number of the player who is executing the script. If the user does not have a bank this method will return null.

      print("My Bank number is: " + user_bank_number)
    • user_input(
      message: string = "", isPassword: number = 0, anyKey: number = 0
      ):

      string

      Puts script execution on hold to receive input from the user. Input can be submitted by pressing Enter. You can style the output message using TextMeshPro rich-text tags. Two optional arguments are available: isPassword, which defines whether input should be masked by asterisk signs, and anyKey, which enables capturing of keys individually. Using this method within an SSH encryption process or passing values deviating from the defined method signature will cause an error to be thrown, interrupting further script execution.

      num = 0
      aboveIncludingZeroTag = "<color=yellow>"
      belowZeroTag = "<color=red>"
      while (true)
         clear_screen
         output = aboveIncludingZeroTag + num
         if (num < 0) then
            output = belowZeroTag + num
         end if
         print(output)
         key = user_input("Press arrow up/down to change value.", false, true)
         if (key == "UpArrow") then
            num = num + 1
         else if (key == "DownArrow") then
             num = num - 1
         else
             exit("Bye!")
         end if
      end while
    • user_mail_address():

      stringornull

      Returns a string containing the email address of the player who is executing the script. If the user does not have an email address this method will return null.

      print("My EMail address is: " + user_mail_address)
    • wait(
      delay: number = 1
      ):

      null

      Pauses the script execution. Optionally, the duration can be provided via the time argument. By default, the duration will be 1 second. The duration cannot be below 0.01 or above 300; otherwise, this method will throw a runtime exception.

      start = time
      wait(5)
      elapsed = time - start
      print("Waited: " + elapsed)
    • whois(
      ip: string
      ):

      string

      "Invalid IP address: ${ip}""Error: the IP address must be public""No Info available""Address not found"

      Returns a string containing the administrator information behind an IP address provided. In case of failure the returned string will contain an error message instead. If the provided ip is not a string or is empty this method will throw an error causing the script to stop.

      adminInfo = whos("1.1.1.1")
      infoLines = adminInfo.split(char(10))
      infoObject = {}
      infoObject.domainName = infoLines[0].split(":")[1].trim
      infoObject.administrativeContact = infoLines[1].split(":")[1].trim
      infoObject.emailAddress = infoLines[2].split(":")[1].trim
      infoObject.phone = infoLines[3].split(":")[1].trim
      print("Phone number: " + infoObject.phone)
    • yield():

      null

      Waits for the next tick.

      while (true)
         yield
         print("tick")
      end while
  • list

    Create a list with square brackets. Then iterate over the list with for, or pull out individual items with a 0-based index in square brackets. A negative index counts from the end. Get a slice (subset) of a list with two indices, separated by a colon.

    x = [2, 4, 6, 8]
    print(x[0]) // get first item from list
    print(x[-1]) // get last item from list
    print(x[1:3]) // slice items from index 1 to 3
    x[2] = 5 // set item at index 2 to 5
    print(x)
    print(x + [42]) // concatenate two lists
    • hasIndex(
      index: number
      ):

      number

      01

      Returns a number. If the provided index is available in the list, the value will be one. Otherwise, the value will be zero.

      myList = [42, 1, 3]
      containsIndex = myList.hasIndex(1)
      if containsIndex then
         print("List contains index of 1.")
      else
         print("List does not contain index of 1.")
      end if
    • indexOf(
      value: any, offset?: number
      ):

      numberornull

      Returns a number which indicates the first matching index of the provided value inside the list. Optionally a start index can be provided. In case the value does not exist inside the list a null gets returned.

      myList = [42, 1, 3]
      index = myList.indexOf(42)
      if index != null then
         print("The answer for everything is at the following index: " + index)
      else
         print("No answer for everything found.")
      end if
    • indexes():

      list<number>

      Returns a list containing all available indexes.

      myList = [42, 1, 3]
      for i in myList.indexes
         print(myList[i])
      end for
    • insert(
      index: number, value: any
      ):

      list<any>

      Inserts a value into the list at the index provided. Due to the insertion the list will get mutated. Returns the mutated list. If the passed index is not a number, this method throws an error, preventing further script execution.

      myList = [1, 3]
      myList.insert(1, 42)
      print("This list does contain the answer to everything: " + myList.split(", "))
    • join(
      delimiter: string
      ):

      string

      Returns a concatenated string containing all stringified values inside the list. These values will be separated via the provided separator. In case the list exceeds 16777215L items or the delimiter exceeds 128 characters, this method will throw an error, interrupting further script execution.

      myList = [42, 1, 3]
      print(myList.join(" .-*'*-. "))
    • len():

      number

      Returns a number representing the count of values inside the list.

      myList = [42, 1, 3]
      print("myList contains " + myList.len + " items")
    • pop():

      any

      Returns and removes the last item in the list. This operation will mutate the list. If the map is empty, this method will return null.

      myList = [1, 3, 42]
      answer = myList.pop
      print("Answer to everything: " + answer)
    • pull():

      any

      Returns and removes the first item in the list. This operation will mutate the list. If the map is empty, this method will return null.

      myList = [42, 1, 3]
      answer = myList.pull
      print("Answer to everything: " + answer)
    • push(
      value: any
      ):

      list<any>

      Appends a value to the end of the list. This operation will mutate the list. Additionally, this method will return the updated list. However, it throws an error if you attempt to push a value into itself or into a map-like object such as a file, halting further script execution.

      myList = [1, 3]
      myList.push(42)
      print("This list does contain the answer to everything: " + myList.split(", "))
    • remove(
      index: number
      ):

      null

      Removes an item from the list with the provided index. Due to the removal the list will get mutated. If the passed index is null this method will throw an error preventing further script execution.

      myList = [1, 42, 3]
      myList.remove(1)
      print("This list does not contain the answer to everything: " + myList.split(", "))
    • replace(
      oldVal: any, newVal: any, maxCount?: number
      ):

      list<any>

      Returns updated list where each value matching with the provided replace argument gets replaced. This operation will mutate the list.

      myList = [1, 2, 2, 7]
      myList.replace(2, 3)
      print(myList.join(""))
    • reverse():

      null

      Reverses the order of all values in the list. This operation will mutate the list.

      myList = [42, 1, 3]
      myList.reverse
      print("Reversed list: " + myList.split(", "))
    • shuffle():

      null

      Shuffles all values in the list. This operation will mutate the list.

      myList = [42, 1, 3]
      myList.shuffle
      print("New list order: " + myList.split(", "))
    • sort(
      key: any, ascending: number = 1
      ):

      list<any>

      Sorts the values of a list alphanumerically. This operation mutates the original list. Optionally, a key can be provided, which is used if the items are maps or lists. Finally, this method returns the updated list.

      myList = [{ "key": 42 }, { "key": 2 }, { "key": 1 }]
      myList.sort("key")
      print(myList)
    • sum():

      number

      Returns sum of all values inside the list. Any non-numeric values will be considered a zero.

      myList = [42, 1, 3]
      sum = myList.sum
      print("Sum of all items in list: " + sum)
    • values():

      list<any>

      Returns a list containing all available values. Note that this will not create a copy of the original list. The returned instance will the same as original list, so any mutations made to the returned list will also affect the original one.

      myList = [42, 1, 3]
      for v in myList.values
         print(v)
      end for
  • map

    A map is a set of values associated with unique keys. Create a map with curly braces; get or set a single value with square brackets. Keys and values may be any type.

    x = { "test": 123 }
    x.foo = 42 // set property foo to 42
    print(x.foo) // get value of property foo
    print(x + { "bar": 2 }) // concatenate two maps
    • hasIndex(
      key: any
      ):

      number

      01

      Returns a number. If the provided key is available in the map, the value will be one. Otherwise, the value will be zero.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      containsIndex = myList.hasIndex("answer")
      if containsIndex then
         print("Map contains the answer.")
      else
         print("Map does not contain the answer.")
      end if
    • indexOf(
      value: any
      ):

      any

      Returns a value which can be of any type since map keys can be of any type. In case the value does not exist inside the map, null is returned.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      key = myList.indexOf(42)
      if key != null then
         print("Map contains the answer.")
      else
         print("Map does not contain the answer.")
      end if
    • indexes():

      list<any>

      Returns a list containing all available keys. Keys can be of any type.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      for key in myMap.indexes
         print(myMap[key])
      end for
    • len():

      number

      Returns a number representing the count of items inside the map.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      print("myMap contains " + myMap.len + " items")
    • pop():

      any

      Returns and removes the first item in the map. This operation will mutate the map. Passing a map-like object such as file or computer will result in an error, interrupting further script execution. If the map is empty, this method will return null.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      print(myMap.pop)
    • pull():

      any

      Returns and removes the first item in the map. This operation will mutate the map. Passing a map-like object such as file or computer will result in an error, interrupting further script execution. If the map is empty, this method will return null.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      print(myMap.pull)
    • push(
      key: any
      ):

      map<any,any>

      Adds the value 1 to the provided key. This operation will mutate the map. The updated map will be returned. However, it throws an error if you attempt to push a value into itself or into a map-like object such as a file, halting further script execution. If the passed key is null an error will be thrown as well.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      myMap.push("answer")
      print(myMap.answer)
    • remove(
      key: string
      ):

      number

      01

      Removes an item from the map with the provided key. Due to the removal, the map will get mutated. If the value is removed successfully, this method will return a number with the value one. If the removal fails, the value will be zero. Passing any map-like object, such as a file or computer, will cause an error to be thrown, stopping further script execution.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      myMap.remove("answer")
      print(myMap)
    • replace(
      oldVal: any, newVal: any, maxCount?: number
      ):

      map<any,any>

      Returns updated map where each value matching with the provided replace argument gets replaced. This operation will mutate the map. In case this method gets used on a map-like object such as file this method will throw a runtime error.

      myObject = { "answer": 45 }
      myObject.replace(45, 42)
      print(myObject.answer)
    • shuffle():

      null

      Shuffles all values in the map. This operation will mutate the map.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      myMap.shuffle
      print(myMap)
    • sum():

      number

      Returns sum of all values inside the map. Any non-numeric values will be considered a zero.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      sum = myMap.sum
      print("Sum of all items in map: " + sum)
    • values():

      list<any>

      Returns a list containing all available values within map.

      myMap = { "answer": 42, "bar": 23, "foo": "moo" }
      for value in myMap.values
         print(value)
      end for
  • metaLib

    A metaLib object can be obtained by either using load or dump_lib. The classID used for this object is "MetaLib".

    • debug_tools(
      user: string, password: string
      ):

      stringordebugLibraryornull

      "Error: The file must be a library""Error: Incorrect password"

      Returns a library in debug mode as a debugLibrary object. A valid Neurobox engineer's username and password are required to access this mode. If successful, the debugLibrary object is returned; in case of an error, a string with details is provided. Passing values that deviate from the defined signature will result in null.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      debugLib = metaLib.debug_tools("test", "test")
      if typeof(debugLib) == "debugLibrary" then
         print("Received debug libary object!")
      end if
    • is_patched(
      getdate: number
      ):

      numberorstringornull

      "Error: The file must be a library"01

      Returns by default a number indicating whether the library has been patched. A value of one indicates that the library has been patched, while zero indicates that it has not. If the getdate parameter is set to true, the function will return a string containing the date of the last patch. The data format is as follows: "dd/MM/yyyy". Additionally if there is any error the return value will be a string. Providing values that deviate from the defined signature will cause null to be returned.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      isPatchedResult = metaLib.is_patched
      if isPatchedResult == 1 then
         print("init.so has been patched!")
      end if
    • lib_name():

      string

      Returns a string containing the name of the library. An example of a name would be "init.so".

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      print("Name for library is: " + metaLib.lib_name)
    • overflow(
      memoryAddress: string, unsecZone: string, optArgs: string = ""
      ):

      stringornumberorshellorcomputerorfileornull

      "Exploit failed: the remote server has been temporarily disabled due to non-payment"01

      Exploits vulnerabilities. The returned value can be of various data types. Therefore, using typeof is advisable. optArgs are required when changing a password or obtaining a computer via a router. It should be the desired password or LAN IP, respectively. Change password, traffic light and firewall disable exploits will return a number, where the value is either one or zero. One indicates success while zero indicates failure. Shell, computer, and file exploits either return an instance of their type or null. Providing values that deviate from the defined signature will cause a runtime exception to be thrown.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      scanResult = metax.scan(metaLib)
      target = scanResult[0]
      scanAddress = metax.scan_address(metaLib, target)
      segments = scanAddress.split("Unsafe check: ")
      exploit = null
       for segment in segments
         hasRequirement = segment.indexOf("*") != null
         if (not hasRequirement) then
            labelStart = segment.indexOf("<b>")
            labelEnd = segment.indexOf("</b>")
            exploit = segment[labelStart + 3: labelEnd]
         end if
      end for
      if (exploit) then
         print("Exploiting... " + target + ":" + exploit)
         print(metaLib.overflow(target, exploit))
      else
         print("No exploit found with zero requirements")
      end if
    • version():

      string

      Returns a string containing the version number of the library. An example of a version number would be "1.0.0".

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      print("Init.so version: " + metaLib.version)
  • metaMail

    A MetaMail object can be obtained by using mail_login. The classID used for this object is "MetaMail".

    • delete(
      mailId: string
      ):

      numberorstringornull

      "Unknown error: Unable to access to local computer""read: No internet access."1

      Delete the email corresponding to the provided email ID. Returns a number with the value one if the email removal was successful. Otherwise, a string with an error message will be returned. If the provided mailId is anything other than a string this method will return null.

      metaMail = mail_login(user_mail_address, "test")
      mails = metaMail.fetch
      results = []
      for mail in mails
         segments = mail.split(char(10))
         mailId = segments[2][8:]
         print(metaMail.delete(mailId))
      end for
      print("Deleted every mail!")
    • fetch():

      list<string>orstring

      "Unknown error: Unable to access to local computer""fetch: No internet access."

      Returns a list where each item is a string containing mail id, from, subject and a small preview of the content consisting of the first 125 characters. If there is any issue a string will be returned with details.

      metaMail = mail_login(user_mail_address, "test")
      mails = metaMail.fetch
      results = []
      for mail in mails
         segments = mail.split(char(10))
         item = {}
         item.mailId = segments[2][8:]
         item.from = segments[3][6:]
         item.subject = segments[4][9:]
         item.preview = segments[5:]
         results.push(item)
      end for
      print(results)
    • read(
      mailId: string
      ):

      stringornull

      "Unknown error: Unable to access to local computer""fetch: No internet access.""Mail not found"

      Returns a string containing the content of a mail related to the provided mail id. The mail id argument can be obtained with fetch. In case the mail cannot be found this method will return "Mail not found". If the provided mailId is not a string, this method will return null.

      metaMail = mail_login(user_mail_address, "test")
      mails = metaMail.fetch
      results = []
      for mail in mails
         segments = mail.split(char(10))
         mailId = segments[2][8:]
         print(metaMail.read(mailId))
      end for
    • send(
      emailAddress: string, subject: string, message: string
      ):

      stringornumberornull

      "Unable to login into account. Wrong password.""${user} user not found""Unknown error: This email account cannot be obtained.""Invalid email address""Mail subject too large""Mail message too large""Unknown error: attachment failed""Error: attachment not found""Unable to attach file: permission denied""The email couldn't be sent. The recipient has blocked this email address.""The email couldn't be sent. The recipient has blocked emails sent by other players.""The email couldn't be sent. The recipient has blocked emails sent by other players using npcs accounts.""The mail could not be sent. Wait a moment before sending another email.""Unknown error: Unable to access to local computer""read: No internet access.""read: No email account registered""Mail not delivered"1

      Send a new mail to the provided email address. Keep in mind that the subject can not exceed 128 characters and the message size should not exceed 2500 characters. Returns a number with the value one if the mail has been sent correctly, otherwise returns a string with an error. If any of the provided values deviate from the method signature, it will return null.

      metaMail = mail_login(user_mail_address, "test")
      result = metaMail.send(user_mail_address, "test subject", "test message")
      if typeof(result) == "string" then
         print("There was an error while sending mail: " + result)
      else
         print("Mail got send successfully.")
      end if
  • metaxploit

    A metaxploit object can be obtained by using include_lib. The classID used for this object is "MetaxploitLib".

    • load(
      path: string
      ):

      metaLibornull

      Returns a metaLib object for the provided path to the library binary. Keep in mind that this can only be used on library files. On failure, this method will return null. If the provided path is empty, this method will throw a runtime exception, preventing further script execution.

      metax = include_lib("/lib/metaxploit.so")
      libFolder = get_shell.host_computer.File("/lib")
      for file in libFolder.get_files
         metaLib = metax.load(file.path)
         print("Library: " + metaLib.lib_name + " - " + metaLib.version)
      end for
    • net_use(
      ip: string, port: number = 0
      ):

      netSessionornull

      Returns a netSession object for the provided IP address and port. Note that if the port is set to zero, it will return a netSession related to the kernel router. The main purpose of this method is to gain a netSession and then use dump_lib to receive a metaLib object to exploit vulnerabilities. In case of failure, this method will return null. If this method is used within an SSH encryption process or with disabled internet, or if an invalid target IP is provided, this method will throw a runtime exception.

      metax = include_lib("/lib/metaxploit.so")
      ports = get_router("1.1.1.1").used_ports
      for port in ports
         netSession = metax.net_use("1.1.1.1", port.port_number)
         metaLib = netSession.dump_lib
         print("Library: " + metaLib.lib_name + " - " + metaLib.version + " on port " + port.port_number)
      end for
    • rshell_client(
      ip: string, port: number = 1222, processName: string = "rshell_client"
      ):

      stringornumberornull

      "No internet access.""Remote host is down""Unable to find service ${service}""Invalid target service port configuration.""connection rejected: port forward removed by admin""Unable to connect: missing ${library}""Unable to connect: invalid ${library}""Unexpected library found. Not a valid ${library} library.""Unknown error""rshell_client: Invalid IP address""Error: only alphanumeric allowed as proccess name.""Error: proccess name cannot exceed the limit of 28 characters.""Error: ${programName} is a reserved process name""rshell_client: IP address not found: ${ip}""rshell_client: unable to find remote server at port ${port}"1

      Launches a process on the victim's computer, silently attempting to continuously connect in the background to the specified address and port. For the reverse shell to run successfully, the rshell service must be installed, and the port forward must be configured correctly on the machine where the server is waiting for the victim's connection. If the launch was successful, a number with the value one will be returned. In case of failure, a string with details will be returned.

      metax = include_lib("/lib/metaxploit.so")
      metax.rshell_client("1.1.1.1", 1222, "bgprocess")
    • rshell_server():

      stringorlist<shell>

      "rshell_server: No internet connection""rshell_server: The service cannot be started on this network.""error: service rshelld is not running""error: rshell portforward is not configured correctly"

      This method returns a list of shell objects that have been reverse shell connected to this computer. To manage the connections received, the rshell service must be installed on the machine that receives the victims' connections. In case of failure a string will be returned with details.

      metax = include_lib("/lib/metaxploit.so")
      shells = metax.rshell_server
      firstShell = shells[0]
      firstShell.host_computer.File("/").chmod("o-wrx", true)
    • scan(
      metaLib: metaLib
      ):

      list<string>ornull

      Returns a list where each item is a string representing a memory area which has vulnerabilities related to the provided library. These memory areas can be used to make further scans via scan_address. In case of failure, this method returns null instead. An example of a memory area would be "0x7BFC1EAA". Using this method within a SSH encryption process will throw a runtime exception.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      scanResult = metax.scan(metaLib)
      for area in scanResult
         print("Memory area containg vulnerability: " + area)
      end for
    • scan_address(
      metaLib: metaLib, memoryAddress: string
      ):

      stringornull

      Returns a string containing information about each vulnerability in the provided library and memory area. In case the scanning fails this method will return null. Using this method within a SSH encryption process will throw a runtime exception.

      metax = include_lib("/lib/metaxploit.so")
      metaLib = metax.load("/lib/init.so")
      scanResult = metax.scan(metaLib)
      scanAddress = metax.scan_address(metaLib, scanResult[0])
      segments = scanAddress.split("Unsafe check: ")[1:]
      exploits = []
      for segment in segments
         labelStart = segment.indexOf("<b>")
         labelEnd = segment.indexOf("</b>")
         exploits.push(segment[labelStart + 3: labelEnd])
      end for
      print("Available vulnerabilities: " + exploits.join(", "))
    • sniffer(
      saveEncSource: number = 0
      ):

      stringornull

      The terminal listens to the network packets of any connection that passes through the computer. When any connection information gets captured, it will print a string with the obtained data. In case saving of encryption source is enabled it will download the source code of the script responsible for encryption. In case the operation fails this method will return null. Using this method within a SSH encryption process will throw a runtime exception.

      metax = include_lib("/lib/metaxploit.so")
      result = metax.sniffer
      print(result)
  • netSession

    A netSession object can be obtained by using net_use. The classID used for this object is "NetSession".

    • dump_lib():

      metaLib

      Returns the metaLib associated with the remote service. For example if the metaxpoit method net_use was used on a ssh port it will return the metaLib related to the ssh service. In case the port was zero is will return a metaLib related to the kernel router.

      metax = include_lib("/lib/metaxploit.so")
      ports = get_router("1.1.1.1").used_ports
      netSession = metax.net_use("1.1.1.1", ports[0].port_number)
      metaLib = netSession.dump_lib
      print("Library: " + metaLib.lib_name + " - " + metaLib.version + " on port " + ports[0].port_number)
    • get_num_conn_gateway():

      number

      Returns the number of devices using this router as a gateway. If you obtained your netSession from a computer, it will fetch and return the value from its gateway router.

      metax = include_lib("/lib/metaxploit.so")
      ports = get_router("1.1.1.1").used_ports
      netSession = metax.net_use("1.1.1.1", ports[0].port_number)
      print("Gateway clients: " + netSession.get_num_conn_gateway)
    • get_num_portforward():

      number

      Returns the number of ports forwarded by this router. If you obtained your netSession from a computer, it will fetch and return the value from its gateway router.

      metax = include_lib("/lib/metaxploit.so")
      ports = get_router("1.1.1.1").used_ports
      netSession = metax.net_use("1.1.1.1", ports[0].port_number)
      print("Port forwards: " + netSession.get_num_portforward)
    • get_num_users():

      number

      Returns the number of user accounts on the system.

      metax = include_lib("/lib/metaxploit.so")
      ports = get_router("1.1.1.1").used_ports
      netSession = metax.net_use("1.1.1.1", ports[0].port_number)
      print("User accounts: " + netSession.get_num_users)
    • is_any_active_user():

      number

      01

      Returns a number. If there is an active user on the system it will be one. Otherwise, it will be zero.

      metax = include_lib("/lib/metaxploit.so")
      ports = get_router("1.1.1.1").used_ports
      netSession = metax.net_use("1.1.1.1", ports[0].port_number)
      print("User Active?: " + netSession.is_any_active_user)
    • is_root_active_user():

      number

      01

      Returns a number. If there is an active root on the system it will be one. Otherwise, it will be zero.

      metax = include_lib("/lib/metaxploit.so")
      ports = get_router("1.1.1.1").used_ports
      netSession = metax.net_use("1.1.1.1", ports[0].port_number)
      print("Root Active?: " + netSession.is_root_active_user)
  • number

    All numbers are stored in full-precision format. Numbers also represent true == 1 and false == 0.

    a = 20
    b = 22
    print(a + b) // addition
    print(a - b) // substraction
    print(a / b) // division
    print(a * b) // multiply
    print(a % b) // modulo
    print(a - b) // substraction
    print(a ^ b) // power
    print(a and b) // logical and
    print(a or b) // logical or
    print(not a) // logical not
    print(a == b) // comparison equal
    print(a != b) // comparison unequal
    print(a > b) // comparison greater than
    print(a < b) // comparison lower than
    print(a >= b) // comparison greater equal than
    print(a <= b) // comparison lower equal than
  • port

    A port object can be obtained by using get_ports, ping_port, used_ports or device_ports. The classID used for this object is "port". Generally there are no restrictions in regards to which service runs on which port but there are some default ports for each service. List of the most common ports: 21 (FTP), 22 (SSH), 25 (SMTP), 80 (HTTP), 141 (SQL), 8080 (HTTP), 1222 (RSHELL), 1542 (Repository), 3306 (SQL), 3307 (SQL), 3308 (SQL), 6667 (Chat), 37777 (CCTV)

    • get_lan_ip():

      string

      Returns a string containing the local IP address of the computer to which the port is pointing.

      router = get_router
      ports = router.used_ports
      for port in ports
         print("Port " + port.port_number + " is pointed to " + port.get_lan_ip + "!")
      end for
    • is_closed():

      number

      01

      Returns a number, where one indicates that the specified port is closed and zero indicates that the port is open.

      router = get_router
      ports = router.used_ports
      for port in ports
         state = "open"
         if (port.is_closed) then state = "closed"
         print("Port " + port.port_number + " is " + state + "!")
      end for
    • port_number():

      number

      Returns the number which is used for the port.

      router = get_router
      ports = router.used_ports
      for port in ports
         print("Port " + port.port_number + " is in use!")
      end for
  • router

    A router object can be obtained by either using get_router or get_switch. The classID used for this object is "router".

    • bssid_name():

      string

      Returns a string with the BSSID value of the router.

      router = get_router
      bssid = router.bssid_name
      print("BSSID: " + bssid)
    • device_ports(
      ip: string
      ):

      stringorlist<port>ornull

      Returns a list where each item is an open port related to the device of the provided LAN IP address. The device needs to be within the network of the router. In case of failure, this method will return null or a string with details. In case an empty ip is provided this method will throw a runtime exception.

      router = get_router
      devices = router.devices_lan_ip
      for ip in devices
         ports = router.device_ports(ip)
         openPorts = []
         for port in ports
            if port.is_closed then continue
            openPorts.push(port)
         end for
      
         if (openPorts.len == 0) then
            print(ip + " has no open ports")
         else
            print(ip + " contains following open ports:")
            for port in openPorts
               print("|-" +  port.port_number)
            end for
         end if
      end for
    • devices_lan_ip():

      list<string>

      Returns a list where each item is a string representing a LAN IP address. All devices are within the network of the router and can be reached by using the ping method. Some of the devices might be behind a firewall.

      router = get_router
      devices = router.devices_lan_ip
      for ip in devices
         print(ip + " found!")
      end for
    • essid_name():

      string

      Returns a string with the ESSID value of the router.

      router = get_router
      essid = router.essid_name
      print("ESSID: " + essid)
    • firewall_rules():

      list<string>

      Returns a list where each item is a string containing a firewall rule.

      router = get_router
      rules = router.firewall_rules
      print("Firewall rules: " + rules.join(", "))
    • kernel_version():

      string

      Returns a string with the version of the kernel_router.so library.

      router = get_router
      version = router.kernel_version
      print("Kernel router version: " + version)
    • local_ip():

      string

      Returns a string with the local IP address of the router.

      router = get_router
      localIp = router.local_ip
      print("Local IP: " + localIp)
    • ping_port(
      port: number
      ):

      portornull

      Returns a port that is behind the port number provided. In case the port does not exist null gets returned.

      router = get_router
      ports = router.used_ports
      for port in ports
         pingedPort = router.ping_port(port.port_number)
         if (pingedPort == null) then continue
         print("Pinged " + pingedPort.port_number)
      end for
    • port_info(
      port: port
      ):

      stringornull

      Returns a string with information about the provided port, including details about the running service and its version. For example, the output could be "http 1.0.0". If the operation fails, null will be returned.

      router = get_router
      ports = router.used_ports
      for port in ports
         info = router.port_info(port)
         print(info)
      end for
    • public_ip():

      string

      Returns a string with the public IP address of the router.

      router = get_router
      publicIp = router.public_ip
      print("Public IP: " + publicIp)
    • used_ports():

      list<port>

      Returns a list where each item is a port used inside the router.

      router = get_router
      ports = router.used_ports
      for port in ports
         print("Port " + port.port_number + " is available!")
      end for
  • service

    The service object can be obtained by using include_lib. The classID used for this object is "service". List of all installable services: "FTP", "SSH", "HTTP", "Repository", "Chat"

    • install_service():

      numberorstring

      "Denied. Only root user can install this service."1

      Installs the necessary files for the correct functioning of the service and starts it. If the installation is completed successfully, it returns a number with the value one. In case of an error, it returns a string with details.

      service = include_lib("/lib/libhttp.so")
      result = service.install_service
      if result == 1 then
          print "Successfully installed service"
      else
          print "Service installation failed: " + result
      end if
    • start_service():

      numberorstring

      "Denied. Only root user can install this service.""<color=yellow>${reason} The chat service can't be accessed.</color>"1

      Starts the service and opens its associated port on the local machine. The service requires a port forwarded to the router to be accessible from the outside. If the service starts correctly, it returns a number with the value one. In case of an error, it returns a string with details.

      service = include_lib("/lib/libhttp.so")
      result = service.start_service
      if result == 1 then
          print "Successfully started service"
      else
          print "Starting service failed: " + result
      end if
    • stop_service():

      numberorstring

      "Denied. Only root user can install this service."10

      Stops the service and closes its associated port on the local machine. If the service is stopped successfully, it returns a number with the value one. If an error occurs during the process, it returns a string with details. In some cases, the returned number might be zero, indicating that the service removal failed.

      service = include_lib("/lib/libhttp.so")
      result = service.stop_service
      if result == 1 then
          print "Successfully stopped service"
      else
          print "Stopping service failed: " + result
      end if
  • shell

    A shell object can be acquired by either using get_shell, connect_service or overflow. The classID used for this object is "shell". In case you want to use connect_service to connect to a SSH port it will be usually at port 22.

    • build(
      pathSource: string, pathBinary: string, allowImport: number = 0
      ):

      string

      "pathSource and programName can't be empty""Invalid shell""Unknown error: Unable to access to local computer""Can't find ${pathSource}""Can't find ${pathBinary}""Can't access to ${pathSource}. Permission denied.""Can't build ${pathSource}. Binary file""Can't create binary in ${pathBinary}. Permission denied.""Can't build ${pathSource}. Invalid extension.""Can't compile. Source code is empty"

      Compiles a plain code file provided in the arguments to a binary. On success, the new binary will be available under the provided build folder. The binary name will be the same as the source file just without the file extension. Optionally, an allowImport flag can be set which enables the use of import_code on the binary. All provided paths must be absolute. Returns an empty string on success. On failure, it will return a string containing details about the reason for failure. In case any provided values deviate from the defined signature a runtime exception will be thrown.

      shell = get_shell
      computer = shell.host_computer
      computer.touch(home_dir, "test.src")
      computer.File(home_dir + "/test.src").set_content("print(""hello world"")")
      buildResult = shell.build(home_dir + "/test.src", home_dir + "/Desktop")
      if buildResult != "" then
         print("There was an error while compiling: " + buildResult)
      else
         print("File has been compiled.")
      end if
    • connect_service(
      ip: string, port: number, user: string, password: string, service: string = "ssh"
      ):

      shellorftpShellorstringornull

      "No internet access.""Remote host is down""Unable to find service ${service}""Invalid target service port configuration.""connection rejected: port forward removed by admin""Unable to connect: missing ${library}""Unable to connect: invalid ${library}""Unexpected library found. Not a valid ${library} library.""Unknown error""ip address not found""can't connect: the remote server has been temporarily disabled due to non-payment""can't connect: port ${port} not found""can't connect: port closed""can't connect: There is no active machine behind the port ${port}""can't connect: service not found behind the port ${port}""Invalid service ID""can't connect: incorrect user/password""Unknown error: Unable to access to local computer""Direct connections cannot be made outside of this network"

      Returns a shell if the connection attempt to the provided IP was successful. This method can only connect to ports running an SSH or FTP service. SSH services usually run on port 22 and FTP services usually on port 21. Keep in mind to pass the right service value depending on which service is going to be used. By default, it will use SSH as the service. Please note that connecting will leave a log entry. In case of failure, a string is returned containing details. If any provided arguments deviate from the method signature, if this method is run in an SSH encryption process, or if the computer is not connected to the internet, a runtime exception will be thrown.

      shell = get_shell
      connectionResult = shell.connect_service("1.1.1.1", 22, "test", "test")
      if typeof(connectionResult) != "shell" then
         print("There was an error while connecting: " + connectionResult)
      else
         print("Connected!")
      end if
    • host_computer():

      computer

      Returns a computer related to the shell.

      shell = get_shell
      computer = shell.host_computer
      print("Computer public IP is: " + computer.public_ip)
    • launch(
      program: string, params: string = ""
      ):

      stringornumber

      "Invalid shell""Can't find computer"10

      Launches the binary located at the provided path. Optionally, parameters can be passed. Returns a number. If the launch was successful, the value will be one; otherwise, it will be zero. In some cases, a string will be returned containing an error message. If you need to share variables between a launched script and the current process, consider using get_custom_object. Note that launching a script is not asynchronous, meaning that the current script will pause its execution until the launched script finishes. This method cannot be used to execute binaries with an EXE extension (GUI interface). If any provided values deviate from the method signature, a runtime exception will be thrown.

      shell = get_shell("root", "test")
      shell.launch("/bin/cat", "/etc/passwd")
    • ping(
      ip: string
      ):

      stringornumber

      "ping: invalid ip address"10

      Returns a number. If the remote address could be reached the value will be one, zero otherwise. Firewalls do not block ping requests. Passing an invalid ip will cause the method to return a string with an error message. If any provided arguments deviate from the method signature a runtime exception will be thrown.

      shell = get_shell
      isPingable = shell.ping("1.1.1.1")
      if isPingable then
         print("Ping was successful!")
      else
         print("Ping failed!")
      end if
    • scp(
      file: string, folder: string, remoteShell: shell
      ):

      numberorstringornull

      "unknown error""Invalid path""${filepath} not found""permission denied""permission denied. ${filename} is protected""The copy can not be made. Reached maximum number of files in a folder""The copy can not be made. Reached maximum limit""${sourceFile} not found""${destinationFolder} not found""${destinationFolder} it's not a folder"1

      Send a file to the computer related to the provided shell. You require permission to read the file on the computer from which you are uploading and write permissions in the folder of the computer you are trying to upload to. In case of failure, this method will return a string with the cause. Otherwise, a number with the value one gets returned. If any of the passed arguments deviates from the types of the method signature, null will be returned. In case the string for sourceFile or destinationFolder is empty, an error will be thrown, preventing further script execution

      shell = get_shell
      remoteShell = shell.connect_service("1.1.1.1", 22, "test", "test")
      result = remoteShell.scp("/bin/ls", "/etc/", shell)
      if typeof(result) == "string" then
         print("There was an error while sending file: " + result)
      else
         print("File got sent successfully.")
      end if
    • start_terminal():

      null

      Launches an active terminal. The terminal's color will change, displaying the IP of the connected shell. Script execution will be stopped upon starting a new terminal, unless this is called from another script that was executed via shell.launch. In that case, you will enter the shell after closing your root-level script within that terminal window. Using this method within an SSH encryption process will cause an error to be thrown, preventing further script execution.

      shell = get_shell
      shell.start_terminal
  • smartAppliance

    A smartAppliance object can be obtained by using include_lib. The classID used for this object is "SmartAppliance".

    • model():

      string

      "Unknown error: Unable to access to local computer""error: No internet access.""error: Device hardware malfunction"

      Returns a string with the appliance model ID.

      libSmartapp = include_lib("/lib/libsmartappliance.so")
      modelResult = libSmartapp.model
      if modelResult.matches("^[A-Z]+$") then
          print("Model is: " + modelResult)
      else
          print("Model couldn't be determined due to: " + modelResult)
      end if
    • override_settings(
      power: number, temperature: number
      ):

      stringornumberornull

      "Unknown error: Unable to access to local computer""error: No internet access.""error: Device hardware malfunction""override_settings: denied: The settings are locked for security reasons."1

      Overrides the power and temperature settings of the appliance. If successful, it returns a number with the value one; otherwise, it returns a string detailing the error. If any arguments deviate from the defined signature, this method will return null.

      libSmartapp = include_lib("/lib/libsmartappliance.so")
      overrideResult = libSmartapp.override_settings(1000, 20)
      if overrideResult == 1 then
          print("Override was successful!")
      else
          print("Override failed due to: " + overrideResult)
      end if
    • set_alarm(
      enable: number
      ):

      stringornumberornull

      "Unknown error: Unable to access to local computer""error: No internet access.""error: Device hardware malfunction""set_alarm: denied: The alarm settings are locked for security reasons."1

      Activates or deactivates the sound alarm indicating any appliance malfunction. If the operation is successful, a number with the value one is returned; otherwise, a string containing error details is returned. If the enable argument deviates from the defined signature, the method will return null.

      libSmartapp = include_lib("/lib/libsmartappliance.so")
      setAlarmResult = libSmartapp.set_alarm(false)
      if setAlarmResult == 1 then
          print("Alarm was disabled successfully!")
      else
          print("Disabling alarm failed due to: " + setAlarmResult)
      end if
  • string

    Text is stored in strings of Unicode characters. Write strings by surrounding them with quotes. If you need to include a quotation mark in the string, write it twice.

    a = "hello"
    b = "world"
    print(a + b) // concatinate a and b
    print(a * 10) // repeat hello ten times
    print(a[0]) // prints h
    print(a[1:3]) // prints ell
    • code():

      number

      Returns a number representing the Unicode code of the first character of the string.

      myString = "HELLO WORLD"
      print(myString.code)
    • hasIndex(
      index: number
      ):

      number

      01

      Returns a number. If the provided index is available in the string, the value will be one. Otherwise, the value will be zero.

      myString = "42 as an answer is wrong"
      containsIndex = myString.hasIndex(1)
      if containsIndex then
         print("String contains index of 1.")
      else
         print("String does not contain index of 1.")
      end if
    • indexOf(
      value: string, offset?: number
      ):

      numberornull

      Returns a number which indicates the first matching index of the provided value inside the list. Optionally a start index can be provided. In case the value does not exist inside the string a null gets returned.

      myString = "42 as an answer is wrong"
      index = myString.indexOf("wrong")
      if index != null then
         print("Invalid information spotted at: " + index)
      else
         print("Information seems valid.")
      end if
    • indexes():

      list<number>

      Returns a list where each item is a number representing all available indexes in the string.

      myString = "42"
      print(myString.indexes)
    • insert(
      index: number, value: string
      ):

      string

      Returns a string with the newly inserted string at the provided index. If the passed index is not a number, this method throws an error, preventing further script execution.

      myString = "42 as an answer is wrong"
      index = myString.lastIndexOf("w") - 1
      newString = myString.insert(index, "not ")
      print(newString)
    • is_match(
      pattern: string, regexOptions: string = "none"
      ):

      number

      10

      Uses regular expression to check if a string matches a certain pattern. If it matches, it will return a number with the value one. If it does not match, the value of the number will be zero. If any provided arguments deviate from the method signature types, if the pattern is empty, if the provided regexOptions are invalid, or if the regular expression times out, an error will be thrown, preventing further script execution.

      myString = "42 as an answer is wrong"
      hasWordAtTheEnd = myString.is_match("\w+$")
      print(hasWordAtTheEnd)
    • lastIndexOf(
      searchStr: string
      ):

      number

      Returns a number which indicates the last matching index of the provided value inside the list. In case the value does not exist inside the string a -1 gets returned. If the provided searchStr is not a string, this method will return null.

      myString = "42 as an answer is wrong"
      index = myString.lastIndexOf("wrong")
      if index != -1 then
         print("Invalid information spotted at: " + index)
      else
         print("Information seems valid.")
      end if
    • len():

      number

      Returns a number representing the length of the string.

      myString = "HELLO WORLD"
      print("Size of string is: " + myString.len)
    • lower():

      string

      Returns a new string in which all characters are transformed into lowercase.

      myString = "HELLO WORLD"
      print(myString.lower)
    • matches(
      pattern: string, regexOptions: string = "none"
      ):

      map<number,string>

      Returns a map with all search results for the provided regular expression. Each key contains the index and the value contains the matching string. If any provided arguments deviate from the method signature types, if the pattern is empty, if the provided regexOptions are invalid, or if the regular expression times out, an error will be thrown, preventing further script execution.

      myString = "42 as an answer is wrong"
      result = myString.matches("w")
      print(result)
    • remove(
      value: string
      ):

      string

      Returns a new string with the provided value removed. Any value other than null can be passed, but note that it will be cast to a string. If null is passed, this method will throw an error, preventing further script execution.

      myString = "42 as an answer is wrong"
      newString = myString.remove("wrong")
      print(newString + "right")
    • replace(
      pattern: string, newValue: string, regexOptions: string = "none"
      ):

      string

      Returns a string with the replaced content by using regular expressions. If any provided arguments deviate from the method signature types, if the pattern is empty, if the provided regexOptions are invalid or if the regular expression times out, an error will be thrown, preventing further script execution.

      myString = "42 as an answer is wrong"
      newString = myString.replace("wrong", "right")
      print(newString)
    • split(
      pattern: string, regexOptions: string = "none"
      ):

      list<string>ornull

      Returns a list where each item is a segment of the string, separated by the provided separator string. This method uses regular expressions for matching, so remember to escape special characters such as dots. If any of the provided arguments deviate from the method signature types, this method will return null. In case the pattern is empty, the provided regexOptions are invalid, or the regular expression times out, an error will be thrown, preventing further script execution.

      myString = "42 as an answer is wrong"
      segments = myString.split(" ")
      if segments[0] != "42" then
         print("Invalid information spotted!")
      else
         print("Information seems valid!")
      end if
    • to_int():

      stringornumber

      Returns a number which is parsed from the string as an integer. In case the string is not numeric it will return the original string.

      myString = "1"
      print(myString.to_int + 41)
    • trim():

      string

      Returns a new string stripped of any spacing at the beginning and ending.

      myString = "    42   "
      print(myString.trim)
    • upper():

      string

      Returns a new string in which all characters are transformed into uppercase.

      myString = "hello world"
      print(myString.upper)
    • val():

      number

      Returns a number which is parsed from the string. In case the string is not numeric it will return a zero.

      myString = "1.25"
      print(myString.val + 40.75)
    • values():

      list<string>

      Returns a list where each item is a string representing all available characters in the string. Could be compared to using split but without any separator.

      myString = "hello world"
      print(myString.values)
  • subWallet

    A subWallet object can be obtained by either using get_subwallet or get_subwallets. The classID used for this object is "subwallet".

    • check_password(
      password: string
      ):

      numberorstring

      "Unknown error: Unable to access to local computer""No internet access.""login_subwallet: the account does not exist."10

      Returns a number with the value one if the credentials are correct, otherwise, the value is zero. For some cases, this method will return a string with an error message.

      blockchain = include_lib("/lib/blockchain.so")
      coin = get_coin(blockchain, "test", "test", "test")
      subWallet = get_subwallet(coin, "test")
      password = user_input("SubWallet password:", true)
      if check_password(subWallet, password) == 1 then
          print "Password is correct!"
      end if
    • delete():

      stringornumber

      "Unknown error: Unable to access to local computer""No internet access."10

      Deletes the account registered in the cryptocurrency. Returns a number where one indicates successful deletion and zero indicates failure. In case of certain failures, this method may return a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = get_coin(blockchain, "test", "test", "test")
      subWallet = get_subwallet(coin, "test")
      result = delete_subwallet(subWallet)
      if result == 1 then
          print "Subwallet got deleted!"
      end if
    • get_balance():

      numberorstring

      "get_balance: The account does not exist.""Unknown error: Unable to access to local computer""No internet access."

      Returns a number of coins of a given currency. In case of error, a string with the details is returned.

      blockchain = include_lib("/lib/blockchain.so")
      coin = blockchain.get_coin("test", "test", "test")
      subWallet = coin.get_subwallet("test")
      print "Balance: " + subWallet.get_balance
    • get_info():

      string

      "Error: ${coinName} does not exist""Error: ${subWalletUser} does not exist""Error: main wallet linked to ${subWalletUser} does not exist anymore""Error: Coin ${coinName}does not exist in the Wallet user""Unknown error: Unable to access to local computer""No internet access."

      Returns a string with the information stored by the coin creator.

      blockchain = include_lib("/lib/blockchain.so")
      coin = get_coin(blockchain, "test", "test", "test")
      subWallet = get_subwallet(coin, "test")
      print "Subwallet info: " + get_info(subWallet)
    • get_user():

      string

      "Unknown error: Unable to access to local computer""No internet access."

      Returns a string with the username associated with this subwallet. On failure, this method returns a string with an error message.

      blockchain = include_lib("/lib/blockchain.so")
      coin = get_coin(blockchain, "test", "test", "test")
      subWallet = get_subwallet(coin, "test")
      print "Subwallet user: " + get_user(subWallet)
    • last_transaction():

      list<any>ornumberorstring

      "Unknown error: Unable to access to local computer""No internet access."0

      Returns a list with the information of the last transaction. Index 0 is a string with the other subWallet. Index 1 is an integer with the amount. Index 2 is a number indicating the direction of the transaction (0 for Deposit, 1 for Withdrawal). Index 3 is a string indicating the date of the transaction. On failure, this method will either return a number with the value zero or a string with an error message.

      blockchain = include_lib("/lib/blockchain.so")
      coin = get_coin(blockchain, "test", "test", "test")
      subWallet = get_subwallet(coin, "test")
      transactionItem = last_transaction(subWallet)
      destinationAccount = transactionItem[0]
      amount = transactionItem[1]
      direction = transactionItem[2]
      completeDate = transactionItem[3]
      if direction == 0 then
          print "Received " + amount + " from " + destinationAccount + " got completed at the " + completeDate
      else
          print "Send " + amount + " to " + destinationAccount + " got completed at the " + completeDate
      end if 
    • mining():

      numberorstring

      "Unknown error: Unable to access to local computer""No internet access.""all existing coins of ${coinName} have been mined.""Only one mining process is allowed.""Error: GPU is damaged. Unable to start the mining process.""Error: GPU returned corrupted data while performing floating point tests. Unable to start the mining process.""Hardware error"1

      Starts the process of mining the cryptocurrency. The process leaves the terminal busy until a coin is mined. On success, this method will return a number with the value one. On failure, this method will return a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      coin = get_coin(blockchain, "test", "test", "test")
      subWallet = get_subwallet(coin, "test")
      while mining(subWallet) == 1
          print "Mining...", true
          print "Balance " + get_balance_subwallet(subWallet)
      end while
    • set_info(
      info: string
      ):

      numberorstring

      "Error: ${coinName} does not exist""Error: ${subWalletUser} does not exist""Error: main wallet linked to ${subWalletUser} does not exist anymore""Error: exceeded maximum of 256 characters""Unknown error: Unable to access to local computer""No internet access."1

      Stores optional information in the Subwallet for any use. Upon success, a number with the value one will be returned. In case of failure, a string with details will be returned.

      blockchain = include_lib("/lib/blockchain.so")
      coin = get_coin(blockchain, "test", "test", "test")
      subWallet = get_subwallet(coin, "test")
      result = set_info(subWallet, "test")
      if result == 1 then
          print "Subwallet info got set!"
      end if
    • wallet_username():

      string

      "Unknown error: Unable to access to local computer""No internet access."

      Returns a string with the name of the wallet to which this subwallet belongs.

      blockchain = include_lib("/lib/blockchain.so")
      coin = get_coin(blockchain, "test", "test", "test")
      subWallet = get_subwallet(coin, "test")
      print "SubWallet username: " + wallet_username(subWallet)
  • trafficNet

    A trafficNet object can be obtained by using include_lib. The classID used for this object is "TrafficNet".

    • Accesses the traffic camera system, opening a window with controls to switch between different cameras. If the window opens successfully, this method returns a number with the value one. In case of an error, it returns a string with details.

      libTraffic = include_lib("/lib/libtrafficnet.so")
      linkSystemResult = libTraffic.camera_link_system
      if linkSystemResult == 1 then
          print("Initiated camera broadcast!")
      end if
    • get_credentials_info():

      string

      "Unknown error: Unable to access to local computer""error: No internet access.""error: This device is not registered on any police network""${job} ${name}"

      Returns string which contains job and name of a NPC. If an error occurs, a string with details is returned.

      libTraffic = include_lib("/lib/libtrafficnet.so")
      print(libTraffic.get_credentials_info)
    • locate_vehicle(
      licensePlate: string, password: string
      ):

      numberorstringornull

      "Error: This user cannot access the global camera system for another 24 hours.""Error: This network has disabled access to the traffic cameras.""error: Workstation not found. Unable to get the credentials info from ${credentials}""error: Incorrect password. Access denied.""Unknown error: Unable to access to local computer""error: Invalid license plate.""Error: Unable to use the camera at this time. Too many calls.""error: No internet access.""error: This device is not registered on any police network""locate_vehicle: License plate not found.""The vehicle could not be located in the camera system at this time."1

      Performs a search for the specified license plate to locate the vehicle. If the vehicle is visible on any camera, the viewer will switch to the camera currently displaying it and return a number with the value one. If the vehicle cannot be located or the license plate is incorrect, a string indicating the error is returned. If any of the provided values deviates from the defined types in the method signature, this method will return null.

      libTraffic = include_lib("/lib/libtrafficnet.so")
      libTraffic.camera_link_system
      vehicleSearchResult = libTraffic.locate_vehicle("1L2M3N", "pass")
      if vehicleSearchResult == 1 then
          print("Found vehicle!")
      end if
  • wallet

    A wallet object can be obtained by either using create_wallet or login_wallet. The classID used for this object is "wallet".

    • buy_coin(
      coinName: string, coinAmount: number, unitPrice: number, subwalletUser: string
      ):

      numberorstring

      "Unknown error: Unable to access to local computer""No internet access.""sell_coin: coin amount and proposed price cannot be 0."1

      Publishes a purchase offer indicating the number of coins you wish to buy and the price ($) per unit you are willing to pay. The purchase will be finalized if there is any sale offer with a price less than or equal to the one proposed in the purchase. If there is no eligible offer to sell at that time, the offer to buy will remain publicly visible until a new offer to sell satisfies the requirements. If the publication has been successful, a number with the value one is returned. In case of error, a string with the details is returned. Any deviation from the method signature will result in a runtime exception preventing further script execution.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = login_wallet(blockchain, "test", "test")
      result = wallet.buy_coin("test", 100, 20, "test")
      if result == 1 then
          print "Sucessfully created purchase offer!"
      else
          print "Failed: " + result
      end if
    • cancel_pending_trade(
      coinName: string
      ):

      stringornull

      "Unknown error: Unable to access to local computer""No internet access."

      Cancel any pending offer of a certain coin. On success, an empty string will be returned. On failure, a string with an error message will be returned. Any deviation from the method signature will result in null.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.login_wallet("test", "test")
      if wallet.cancel_pending_trade("test") == "" then
          print "Trade got canceled!"
      end if
    • get_balance(
      coinName: string
      ):

      numberorstringornull

      "Unknown error: Unable to access to local computer""No internet access.""Error: wallet does not exist/incorrect credentials.""get_balance: wallet does not have coins in the selected currency"

      Returns a number of coins of a given currency. In case of error, a string with the details is returned. If the passed coinName is anything other than a string this method will return null.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.login_wallet("test", "test")
      for coinName in wallet.list_coins
          print "You have " + wallet.get_balance(coinName) + " coins of the currency """ + coinName + """"
      end for
    • get_global_offers(
      coinName: string
      ):

      stringormap<string,list<any>>ornull

      "Unknown error: Unable to access to local computer""No internet access."

      Returns a map with all the offers made by any player of a given currency. The key of the map represents the WalletID of the player who has made the offer, and the value of the map is a list where index 0 represents the type of offer with a string (Buy/Sell), index 1 represents the amount to sell or buy, and index 2 represents the price per unit. In case of failure, this method returns a string with details. Any deviation from the method signature will result in null.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.login_wallet("test", "test")
      for item in wallet.get_global_offers("test")
          walletId = item.key
          trade = item.value
          isBuying = trade[0] == "Buy"
          quantity = trade[1]
          unitPrice = trade[2]
          print "-" * 10
          print "<b>" + walletId + "</b>"
          if isBuying then
              print "<color=green>Is buying</color>"
          else
              print "<color=yellow>Is selling</color>"
          end if
          print quantity + " coins with a unit price of " + unitPrice
      end for
    • get_pending_trade(
      coinName: string
      ):

      stringorlist<any>ornull

      "Unknown error: Unable to access to local computer""No internet access."

      Returns a list with the pending sale or purchase offer of this wallet for a certain currency. Index 0 of the list represents the type of offer with a string (Buy/Sell), index 1 represents the quantity to be sold or bought, and index 2 represents the price per unit. On failure, this method will return a string with details. Any deviation from the method signature will result in a null.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.login_wallet("test", "test")
      result = wallet.get_pending_trade("test")
      isBuying = result[0] == "Buy"
      quantity = result[1]
      unitPrice = result[2]
      currentBalance = wallet.get_balance("test")
      if isBuying then
          print "After buying was successful your balance will be " + (quantity * unitPrice + currentBalance)
      else
          print "After selling was successful your balance will be " + (currentBalance - quantity * unitPrice)
      end if
    • get_pin():

      string

      "Unknown error: Unable to access to local computer""No internet access."

      Returns a string with a PIN that refreshes every few minutes. This PIN is used to obtain an account in cryptocurrency services.

      blockchain = include_lib("/lib/blockchain.so")
      myShell = get_shell
      myComputer = myShell.host_computer
      wallet = blockchain.login_wallet("test", "test")
      myComputer.touch("/root", "pin_launch.src")
      myFile = myComputer.File("/root/pin_launch.src")
      myFile.set_content("
          blockchain = include_lib(""/lib/blockchain.so"")
          myShell = get_shell
          myComputer = myShell.host_computer
          wallet = blockchain.login_wallet(""test"", ""test"")
          if params[0] ==  wallet.get_pin then
              get_custom_object.secret = ""The answer is 42""
          else
              get_custom_object.secret = ""The answer is 10053""
          end if
      ")
      myShell.build("/root/pin_launch.src", "/root")
      myFile.delete
      myShell.launch("/root/pin_launch", wallet.get_pin)
      print "The secret: " + get_custom_object.secret
    • list_coins():

      list<string>orstring

      "Unknown error: Unable to access to local computer""No internet access.""Error: wallet does not exist/incorrect credentials."

      Returns a list where each item is a string with the names of the coins available in the wallet. On failure this method returns a string with an error message.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.login_wallet("test", "test")
      print "My wallet is connected to: " + wallet.list_coins.join(", ")
    • list_global_coins():

      stringorlist<string>

      "Unknown error: Unable to access to local computer""No internet access."

      Returns a list where each item is a string containing the names of all the currencies that exist. In case of failure, this method returns a string with details.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.login_wallet("test", "test")
      print "All existing coins: " wallet.list_global_coins.join(", ")
    • reset_password(
      newPassword: string
      ):

      numberorstringornull

      "Error: Wallet does not exist.""Error: Only the account owner can change the password""Error: The password can only be reset once a day""Unknown error: Unable to access to local computer""No internet access.""reset_password: only alphanumeric characters are allowed as password""reset_password: name and password cannot exceed the 16 character limit."1

      Change the password of the wallet. Only the account owner can perform this action. If the process is completed successfully, a number with the value one will be returned. In case of an error, a string with details will be returned. Any deviation from the method signature will result in null.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = blockchain.login_wallet("test", "test")
      if wallet.reset_password("test") == 1 then
          print "You got a new password!"
      end if
    • sell_coin(
      coinName: string, coinAmount: number, unitPrice: number, subwalletUser: string
      ):

      numberorstring

      "Unknown error: Unable to access to local computer""No internet access.""sell_coin: coin amount and proposed price cannot be 0."1

      Publishes a sale offer indicating the amount of coins you want to sell and the price ($) per unit you want to assign. The sale will be finalized if there is any purchase offer with a price greater than or equal to that proposed in the sale. If there is no existing offer to buy that matches the requirements at that time, the offer to sell will remain publicly visible until a new offer to buy satisfies the requirements. If the publication has been successful, a number with the value one is returned. In case of error, a string with the details is returned. Any deviation from the method signature will result in a runtime exception preventing further script execution.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = login_wallet(blockchain, "test", "test")
      result = wallet.sell_coin("test", 100, 20, "test")
      if result == 1 then
          print "Sucessfully created sell offer!"
      else
          print "Failed: " + result
      end if
    • show_nodes(
      coinName: string
      ):

      stringornumberornull

      "Unknown error: Unable to access to local computer""No internet access.""show_nodes: wallet does not exist""show_nodes: coin does not exist"

      Returns a number representing the count of devices mining a specific coin for the same wallet. In case of an error, a string with details is returned. Any deviation from the method signature will result in null.

      blockchain = include_lib("/lib/blockchain.so")
      wallet = login_wallet(blockchain, "test", "test")
      print "Active miners: " show_nodes(wallet, "test")