I know. I can’t help myself with these titles. Sorry.

Some time ago, I heard about Bart Busschots‘s xkpasswd.net password generating site via his appearances on the NosillaCast Podcast. I absolutely love the passwords it generates and I’ve used the site many, many times when setting up new online accounts. My favoured password type is provided by the Web site (16 chars) preset.

Later, Bart mentioned he had developed an Automator-based Service to generate passwords locally on his Mac, directly using the Perl library that sits behind the web site. I’ve never been a huge fan of services. I’ve written one or two in my time but the method of invoking them from menus always seemed a bit fiddly to me and assigning a keyboard shortcut – well, I have trouble remembering most of the ones that OS X provides me in the first place.

So imagine the look of joy that came across my face when I was mucking around with an Alfred 2 workflow the other day and realised it would be the perfect front end to the xkpasswd library!

I’m no AppleScript guru, but I thought that armed with Bart’s documentation on the library and Google for the rest, I’d give it a crack. I made many mistakes, but that’s actually half the fun of doing stuff like this. I’ve been programming on and off in many different languages for over 30 years and I find it challenging and fun. And, when it all works, extremely rewarding.

After I got a basic workflow going, it was time to expand it and smarten things up. I decided that I would allow for generating passwords from all the same presets that are provided on xkpasswd.net. The end result is rather pleasing.

As you can see, as soon as I start typing xk into Alfred, the 6 password types appear. I can either choose one by arrowing down or continuing with the specific keyword which is equivalent to the preset I need.

  • xk – Default
  • xkweb8 – Web site (8 character)
  • xkweb16 – Web site (16 character)
  • xkwin – Windows (NTLM compatible)
  • xkapple – Apple ID
  • xkwpa – WPA2

Alfred sorts by frequency, so my favoured Web site (16 character) is at the top of the list.

If you fancy having this on your Mac, you’ll find the workflow file below, but you’ll also need to install Bart’s xkpasswd library which you can find on his site. I adopted his recommendations for where to store the library, which is in the /usr/local/xkpasswd directory. Visit Bart’s Automator Service blog post for more information (see the second paragraph).

 
Click to download the workflow file.

Click to download the workflow file.

 

Finally, to explain the title of this post. This workflow, of course, would not have been possible without the work of others – not only Bart’s library, but also various others who think nothing of putting their knowledge out there on the internet for others to benefit from. There was much Googling in the making of this. But I will leave you with Bart’s words when I ran this past him prior to publishing.

The reason I chose the BSD licence for the library was to make it as easy as possible for people to re-use, so this kind of thing makes me smile 

Banner image Creative Commons by Bobbi Klein.

Comment