> For the complete documentation index, see [llms.txt](https://documentation.hak5.org/lan-turtle-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.hak5.org/lan-turtle-hub/payload-development/duckyscript-for-lan-turtle/wifi.md).

# WIFI

The LAN Turtle Hub can act as a WiFi client (connecting to other networks, such as a mobile hotspot) and as a WiFi access point (providing access to the LAN Turtle Hub directly through WiFi).

## WIFI\_CONNECT

Connect the LAN Turtle Hub as a client of a WiFi network.  This network does not need to be present at the time of configuration; the LAN Turtle Hub will attempt to connect to it once it is available.

### Options

The `WIFI_CONNECT` command accepts several options:

<pre><code><strong>WIFI_CONNECT [country] [ssid] [encryption] [key] [bssid]
</strong><strong>  country     Country code for AP
</strong>  ssid        SSID to connect to
  encryption  Encryption configuration
              open       - No encryption
              psk        - WPA PSK
              psk2       - WPA2 PSK
              sae        - WPA3 SAE (personal)
  key         Encryption key (or 'NONE')
  bssid       Specific BSSID (or 'ANY')
</code></pre>

#### country

Two-digit country code.  This *must* match your country of operation to remain in compliance with radio regulations.

The country code is based on the ISO 3166-1 standard.  If you do not know your country code, it can likely be found [here](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).

#### ssid

The network SSID (name) to connect to.

#### encryption

Type of encryption used on this network:

* open - no encryption
* psk - WPA1 PSK (pre-shared key / password)
* psk2 - WPA2 PSK (pre-shared key / password)
* sae - WPA3 PSK/Personal (pre-shared key / password)

#### key

The actual network key, or `NONE` if the network type is `open`.

#### bssid

Connect only to a specific BSSID (the MAC address of the access point).  To connect to any access point with the proper SSID and encryption, specify `ANY`.

### Examples

To connect to a WPA2 network:

```
WIFI_CONNECT US TestNetwork psk2 "Test Password" ANY
```

To connect to an open network:

```
WIFI_CONNECT US TestOpen open NONE ANY
```

## WIFI\_DISCONNECT&#x20;

The `WIFI_DISCONNECT` command disables the client connection on the LAN Turtle Hub, if one is enabled.

### Options&#x20;

`WIFI_DISCONNECT` does not take any options.

### Examples

To stop the WiFi client connection, simply include `WIFI_DISCONNECT` in your payload.

```
WIFI_DISCONNECT
```

## WIFI\_MGMT\_AP

The `WIFI_MGMT_AP` command configures the LAN Turtle Hub management AP.

### Options

`WIFI_MGMT_AP` takes a number of parameters:

```
WIFI_MGMT_AP [channel] [ssid] [encryption] [key] [hidden|visible] {bssid}
```

#### channel

Configure the WiFi channel of the AP, between 1 and 11. &#x20;

If the LAN Turtle Hub is also configured as a WiFi client, the AP will ignore this setting and use the channel the client AP is on.

#### ssid

The network SSID (or name).  This is the name that is advertised by the AP, it will be visible in nearby network lists and to scanning tools like the WiFi Pineapple and Kismet.

#### encryption

The encryption type of the management AP, which should be one of:

* psk - WPA1 / WPA2 PSK
* sae-mixed - WPA2 / WPA3 PSK
* sae - WPA3 PSK

#### key

The encryption key / password.

#### hidden -or- visible

If `hidden` is specified, the management AP SSID will not be advertised.

Hiding a SSID *may* obscure it from appearing in the network list of nearby devices, but *can not fully hide the SSID*.  Tools such as the WiFi Pineapple and Kismet will still be able to discover and reveal the SSID.

If the management AP was previously enabled with a visible SSID, nearby devices may continue to report that it is visible (or that it is using the old SSID) until they have refreshed any cached network lists or been rebooted.

#### bssid

Optionally set the BSSID (mac address) of the management AP. &#x20;

Leave this option blank to use the default address.

### Examples

To configure a WPA2/WPA3 management network with a visible SSID:

```
WIFI_MGMT_AP Turtlehub sae-mixed hak5turtlehub visible 
```

## WIFI\_MGMT\_AP\_DISABLE

Disable the LAN Turtle Hub management AP.

### Options&#x20;

`WIFI_MGMT_AP_DISABLE` does not take any options.

### Examples

To disable the management ap, simply run the `WIFI_MGMT_AP_DISABLE` command:

```
WIFI_MGMT_AP_DISABLE
```

## WIFI\_WAIT

`WIFI_WAIT` will delay for a specified number of seconds (or forever) until a WiFi client connection is established.

### Options

```
WIFI_WAIT {timeout}
```

#### timeout

If specified, `WIFI_WAIT` will exit (with an error return code) after *timeout* seconds.

### Examples

```
WIFI_WAIT 30 || LED R SINGLE
```
