4

I want to write a perl script to auto login a website and do some interesting things. The problem is that the website which I want to log into has a captcha image. I don't have the ability to anticaptcha it, so I need to read the image then display the image to the user to let the user reads the characters on the image, then type the character in the command line back to the program. I want to know, what is the easiest way to display an image to the user?

Thanks.

Just a learner
  • 26,690
  • 50
  • 155
  • 234

2 Answers2

9

Firstly you can use LWP::Simple to fetch the image and save it to disk.

Afterwards , the simplest thing on Windows is to do

  system("C:\\imagepath\\foo.jpg");

which will show the image in the default application that is used to display it.

On OS X you can do

 system("open ~/imagepath/foo.jpg");

On freedesktop.org standard compliant systems you can do

 system("xdg-open ~/imagepath/foo.jpg");

These involve switching between a command line app and the OS designated application to view the image. If you want it more seamless you can use a Perl GUI library and create a window with downloaded image

Community
  • 1
  • 1
parapura rajkumar
  • 24,045
  • 1
  • 55
  • 85
  • `orz` Sorry for the botched edit, I did not notice that we overlapped in time. – daxim Jan 17 '12 at 15:23
  • 1
    Joel, I don't particularly care for such parochialisms. We have a [standard](http://portland.freedesktop.org) that universally applies to modern desktops building on X, mkay? – daxim Jan 17 '12 at 17:26
1

Open in a web page?

Create your application as a web application an simply download the image with LWP then display it in your page (CGI or Dancer, etc.)

You could put a simple text form that let you enter the code.

user1126070
  • 5,059
  • 1
  • 16
  • 15