Jump to content

cbox


Recommended Posts

Posted

I went through about a week of making bots, and when you make a bot you have to be able to download the image from the CAPTCHA (or in this case ReCaptcha) so you can display it to the user to be entered, or send it to decaptcher for them to crack it.

 

If you don't understand what that meant, this tutorial isn't for you. I'm just going to walk through how to pull the image from the ReCaptcha field. This tutorial assumes you have a hidden web browser in which you are using to navigate some page. This is assuming the basic GetElementByID doesn't work, since its generated dynamically per pageload.

 

code2.png

 

 

This is our code.

 

Were using a foreach loop to go through every image in the Webbrowser

foreach (HtmlElement images in webBrowser1.Document.Images)

 

Now were doing a quick if statement to see if that image path has the URL of the recaptcha in it.

if (images.GetAttribute("src").Contains("http://api.recaptcha.net/image?c="))

 

GetAttribute allows you to lots of things with a specific HTMLElement (in this case images)

 

If it matches a simple line will dump that URL to an imagebox.

string url = images.GetAttribute("src");

 

Then dump the variable url to your imagebox. Ignore the code tCount++; in there, it was part of that application.

 

So it starts as a picture box.

precap.png

Assuming you grabbed the URL of the image correctly, it should show the image like so.

postcap.png

  • Like 2
  • 4 months later...
Posted

First of all , thanks for this good Method iBotPeaches , but what about if i am not using the web browser and requesting the register page with http web request how i can fetch the recaptcha image, tried to generate it with the site key but alwayz the response come back with : " Sorry but your captcha input was not correct. hope you can help,

 

Thanks!

Co

Posted

I don't know how you navigate a httpwebrequest, but if you can do a simple foreach in it to grab the URL of the image box, then you can just declare your streams and grab the image.

 

	HttpWebRequest Request;
	HttpWebResponse Response;

	Request = (HttpWebRequest)System.Net.WebRequest.Create(URL);

	Response = (HttpWebResponse)(WebResponse)Request.GetResponse();

	return System.Drawing.Image.FromStream(Response.GetResponseStream());

  • 1 month later...
Posted (edited)

I was talking about your first post. Maybe i am doing something wrong ( im still learning all that c# stuff)

 

but tried like this

 

 

           foreach (HtmlElement images in webBrowser1.Document.Images)
           {
               if (images.GetAttribute("src").Contains("http://api.recaptcha.net/image?c="))
               {
                   string url = images.GetAttribute("src");
                   pictureBox1.ImageLocation = url;
                   break;
               }
           }

 

Picture box stays empty. Not sure what im doing wrong

Edited by derekchrisp
Posted (edited)
I think it's probably because captcha is generated dynamically it's src is not actually in html source. To get captchas location you have to get access to DOM and grab images src from there. Edited by derekchrisp
Posted


                   foreach (HtmlElement images in webBrowser1.Document.Images)
                   {
                       if (images.GetAttribute("src").Contains("http://api.recaptcha.net/image?c="))
                       {
                           string url = images.GetAttribute("src");
                           title = webBrowser1.Document.Title;
                           capImage.ImageLocation = url;
                           break;
                       }
                   }

 

Just tested this code and the recaptcha popped up. So it still works this way. Add me on MSN (ibotpeaches@ibotmodz.net), and I'll try and see whats up.

Posted (edited)

So ok i tested following tell me what a heck im doing wrong like i said im really new with this so it makes me bit headache :)

 

Testing with mixx registration page https://www.mixx.com/register

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace test2
{
   public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();
       }

       private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
       {
           foreach (HtmlElement images in webBrowser1.Document.Images)
           {
               if (images.GetAttribute("src").Contains("http://api.recaptcha.net/image?c="))
               {
                   string url = images.GetAttribute("src");
                   pictureBox1.ImageLocation = url;
                   break;
               }
           }
       }

       private void goButton_Click(object sender, EventArgs e)
       {
           webBrowser1.Navigate(txtUrl.Text);
       }

       private void pictureBox1_Click(object sender, EventArgs e)
       {

       }

       private void txtUrl_TextChanged_1(object sender, EventArgs e)
       {

       }
   }
}

Edited by derekchrisp
Posted

o, that site is using the recaptcha in an iframe, and it uses this url instead of the other one.

 

https://api-secure.recaptcha.net/noscript?k=6LesGQMAAAAAAF0BRs_lsPUkSrYZ-qcgqgoiR-Mv

 

Probably would take 10 minutes to adapt my script to make it work, so just catch me on MSN and I'll see if I can get yours working.

Posted (edited)

I can easily crack it through noscript solution with php . Thats not problem . But im trying to do it without noscript. Let's take Twitter

. As you can see they don't offer noscript access so this is what makes me some headache.

Hey i added you in msn im kaidoristm@

Edited by derekchrisp
  • 6 months later...
Posted

I need some help with the captcha's

 

How would i make the application re-grab the captcha if the page is refreshed?

 

Also, it seems like my app doesn't grab the captcha if my bot's forms are filled.

 

Like, my bot has textboxes that submit a form on a webpage. If my bot's textboxes are filled and sent to the webpage, it won't grab the captcha, however if the boxes are left empty, the captcha is grabbed.

 

Any help would be awesome!

 

 

--decrypT

Posted

 

How would i make the application re-grab the captcha if the page is refreshed?

 

Use the webbrowser event of like doneLoading, so anytime it is refreshed and re-loaded that portion of code will be re-ran so you then can call your reCaptcha code or just include it in there.

 

Like, my bot has textboxes that submit a form on a webpage. If my bot's textboxes are filled and sent to the webpage, it won't grab the captcha, however if the boxes are left empty, the captcha is grabbed.

 

Does your bot use getElementByID? I think it conflicts somewhere and there is one variable you have to re-init, but I can't remember why or which one.

Posted (edited)

Use the webbrowser event of like doneLoading, so anytime it is refreshed and re-loaded that portion of code will be re-ran so you then can call your reCaptcha code or just include it in there.

 

 

 

Does your bot use getElementByID? I think it conflicts somewhere and there is one variable you have to re-init, but I can't remember why or which one.

 

Yes, it uses getelementbyid and by name. Also, the doneLoading event, is that just like.

 

if(webBrowser1.doneLoading)

{

Code for regrabbing the catpcha

}

?

 

Thanks for the reply.

Edited by decrypT
Posted

http://i35.tinypic.com/20uy4bp.png

 

  • Click on your webBrowser (If its a hidden one select it from the dropdown)
  • Click the lightning bolt to bring up events
  • Double click on DocumentCompleted
  • That will move to your code and form the function

Looks like this.

 

http://i38.tinypic.com/5bnwx5.png

 

 

You cannot just type that out, you gotta do all the steps to insure the handler picks up the event.

Posted (edited)

http://i35.tinypic.com/20uy4bp.png

 

  • Click on your webBrowser (If its a hidden one select it from the dropdown)
  • Click the lightning bolt to bring up events
  • Double click on DocumentCompleted
  • That will move to your code and form the function

Looks like this.

 

http://i38.tinypic.com/5bnwx5.png

 

 

You cannot just type that out, you gotta do all the steps to insure the handler picks up the event.

 

yeah i threw the getelements/names in that document completed method.

 

webBrowser1.GetElementById("ID HERE").SetAttribute("value", fdsfs.Text);

 

But i was wondering how i could reload the captcha after each entry. Using an if loop i guess.

Edited by decrypT
  • 2 years later...
Posted (edited)

My code is not is not working,

 

private void btnKayit_Click(object sender, EventArgs e)
 {
	 webBrowser1.Navigate("http://xpblogger.com/register.php");
 }

foreach (HtmlElement images in webBrowser1.document.Images)
{

if (images.GetAttribute("src").Contains("http://api.recaptcha.net/noscript?k="))
{
string url = images.GetAttribute("src");
pictureBox1.ImageLocation = url;
break;
}
}

 

if (images.GetAttribute("src").Contains("http://api.recaptcha...et/noscript?k=")) type is FALSE

Please help me. Thank you..

Edited by ikizmert
Posted

My code is not is not working,

 

private void btnKayit_Click(object sender, EventArgs e)
 {
	 webBrowser1.Navigate("http://xpblogger.com/register.php");
 }

foreach (HtmlElement images in webBrowser1.document.Images)
{

if (images.GetAttribute("src").Contains("http://api.recaptcha.net/noscript?k="))
{
string url = images.GetAttribute("src");
pictureBox1.ImageLocation = url;
break;
}
}

 

if (images.GetAttribute("src").Contains("http://api.recaptcha...et/noscript?k=")) type is FALSE

Please help me. Thank you..

 

It seems the recaptcha code has changed.

 

		    if (images.GetAttribute("OuterHtml").Contains("http://www.google.com/recaptcha/api/image?"))
		    {
			    string url = images.GetAttribute("OuterHtml");
			    break;
		    }

 

That would work, but then you'll need to create some regex to pull the correct stuff out of that url var. It seems recaptcha is changing, but no offense this topic is like 3 years old.

Posted (edited)

It seems the recaptcha code has changed.

 

		 if (images.GetAttribute("OuterHtml").Contains("http://www.google.com/recaptcha/api/image?"))
		 {
			 string url = images.GetAttribute("OuterHtml");
			 break;
		 }

 

That would work, but then you'll need to create some regex to pull the correct stuff out of that url var. It seems recaptcha is changing, but no offense this topic is like 3 years old.

(images.GetAttribute("OuterHtml").Contains("http://www.google.co...cha/api/image?") = FALSE ; its didnt work.

 

but no offense this topic is like 3 years old. i not knowing im sorry... my english easy, i used google translate :))

Thank you anyway...

Edited by ikizmert

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...