> For the complete documentation index, see [llms.txt](https://cyberboat.gitbook.io/cyberboat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cyberboat.gitbook.io/cyberboat/cyberboat/nmea-t-connector/wasm-application.md).

# WASM Application

The WASM Application can be found in [nmea\_attack](https://github.com/gpearcey/nmea_attack).

## lib.rs

Contains functions called by the firmware.

#### main()

* Reads a message from the message buffer, reads the attack mode from the attack mode buffer.&#x20;
* Based on the mode, either sends no messages, sends all messages without modifying them, or modifies messages for GPS attacks. When sending messages, messages received on controller 0 are sent to controllers 1 and 2, messages received on controller 1 are sent to controllers 0 and 2, and messages received on controller 2 are sent to controllers 0 and 1.

## Attack Modes

Attack modes are currently set from the [nmea\_t\_modes.py](https://github.com/gpearcey/cyberboat_control/blob/main/nmea_t_modes.py) script running on the Pi. The script sets controls 2 pins connected to 2 pins on the ESP32.&#x20;

#### 1. OFF

Stops transmission off all messages passing through the T connector.

#### 2. PASSIVE

This is the default mode. Sends all messages through without modifying them.&#x20;

#### 3. OPPOSITE DIRECTION ATTACK

Shows the boat moving in the opposite direction of real movement. Flips heading by 180 degrees.&#x20;

#### 4. TRANSLATION ATTACK&#x20;

Translates the current position by a constant latitude and longitude. Heading remains the same.
