This project is a Go-based utility to generate QR codes for Wi-Fi networks. Users can provide Wi-Fi details (SSID, password, authentication type, etc.) as command-line arguments, and the script generates a QR code image that can be scanned to connect to the network.
- Generates a QR code for Wi-Fi networks.
- Supports various authentication types (WPA, WEP, or none).
- Handles hidden and visible networks.
- Easy to use with command-line arguments.
- Go: Ensure Go is installed on your system. You can download it from go.dev.
- qrcode Library: The script uses the
github.com/skip2/go-qrcodelibrary for generating QR codes.
-
Clone the repository or save the script in a file (e.g.,
main.go). -
Initialize a Go module (if not already done):
go mod init wifi_qr_generator
-
Install the
qrcodelibrary:go get github.com/skip2/go-qrcode
Compile and run the script with the following command:
go run main.go --ssid="MyWiFi" --password="12345678" --auth="WPA" --hidden=false| Argument | Description | Required | Default |
|---|---|---|---|
--ssid |
The name of the Wi-Fi network. | Yes | None |
--password |
The password for the Wi-Fi network. | No | None |
--auth |
Authentication type: WPA, WEP, or empty for no encryption. |
No | WPA |
--hidden |
Whether the Wi-Fi network is hidden (true or false). |
No | false |
The script generates a file named wifi_qr_code.png in the current directory. This file contains the QR code with the provided Wi-Fi details.
To generate a QR code for a Wi-Fi network:
- SSID:
HomeNetwork - Password:
mypassword - Authentication:
WPA - Hidden:
false
Run:
go run main.go --ssid="HomeNetwork" --password="mypassword" --auth="WPA" --hidden=falseThe output file wifi_qr_code.png will be created in the current directory.
-
Missing Module Error: If you encounter an error like
go.mod file not found, initialize the Go module usinggo mod init wifi_qr_generator. -
Library Not Found: If the library is missing, ensure you install it using:
go get github.com/skip2/go-qrcode
-
Permission Issues: Ensure you have write permissions for the directory where the script is executed.
This project is licensed under the MIT License. Feel free to use and modify it as needed.