Nodes (Extensions)

**Nodes** are a core element of Extensions.

*For a list of nodes in the base game and the Intro Extension, see Nodes*.
## Description

A node is essentialy a computer that the player can interact with. Nodes are defined in the `Nodes` folder of an Extension.

Like in the original game of *Hacknet*, nodes have ports, four default folders (`/home`, `/log`, `/bin`, and `/sys`), daemons, and other linked nodes (including eOS devices). Any node can be customized.

The Extension Example PC in the Intro Extension contains most information regarding Nodes.

## Basics

Every node is defined inside the `<Computer> </Computer>` tags.

The `Computer` tag has multiple attributes:

* `id` - the ID of the node. It is not seen in-game but is used when defining the specific node in the Extension.
* `name` - the name of the node. It is seen in-game.
* `ip` - the IP of the node. Removing this attribute will randomize the IP of the node.
* `security` - defines the security of the node and the amount of ports required to break into the node.
* `allowsDefaultBootModule` - boolean attribute: if set to `true` the node will launch the daemon that is defined last in the node file.
* `icon` - defines the icon of the node.
* `type` - defines the type of the node. Setting this attribute to `empty` will ensure that the node will not contain any junk/IRC files. Available type parameters are:
	+ `1`, `2`, and `3` generate junk files in the `/home` folder.
	+ `4` and `empty` do not generate any junk files.
	+ `5` generates the `/eos` folder, similar to eOS devices.

Usage:

```
<Computer id="ExampleNode"
          name="Example Computer"
          ip="127.0.0.1"
          security="4"
          allowsDefaultBootModule="true"
          icon="laptop"
          type="1">

</Computer>
```

This will define the most basic computer in the Extension.

### Node Icons

Sec0Computer - `security="0"`Sec1Computer - `security="1"`Computer - `security="2"`OldServer - `security="3"`Sec2Computer - `security="4"` and aboveLaptop - `icon="laptop"`Phone1 - `icon="ePhone"`Phone2 - `icon="ePhone2"`Tablet - `icon="tablet"`Chip - `icon="chip"`KellisCompIcon - `icon="kellis"`
*Labyrinths* only

PC1 - `icon="DLCPC1"`PC2 - `icon="DLCPC2"`Laptop - `icon="DLCLaptop"`Server - `icon="DLCServer"`AlchemistsIcon - `icon="Alchemist"`PacificAir - `icon="PacificAir"`Psylance - `icon="Psylance"`
## Core elements

### `adminPass`

This tag defines the admin password to the node.

Usage:

```
<adminPass pass="password" />
```

If the tag does not exist, the password will be random.

### `account`

This tag defines other node accounts.

Usage:

```
<account username="guest" password="guestpass" type="1" />
```

The following types can be used:

* ADMIN = 0
* ALL = 1 (can delete files)
* MAIL = 2 (for mail accounts)
* MISSIONLIST = 3 (for mission listing server accounts)

To define the player account (e.g. for the mail server), the wildcard `#PLAYERNAME#` is used:

```
<account username="#PLAYERNAME#" password="password" type="2" />
```

### `ports`

This tag defines the node ports. Crackable ports can be opened with executables and Hacker Scripts, non-crackable can only be opened with Hacker Scripts.

Usage:

```
<ports>22, 21, 25, 80, 1433</ports>
```

Available ports:

* Crackable
	+ 22 - SSH
	+ 21 - FTP Server
	+ 25 - SMTP MailServer
	+ 80 - HTTP WebServer
	+ 1433 - SQL Server
	+ 104 - Medical Services
	+ 6881 - BitTorrent
	+ 443 - HTTPS (SSL)
	+ 192 - Pacific Dedicated
	+ 554 - RTSP

* Non-crackable
	+ 3659 - eOS Connection Manager
	+ 3724 - Blizzard Updater
	+ 9418 - Version Control
	+ 211 - Transfer

If the tag does not exist, the node will have the following ports: 80, 25, 21, 22.

### `portRemap`

This tag remaps existing ports.

Usage:

```
<portsRemap>22=340, 80=8000</portRemap>
```

The example above sets the value of the SSH port to 340 and the HTTP port to 8000.

### `portsForCrack`

This tag defines the amount of ports required to break into the node. It overrides the `security` attribute of the `Computer` tag.

Usage:

```
<portsForCrack val="4" />
```

### `trace`

This tag defines the time (in seconds) it takes for the active trace to detect the player.

Usage:

```
<trace time="100" />
```

Setting the value to `-1` or removing the tag disables the active trace.

### `proxy`

This tag defines the proxy. The multiplier equals 30 seconds.

Usage:

```
<proxy time="2" />
```

The proxy above will take one minute to overload, assuming the player uses only one shell.

### `firewall`

This tag defines the firewall that can be analyzed with `analyze` and solved with `solve` commands.

Usage:

```
<firewall level="8" solution="FIREWALL" additionalTime="1.0"/>
```

* `level` should not be less than the solution length.
* `additionalTime` is the extra time it takes the player to solve the firewall per step.

### `admin`

This tag defines the admin account type of the node.

Available types:

* `basic` - the player loses admin privileges on the system after 15 seconds; also resets ports
* `progress` - ports reset only if the player is not an admin of the system
* `fast` - the player loses admin privileges on the system instantly after disconnect; also resets ports

`resetPassword` ensures that the admin password changes after the player disconnects from the system.

`isSuper` resets the admin password instantly.

Usage:

```
<admin type="fast" resetPassword="false" isSuper="false" />
```

### `tracker`

This tag defines the passive trace - if the player leaves logs on the system after disconnect, the system will attack the player, either bluescreening the player or making them do the Emergency Trace Aversion Sequence.

Usage:

```
<tracker />
```

The passive trace sequence can be modified by creating a `TrackSequence.txt` hacker script in the `HackerScripts` folder.

## Network

### `dlink`

This tag links the node to another one. `Scan`ning the main node reveals other linked nodes.

Use multiple tags to link the main node with multiple other nodes.

Usage:

```
<dlink target="ExampleNode2" />
```

### `positionNear`

This tag places the node near the target.

Usage:

```
<positionNear target="ExampleNode1" position="1" total="3" extraDistance="0.1" force="false"/>
<positionNear target="ExampleNode2" position="2" total="3" extraDistance="0.1" force="false"/>
<positionNear target="ExampleNode3" position="3" total="3" extraDistance="0.1" force="false"/>
```

This will place three nodes around the target at approximately similar distance.

Position is it's position radially around it.

Total is the number of radially surrounding nodes it has.

ExtraDistance should be between -0.6 and 0.3 - anything bigger will seem really far away, and can cause problems. 0.1 is a good distance.

Force tag ensures that this node is positioned exactly where it's defined here, regardless of overlaps with other nodes etc. It basically prevents the checks that ensure stability, but guarantees that it'll be placed close.

## Files

The following tags define various files within the node.

### Normal files

```
<file path="home" name="Example_file.txt">This is an example file.

It supports newlines.

Place this file in the subfolder, e.g. path="home/subfolder"</file>
```

### Executables

Executables and default themes use wildcards (e.g. `SSHCrack.exe`)

```
<file path="bin" name="SSHCrack.exe">#SSH_CRACK#</file>
```
Custom theme files

```
<customthemefile path="sys" name="Custom_x-server.sys" themePath="Themes/CustomTheme.xml" />
```

### DEC encrypted files

`double` attribute creates a second layer, meaning the file must be decrypted twice.

```
<encryptedFile path="home" name="encrypted_File.dec" extension=".txt" ip="192.168.1.1" header="This is the header" pass="password" double="false">This generates an encrypted file that can be decrypted using the password above. It decrypts to have the extension .txt</encryptedFile>
```

### Memory dumps (***Labyrinths* only**)

The following dump can be generated with the `MemDumpGenerator.exe`:

```
<Memory>
 <Commands>
  <Command>cd /log</Command>
  <Command>rm *</Command>
  <Command>cd /log</Command>
  <Command>rm *</Command>
 </Commands>
 <Data>
  <Block>This appears in the "files" section</Block>
  <Block> more and longer, multi line notes!</Block>
 </Data>
 <Images>
  <Image>Images/ExampleImage.png</Image>
 </Images>
</Memory>

```
To create a memory dump as a file, place it inside the following tags:

```
<memoryDumpFile name="ExampleDump.md" path="home">

</memoryDumpFile>

```

## eOS devices

Nodes support eOS devices connected to them. These can be revealed by using `eosDeviceScan.exe`.

* `empty` attribute ensures that the eOS device will not have misc applications in the `eos` folder.
* `passOverride` is the custom password. Removing this attribute will set the password to `>alpine`.

```
<eosDevice name="Example ePhone 4S" id="ExamplePhone" icon="ePhone" empty="false" passOverride="password">

<note>Test_note
Text goes here</note>

<mail username="test@jmail.com" pass="testpassword" />

<file path="eos/test" name="Test_file.txt">More text goes here</file>

</eosDevice>
```

## Daemons

*Main article: Daemons*
Daemons are Node programs that the player can interact with. Nodes can support any amount of daemons, although it is preferrable to keep the number low.

Like other core elements, daemons are defined within the `Computer` tags. The last daemon defined in the file will be launched upon connecting to the node if the `allowsDefaultBootModule` attribute is set to `true`.