private static void join_thread(object xarg) { join_thread_arg arg=(join_thread_arg) xarg; string bot=arg.BotList.GetNextBot(); while(bot!=null) { string[] pair=bot.Split('|'); bool sOK=false; while (!sOK) { NerZul.Core.Network.Bot Bot=new NerZul.Core.Network.Bot(pair[0],pair[1], "Opera/9.62 (Windows NT 6.1; U; ru) Presto/2.1.1", "",0); Bot.HttpClient.Proxy=arg.ProxyList.GetRandomString(); Bot.HttpClient.Timeout=20000; ConsoleLog.WriteLine("Try \""+pair[0]+"\" with"+Bot.HttpClient.Proxy); try { if(Bot.Login()) { //Bot.HttpClient.Proxy=null; if(arg.Leave) { ConsoleLog.WriteLine(pair[0]+" logged in"); string PostData=Bot.GetTokenArg(1); Bot.CustomRequest("http://www.erepublik.com/en/resign-party/"+ arg.Party,PostData); }else{ Bot.CustomRequest("http://www.erepublik.com/en/join-party/"+arg.Party); } sOK=true; ConsoleLog.WriteLine(pair[0]+" OK"); } }catch (Exception){}; } bot=arg.BotList.GetNextBot(); } }
public static void Worker(string[] args) { #if !PUBLIC_BUILD if(args.Length!=4) { ConsoleLog.WriteLine("Usage: fire_all login(email) password company"); return; } Globals.webCitadel.SendLogInfo(new string[] { "fire_all" }, 0); args[1] = args[1].Replace("%", " "); NerZul.Core.Network.Bot bot = new NerZul.Core.Network.Bot(args[1], args[1], args[2], Globals.BotConfig.bBeep); if(!bot.Login()) { ConsoleLog.WriteLine("Unable to login"); return; } string scan=bot.CustomRequest("http://www.erepublik.com/en/company-employees/"+ args[3]+"/1/1/1"); while(true) { System.Text.RegularExpressions.Match m= System.Text.RegularExpressions.Regex.Match(scan, @"/en/fire-employee/company-\w+-employee-\w+"); if(m.Groups[0].Value.Length==0) break; ConsoleLog.WriteLine("Found: "+m.Groups[0].Value); System.Threading.Thread.Sleep(3000); scan=bot.CustomRequest("http://www.erepublik.com"+m.Groups[0].Value); } return; //http://api.erepublik.com/v1/feeds/companies/COMPANY_ID} #else ConsoleLog.WriteLine("ƒумаешь самый умный? —казано, не работает!"); #endif }
private void Userbutton_Click(object sender, EventArgs e) { string sbuf; int iTotal; string sCountFind; string sFind; int ipos; int i; int iVal; string sVal1, sVal2, sFind1; string sB1 = "\" href=\"/en/citizen/profile/", sB2 = "\">"; if (UsertextBox.Text.Length == 0) { MessageBox.Show("Id пользователя не задано!"); return; } string sLogin = LogintextBox.Text; string sPassword = PasswordtextBox.Text; if (sLogin.Length == 0 || sPassword.Length == 0) { MessageBox.Show("Логин и пароль не заданы!"); return; } throw new NotImplementedException("Login not updated to email"); NerZul.Core.Network.Bot bt = new NerZul.Core.Network.Bot(sLogin, sLogin, sPassword, bBeep); if (!bt.Login()) return; m_Response = bt.CustomRequest("http://www.erepublik.com/en/citizen/friends/"+UsertextBox.Text+"/0/100"); if (m_Response.Contains("Page not found")) { MessageBox.Show("Имя партии должно быть задано в формате (название-логин)!"); return; } sCountFind = "class=\"last\" title=\"Go to page "; ipos = m_Response.IndexOf(sCountFind); if (ipos == -1) { iTotal = 5; } else { sbuf = m_Response.Substring(ipos + sCountFind.Length); ipos = sbuf.IndexOf("\""); iTotal = int.Parse(sbuf.Substring(0, ipos)); } ConsoleLog.WriteLine("Total=" + iTotal.ToString()); for (i = 0; i <= iTotal; i++) { m_Response = bt.CustomRequest("http://www.erepublik.com/en/citizen/friends/"+UsertextBox.Text+"/"+i.ToString()+"/100"); ConsoleLog.WriteLine("http://www.erepublik.com/en/citizen/friends/" + UsertextBox.Text + "/" + i.ToString() + "/100"); sFind = "<div class=\"avatarholder\">\n\t\t\t\t<a title=\""; while ((ipos = m_Response.IndexOf(sFind)) != -1) { m_Response = m_Response.Substring(ipos + sFind.Length); ipos = m_Response.IndexOf("\""); sVal2 = m_Response.Substring(0, ipos); sFind1 = sVal2 + sB1; ipos = m_Response.IndexOf(sFind1); m_Response = m_Response.Substring(ipos + sFind1.Length); ipos = m_Response.IndexOf(sB2); iVal = int.Parse(m_Response.Substring(0, ipos)); sVal1 = iVal.ToString(); sVal2.Trim(); if (iVal!=2&&sVal2.Length!=0) { m_ssUsers[sVal1] = sVal2; } } ConsoleLog.WriteLine("ok"); } ConsoleLog.WriteLine("Total in " + m_ssUsers.Count.ToString()); System.IO.File.WriteAllText(UsertextBox.Text + ".txt", GetLine(m_ssUsers)); ConsoleLog.WriteLine("Saved to " + UsertextBox.Text + ".txt"); MessageBox.Show("Готово!"); }
static void Main(string[] args) { StringBuilder sb = new StringBuilder(); List<string> listArts = new List<string>(); List<string> listConts = new List<string>(); int i; string sbuf; int iTotal; string sCountFind; string sFind; int ipos; NerZul.Core.Network.Bot bt = new NerZul.Core.Network.Bot("sasha240", "*****@*****.**", "vfvfvskfhfve", false); string m_Response; string sNumPaper; sNumPaper = "the-independent-nowadays-191782"; if (!bt.Login()) return; m_Response = bt.CustomRequest("http://www.erepublik.com/en/newspaper/" + sNumPaper + "/1"); sCountFind = "class=\"last\" title=\"Go to page "; ipos = m_Response.IndexOf(sCountFind); if (ipos == -1) { iTotal = 5; } else { sbuf = m_Response.Substring(ipos + sCountFind.Length); ipos = sbuf.IndexOf("\""); iTotal = int.Parse(sbuf.Substring(0, ipos)); } //int iVal; //string sVal1; //string sFind1; //string sB1; //string sVal2; //string sB2; string sFullLink; ConsoleLog.WriteLine("Total=" + iTotal.ToString()); for (i = 1; i <= iTotal; i++) { sFullLink = "http://www.erepublik.com/en/newspaper/" + sNumPaper + "/" + i.ToString(); ConsoleLog.WriteLine(sFullLink); m_Response = bt.CustomRequest(sFullLink); sFind = "class=\"padded\"><a href=\"/en/article/"; sbuf = "class=\"padded\"><a href=\""; while ((ipos = m_Response.IndexOf(sFind)) != -1) { m_Response = m_Response.Substring(ipos + sbuf.Length); sFind = "/1/20\">"; ipos = m_Response.IndexOf(sFind); listArts.Add(m_Response.Substring(0, ipos + sFind.Length-2)); sFind = "class=\"padded\"><a href=\"/en/article/"; } ConsoleLog.WriteLine("ok"); } foreach(string sLink in listArts) { System.Threading.Thread.Sleep(2000); sFullLink = "http://www.erepublik.com" + sLink; ConsoleLog.WriteLine(sFullLink); try { m_Response = bt.CustomRequest(sFullLink); } catch (System.Exception e) { Console.WriteLine("Error"); continue; } sFind = "<p class=\"preview\">"; ipos = m_Response.IndexOf(sFind); if (ipos!=-1) { m_Response = m_Response.Substring(ipos + sFind.Length); sFind = "<p class=\"bottomcontrol\">"; ipos = m_Response.IndexOf(sFind); listConts.Add(m_Response.Substring(0, ipos)); } } foreach(string sCont in listConts) { sb.Append(sCont); } System.IO.File.WriteAllText("c:\\2\\" + sNumPaper + ".txt", sb.ToString()); }
private void Regionbutton_Click(object sender, EventArgs e) { string sbuf; int iTotal; string sCountFind; string sFind; int ipos; int i; int iVal; string sVal1, sVal2, sFind1; string sB1 = "\">", sB2 = "</"; if (RegiontextBox.Text.Length == 0) { MessageBox.Show("Номер региона на задан!"); return; } PartytextBox.Text.Trim('/'); string sLogin = LogintextBox.Text; string sPassword = PasswordtextBox.Text; if (sLogin.Length == 0 || sPassword.Length == 0) { MessageBox.Show("Логин и пароль не заданы!"); return; } throw new NotImplementedException("Login not updated to email"); NerZul.Core.Network.Bot bt = new NerZul.Core.Network.Bot(sLogin, sLogin, sPassword, bBeep); if (!bt.Login()) return; m_Response = bt.CustomRequest("http://www.erepublik.com/en/rankings/citizens/region/1/" + RegiontextBox.Text); if (m_Response.Contains("Page not found")) { MessageBox.Show("Нужно ввести номер региона (цифру)!"); return; } sCountFind = "class=\"last \" title=\"Go to page "; ipos = m_Response.IndexOf(sCountFind); if (ipos == -1) { iTotal = 5; } else { sbuf = m_Response.Substring(ipos + sCountFind.Length); ipos = sbuf.IndexOf("\""); iTotal = int.Parse(sbuf.Substring(0, ipos)); } ConsoleLog.WriteLine("Total=" + iTotal.ToString()); for (i = 1; i <= iTotal; i++) { ConsoleLog.WriteLine("http://www.erepublik.com/en/rankings/citizens/region/" + i.ToString() + "/" + RegiontextBox.Text); m_Response = bt.CustomRequest("http://www.erepublik.com/en/rankings/citizens/region/" + i.ToString() + "/" + RegiontextBox.Text); sFind = "\"dotted\" href=\"/en/citizen/profile/"; while ((ipos = m_Response.IndexOf(sFind)) != -1) { m_Response = m_Response.Substring(ipos + sFind.Length); ipos = m_Response.IndexOf("\""); iVal = int.Parse(m_Response.Substring(0, ipos)); sVal1 = iVal.ToString(); sFind1 = sVal1 + sB1; ipos = m_Response.IndexOf(sFind1); m_Response = m_Response.Substring(ipos + sFind1.Length); ipos = m_Response.IndexOf(sB2); sVal2 = m_Response.Substring(0, ipos); m_ssUsers[sVal1] = sVal2; } ConsoleLog.WriteLine("ok"); } ConsoleLog.WriteLine("Total in " + m_ssUsers.Count.ToString()); System.IO.File.WriteAllText(RegiontextBox.Text + ".txt", GetLine(m_ssUsers)); ConsoleLog.WriteLine("Saved to " + RegiontextBox.Text + ".txt"); MessageBox.Show("Готово!"); }