WiFi QR Code Creation for Functional Decorations

I was recently playing around with the ability to create a WiFi QR Code, and I wanted to share how easy it is.

WiFi QR Code - Introduction

I was looking for some decoration ideas and I stumbled across a method to create a QR code for a wireless network.

I'd never done it before, but it seemed super straightforward. That said, I wanted to keep everything local, so I decided to use qrencode.

I'm still torn between 3D printed coasters and a print on the wall, so please chime in!

Libqrencode

Installing libqrencode is easy, as it is in the apt repositories.

root@kali:~# apt-get install qrencode
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libavahi-gobject0 libfolks-telepathy25 libgail-3-0 libgcab-1.0-0
  libgfortran4 libmission-control-plugins0 libtelepathy-glib0 magictree
  python-backports.ssl-match-hostname telepathy-mission-control-5
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libqrencode4
The following NEW packages will be installed:
  libqrencode4 qrencode
0 upgraded, 2 newly installed, 0 to remove and 636 not upgraded.
Need to get 80.2 kB of archives.
After this operation, 170 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.linux.duke.edu/kalilinux/kali kali-rolling/main i386 libqrencode4 i386 4.0.2-1 [40.0 kB]
Get:2 http://archive.linux.duke.edu/kalilinux/kali kali-rolling/main i386 qrencode i386 4.0.2-1 [40.2 kB]
Fetched 80.2 kB in 1s (93.6 kB/s)  
Selecting previously unselected package libqrencode4:i386.
(Reading database ... 361435 files and directories currently installed.)
Preparing to unpack .../libqrencode4_4.0.2-1_i386.deb ...
Unpacking libqrencode4:i386 (4.0.2-1) ...
Selecting previously unselected package qrencode.
Preparing to unpack .../qrencode_4.0.2-1_i386.deb ...
Unpacking qrencode (4.0.2-1) ...
Setting up libqrencode4:i386 (4.0.2-1) ...
Setting up qrencode (4.0.2-1) ...
Processing triggers for libc-bin (2.27-6) ...
Processing triggers for man-db (2.8.3-2) ...

Once I finished the install, I verified that I was able to run the qrencode command.

root@kali:~# qrencode
qrencode version 4.0.2
Copyright (C) 2006-2017 Kentaro Fukuchi
Usage: qrencode [OPTION]... [STRING]
Encode input data in a QR Code and save as a PNG or EPS image.

  -h           display this message.
  --help       display the usage of long options.
  -o FILENAME  write image to FILENAME. If '-' is specified, the result
               will be output to standard output. If -S is given, structured
               symbols are written to FILENAME-01.png, FILENAME-02.png, ...
               (suffix is removed from FILENAME, if specified)
  -r FILENAME  read input data from FILENAME.
  -s NUMBER    specify module size in dots (pixels). (default=3)
  -l {LMQH}    specify error correction level from L (lowest) to H (highest).
               (default=L)
  -v NUMBER    specify the minimum version of the symbol. (default=auto)
  -m NUMBER    specify the width of the margins. (default=4 (2 for Micro))
  -d NUMBER    specify the DPI of the generated PNG. (default=72)
  -t {PNG,PNG32,EPS,SVG,XPM,ANSI,ANSI256,ASCII,ASCIIi,UTF8,ANSIUTF8}
               specify the type of the generated image. (default=PNG)
  -S           make structured symbols. Version must be specified.
  -k           assume that the input text contains kanji (shift-jis).
  -c           encode lower-case alphabet characters in 8-bit mode. (default)
  -i           ignore case distinctions and use only upper-case characters.
  -8           encode entire data in 8-bit mode. -k, -c and -i will be ignored.
  -M           encode in a Micro QR Code.
  -V           display the version number and copyrights of the qrencode.
  [STRING]     input data. If it is not specified, data will be taken from
               standard input.

  Try "qrencode --help" for more options.

Creating the QR Code

With the library and application installed, it was time to create my (test) QR code!

To do this, I ran the qrencode command, with a type of SVG, an output file, and the input data for my test access-point. As you can see, the format is "WIFI:S:;T:;P:;H:;".

root@kali:~# qrencode -t SVG -o wifi-test.svg "WIFI:S:TestSSID;T:WPA2;P:WpaKeyHere;;"

After I ran the command, I opened the file to verify that qrencode generated the image.

WiFi QR Code - QR Code

Testing the Code

With the code created, I used the QR & Barcode Scanner app on my Android device.

As you can see, the code scanned properly, and I was able to connect to the network!

WiFi QR Code - Scanning

WiFi QR Code - Conclusion

While this was easy enough, I think it will (eventually) make a fun decoration around my house!

This is also a good point for me to start modifying my wireless setup. I want to have a "guest" network, that this code would be perfect for, a personal network, and an IoT/device network. I may also setup RADIUS eventually, but that's further down the line.

If you have suggestions for 3D printing these into coasters, then I'd love to hear them.

doyler on Githubdoyler on Twitter
doyler
Ray Doyle is an avid pentester/security enthusiast/beer connoisseur who has worked in IT for almost 16 years now. From building machines and the software on them, to breaking into them and tearing it all down; he's done it all. To show for it, he has obtained an OSCP, eCPPT, eWPT, eWPTX, eMAPT, Security+, ICAgile CP, ITIL v3 Foundation, and even a sabermetrics certification!

He currently serves as a Senior Penetration Testing Consultant for Secureworks. His previous position was a Senior Penetration Tester for a major financial institution.

When he's not figuring out what cert to get next (currently GXPN) or side project to work on, he enjoys playing video games, traveling, and watching sports.

Leave a Comment

Filed under Security Not Included

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.