VB.NET ~ Are captcha's possible with webclient?

simpleonline12

New member
Sep 29, 2009
191
3
0
I am looking into getting away from using the web browser component to create applications but one of the good things about the web browser component was that it could use Javascript to pull a captcha into a picturebox for the user to solve.

I am moving on to using the webclient but I'm not sure if the webclient would be able to download a captcha picture into a picturebox for the user to solve.
 


Yes, you are able to do that. Use an Image Object as an interface between the webclient and the picturebox.

//Edit: It's even easier then that...

Code:
Dim MyWebClient As New System.Net.WebClient
Dim ImageInBytes() As Byte = MyWebClient.DownloadData(TextBox1.Text)
Dim ImageStream As New IO.MemoryStream(ImageInBytes)
PictureBox1.Image = New System.Drawing.Bitmap(ImageStream)
 
Cool beans...thank you...you da man....

**Edit - this would be something like a standard picture from the internet right? I know a captcha is much more complex than using a standard url to download the captcha into the picturebox..for instance...if I wanted to download a picture from Google Images I would just put the URL of the image into the textbox and it would download the image and put the source into the picturebox...that is the easy part.

Captcha is javascript ran so it isn't something that you can grab via url....it's generated on the fly and trying to grab an instance will only give you the previous captcha image because it refreshes when you try to navigate to the url again to enter your inputs.

Not sure if I'm right on this but from memory I believe this was the reason that I chose to go with the web browser component the first time around.
 
Hey simpleonline,

downloading images from Google is just like downloading Captcha since those are images too... :)

However, you're right - downloading captcha could be a bit tricky. It depends on the captcha provider.. For example, if you want to download a captcha which is provided by reCaptcha then you should do something like this:

1. Scrape reCaptcha Public Key (Website)
2. Get reCaptcha Challenge Key by using the Public Key (API)
3. Download Image by using Challenge Key (API)

That's basically it ... :)
 
  • Like
Reactions: simpleonline12
How to you scrape the reCaptcha public key? I found the Google site where you can enter the domain name to generate the public key but this is different than the numbers that I find if I use Firebug on the Captcha image.

The firebug version gives me what looks like 50 bit number and the Google public key when entering the domain only gives me around 15.

I found that I can scrape the exact image by just grabbing the entire key given from firebug but I don't think that was what you were referring to...know of any handy tutorials around that would describe what your talking about in more detail? I know I'm a pain the ass.

Thanks
 
The reCaptcha Public Key could be something like that:

Code:
6LfwKQQAAAAAAPFCNozXDIaf8GobTb7LCKQw54EA