[Tutorial] How to get ReCaptcha image using httpwebrequest

Senotaru

Registered Member
Joined
Jan 17, 2011
Messages
67
Reaction score
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.
 
Last edited:
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);
        }
 
Can you please give an example for this.



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.
 
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 : \').*?(?=\')"
 
lol seems i rep and thanks little earlier there is no fields called k and something in hotmail page any help please ?
 
Last edited:
Back
Top