Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 31.50 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Threading;
  10. using System.Net;
  11. using System.IO;
  12. using System.Text.RegularExpressions;
  13. using System.Web;
  14.  
  15. namespace Aeriagames_Bot
  16. {
  17.     public partial class Form1 : Form
  18.     {
  19.         // Range to scan
  20.         List<int> scanRange = new List<int>();
  21.  
  22.         // Usernames to send message
  23.         static public List<string> userNames = new List<string>();
  24.  
  25.         // Accounts+Proxy+Cookies | name - object
  26.         Dictionary<string, SpamAcc> accountDic = new Dictionary<string, SpamAcc>();
  27.  
  28.         // Random
  29.         Random rand = new Random();
  30.  
  31.         // Message info
  32.         static public string subject = "Brak tematu";
  33.         static public string message = "Brak wiadomości";
  34.  
  35.         // Stats
  36.         static public int usernameFound = 0;
  37.         static public int messageSent = 0;
  38.  
  39.         // deathbycaptcha.com
  40.         static public DeathByCaptcha.Client dbcClient = new DeathByCaptcha.SocketClient(String.Empty, String.Empty);
  41.  
  42.         // Stop state
  43.         bool stopState = false;
  44.  
  45.         // use proxy
  46.         bool useProxy = false;
  47.  
  48.         public Form1()
  49.         {
  50.             InitializeComponent();
  51.  
  52.             Thread mainThread = new Thread(new ThreadStart(MainThread));
  53.             mainThread.IsBackground = true;
  54.             mainThread.Start();
  55.         }
  56.  
  57.         private void MainThread()
  58.         {
  59.             while (true)
  60.             {
  61.                 Thread.Sleep(500);
  62.  
  63.                 lock (accountDic)
  64.                 {
  65.                     string accountNameToDelete = null;
  66.                     foreach (SpamAcc account in accountDic.Values)
  67.                     {
  68.                         if (!account.logged)
  69.                         {
  70.                             accountNameToDelete = account.login;
  71.                             break;
  72.                         }
  73.  
  74.                         // Update last error
  75.                         foreach (DataGridViewRow dataGridRow in dataGridView1.Rows)
  76.                         {
  77.                             if (dataGridRow.Cells[0].Value.ToString() == account.login)
  78.                             {
  79.                                 this.dataGridView1.Invoke((MethodInvoker)(() => dataGridRow.Cells[3].Value = account.lastError));
  80.                             }
  81.                         }
  82.                     }
  83.  
  84.                     if (accountNameToDelete != null)
  85.                     {
  86.                         string proxyForNewAcc = accountDic[accountNameToDelete].proxyAddress;
  87.                         accountDic.Remove(accountNameToDelete);
  88.  
  89.                         int rowIndexToDelete = -1;
  90.                         foreach (DataGridViewRow dataGridRow in dataGridView1.Rows)
  91.                         {
  92.                             if (dataGridRow.Cells[0].Value.ToString() == accountNameToDelete)
  93.                             {
  94.                                 rowIndexToDelete = dataGridRow.Index;
  95.                             }
  96.                         }
  97.  
  98.                         if (rowIndexToDelete > -1)
  99.                         {
  100.                             this.dataGridView1.Invoke((MethodInvoker)(() => this.dataGridView1.Rows.RemoveAt(rowIndexToDelete)));
  101.  
  102.                             // Get new account pass
  103.                             try
  104.                             {
  105.                                 // Get password/login
  106.                                 string othersAccounts = null;
  107.                                 using (StreamReader streamReader = new StreamReader("accounts.TXT"))
  108.                                 {
  109.                                     int tries = 0;
  110.                                     while (++tries < 4)
  111.                                     {
  112.                                         string accInfo = streamReader.ReadLine();
  113.                                         if (accInfo == null) { break; }
  114.  
  115.                                         string accName = accInfo.Split(':')[0];
  116.                                         string password = accInfo.Split(':')[1];
  117.  
  118.                                         if (CreateNewAccount(accName, password, proxyForNewAcc))
  119.                                         {
  120.                                             this.AddNewAccount(accName, password, proxyForNewAcc);
  121.                                             break;
  122.                                         }
  123.                                     }
  124.  
  125.                                     othersAccounts = streamReader.ReadToEnd();
  126.                                 }
  127.  
  128.                                 if (othersAccounts != null)
  129.                                 {
  130.                                     using (StreamWriter streamWriter = new StreamWriter("accounts.TXT"))
  131.                                         streamWriter.Write(othersAccounts);
  132.                                 }
  133.                             }
  134.                             catch { }
  135.                         }
  136.                     }
  137.                 }
  138.  
  139.                 try
  140.                 {
  141.                     this.Invoke((MethodInvoker)(() => this.toolStripStatusLabel2.Text = usernameFound.ToString()));
  142.                     this.Invoke((MethodInvoker)(() => this.toolStripStatusLabel3.Text = messageSent.ToString()));
  143.                     this.Invoke((MethodInvoker)(() => this.toolStripStatusLabel7.Text = ProxyFactory.workingProxyDic.Count.ToString()));
  144.                 }
  145.                 catch { }
  146.             }
  147.         }
  148.  
  149.         private void toolStripButton1_Click(object sender, EventArgs e)
  150.         {
  151.             toolStripButton1.Enabled = false;
  152.  
  153.             // Clear old variables
  154.             stopState = false;
  155.             scanRange.Clear();
  156.             userNames.Clear();
  157.             usernameFound = 0;
  158.             messageSent = 0;
  159.  
  160.             // Create range
  161.             string[] rangeInfo = textBox1.Text.Split('-');
  162.             int fromRange = Convert.ToInt32(rangeInfo[0]);
  163.             int toRange = Convert.ToInt32(rangeInfo[1]);
  164.  
  165.             Logger.AddMessage("New scan range: " + fromRange + " - " + toRange);
  166.  
  167.             for (int i = fromRange; i <= toRange; i++)
  168.                 scanRange.Add(i);
  169.  
  170.             Thread scanThread = new Thread(new ThreadStart(ScanThread));
  171.             scanThread.IsBackground = true;
  172.             scanThread.Start();
  173.  
  174.             Thread spamThread = new Thread(new ThreadStart(SpamThread));
  175.             spamThread.IsBackground = true;
  176.             spamThread.Start();
  177.         }
  178.  
  179.         private bool CheckStopState()
  180.         {
  181.             if (stopState)
  182.             {
  183.                 while (NetworkClass.connectionActive > 0)
  184.                     Thread.Sleep(1000);
  185.  
  186.                 return true;
  187.             }
  188.  
  189.             return false;
  190.         }
  191.  
  192.         private void ScanThread()
  193.         {
  194.             while (scanRange.Count > 0 || NetworkClass.connectionActive > 0)
  195.             {
  196.                 Thread.Sleep(10);
  197.  
  198.                 if (CheckStopState()) { break; }
  199.  
  200.                 if (scanRange.Count == 0) { continue; }
  201.  
  202.                 while (!NetworkClass.GetDownloadSpot())
  203.                     Thread.Sleep(10);
  204.  
  205.                 int numberToScan = 0;
  206.                 lock (scanRange)
  207.                 {
  208.                     numberToScan = scanRange[0];
  209.                     scanRange.RemoveAt(0);
  210.                 }
  211.  
  212.                 List<SpamAcc> accountList = null;
  213.                 lock (accountDic)
  214.                 {
  215.                     while (accountDic.Count == 0)
  216.                         Thread.Sleep(10);
  217.  
  218.                     accountList = accountDic.Values.ToList();
  219.                 }
  220.  
  221.                 // Get account
  222.                 SpamAcc accToSend = accountList[rand.Next(0, accountList.Count)];
  223.  
  224.  
  225.  
  226.                 Logger.AddMessage("Opening page: http://www.aeriagames.com/buddylist/" + numberToScan);
  227.  
  228.                 HttpWebRequest requestHttp = NetworkClass.CreateHttpAgent("http://www.aeriagames.com/buddylist/" + numberToScan, false);
  229.                 requestHttp.CookieContainer = accToSend.cookies;
  230.                 if (!String.IsNullOrWhiteSpace(accToSend.proxyAddress)) { requestHttp.Proxy = new WebProxy(accToSend.proxyAddress); }
  231.                 requestHttp.Credentials = new NetworkCredential("ukaszbara", "12345");
  232.                 requestHttp.Proxy.Credentials = new NetworkCredential("ukaszbara", "12345");
  233.  
  234.  
  235.                 /*
  236.                 if (useProxy)
  237.                 {
  238.                     string proxyAddress = null;
  239.                     while (proxyAddress == null)
  240.                     {
  241.                         proxyAddress = ProxyFactory.GetProxy();
  242.                         Thread.Sleep(10);
  243.                     }
  244.  
  245.                     requestHttp.Proxy = new WebProxy(proxyAddress);
  246.                 }
  247.                  */
  248.                
  249.                 IAsyncResult result_async = requestHttp.BeginGetResponse(new AsyncCallback(Scan_async), new object[2] { requestHttp, numberToScan });
  250.             }
  251.  
  252.             Logger.AddMessage("Scanning completed");
  253.         }
  254.  
  255.         public void Scan_async(IAsyncResult asynchronousResult)
  256.         {
  257.             object[] objectParameters = asynchronousResult.AsyncState as object[];
  258.  
  259.             HttpWebRequest requestHttp_async = objectParameters[0] as HttpWebRequest;
  260.             int numberToScan_async = (int)objectParameters[1];
  261.  
  262.             string resultPage = null;
  263.  
  264.             bool badTry = false;
  265.  
  266.             try
  267.             {
  268.                 using (HttpWebResponse response = (HttpWebResponse)requestHttp_async.EndGetResponse(asynchronousResult))
  269.                 {
  270.                     using (Stream responseStream = response.GetResponseStream())
  271.                     {
  272.                         using (StreamReader reader = new StreamReader(responseStream))
  273.                         {
  274.                             resultPage = reader.ReadToEnd();
  275.                         }
  276.                     }
  277.                 }
  278.             }
  279.             catch(WebException webEx)
  280.             {
  281.                 if (webEx.Response != null)
  282.                 {
  283.                     if (((HttpWebResponse)webEx.Response).StatusCode != HttpStatusCode.NotFound) { badTry = true; }
  284.                 }
  285.  
  286.                 if (badTry) { Logger.AddMessage("Can't open page: " + requestHttp_async.Address.ToString() + " | Error: " + webEx.Message); }
  287.                
  288.                 resultPage = null;
  289.             }
  290.  
  291.             WebProxy usedProxy = requestHttp_async.Proxy as WebProxy;
  292.  
  293.             if (resultPage != null)
  294.             {
  295.                 /*
  296.                 try
  297.                 {
  298.                     using (StreamWriter streamWriter = new StreamWriter("website.txt", true))
  299.                     {
  300.                         streamWriter.WriteLine(resultPage);
  301.                     }
  302.                 }
  303.                 catch { }
  304.                  */
  305.  
  306.  
  307.                 Match userName_S = Regex.Match(resultPage, @"href=""//www.aeriagames.com/user/([^<]*)/""");
  308.  
  309.                
  310.                 if (userName_S.Success)
  311.                 {
  312.                     string userName = userName_S.Groups[1].Value;
  313.                     lock (userNames)
  314.                     {
  315.                         userNames.Add(userName);
  316.                         Logger.AddMessage("Username found: " + userName);
  317.                         Interlocked.Increment(ref usernameFound);
  318.                     }
  319.                 }
  320.             }
  321.  
  322.             if (badTry) { ProxyFactory.ReportProxyTry(usedProxy, false); }
  323.             else
  324.             {
  325.                 ProxyFactory.ReportProxyTry(usedProxy, true);
  326.             }
  327.  
  328.             NetworkClass.RelaseDownloadSpot();
  329.         }
  330.  
  331.         private void SpamThread()
  332.         {
  333.             while (scanRange.Count > 0 || NetworkClass.connectionActive > 0 || userNames.Count > 0)
  334.             {
  335.                 Thread.Sleep(10);
  336.  
  337.                 if (CheckStopState()) { break; }
  338.  
  339.                 if (userNames.Count == 0) { continue; }
  340.  
  341.                 while (!NetworkClass.GetDownloadSpot())
  342.                     Thread.Sleep(1);
  343.  
  344.                 string userNameToScan = String.Empty;
  345.                 lock (userNames)
  346.                 {
  347.                     userNameToScan = userNames[0];
  348.                     userNames.RemoveAt(0);
  349.                 }
  350.  
  351.                 List<SpamAcc> accountList = null;
  352.                 lock (accountDic)
  353.                 {
  354.                     while (accountDic.Count == 0)
  355.                         Thread.Sleep(10);
  356.  
  357.                     accountList = accountDic.Values.ToList();
  358.                 }
  359.  
  360.                 // Get account
  361.                 SpamAcc accToSend = accountList[rand.Next(0, accountList.Count)];
  362.  
  363.                 Logger.AddMessage("Opening page: http://www.aeriagames.com/privatemsg/msgto/" + HttpUtility.UrlEncode(userNameToScan));
  364.                 HttpWebRequest requestHttp = NetworkClass.CreateHttpAgent("http://www.aeriagames.com/privatemsg/msgto/" + HttpUtility.UrlEncode(userNameToScan), false);
  365.                 requestHttp.CookieContainer = accToSend.cookies;
  366.                 if (!String.IsNullOrWhiteSpace(accToSend.proxyAddress)) { requestHttp.Proxy = new WebProxy(accToSend.proxyAddress); }
  367.                 requestHttp.Credentials = new NetworkCredential("ukaszbara", "12345");
  368.                 requestHttp.Proxy.Credentials = new NetworkCredential("ukaszbara", "12345");
  369.                
  370.  
  371.  
  372.                 requestHttp.ServicePoint.Expect100Continue = false;
  373.  
  374.                 IAsyncResult result_async = requestHttp.BeginGetResponse(new AsyncCallback(accToSend.Spam_async), new object[2] { requestHttp, userNameToScan });
  375.             }
  376.  
  377.             this.Invoke((MethodInvoker)(() => this.toolStripButton1.Enabled = true));
  378.             this.Invoke((MethodInvoker)(() => this.toolStripButton3.Enabled = true));
  379.             this.Invoke((MethodInvoker)(() => this.toolStripButton3.Text = "Stop"));
  380.             Logger.AddMessage("Spamming completed");
  381.         }
  382.  
  383.         private void button1_Click(object sender, EventArgs e)
  384.         {
  385.             if (!Form1.dbcClient.User.LoggedIn)
  386.             {
  387.                 Form1.dbcClient = new DeathByCaptcha.SocketClient(textBox8.Text, textBox9.Text);
  388.                 if (!Form1.dbcClient.User.LoggedIn)
  389.                     MessageBox.Show("Wrong login/password for DeathByCaptcha." + Environment.NewLine + "Can't add new Account.", "Error");
  390.             }
  391.  
  392.             if (Form1.dbcClient.User.LoggedIn)
  393.             {
  394.                 this.button1.Enabled = false;
  395.                 this.button1.Text = "Adding";
  396.  
  397.                 ThreadPool.QueueUserWorkItem((objectParameter) =>
  398.                 {
  399.                     AddNewAccount(textBox4.Text, textBox5.Text, textBox6.Text);
  400.                     this.button1.Invoke((MethodInvoker)(() => this.button1.Enabled = true));
  401.                     this.button1.Invoke((MethodInvoker)(() => this.button1.Text = "Add"));
  402.  
  403.                 });
  404.             }
  405.         }
  406.  
  407.         private void AddNewAccount(string login, string password, string proxy)
  408.         {
  409.             SpamAcc newAcc = new SpamAcc(login, password, proxy);
  410.             if (newAcc.Login())
  411.             {
  412.                 if (!accountDic.ContainsKey(newAcc.login))
  413.                 {
  414.                     this.dataGridView1.Invoke((MethodInvoker)(() => this.dataGridView1.Rows.Add(new object[] { newAcc.login, newAcc.password, newAcc.proxyAddress })));
  415.  
  416.                     accountDic.Add(newAcc.login, newAcc);
  417.                     Logger.AddMessage("New account loaded: " + newAcc.login + " - " + newAcc.password + " (" + newAcc.proxyAddress + ")");
  418.                 }
  419.  
  420.                 else { MessageBox.Show("This account was already added", "Can't add this account"); }
  421.             }
  422.             else { MessageBox.Show("Login failed. Please check login/password.", "Can't add new account"); }
  423.         }
  424.  
  425.         private void textBox7_TextChanged(object sender, EventArgs e)
  426.         {
  427.             Int32.TryParse(textBox7.Text, out NetworkClass.connectionMax);
  428.         }
  429.  
  430.         private void textBox2_TextChanged(object sender, EventArgs e)
  431.         {
  432.             Form1.subject = textBox2.Text;
  433.         }
  434.  
  435.         private void textBox3_TextChanged(object sender, EventArgs e)
  436.         {
  437.            
  438.             Form1.message = textBox3.Text ;
  439.            
  440.         }
  441.  
  442.         private void toolStripButton2_Click(object sender, EventArgs e)
  443.         {
  444.             if (!Form1.dbcClient.User.LoggedIn)
  445.             {
  446.                 Form1.dbcClient = new DeathByCaptcha.SocketClient(textBox8.Text, textBox9.Text);
  447.                 if (!Form1.dbcClient.User.LoggedIn)
  448.                     MessageBox.Show("Wrong login/password for DeathByCaptcha." + Environment.NewLine + "Can't add new Account.", "Error");
  449.             }
  450.  
  451.             if (!Form1.dbcClient.User.LoggedIn)
  452.                 return;
  453.  
  454.             this.toolStripButton2.Enabled = false;
  455.             this.toolStripButton2.Text = "Creating ...";
  456.  
  457.             ThreadPool.QueueUserWorkItem((objectParameter) =>
  458.             {
  459.                 // Get new account pass
  460.                 try
  461.                 {
  462.                     // Get password/login
  463.                     string othersAccounts = null;
  464.                     using (StreamReader streamReader = new StreamReader("accounts.TXT"))
  465.                     {
  466.                         int tries = 0;
  467.                         while (++tries < 4)
  468.                         {
  469.                             string accInfo = streamReader.ReadLine();
  470.                             if (accInfo == null) { break; }
  471.  
  472.                             string accName = accInfo.Split(':')[0];
  473.                             string password = accInfo.Split(':')[1];
  474.  
  475.                             if (CreateNewAccount(accName, password, String.Empty))
  476.                             {
  477.                                 this.AddNewAccount(accName, password, String.Empty);
  478.                                 break;
  479.                             }
  480.                         }
  481.  
  482.                         othersAccounts = streamReader.ReadToEnd();
  483.                     }
  484.  
  485.                     if (othersAccounts != null)
  486.                     {
  487.                         using (StreamWriter streamWriter = new StreamWriter("accounts.TXT"))
  488.                             streamWriter.Write(othersAccounts);
  489.                     }
  490.                 }
  491.                 catch { }
  492.  
  493.                 this.button1.Invoke((MethodInvoker)(() => this.toolStripButton2.Enabled = true));
  494.                 this.button1.Invoke((MethodInvoker)(() => this.toolStripButton2.Text = "Create Account"));
  495.  
  496.             });
  497.         }
  498.  
  499.  
  500.         private bool CreateNewAccount(string accountName, string password, string proxyAddress)
  501.         {
  502.             Logger.AddMessage("Trying to create new ACC: " + accountName + " - " + password + " (" + proxyAddress + ")");
  503.  
  504.             CookieContainer creatingAccCookies = new CookieContainer();
  505.  
  506.             int tries = 0;
  507.             while (++tries < 4)
  508.             {
  509.                 HttpWebRequest createAccRequest = NetworkClass.CreateHttpAgent("http://www.aeriagames.com/account/signup", false);
  510.                 createAccRequest.CookieContainer = creatingAccCookies;
  511.                 createAccRequest.ServicePoint.Expect100Continue = false;
  512.                 if (!String.IsNullOrWhiteSpace(proxyAddress)) { createAccRequest.Proxy = new WebProxy(proxyAddress); }
  513.                 NetworkClass.SendGetRequest(createAccRequest);
  514.  
  515.                 createAccRequest = NetworkClass.CreateHttpAgent("http://www.aeriagames.com/account/signup", true);
  516.                 createAccRequest.CookieContainer = creatingAccCookies;
  517.                 createAccRequest.ServicePoint.Expect100Continue = false;
  518.                 if (!String.IsNullOrWhiteSpace(proxyAddress)) { createAccRequest.Proxy = new WebProxy(proxyAddress); }
  519.  
  520.                 // Get Captcha Code
  521.                 ReCaptcha newReCaptcha = new ReCaptcha("6LcR-MUSAAAAAODqgJEVRJl-lPlhEfZqxaEzRgRq");
  522.                 if (newReCaptcha.IsSuccess())
  523.                 {
  524.                     string captchaCode = newReCaptcha.SolveCaptcha();
  525.                     string captchaId = newReCaptcha.uniqueCaptchaId;
  526.  
  527.                     StringBuilder postParameters = new StringBuilder();
  528.                     NetworkClass.AddPostParameter(ref postParameters, "edit[method]", String.Empty);
  529.                     NetworkClass.AddPostParameter(ref postParameters, "edit[destination]", String.Empty);
  530.                     NetworkClass.AddPostParameter(ref postParameters, "edit[mail]", accountName + "@gmail.com");
  531.                     NetworkClass.AddPostParameter(ref postParameters, "edit[birth][month]", "1");
  532.                     NetworkClass.AddPostParameter(ref postParameters, "edit[birth][day]", "1");
  533.                     NetworkClass.AddPostParameter(ref postParameters, "edit[birth][year]", "1989");
  534.                     NetworkClass.AddPostParameter(ref postParameters, "recaptcha_challenge_field", captchaId);
  535.                     NetworkClass.AddPostParameter(ref postParameters, "recaptcha_response_field", captchaCode);
  536.                     NetworkClass.AddPostParameter(ref postParameters, "edit[form_id]", "account_signup");
  537.  
  538.                     string createAccResult = NetworkClass.SendPostRequest(createAccRequest, NetworkClass.GetPostData(postParameters));
  539.                     if (createAccResult == null) { continue; }
  540.  
  541.                     if (createAccResult.Contains("edit[name]"))
  542.                     {
  543.                         tries = 0;
  544.                         while (++tries < 4)
  545.                         {
  546.                             createAccRequest = NetworkClass.CreateHttpAgent("http://www.aeriagames.com/account/signup2", true);
  547.                             createAccRequest.CookieContainer = creatingAccCookies;
  548.                             createAccRequest.ServicePoint.Expect100Continue = false;
  549.                             if (!String.IsNullOrWhiteSpace(proxyAddress)) { createAccRequest.Proxy = new WebProxy(proxyAddress); }
  550.  
  551.                             postParameters = new StringBuilder();
  552.                             NetworkClass.AddPostParameter(ref postParameters, "edit[mail]", accountName + "@gmail.com");
  553.                             NetworkClass.AddPostParameter(ref postParameters, "edit[birth][month]", "1");
  554.                             NetworkClass.AddPostParameter(ref postParameters, "edit[birth][day]", "1");
  555.                             NetworkClass.AddPostParameter(ref postParameters, "edit[birth][year]", "1989");
  556.                             NetworkClass.AddPostParameter(ref postParameters, "edit[name]", accountName);
  557.                             NetworkClass.AddPostParameter(ref postParameters, "edit[pass]", "!23qweasD");
  558.                             NetworkClass.AddPostParameter(ref postParameters, "edit[form_id]", "account_signup2");
  559.  
  560.                             createAccResult = NetworkClass.SendPostRequest(createAccRequest, NetworkClass.GetPostData(postParameters));
  561.                             if (createAccResult == null) { continue; }
  562.  
  563.                             if (createAccResult.Contains("signupCompleteBox"))
  564.                             {
  565.                                 Logger.AddMessage("[Creating ACC] New account was created.");
  566.  
  567.                                 string userId = String.Empty;
  568.                                 Match userId_S = Regex.Match(createAccResult, @"user/(\d+)/edit");
  569.                                 if (userId_S.Success) { userId = userId_S.Groups[1].Value; }
  570.  
  571.                                 string[] avatars = Directory.GetFiles("avatars");
  572.                                 if (avatars.Length > 0)
  573.                                 {
  574.                                     FileInfo avatarFile = new FileInfo(avatars[rand.Next(0, avatars.Length)]);
  575.  
  576.                                     tries = 0;
  577.                                     while (++tries < 4)
  578.                                     {
  579.                                         // Get token id
  580.                                         HttpWebRequest avatarChangeRequest = NetworkClass.CreateHttpAgent("http://www.aeriagames.com/user/" + userId + "/edit", false);
  581.                                         avatarChangeRequest.CookieContainer = creatingAccCookies;
  582.                                         avatarChangeRequest.ServicePoint.Expect100Continue = false;
  583.                                         if (!String.IsNullOrWhiteSpace(proxyAddress)) { avatarChangeRequest.Proxy = new WebProxy(proxyAddress); }
  584.  
  585.                                         string avatarChangeResponse = NetworkClass.SendGetRequest(avatarChangeRequest);
  586.                                         if (avatarChangeResponse != null)
  587.                                         {
  588.                                             string tokenId = String.Empty;
  589.                                             Match tokenId_S = Regex.Match(avatarChangeResponse, @"name=""edit\[form_token\]"".*?value=""(.*?)""");
  590.                                             if (tokenId_S.Success) { tokenId = tokenId_S.Groups[1].Value; }
  591.  
  592.                                             newReCaptcha = new ReCaptcha("6LcR-MUSAAAAAODqgJEVRJl-lPlhEfZqxaEzRgRq");
  593.                                             if (newReCaptcha.IsSuccess())
  594.                                             {
  595.                                                 captchaCode = newReCaptcha.SolveCaptcha();
  596.                                                 captchaId = newReCaptcha.uniqueCaptchaId;
  597.  
  598.                                                 BoundaryClass boundary = new BoundaryClass();
  599.                                                 boundary.InsertString("edit[fname]", String.Empty);
  600.                                                 boundary.InsertString("edit[lname]", String.Empty);
  601.                                                 boundary.InsertString("edit[gender]", "M");
  602.                                                 boundary.InsertString("edit[birth][month]", "1");
  603.                                                 boundary.InsertString("edit[birth][day]", "1");
  604.                                                 boundary.InsertString("edit[birth][year]", "1989");
  605.                                                 boundary.InsertString("edit[city]", String.Empty);
  606.                                                 boundary.InsertString("edit[country]", "US");
  607.                                                 boundary.InsertString("edit[language]", "en");
  608.                                                 boundary.InsertString("edit[picture_key]", String.Empty);
  609.                                                 boundary.InsertFile("edit[picture_upload]", avatarFile, "image/png");
  610.                                                 boundary.InsertString("edit[form_token]", tokenId);
  611.                                                 boundary.InsertString("edit[form_id]", "user_edit");
  612.                                                 boundary.InsertString("recaptcha_challenge_field", captchaId);
  613.                                                 boundary.InsertString("recaptcha_response_field", captchaCode);
  614.                                                 boundary.InsertString("op", "Submit");
  615.                                                 boundary.CloseBoundary();
  616.                                                
  617.                                                 tries = 0;
  618.                                                 while (++tries < 4)
  619.                                                 {
  620.                                                     avatarChangeRequest = NetworkClass.CreateHttpAgent("http://www.aeriagames.com/user/" + userId + "/edit", false);
  621.                                                     avatarChangeRequest.CookieContainer = creatingAccCookies;
  622.                                                     avatarChangeRequest.ServicePoint.Expect100Continue = false;
  623.                                                     if (!String.IsNullOrWhiteSpace(proxyAddress)) { avatarChangeRequest.Proxy = new WebProxy(proxyAddress); }
  624.                                                     avatarChangeRequest.Method = "POST";
  625.                                                     avatarChangeRequest.ContentType = boundary.GetContentType();
  626.  
  627.                                                     avatarChangeResponse = NetworkClass.SendPostRequest(avatarChangeRequest, boundary.GetBoundaryData());
  628.                                                     if (avatarChangeResponse.Contains("The changes have been saved.")) { break; }
  629.                                                 }
  630.  
  631.                                                 if (avatarChangeResponse.Contains("The changes have been saved.")) { break; }
  632.                                             }
  633.                                         }
  634.                                     }
  635.                                 }
  636.  
  637.                                 return true;
  638.                             }
  639.                             else
  640.                             {
  641.                                 Logger.AddMessage("[Creating ACC] Error in second step.");
  642.                             }
  643.                         }
  644.                     }
  645.                     else
  646.                     {
  647.                         Logger.AddMessage("[Creating ACC] Error in first step.");
  648.                     }
  649.                 }
  650.                 else
  651.                 {
  652.                     Logger.AddMessage("[Creating ACC] Can't open recaptcha image.");
  653.                 }
  654.  
  655.             }
  656.  
  657.             Logger.AddMessage("[Creating ACC] Unable to create new acc after 4 tries.");
  658.             return false;
  659.         }
  660.  
  661.         private void toolStripButton3_Click(object sender, EventArgs e)
  662.         {
  663.             stopState = true;
  664.             toolStripButton3.Enabled = false;
  665.             toolStripButton3.Text = "Wait ...";
  666.         }
  667.  
  668.         private void exitToolStripMenuItem_Click(object sender, EventArgs e)
  669.         {
  670.             this.Close();
  671.         }
  672.  
  673.         private void checkBox1_CheckedChanged(object sender, EventArgs e)
  674.         {
  675.             this.useProxy = checkBox1.Checked;
  676.         }
  677.  
  678.  
  679.  
  680.         private void deleteAccountToolStripMenuItem_Click(object sender, EventArgs e)
  681.         {
  682.             Int32 rowToDelete = dataGridView1.Rows.GetFirstRow(DataGridViewElementStates.Selected);
  683.             if (rowToDelete >= 0)
  684.             {
  685.                 string accountName = dataGridView1.Rows[rowToDelete].Cells[0].Value.ToString();
  686.                 lock (accountDic)
  687.                 {
  688.                     if (accountDic.ContainsKey(accountName))
  689.                     {
  690.                         accountDic.Remove(accountName);
  691.                     }
  692.                 }
  693.  
  694.                 dataGridView1.Rows.RemoveAt(rowToDelete);
  695.                 dataGridView1.ClearSelection();
  696.             }
  697.         }
  698.  
  699.         private void dataGridView1_MouseDown(object sender, MouseEventArgs e)
  700.         {
  701.             if (e.Button == MouseButtons.Right)
  702.             {
  703.                 var hti = dataGridView1.HitTest(e.X, e.Y);
  704.                 if (hti.RowIndex >= 0 && hti.ColumnIndex >= 0)
  705.                 {
  706.                     dataGridView1.ClearSelection();
  707.                     dataGridView1.Rows[hti.RowIndex].Selected = true;
  708.                 }
  709.             }
  710.         }
  711.  
  712.         private void Form1_Load(object sender, EventArgs e)
  713.         {
  714.  
  715.         }
  716.  
  717.         private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  718.         {
  719.  
  720.         }
  721.  
  722.         private void statusStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  723.         {
  724.  
  725.         }
  726.  
  727.     }
  728. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement