Today I'm working on the QR Code Generator.

UPDATE #1:  I got it mostly done.

UPDATE #2:  I re-inverted the QR code (so it's not inverted now).  This results in a clearer, more readable, faster-scanning QR code.  Also, some QR Code scanner apps simply just don't work with color-inverted QR codes.

UPDATE #3:  I added a button to give you more time to view the QR code and a button to Go Back (see bottom of page)

QR Code with Countdown before adding "I Need More Time" button

I also added a white bar at the bottom of the screen to display the URL behind the code.

To top it off, the white bar at the top of the screen connects to the QR code and URL in one piece.

P4wnSolo QR Code screen (updated & re-inverted)

But before I got it looking like it did in the pic above, here's a pic after I got the screen elements arranged:

p4wnsolo QR Code Generator preview

The Initial Plan

Here's what I set out to do:

 

What I Actually Did

p4wnsolo QR Code screen zoomed in a bit more

After wrestling with this code for hours, I finally got it to a decent spot:

Resources Used

The heart of the QR Code Generator feature in p4wnsolo is a simple Python library on Github called python-qrcode.

I ended up using this StackOverflow post to draw text over an image (see this link too).

At some point I used this StackOverflow post to call a subprocess and get its output.

I split a string or two in Python.

In Python, I also used a method to rotate an image 180 degrees.

For the circles to indicate what happens when a button is pressed, I made ellipses in Python.

And I'm still stoked on this one-liner Linux command to get your IP address.

 

To Do for QR Code Generation

I didn't get around to adding the "Generating QR Code - Please wait" display screen.

 

Currently Working with These Filenames:

wifi-qr-bak.py

wifi-qr-bak_21-12-02.py

 

Finished (with the Display part):

I finally got the QR Code to show up un-inverted along with the other text on the screen.

This took awhile.

But it's done:

greyscale-bak_21-12-03_final.py

Run this command to view on OLED SH1106:

python3 filename.py -i spi --display sh1106

 

Update #3:  Exit Button, Countdown, Loading Screen

QR Code display with Countdown timer & Exit button

I added an "Exit" button (KEY3) to exit the script when the button is pressed.

Then I added a countdown timer which also exits the script when the timer reaches 0.

Finally, I added a "Generating (Service Name) QR Code. Please Wait" screen

Generating QR Code screen (takes about 10 seconds on Pi Zero W 1)

Currently working with these filenames:

greyscale.py (current)

greyscale-bak_21-12-03_2-final_plus.py (backup)

 

Added "+" Button for More Time

greyscale.py

greyscale-bak_21-12-03_3-final_plus.py

To Do:

  1. Add the QR Code script to Crontab (place it just before the Dashboard is launched)
  2. Make the QR Code accept a new parameter (servicename) to tell the script what PORT and URL PREFIX to output.  Ex:  ssh / vnc / spiderfoot / phoneinfoga / wifiap / hostname
  3. Adapt the key_demo.py script to display different QR codes with different button presses (using parameter-ized QR Code script)

To simplify this and tie it all together, can we make the QR Generate / display code into a function w/parameter?

This way we could just call the function from within key_demo.py.  Ex:  showqr('spiderfoot')

List of QR Codes to Make for Raspberry Pi (P4wnP1)