wifi

wifi.on()

Starts the Wi-Fi functionality.

Note: This function cannot be used if the device is already connected to the internet via Wi-Fi.

wifi.on();

wifi.off()

Stops the Wi-Fi functionality.

Note: This function cannot be used if the device is already connected to the internet via Wi-Fi.

wifi.off();

wifi.sniffStart(callback);

Starts Wi-Fi sniffing and specifies a callback function to receive captured packets.

Sniffing can only be performed on a specific channel at a time. To perform a bulk scan across multiple frequencies, please switch channels sequentially.

function callback(da_addr, sa_addr, bssid_addr, channel, rssi)
  local da = mac_to_hex(da_addr)
  local sa = mac_to_hex(sa_addr)
  local bssid = mac_to_hex(bssid_addr)
  os.log(string.format(
    "DA: %s, SA: %s, BSSID: %s, Channel: %d, RSSI: %d",
    da, sa, bssid, channel, rssi
  ))
end

wifi.on();
wifi.sniffStart(callback);
wifi.sniffSetChannel(2);

wifi.sniffSetChannel(channel);

Changes the target channel after sniffing has started.

Please verify the frequencies (channels) allowed for Wi-Fi use in your specific country or region.

wifi.sniffSetChannel(2);

wifi.sniffStop();

Stops the Wi-Fi sniffing process.

wifi.sniffStop();