Author Archives: Simon Aldrich

Changing Pageant’s default behaviour

As a Unix developer, I spend most of my working day with lots of terminals open to various Linux & Solaris development or test servers

For many years I’ve used the excellent PuTTY by Simon Tatham for all my SSH’ing needs. In addition to PuTTY, I also use Pageant to make launching new terminal sessions as easy as right clicking an icon in the system-tray and choosing the machine.

The one complaint that I have with Pageant is its default double-click behaviour. My typical use case for Pageant is:

  • I start Pageant when logging into Windows and automatically load my SSH key (by supplying the filename of the private-key file as a command-line argument to Pageant).
  • I mostly launch previously saved PuTTY sessions from Pageant’s “Saved Sessions” menu.
  • Occasionally (once or twice a day) I’ll need to launch a PuTTY session to a machine which isn’t in my “Saved Sessions” (usually because saving them all would make the “Saved Sessions” menu overly long).

Pageant’s default behaviour when double-clicking the tray icon is to launch the “View Keys” dialog. What I’d really like it to do is to launch PuTTY (i.e.: what the “New Session” menu item does).

Thankfully Pageant (indeed all of the PuTTY suite) is open-source so it was relatively straightforward to download the source, make my simple change and recompile Pageant.

In case anyone else shares my use case I’m making this modified Pageant available:

Pageant

You can also download a patch file containing these changes which can be applied to Pageant v0.62 here.

App Idea : SMS Spam Reporter

I’m probably not alone in getting quite a few “spam” SMS messages on my phone. Lately they’ve all been about PPI mis-selling but in the past they’ve been about dodgy loans, accident claims etc etc

Unfortunately all these messages come from mobiles that have been bought to bulk-send SMS spam and aren’t registered or legislated for in any way. The only recourse that you might possibly have against these are to report the text to your mobile phone operator in the hope that they will block that number so that others aren’t inconvenienced.

You obviously need to include the sender’s number when forwarding the spam text to 7226 or (87226 if you’re on Vodafone). On my phone, the ‘forward’ function doesn’t do this automatically. So here’s my great app idea:

  • You set up a “blacklist” of words that usually appear in spam texts (e.g.: “PPI”, “claim” etc)
  • When your phone receives a text with one of the blacklisted words it automatically pops up a dialog which shows you the text and asks you if you’d like to report it as spam.
  • The app edits the text to include the original sender’s number and automatically forwards it to your operator’s SMS spam reporting number.
  • The app then deletes the text from your text inbox.

It doesn’t sound too hard does it? It might even result in these spam merchants getting their comeuppance. So why can’t I find an app that will do this? All the anti-spam apps I can find want to filter messages out of my inbox and become my messaging app. I don’t want that, I just want to report these sons of guns.

If I get a bit of free time this will be my first Android app (unless someone else makes it first).

Listing recovery and source files using par2cmdline

I use the parchive command-line utility par2 quite a lot. In order to improve its scriptability I found that I needed to have the ability to list the recovery (*.par2) and source files (the files verified or repaired using the recovery data) associated with a master PAR2 file.

Admittedly I could have scraped the output from par2 -r <somefile.par2> but as it does some progress-percentage type output to the console I thought it might be cleaner to patch the par2 command to add a -list option.

Here’s how to download, patch & compile the par2cmdline v0.4 package to get these changes for yourself. These instructions are specifically for Ubuntu 10.04 (Lucid Lynx) but will probably work on any recent(ish) Ubuntu (or indeed Debian) install.

Optional step; if you’ve already installed par2cmdline via apt-get you’ll probably want to remove it with:

sudo apt-get remove par2
  1. Download the source of par2cmdline v0.4 from here (hint: you want par2cmdline-0.4.tar.gz).
  2. Untar the archive, this will create a par2cmdline-0.4 directory with the source in.
  3. If you’ve got gcc version 4 on your machine (you probably have) you’ll need to apply this patch to the source directory.
  4. Download and apply my patch to the source directory.
  5. Configure, compile and install.

Or, if you’re too busy and|or lazy to follow that, just paste the following into your console:

wget -O "par2cmdline-0.4.tar.gz" "http://downloads.sourceforge.net/project/parchive/par2cmdline/0.4/par2cmdline-0.4.tar.gz?r=&ts=1351786076&use_mirror=switch"
tar -xvzf par2cmdline-0.4.tar.gz
wget "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/par2cmdline/files/par2cmdline-0.4-gcc4.patch"
patch -p0 < par2cmdline-0.4-gcc4.patch
wget "http://simon.aldrich.eu/download/par2cmdline/par2cmdline-0.4-list.patch"
patch -p0 < par2cmdline-0.4-list.patch
cd par2cmdline-0.4/
./configure
make
sudo make install

If all goes well you’ll end up with a par2 command with the following new options:

Usage:

  par2 c(reate) [options]  [files] : Create PAR2 files
  par2 v(erify) [options]  [files] : Verify files using PAR2 file
  par2 r(epair) [options]  [files] : Repair files using PAR2 files
  par2 l(ist)   [options]  [files] : List files using PAR2 files

You may also leave out the "c", "v", and "r" commands by using "parcreate",
"par2verify", or "par2repair" instead.

Options:

  -b  : Set the Block-Count
  -s  : Set the Block-Size (Don't use both -b and -s)
  -r  : Level of Redundancy (%%)
  -c  : Recovery block count (Don't use both -r and -c)
  -f  : First Recovery-Block-Number
  -u     : Uniform recovery file sizes
  -l     : Limit size of recovery files (Don't use both -u and -l)
  -n  : Number of recovery files (Don't use both -n and -l)
  -m  : Memory (in MB) to use
  -v [-v]: Be more verbose
  -q [-q]: Be more quiet (-q -q gives silence)
  -e     : List only recovery files
  -o     : List only source files
  --     : Treat all remaining CommandLine as filenames

The -l command will by default list both the recovery & source files. Use the -e and -o options to restrict listing to one or the other of these file types.

By my own admission this patch is pretty rough and ready (it doesn’t handle PAR v1 files for example) but I hope it’s of use to someone.