Before anyone points out the post that Quinzy made a couple of years ago saying how passwords aren’t secure, I’d like to say that I agree with him, and the title of this blog post shouldn’t be taken to mean I think otherwise. But, like it or not, passwords are probably here to stay for the time being. With that in mind, it would be a good idea to make sure any passwords you use are strong enough.
I’ve been using a dice-based password generator for some time now, and I typically spend a bit of time now and then to generate a list of passwords [1]. Any time I need a new password, I just grab the next password in the list and cross it off, so I don’t re-use it (believe me, this is easy to do…). But I don’t always have my list of passwords with me, or if I do, sometimes I don’t have an unused one to use.
Years ago, when I was studying, I wrote a pass phrase generator to test my Java knowledge. It was pretty handy and being written in Java meant I could use it on Mac or PC. When I upgraded my PC after finishing Uni, I never bothered installing Java, so I didn’t have my handy-dandy generator. I’ve been (re)learning Python recently, so I thought I’d build something similar, so I have the ability to just smash out pass phrases as needed without resorting to rolling bunches of dice and looking up words in tables.
Searching around on the ‘Net for information about how to make apps with GUIs in Python gave me a few options. The two I saw most information about were PySimpleGui and TKinter, and having done a bit of reading I decided to give PySimpleGui a go. It seemed like a really nice way to build an app, but the visual aspects were less than appealing. In theory there are a bunch of different themes to choose from, but I found in practice that they did not work as expected. Sure, I ended up with a useable app, but it was as ugly as an ugly thing[2].
A few days ago Youtube recommended a video by NeuralNine on building Python apps with a modern GUI. It used a package called CustomTkinter, based on TKinter that I’d looked at earlier. The video was only 11 minutes long, so I gave it a watch, and was blown away by how nice the apps looked. I decided then and there to rebuild my app using CustomTkinter.
Rewriting the app wasn’t as difficult as expected and took me not much more than an hour or two. This included watching the video again, researching how to make buttons do things and how to handle text boxes. Once I’d finished I had an app I was extremely happy with, so I looked at if it was possible to compile the python app into an executable file. Turns out it absolutely is, thanks to a package called Pyinstaller.
Pyinstaller apparently makes it easy to turn a Python script into an executable program, but honestly, after a full week of work my brain was fried, and I couldn’t work out how to make it work. A bit of Googling later I found a second package called auto-py-to-exe which acts a GUI front end to Pyinstaller. This made life much easier for me, although things weren’t exactly straight forward.
My first attempt at making a .exe file of my Python app crashed when I ran it. Reading the error message, I found it was because I’d tried to put everything in one file. Turns out CustomTkinter makes that option impossible, and I would have to have a folder containing all the associated files for the GUI. Once I’d fixed that everything worked well.
My only complaint was that now I had a folder full of stuff, rather than a simple file I could run, but making a shortcut to the executable meant I could just ignore the folder full of crud. Still, part of me thought that if I ever wanted to give the app to someone else or move it to a new computer for that matter, then I needed a better way to share it. The obvious choice was to just zip everything up into a compressed file, but then that left making shortcuts to make the app easy to run.
The ideal choice would be to find a way of building an installer, so that files could be put where they needed to go, and a shortcut to the app put in the start menu. A bit of googling showed that I had 3 options. The simplest option was to use 7zip to make a self-extracting archive, but that wouldn’t allow a choice of install location or the making of start menu items. Option two was to use a built-in Windows utility called IExpress, which would do exactly what I wanted it to, right up until I found out it couldn’t handle subfolders. Option three was an open-source package called Inno Setup.
While this was probably overkill for my purposes, it did everything I wanted. The wizard for creating the installer was incredibly easy to follow, and I had my installer built and working in about 15-20 minutes. So, now that I have my Python script converted to an executable app, and packaged with an installer, I figured why not share it with the world? Along with the installer, I’ve included my source code and the word lists I used. It’s available for free, because honestly, I’d rather people be secure than get money for it. You can get it on the Downloads page.
[1] If you’re wondering why I think it’s okay to write my passwords down like this, I look at it this way:
1) There’s no indication which account a particular password is used for
2) The capitalisation I use in my list is not the same as the actual passphrase
3) I also add numbers and symbols when I choose one, and these are never written down
[2] To quote a friend: “It was as ugly as a hat full of busted arseholes”. Yup, that’s a horrifying mental image, but so was the app I built…
I like messing with stuff and seeing what I can make it do. Computers, electronics, photography are my main hobbies, but I also enjoy bike riding, gel blasting and music.