Jun
4
Crypt::HSXKPasswd on MacOS (File::HomeDir workaround)
Filed Under My Projects, Computers & Tech on June 4, 2019 | 1 Comment
Due to a problem with the File::HomeDir
Perl module on recent versions of MacOS, the usual one-step instructions for installing Crypt::HSXKPasswd
from CPAN don’t work on Macs ATM (June 2019).
TL;DR
sudo cpan -f -I File::HomeDir sudo cpan Crypt::HSXKPasswd
May
4
backup.pl Version 0.2 Released
Filed Under Automation, My Projects, Software Development, Computers & Tech on May 4, 2017 | Leave a Comment
I’ve just published a release of backup.pl
, my simple perl-based generic backup script. You can download the release, and get full documentation on the project’s GitHub page.
Dec
30
Pretty Markdown & HTML Links With TextExpander & Perl
Filed Under Software Development, Computers & Tech, Automation on December 30, 2015 | 7 Comments
What’s the problem to be solved? When doing show notes for the various podcasts I contribute to, I generally have to include a lot of links. Particularly for Let’s Talk Apple and the Security Stuff segment on the Nosillacast, I want to clearly show where the news story came from. I also want to keep the link text short. To balance those two requirements, I decided to use the domain part of the URL with /...
appended to it as the link text. Doing this manually would be a really big pain in the backside because there are often more than 50 links in the notes for a single episode! Clearly, this needed automation.
I do my show notes in Markdown, so my initial solution produced links in Markdown format. Allison asked me how I did my links, because she thought they looked good, and she assumed I would have automated the process in some way. I explained my solution, and she asked if I could build a variant for her that generates the same style of links in HTML format.
My solution is built using a number of building blocks, but the glue that holds it all together is TextExpander. TextExpander is a paid-for Mac-only app, but one I would argue is well worth the price of admission. TextExpander is one of the first things I install on every new Mac.
TextExpander’s raison d’être is to monitor everything you type, looking for abbreviations you have defined, and replacing them with expansions you have defined as you type. Each of these abbreviations/expansion pairs are referred to as snippets within TextExpander.
Snippets can be very simple replacements like expanding *bb
into Bart Busschots
, but they can also be much more complex. The next level up would be to include special codes to inject data into the replacements, for example, I have a snippet that replaces *di
with the current date and my initials, the content of that snippet is %d-%m-%Y BB
– %d
gets replaced with the day part of the current date, %m
the month part of the current date etc.. The next level of complexity is that you can include special codes to make TextExpander popup a little form when ever you type the abbreviation into which you then fill in information that gets included in the replacement text.
However, the thing that really makes TextExpander powerful in my mind is it’s ability to execute a script to generate the replacement text. The scripts can be written in AppleScript, JavaScript, and any scripting language supported in the OS X terminal. This allows TextExpander to utilise the full power of the Terminal, as well as the full power of scripting languages like Perl, Python and Ruby.
Unsurprisingly, I like to use Perl in my snippets, and in this case, I use Perl to reach out to the pbpaste
terminal command, and to harness the power of the URI
perl module.
I use my solution as follows:
- Copy the link to be included in the show notes to the clipboard
Cmd+tab
to the show notes I am working on and type the abbreviation*mdlc
into the place in the notes where I want the URL to be inserted (all my Markdown expansions start with*md
, andlc
stands for linkify clipboard).- The TextExpander snippet then executes – it fetches the URL from the clipboard, parses it with the
URI
perl module, and assuming that succeeds, generates the Markdown code for the link, and inserts it into the show notes in place of the*mdlc
abbreviation.
Dec
15
hsxkpasswd
Without sudo
(with perlbrew
)
Filed Under System Administration, My Projects, Security, Computers & Tech on December 15, 2015 | 2 Comments
While it’s very easy to install hsxkpasswd
onto your system from CPAN – it’s literally just one command (see below) – it requires administrator access to the machine.
sudo cpan Crypt::HSXKPasswd
This is all well and good if you have administrator access and are sure you want the module installed system-wide. But, what if you don’t have admin access, or, what if you just want to experiment with the module in your own home directory? The answer is perlbrew
, a system for running custom versions of Perl inside your home directory. No need for sudo
, and what ever you install with perlbrew
is entirely contained within your home directory. If you already have perlbrew
installed and configured with a version of Perl greater than or equal to 5.16, you can skip to the final step. If not, you’ll need to make your way through all the steps.
Step 1 – Install perlbrew
Into Your Home Dir
There are a few different ways of installing perlbrew
, but I find the following method the simplest:
curl -L http://install.perlbrew.pl | bash
That should install perlbrew
into your home directory, and it should tell you to append some code to the end of your ~/.bash_profile
file, which you can do with the following command:
echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bash_profile
Once that’s done, close your Terminal window and open a new one (this is to pick up the new environment variables defined in ~/perl5/perlbrew/etc/bashrc
). You’ll know the install has been successful if you can run the perlbrew
command:
perlbrew version
Step 2 – Install a Compatible Version of Perl into perlbrew
The joy of perlbrew
is that you can have as many versions of Perl installed at any one time as you like, and you can then switch between them with the perlbrew
command.
You can install Crypt::HSXKpasswd
, and hence the hsxkpasswd
terminal command, into any version of Perl greater than or equal to 5.16.
The following command will install Perl 5.16 into perlbrew
:
perlbrew install perl-5.16.0
Go off and make yourself a cup of your favourite beverage – this will take a while! 🙂
Once the install finally finishes, you can activate that version of perl (just on your account) with the command:
perlbrew switch perl-5.16.0
It’s important to note that if at any stage you want to disable perlbrew
and get back to the default system version of perl, the command to do so is:
perlbrew off
Step 3 – Enable the perlbrew
CPAN Client
If you haven’t already done so, enable the perlbrew
CPAN client cpanm
with the command:
perlbrew install-cpanm
Step 4 – Install Crypt::HSXKPasswd
Once you have perlbrew
installed and configured with a compatible version of perl, you can install Crypt::HSXKPasswd
with the following simple command:
cpanm Crypt::HSXKPasswd
You’ll know it’s worked if you can run the hsxkpasswd
terminal command:
hsxkpasswd --version
Aug
11
Crypt::HSXKPasswd
and hsxkpasswd
now on CPAN
Filed Under My Projects, Security, Software Development, Computers & Tech on August 11, 2015 | 1 Comment
The latest stable release of both the Crypt::HSXKPasswd
perl module, and the hsxkpassd
terminal command are now available through CPAN: http://search.cpan.org/perldoc?Crypt%3A%3AHSXKPasswd
The library and terminal command are bundled together, and can be installed onto Unix/Linux/Mac OS X computers in the standard CPAN way:
sudo cpan Crypt::HSXKPasswd
When this install finishes, both the terminal command and perl module will be available for use on the system, along with the documentation for both:
man hsxkpasswd perldoc Crypt::HSXKPasswd
Even though I’ve put a lot of time an effort into creating these tools, I’ve chosen to released them entirely free of charge, and with a very liberal open-source license (BSD). If you find either the terminal command or Perl module useful, please consider making a donation below to help cover my time and costs.
If you find a bug, would like to suggest a change or improvement, or would like to contribute code to the project, please use the project’s GitHub page.
Aug
8
Uninstalling a Crypt::HSXKPasswd
Beta
Filed Under System Administration, My Projects, Computers & Tech on August 8, 2015 | 2 Comments
Firstly, thanks to everyone who runs beta versions of Crypt::HSXKPasswd
– every bug you find makes the software that little bit better!
However, now that the software is in CPAN, many of you may well want to move away from the stand-alone beta releases, and start getting the module directly from CPAN. Before you install the module from CPAN, you should remove the beta from your system. You can do that in two easy steps:
- Install
pm-uninstall
from CPAN:sudo cpan App::pmuninstall
- Use
pm-uninstall
to remove the beta version ofCrypt::HSXKPasswd
:sudo pm-uninstall Crypt::HSXKPasswd
Jul
19
Announcing Crypt::HSXKPasswd
Beta 4
Filed Under Security, Software Development, Computers & Tech on July 19, 2015 | Leave a Comment
Another week, another beta release of Crypt::HSXKPasswd
. The fact that the betas are now coming quick and fast is indeed a sign that this code is getting very close to ready for a full release.
This latest series of changes came about because when I started work on a tutorial for using the command line app I realised some changes were needed to give a better user experience.
The headline changes are that you can now specify a dictionary file rather than a dictionary package name if you prefer, you can now specify arguments for the dictionary and RNG packages, and the file format for hsxkpasswdrc
files has been updated to match these changes.
Finally, I’m still looking for help in the following areas:
- Native German, French, Italian, Spanish, Dutch, and Portuguese speakers to sanitise the dictionary files for those languages, leaving only a few thousand common words – these dictionary files are simply too big at the moment, and they must be full of really obscure words to be this large!
- People who are good at technical writing to help me give the documentation some spit and polish. I think all the relevant information is there, and I have run it all though a spell checker, but it could definitely do with some TLC from a copy editor!
Oh, and finally finally, if you find this module useful, please consider donating with the button below – I have literally put hundreds of hours into this code in the last few months, and given it all away for free.
*Download Beta 4 of Crypt::HSXKPasswd
via GitHub*
Jul
13
Announcing Crypt::HSXKPasswd
Beta 3
Filed Under Security, Software Development, Computers & Tech on July 13, 2015 | Leave a Comment
I’ve just released what I hope will be the last beta release before the first stable release of Crypt::HSXKPasswd
. This release has some bug fixes, but is mostly focused on improvements, especially to the new command line interface.
Initially I had planned to make the previous beta the last one before the first stable release, but then I realised that the command line interface really does need support for a configuration file before it’s ready for prime-time, so this beta is focused around the addition of what I am calling hsxkpasswdrc
files.
hsxkpasswdrc
files allow custom presets to be stored for re-use, and for defaults to be set for many of the command line options, making it much easier to customise the command line interface’s behaviour.
By default the command line interface now looks for a hsxkpasswdrc
file at ~/.hsxkpasswdrc
. You can specify a different path with the new --rcfile
option, and you can use the new --test-rcfile
option to help you debug your hsxkpasswdrc
files.
If you have an interest in this module, please install the beta and report any problems you find by opening issues on the project’s GitHub page. Or better still if you’re a developer, fixing the bug and sending me a pull request 🙂
Finally, I’m still looking for help in the following areas:
- Native German, French, Italian, Spanish, Dutch, and Portuguese speakers to sanitise the dictionary files for those languages, leaving only a few thousand common words – these dictionary files are simply too big at the moment, and they must be full of really obscure words to be this large!
- People who are good at technical writing to help me give the documentation some spit and polish. I think all the relevant information is there, and I have run it all though a spell checker, but it could definitely do with some TLC from a copy editor!
Oh, and finally finally, if you find this module useful, please consider donating with the button below – I have literally put hundreds of hours into this code in the last few months, and given it all away for free.
*Download Beta 3 of Crypt::HSXKPasswd
via GitHub*
Jun
8
Announcing Crypt::HSXKPasswd
Beta 2 – now with more command-line!
Filed Under Security, Software Development, Computers & Tech on June 8, 2015 | Leave a Comment
Last night I released what I hope will be the last beta release Crypt::HSXKPasswd
before the first release to CPAN. You can download it from the project’s GitHub page (reminder, you can get installation instructions for the beta releases here).
The head-line change is the addition of a bundled command line app, bringing all the power of Crypt::HSXKPasswd
to the terminal, shell scripts, and indeed programs and scripts written in any language with the ability to shell out.
In terms of lines of code the biggest change is a complete re-write of all data validation code. The project now contains a custom type library which exactly defines what it means to be a word, letter, symbol, symbol alphabet etc.. This has made the code much more robust, and has make it a lot easier to write consistent documentation. The type library is written using Type::Tiny
, and all the custom type definitions contain customised validation error message functions to give users much more helpful feedback.
With the help of Allison Sheridan from the NosillaCast Mac Podcast, the warnings and error messages issued by the module have also become a lot more human-friendly.
The test suite has also been greatly expanded, making it easier to find and fix bugs going forward.
If you have an interest in this module, please install the beta and report any problems you find by opening issues on the project’s GitHub page. Or better still if you’re a developer, fixing the bug and sending me a pull request 🙂
Finally, I’m looking for help in the following areas:
- Native German, French, Italian, Spanish, Dutch, and Portuguese speakers to sanitise the dictionary files for those languages, leaving only a few thousand common words – these dictionary files are simply too big at the moment, and they must be full of really obscure words to be this large!
- People who are good at technical writing to help me give the documentation some spit and polish. I think all the relevant information is there, and I have run it all though a spell checker, but it could definitely do with some TLC from a copy editor!
Oh, and finally finally, if you find this module useful, please consider donating with the button below – I have literally put hundreds of hours into this code in the last few months, and given it all away for free.
*Download Beta 2 of Crypt::HSXKPasswd
via GitHub*
May
28
Getting Started with Crypt::HSXKPasswd
Filed Under My Projects, Software Development, Computers & Tech on May 28, 2015 | 2 Comments
This is a quick-start guide to using the free and open source Crypt::HSXKPasswd
Perl module for generating secure but memorable passwords.
As I write this post the module is not on CPAN yet, and still in beta form. The module can be downloaded from the project’s GitHub page.
This article assumes you have the module installed – you’ll find installation instructions here.
Before we get stuck into some sample code, let’s first summarise the module’s philosophy.
The module is built around the idea of using common words as a kind of lattice around which to build passwords that are long, have a wide coverage of characters, and yet are still memorable. An ideal HSXKPasswd password will contain a mix of upper and lower case letters, some digits, and some symbols.
The module starts building a password by randomly closing a given number of words from a given dictionary. There can then be an optional number of digits added as pseudo words to the front and/or the back of the initial list of words. Next, a symbol can be used to separate the words, and finally a symbol can be used to pad the front and/or back of the password.
Think of it like this:
correct HORSE BATTERY staple 23 correct HORSE BATTERY staple 45 23*correct*HORSE*BATTERY*staple*45 --23*correct*HORSE*BATTERY*staple*45--