Skip to content
Tags

Responding to CAPTCHA Challenges on non-GUI Systems

by on June 14, 2013

When moving a service that gathers data from a 3rd party system to a hosted non-GUI system (e.g., AWS EC2) you may need to enable access to the 3rd party system from that non-GUI system by responding to a CAPTCHA challenge.

Problem

The problem is that your 3rd party service provider will recognize attempts to log into your account from a new location and may protect your account by presenting a CAPTCHA challenge.

CAPTCHA stands for “Completely Automated Public Turing test to tell Computers and Humans Apart”. Common challenges are images containing blurry letters which can be read by humans but cannot be extracted by today’s image processing algorithms. So there is no way of scripting a response to the challenge. Human interaction is required at some point.

If the shell is all you can use, you can of course access the login page of your 3rd party system, e.g., using wget, but remember that each login request will get a new challenge and will only be granted if the response to the challenge is the right one. So you’ll better use a text browser but then you will still be unable to view the image that you’re supposed to decipher.

Solution

Lynx can be configured to use an external image viewer by editing lynx.cfg. If you don’t find lynx.cfg on your system, just create your own (or download one) and pass it to lynx using the -cfg command line option. On our system, the image viewer xv was configured:

XLOADIMAGE_COMMAND:xv %s

The trick is now to replace xv with a command line tool that helps you to finally see the image. I used scp (using SSH public key authentication) to copy the image file to my local machine so that I was able to use my favorite image viewer to read the text.

You could also print the image or email it to someone who will then read the image’s text aloud when you call him. Anyway, once you got the image to another device, you’re nearly done.

Conclusion

Lynx and scp can be combined to help you to respond to CAPTCHA challenges. The approach outlined here works for graphical challenges but can also be used for auditive challenges as long as there’s any chance to download the audio file or to capture the stream.

From → Tips & Tricks

One Comment
  1. Hello,

    thanks for sharing this tip, but i’m new at this and i didn’t understood how to use it properly.

    I uncommented the “XLOADIMAGE_COMMAND:xv %s” and replace by “XLOADIMAGE_COMMAND:scp /mypath %s” (i’m on debian 7.5 on a server). I don’t know if i did it right and how to use it know. Can you help me please ?

    Thank you,

    hugo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s