The wifi-captive.command Z Shell script for Mac OS is used to connect a device to a Wifi network with a Captive Portal that cannot be accessed by the device.
This could happen when the device does not have a web browser installed like the case of an Apple TV or the network configuration tool does not allow the captive portal to be automatically accessed, the later being the case of the Nintendo 3DS.
Public WiFi networks are often configured with a Captive Portal in order to gather specific users information like in hotels or restaurants.
- Determine the MAC address of the device.
- Determine the SSID of the network.
- If already connected to the wireless network, power off or unplug the device to disconnect it.
- Execute the script with one of the following:
- Double click on the script to run it,
- Drag and drop it to the Terminal window,
- Open the Terminal window, navigate to script location and enter the command
./wifi-captive.command.
- Follow the instructions on the screen.
- The script is tested on macOS Monterey (12.3.1).
- This version of the script uses the en0 network interface as default.
- This version of the script uses the Firefox browser to access the captive portal and verify internet connection.
- Ask user to disconnect the device from the network.
- Choose or capture the WiFi network SSID.
- Disconnect Mac computer from the network and remove the network profile.
- Choose or capture the MAC address of the device.
- Spoof the MAC address of the device.
- Connect to the network with the spoofed MAC address.
- Ask user to fill the Captive Portal form, submit it and verify internet connection.
- Disconnect Mac computer from the network and remove the network profile.
- Restore the original MAC address of the Mac computer.
- Connect to the network with the original MAC address.
- Ask user to verify internet connection (if needed submit again Captive Portal form).
Add hints to the script to make it more user friendly.Add a way to store the captured SSIDs in a file.Add a way to select network SSID from the stored list.Add a way to store the captured addresses with their device's name in a file.Add a way to select one of the stored addresses by choosing the device's name.Execute find command silently (hide output).- Add a way to select the network interface name to use (currently hardcoded to en0).
- Add a way to select the browser to use (currently hardcoded to Firefox).
- Save persistency files in dedicated MacOS Application files directory.
- Simplify redundant code.
- Refactor the script to make it more readable.