[TuT] Yahoo Captcha

Posts 115 of 37 · Page 1 of 3
[TuT] Yahoo Captcha
Response to grabbing a Yahoo Captcha even though Yahoo seems to block you from grabbing it with DOM and other methods

TUT [Grabbing Yahoo Captcha]

As Always open VB.net and follow along

What you will need to add to your form.

1 TextBox
1 Button
2 Web Browsers

Oh yeah....PictureBox (thanks LOLland)

In the Button-Click Event we add this code

Code:
        Dim captcha1 As HtmlElement
        captcha1 = WebBrowser1.Document.GetElementById("cimg")
        Dim path As String = captcha1.GetAttribute("src")
        TextBox1.Text = path
        Dim TextFile As New StreamWriter("test.html")
        TextFile.WriteLine("<img src=" & TextBox1.Text & "id" & "=" & "cimg" & " >")
        TextFile.Close()
        WebBrowser2.Navigate("/test.html")
        Dim captcha2 As HtmlElement
        captcha2 = WebBrowser1.Document.GetElementById("cimg")
        Dim path2 As String = captcha2.GetAttribute("src")
        PictureBox1.ImageLocation = path2
What this code does is a concept of thinking outside the box.

It first fetches the URL of the Image location, places it into a a text box, then creates (on the fly) a one page website called Test.html, in this website is one image, the image is the captcha

Thats this part of the code TextFile.WriteLine("<img src=" & TextBox1.Text & "id" & "=" & "cimg" & " >")

Then instead of fetching the captcha from yahoo (because it's blocked)
It fetches it loads your newly created website and loads it's image into the picture box, which happens to be the same as the captcha on yahoo's sign up page.

To make this work for you keep the concept the same, set webbrowser2 visibility to false and modify the code to work in your application (instead of that happening on button 1 , it happens whenever you need it to , have fun)

Hope this helps



This method will work (should) with any other website preventing you from displaying the captcha, all you need is the ID of the captcha
wow excellent.
the only thing i dont get is the test.html.
wat exactly does it do.
i still dont understand it.
Test.Html houses the image for you to grab it,

yahoo won't let you grab the image, so we on the fly (programaticlly) Create a website that has nothing in it but the current captcha , and then the picture box = that image, because yahoo can't block you from grabbing an image off your own site
You forgot to say that you need a picturebox

Good thinking outside the box.
Quote Originally Posted by Lolland View Post
You forgot to say that you need a picturebox

Good thinking outside the box.
Added and thanks, Im crazy that way
one more question. wats the point of two webbrowsers?
streamwriter is not defined.
on this line
Code:
captcha1 = WebBrowser1.Document.GetElementById("cimg")
i get a A first chance exception of type 'System.*********enceException'
In the namespace

Code:
Imports System.IO
yah i already imported System.IO
it debugs fine but when i click on that button that null error occurs.
PM me your code, I will look at it, you have to be missing something.

I tested this and it works fine
Got it, Is this code complete?

Problem 1:

i don't See what triggers timer2 which handles the captcha code.
What Triggers Timer2?
@NextGen1
yes it is complete. it didnt work in a button so i tried it with a timer. both didnt work..

btw can u send me the source just for the captcha. thanks.
Ill just send you my test project , I tested it in a button with your code and it worked fine, but try and manipulate my code to work with yours, or take my application and add the rest of your code to it (if mine works on your machine that is)

Okay

Virus Scan


ScreenShot


File Attached:
(Hope all works well)
testcaptcha.rarattachment deleted · 62 downloads before removal
Posts 115 of 37 · Page 1 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?