Guest User

CAPTCHA BOT SHIT

a guest
Jul 21st, 2013
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.88 KB | None | 0 0
  1.             try
  2.             {
  3.                 String getPublicKey = "\"([^\"]+)\",\"captchaContainer";
  4.                 String getChallenge = "challenge : '([^']+)',";
  5.                 String baseURL = "http://www.google.com/recaptcha/api/image?c=";
  6.                 String backupOption = "\"((http)?s?(://)?(www\\.)?google\\.com/recaptcha/[^\"]+)\"";
  7.                 //Obviously, we don't HAVE to create those strings, but just for the sake of making the code cleaner, I made them here.
  8.                
  9.                 WebClient temp = new WebClient();
  10.                 //WebClient FTW
  11.  
  12.                 String tempSource = temp.DownloadString(textBox1.Text);
  13.                 //Used in case the google image is actually just lying there in the source
  14.  
  15.                 String publicKey = Regex.Match(tempSource, getPublicKey).Groups[1].Value;
  16.                 //We need the public key to get the image of the captcha
  17.  
  18.                 if(String.IsNullOrEmpty(publicKey)){
  19.                     //If we don't have a public key (probably because they're already showing the image in the source), just try to find the image
  20.                     pictureBox1.ImageLocation = Regex.Match(tempSource, backupOption).Groups[1].ToString();
  21.                 }else{
  22.                     String url = String.Format("{0}{1}", baseURL, Regex.Match(temp.DownloadString(String.Format("http://www.google.com/recaptcha/api/challenge?k={0}", publicKey)), getChallenge).Groups[1].ToString());
  23.                     //Now we need the challenge key USING the public key
  24.                     //God google, wai you gotta complicate my life?
  25.  
  26.                     pictureBox1.ImageLocation = url;
  27.                     //Ta-MOTHERFUCKING-DA
  28.                 }
  29.  
  30.             }
  31.             catch (Exception)
  32.             {
  33.                 MessageBox.Show("An error has occured, but I was too lazy to tell you what it is.");
  34.             }
Advertisement
Add Comment
Please, Sign In to add comment