SIS and Python for Series 60 (S60)

June 2, 2008 by jonmccune

Make a SIS file from your Python app with Ensymble.

Debugging Javascript in Firefox

May 20, 2008 by jonmccune

I was playing around with PwdHash today, and I realized I couldn’t see the debug output (created with calls to the built-in function “dump()”). This was sufficiently complex to remedy that I’m making a note of it here.

Open a new tab and enter “about:config” for the address. Right click on any of the existing entries and select “New -> Boolean”. Create the following two booleans, set to true:

browser.dom.window.dump.enabled
javascript.options.showInConsole

This ends up putting these two lines into prefs.js, which lives somewhere in your profile directory:

user_pref(”browser.dom.window.dump.enabled”, true);
user_pref(”javascript.options.showInConsole”, true);

Don’t edit that file while Firefox is running or your changes will be overwritten. Also, using this ‘about:config’ method causes your changes to take effect right away, so no need to restart (or lose all your tabs!). This output goes to the unix console (stdout or stderr), so make sure you run your browser from a terminal. The Error Console viewable from the Tools menu displays more sophisticated errors. I’m only interested in printf()-style output for now.

Bluetooth hacking has come a long way

May 19, 2008 by jonmccune

Recently I learned just how much of the Bluetooth protocol is performed by the Bluetooth adapter itself. This was disappointing for me, as I wish to hack about with the relevant encryption and authentication mechanisms. Life is not all bad, however. Cambridge Silicon Radio (CSR) makes some Bluetooth radios that read their firmware from an onboard flash chip, and some enterprising individuals (evilgenius.de, darkircop, PDF slides) have figured out how to extract, disassemble, reassemble (potentially modified), and reprogram these devices.

The motivation for all these people was to create a general-purpose sniffer, enabling creation of bluedrift. I would like to see the creation of some open source firmware for these devices, so I don’t have to bog through disassembled binary to find where to insert my own code. :-)

Also, an interesting paper is Bluesniff: Eve meets Alice and Bluetooth

OpenSSL Vulnerability for Debian

May 16, 2008 by jonmccune

Debian has a wiki page on the OpenSSL key generation vulnerability. To fix your SSH keys:

aptitude update
aptitude dist-upgrade # regular upgrade is not sufficient
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server

If you have any public-key-based authorizations setup, delete the keys and start over.

IMAP over SSL with Dovecot, and mbox vs maildir

May 8, 2008 by jonmccune

I’m playing around with hosting my own little IMAP server to act as the repository in which I put all my old email I’m too stingy to delete. I ended up choosing Dovecot because it seems simplest, and because the only way mail will get into these folders is when I drag it there in my client. `aptitude install dovecot-imapd` did the trick, and even generated SSL certs by default (although they have localhost.localdomain as the machine name, so I will end up changing them).

I ran into one snag: mbox vs maildir. I have some of my really old email sitting in mbox files, so I chose mbox as my default folder format during installation. This turns out to add a few challenges: mbox folders cannot house subfolders. Thus, in Thunderbird, when I create a new folder, it becomes a message-housing entity if I name the new folder with letters and numbers, but it becomes a subfolder-housing entity if I name the new folder with a trailing ‘/’. This took some Google time to figure out.

It’s fine with me if I can’t have messages and subfolders in my own folders, with the exception of the Inbox. CMU apparently uses maildir format and so I’m used to all of my subfolders hanging off of the Inbox. I’m probably going to switch to maildir before I do The Import.

Emacs copy and paste

April 24, 2008 by jonmccune

Today I got sick of not being able to sanely copy and paste between Acrobat Reader and Emacs under Linux (Debian Etch + Gnome). The “automatic-copy” from selecting does not happen when in Acrobat, and the “Ctrl+V” version of paste doesn’t work in Emacs. This means it’s impossible to copy something from Acrobat and paste it in Emacs. My (pathetic) work-around is generally to paste into a draft email in Mozilla Thunderbird since it plays nicely with both types of copy-and-paste. Well, there’s a solution:

Add this to your .emacs:
(setq x-select-enable-clipboard t)

I take it back this doesn’t work consistently either. I hate computers.

Sed (seder’s) grab bag

April 14, 2008 by jonmccune

Today I discovered a very handy collection of sed scripts. I can attest that remccoms3.sed does in fact remove comments from C / C++ (and assembly if you use C-style comments). I used it like this:

cat asm.S | ~/remcoms3.sed | grep -v "^\s*$" | wc -l

to get a count of the number of lines in an assembly program that are not comments or whitespace.

Solar battery chargers

April 13, 2008 by jonmccune

I’m going on a long bike trip (multiple days + camping in between) and I want to charge my GPS device and cell phone using some kind of solar device. I started looking around and found quite a few:

  • Solio has a classic, hybrid, and magnesium edition.
  • Soldius only seems to offer the Soldius 1, but it does not include an integrated battery.
  • Megasol supposedly makes the Solar Energy Pocket Power (SEPP) but their website doesn’t support English.
  • 21st Century Goods has an entire category for solar products.

Libraries with Ocaml

April 3, 2008 by jonmccune

I’ve been trying to learn a little more about Ocaml, since functional programming is so frequently marketed as solving a lot of today’s bad programming practices that lead to vulnerabilities and security problems.

I’ve been going through the Ocaml Tutorial but the instructions for building grtest1.ml were insufficient:

$ ocamlc grtest1.ml -o grtest1
Error while linking grtest1.cmo: Reference to undefined global `Graphics’

I needed to specify the name of the library I’m using:

$ ocamlc graphics.cma grtest1.ml -o grtest1

which on my Mac OS X system comes from /usr/local/lib/ocaml/.

Bulleted lists in text files with Emacs

April 3, 2008 by jonmccune

I often use emacs to keep notes, etc. in plain text files. One
of the formats I frequently use is the equivalent of a bulleted
list. I like to use the “auto-fill-mode” (Meta-q) to format
things nicely. However, my “bullets” (often, hyphens) sometimes
get misinterpreted. One failure mode is where they get treated
like any other character and folded into the paragraph. Another
is that emacs recognizes them as a “prefix” for a paragraph,
applying a bullet to the front of every line, even if one
bulleted item is long enough to wrap onto multiple lines.

Now, I haven’t figured out how to specify which behavior I want
with a command, but I found an explanation of what’s happening here.
Essentially, the first bulleted item needs to be multi-line to
teach emacs that bulleted items can sometimes be multi-line.