Responding to CAPTCHA Challenges on non-GUI Systems
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.
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.
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:
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.
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.