1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Tutorial] How to get ReCaptcha image using httpwebrequest

Discussion in 'General Programming Chat' started by Senotaru, Apr 17, 2011.

  1. Senotaru

    Senotaru Registered Member

    Joined:
    Jan 17, 2011
    Messages:
    67
    Likes Received:
    11
    1: Visit the page you wish to use, in this example, the hotmail register page.

    2: Find the page that starts like:
    gethip.srf

    This will give you the "k code". It'll start with k: ____________________

    3: From the same page, you'll want the extra_challenge_params, parse them out

    4: Visit the google reCaptcha page appending the k value and the extra params. It'll look like this:
    Code:
    /recaptcha/api/challenge?k= + kValueHere + "&" + ParamValuesHere
    
    5: parse out the challenge field. This will be used to get the captcha image.
    Code:
    /recaptcha/api/image?c= + challengeField
    6: Bam, we have the photo. To submit the solved data, all you gotta do is:
    Code:
    /recaptcha/api/ajaxverify?c= + challengeField+ "&response=" + solvedcaptcharesponse
    
    This will give you the correct encoded string to append to your post string. Hope this helped one or two of you out there.
     
    • Thanks Thanks x 4
    Last edited: Apr 17, 2011
  2. sweepypanda

    sweepypanda Newbie

    Joined:
    Jul 27, 2010
    Messages:
    20
    Likes Received:
    4
    Pretty common knowledge, regardless here is a method to help you to retrieve the values you need. (k=, c=, etc.)

    Code:
    private static string FindStringBetween(string startToken, string endToken, string stringToSearch)
            {
                var startIndex = stringToSearch.IndexOf(startToken);
                if (startIndex < 0) return string.Empty;
                var endIndex = stringToSearch.IndexOf(endToken, startIndex);
                return stringToSearch.Substring(startIndex, endIndex - startIndex).Replace(startToken, string.Empty);
            }
     
  3. yesrams

    yesrams Regular Member

    Joined:
    Dec 16, 2009
    Messages:
    354
    Likes Received:
    75
    Location:
    @BHW
    Can you please give an example for this.



     
  4. Senotaru

    Senotaru Registered Member

    Joined:
    Jan 17, 2011
    Messages:
    67
    Likes Received:
    11
    Matching items with regex is a bit easier in my opinion. Also, I dont think its quiet common knowledge since the question has popped up a few times in the last month or so.

    Code:
    "(?<=k:\"").*?(?=\"")"
    Code:
    "(?<=extra_challenge_params:\"").*?(?=\"")"
    Code:
    "(?<=challenge : \').*?(?=\')"
     
  5. kelvin.thechamp

    kelvin.thechamp Power Member

    Joined:
    Apr 4, 2011
    Messages:
    643
    Likes Received:
    272
    Occupation:
    Account selling , Creating Multithread Bot's
    Location:
    http://spamvilla.com
    lol seems i rep and thanks little earlier there is no fields called k and something in hotmail page any help please ?
     
    Last edited: Jun 9, 2011