17 June 2008

Linux Journal's Captcha

I forgot to post about this in my last article, I was too focused on my rockbox love. Linux Journal has a very unique captcha. Admittedly, the standard find-the-characters-in-the-distorted-image one can be difficult:



However, Linux Journal's solution is probably not the best. It's a particular annoyance because they require you to preview your comment before posting, which loads a new page, and they don't auto-fill/skip the captcha, so even if you fill out all the fields right you have to do at least two captchas. But that's not the problem, I can live with that, the problem is the captcha is a math question. And because (see myspace.com for corroboration) most people on the internet are stupid, they ask you a low number addition problem. Now, computers may suck at complicated OCR, but one thing they've pretty much got down is addition of single digit numbers.

For an amusing proof of concept, here's a greasemonkey script that will automatically fill in the captcha on any Linux Journal comment page:


// LJ-Captcha
//
// ==UserScript==
// @name LJ-Captcha
// @description Auto-fills the Linux Journal captcha
// @include http://www.linuxjournal.com/comment/reply/*
// ==/UserScript==

nodes = document.getElementsByTagName('span');
for(i in nodes) {
if(nodes[i].className == 'field-prefix') {
mathExpr = nodes[i].innerHTML;
mathRe = /([0-9]+) \+ ([0-9]+) \= /;

first = parseInt(mathExpr.replace(mathRe, "$1"), 10);
second = parseInt(mathExpr.replace(mathRe, "$2"), 10);

document.getElementById('edit-captcha-response').value=(first+second);
}
}

No comments: