Last active
February 11, 2023 20:50
-
-
Save GammaGames/7736c7741879e32b5ad2c8b587216445 to your computer and use it in GitHub Desktop.
Generate wifi qr code in python3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyqrcode, sys, base64 | |
if len(sys.argv) < 2: | |
print("Usage: python3 wifi.py [network] [password]") | |
quit() | |
network = sys.argv[1] | |
if len(sys.argv) > 2: | |
protocol = "WPA/WPA2" | |
pwd = sys.argv[2] | |
else: | |
protocol = "nopass" | |
pwd = "" | |
qr = pyqrcode.create(f"WIFI:S:{network};T:{protocol};P:{pwd};;") | |
png = qr.png(f"{network}.png", scale=5) |
Greetings sir!
How do i find the code like "WIFI" as type or ":S", ":T", ":P" or other codes. What are other examples with meanings?
I'm not sure where to find more formats, you can probably find the spec somewhere, but Wikipedia has the format for the wifi network string.
Greetings sir! How do i find the code like "WIFI" as type or ":S", ":T", ":P" or other codes. What are other examples with meanings?
I stumbled upon this gist while googling the same thing. I found this wiki article on zxing/zxing. I tested some of the formats in the document in QR codes and they work as expected.
I know this is a little late, but I hope this can be helpful to people finding this in the future.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before running you need a few dependencies, run this to get them: