PuTTY-url 0.63

I just released PuTTY-url based on PuTTY 0.63. PuTTY-url is a patch that adds support for clickable URLs to PuTTY.

You can download it from http://ryara.net/putty-url/.

Make sure to update, since PuTTY 0.63 includes fixes for four security issues. See the PuTTY web site for more information.

Upgrading firmware on the Linksys SRW2024 without using the web interface

This is useful if, for example, the web interface keeps resetting the connections.

Upgrading the firmware requires first updating the boot code, and the regular console in the earlier firware doesn’t have support for flashing the boot code. However, there is a hidden IOS-like cli available, that makes it possible to upgrade the boot code over tftp. An additional benefit is that it is much faster than using xmodem.

The steps

  1. Setup a tftp server on your machine, serving the files srw2024_16_boot-101.rfb and ls20xx-12230.ros (download from Cisco)
  2. Connect your computer to the switch using ethernet and serial cables.
  3. Boot the switch.
  4. Log into the console.
  5. Press C-z.
  6. On the new promt, type lcli and press enter.
  7. To upgrade the boot code, type copy tftp:///srw2024_16_boot-101.rfb boot
  8. Then upgrade the firmware: copy tftp:///ls20xx-12230.ros image
  9. Lastly, restart the switch: reload

That’s it.

As an aside, please note that the web interface only works in Internet Explorer, so if it seems like it doesn’t work, it’s probably because your’re using another browser.

D-Link DGS-3024 password reset

The DGS-3024 does not have a built-in reset function that resets the password, but here’s how you can do it (without contacting the D-Link support).

First, you need to reset the switch to its default settings. This will not touch the user accounts on the switch. It will, however, reset other settings, most importantly the IP address to the defaults ( To reset to default settings, boot the switch and wait until

  Please wait, loading runtime image ...................... XX%

is displayed on the serial console, then press Shift-3. After that, press y when asked if you want to load the default configuration.

Note: If you press Shift-3 earlier (during the power on self test), you will just be able to flash the switch, or change the flashing settings.

After that, connect the switch to a computer (using an ethernet cable) and assign it an IP address in the appropriate range (e.g.

Secondly, you will need to setup a TFTP server, and in its root put a file named ‘pw.cfg’ containing:

create account admin someuser

where someuser is the user you want to create, and pass is the password you want for that user. If you use a username that already exists, it won’t work (unless you first delete that user).

Third, you will need to download the MIBs for the DGS-3024 (available here), and unpack them.

Then, use SNMP commands to make the switch download and execute the file you created earlier:

# File type (switch configuration)
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private i 3 

# Type of transfer (?)
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private i 2 

# Filename
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private s pw.cfg 

# Transfer direction (download)
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private i 3 

# TFTP server IP (the one you set earlier)
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private a

# Start the transfer
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private i 3

After running these commands you should immediately be able to login to the switch (using serial or telnet) using the username and password you specified earlier.

Thanks goes to this blog post (in russian), that helped me figure out how to reset the password.

PuTTY 0.61 with clickable links

The patch now has a web site at http://ryara.net/putty-url/, where all future updates will be posted.

Since PuTTY tray (which I have been using for this functionality so far) has been discontinued, I decided to port its clickable link functionality to PuTTY 0.61 myself.

For some reason the code (which originally comes from Nutty) was written in C++ while PuTTY is written in C, so I rewrote the C++ parts in C at the same time. This means it should be at least a little bit closer to a possible inclusion in PuTTY.

What I’ve done:

  • Ported C++ parts to C
  • Launching the URL now uses ShellExecute directly, meaning any type of URL should work (e.g. spotify) when using an appropriate regex.
  • Set default font to Consolas and enable ClearType on Vista and later (kept from PuTTY Tray)
  • Change icons to the ones from PuTTY Tray (I like them better)
  • Patch the build Recipe so that you can make a patched build using PuTTY’s build system
  • Bugfix: Clicking a wrapped link with the window scrolled up should now work as expected

To build it yourself (using mingw on linux):

  1. Download the PuTTY source and the patch
  2. Unpack the source and apply the patch: tar xzf putty-0.61.tar.gz; cd putty-0.61; patch -p1 < ../putty-tobbez-0.61-r1.patch
  3. Drop the replacement icons into the windows/ subdirectory if you want them.
  4. Generate build files: ./mkfiles.pl
  5. Export the TOOLPATH variable so that the variables CC and RC in windows/Makefile.cyg to point to your tools (for me it was export TOOLPATH="i686-mingw32-")
  6. Build it: cd windows; make -f Makefile.cyg
  7. The executable has been created in the same folder.

Executable: putty.exe (Only if you trust me)
Patch: putty-tobbez-0.61-r1.patch putty-tobbez-0.61.patch
Icons: putty.ico, puttycfg.ico

Patch for FiSH for irssi with recode

This patch fixes a buffer overflow (causing a segfault) that would happen if an ISO-8859-1 client sent a string consisting of many instances of a single extended character (å, ä, ö etc).

The patch is against FiSH v1.0-RC5, and is only relevant if you use the recode support in FiSH.

The side effect of this patch is that lines that would previously make irssi segfault will now be cut off (due to limits with the structure of irssi modules).

You can download the patch here: FiSH-irssi.v1.00-RC5-recode-segfault-fix.patch


I though I would post this piece of code since it has been laying around for quite a while.

ld-preload-reverse is a LD_PRELOAD library that overrides the most common
functions for writing text to a terminal, and reverses their output:

Looks like this:

tobbez@sagiri ~/dev/ld-preload-reverse $ LD_PRELOAD=./ld-preload-reverse.so bash
$ esrever-daolerp-dl/ved/~ irigas@zebbotls
GNIYPOC elifekaM EMDAER c.esrever-daolerp-dl os.esrever-daolerp-dl
$ esrever-daolerp-dl/ved/~ irigas@zebbotcat Ma elifek
os.esrever-daolerp-dl :lla

c.esrever-daolerp-dl :os.esrever-daolerp-dl
c.esrever-daolerp-dl os.esrever-daolerp-dl o- derahs- CIPf- ldl- llaW- ccg

:naelc YNOHP.
os.esrever-daolerp-dl f- mr
$ esrever-daolerp-dl/ved/~ irigas@zebbottixe

It’s licensed under the Eiffel Forum License 2, and you can find the code here.

lighttpd rewrite rules for Symphony CMS

For Symphony 2.0.6.

url.rewrite-once += ( "^/symphony/favicon.ico$" => "$0",
                      "^/symphony/symphony/(assets|content|lib|template)/.*$" => "$0",
                      "^/symphony/workspace/[^/]+/.*$" => "$0",
                      "^/symphony/image/(.+\.(jpg|gif|jpeg|png|bmp))$" => "/symphony/extensions/jit_image_manipulation/lib/image.php?param=$1",
                      "^/symphony/symphony/?(\?(.*))?$" => "/symphony/index.php?mode=administration&$2",
                      "^/symphony/symphony(/(.*/?))?(\?(.*))?$" => "/symphony/index.php?symphony-page=$1&mode=administration&$4",
                      "^/symphony/([^?]*/?)(\?(.*))?$" => "/symphony/index.php?symphony-page=$1&$3" )

Replace the first occurrence of ‘symphony’ on every line with the location of your Symphony installation.