Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Type type_rucaptcha = AppDomain.CurrentDomain.GetAssemblies().First(x => x.FullName.IndexOf("Rucaptcha", StringComparison.OrdinalIgnoreCase) != -1).GetType("ZennoLab.RuCaptcha.RuCaptchaConfigurator");
- string rucaptcha_key = project.Variables["captchakey"].Value;
- string site_key = project.Variables["sitekey"].Value ;
- if (site_key == string.Empty)
- throw new Exception("google key не найден, задайте его вручную");
- string domen = project.Variables["url"].Value;
- System.Net.HttpWebRequest post_rucaptcha = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(project.Variables["captchaip"].Value+"/in.php");
- post_rucaptcha.Proxy = null;
- post_rucaptcha.AllowAutoRedirect = false;
- post_rucaptcha.ContentType = @"multipart/form-data; boundary=--8d373f8bt2f4cf3";
- post_rucaptcha.Method = "POST";
- post_rucaptcha.ServicePoint.Expect100Continue = false;
- post_rucaptcha.Timeout = 30000;
- string content = string.Format(@"----8d373f8bt2f4cf3
- Content-Disposition: form-data; name=""method""
- userrecaptcha
- ----8d373f8bt2f4cf3
- Content-Disposition: form-data; name=""soft_id""
- 1313
- ----8d373f8bt2f4cf3
- Content-Disposition: form-data; name=""key""
- " + rucaptcha_key + @"
- ----8d373f8bt2f4cf3
- Content-Disposition: form-data; name=""googlekey""
- " + site_key + @"
- ----8d373f8bt2f4cf3
- Content-Disposition: form-data; name=""proxy""
- ----8d373f8bt2f4cf3
- Content-Disposition: form-data; name=""pageurl""
- " + domen + @"
- ----8d373f8bt2f4cf3--");
- using (Stream reqStream = post_rucaptcha.GetRequestStream())
- using (StreamWriter sw = new StreamWriter(reqStream))
- sw.Write(content);
- string url_get;
- using (System.Net.WebResponse resp = post_rucaptcha.GetResponse())
- using (Stream respStream = resp.GetResponseStream())
- using (StreamReader sr = new StreamReader(respStream))
- {
- string resp_answer = sr.ReadToEnd();
- if (!resp_answer.Contains("OK|"))
- throw new Exception(resp_answer);
- url_get =project.Variables["captchaip"].Value+"/res.php?key=" + rucaptcha_key + @"&action=get&id=" + resp_answer.Split('|')[1];
- }
- Thread.Sleep(10000);
- for (int z = 0; ;z++)
- {
- System.Net.HttpWebRequest get_rucaptcha = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url_get);
- get_rucaptcha.Method = "GET";
- get_rucaptcha.Timeout = 30000;
- get_rucaptcha.Proxy = null;
- get_rucaptcha.AllowAutoRedirect = false;
- post_rucaptcha.ServicePoint.Expect100Continue = false;
- string response;
- using (System.Net.WebResponse resp = get_rucaptcha.GetResponse())
- using (Stream respStream = resp.GetResponseStream())
- using (StreamReader sr = new StreamReader(respStream))
- response = sr.ReadToEnd();
- if (response.Contains("OK|"))
- {
- project.Variables["token"].Value = response.Split('|')[1];
- break;
- }
- else if ((response != "CAPCHA_NOT_READY" && response != string.Empty) || z > 35)
- throw new Exception("не удалось решить рекапчу, ответ от сервиса: " + response);
- else
- Thread.Sleep(7000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement