private void SetAgent(object state) { string filePath = (string)state; string[] str = File.ReadAllLines(filePath); foreach (string agent in str) { try { _agents.Add(agent); } catch { } } _currentPosition++; if (_filesCount == _currentPosition) { AgentsReady = true; } string[] fileName = filePath.Split('\\'); lock (LogIO.locker) logging.Invoke(LogIO.mainLog, new Log() { UserName = null, Date = DateTime.Now, LogMessage = $"file {fileName[fileName.Count() - 1]} returned {str.Count()} Agents", Method = "UserAgent.SetUser" }); }
public HttpAndroid(string username, string password, Dictionary <string, object> proxy, string userAgent) { mCoockieC = new CookieContainer(); Username = username; Password = password; _userAgent = userAgent; try { _proxy = new WebProxy(proxy["ip"].ToString(), Int32.Parse(proxy["port"].ToString())); if (proxy.Count > 2) { _proxy.Credentials = new NetworkCredential(proxy["proxyLogin"].ToString(), proxy["proxyPassword"].ToString()); } } catch (Exception ex) { if (_proxy == null) { lock (LogIO.locker) logging.Invoke(LogIO.mainLog, new Log() { Date = DateTime.Now, LogMessage = $"Hе объявлен порт или айпи адрес: {ex.Message}", Method = "HttpAndroid.Ctor", UserName = null }); throw new Exception($"Hе объявлен порт или айпи адрес: {ex.Message}"); } } }
private void btnLoad_Click(object sender, RoutedEventArgs e) { _model = new Model(); if (numcThreads.Value > 0) { if (_proxyWindow == null) { _proxyWindow = new ProxyOptionWindow(); } btnProxyOptions.IsEnabled = false; if (File.Exists("Log.log")) { File.Delete("Log.log"); } if (File.Exists("EasyLog.log")) { File.Delete("EasyLog.log"); } Task.Run(() => ControlWorker_Run()); btnLoad.IsEnabled = false; lock (LogIO.locker) logging.Invoke(LogIO.mainLog, new Log() { Date = DateTime.Now, Method = "MainWindow", LogMessage = "Start check info", UserName = null }); _model.InitProxy((bool)cbApiProxy.IsChecked ? true : false, _proxyWindow.AllLinks); //List<strings> Task.Run(() => Load_Run()); } else { MessageBox.Show("Количество потоков или аккаунтов \nв потоке не может быть меньше 1", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public async Task <HashResult> FindHashtagPhotos() { try { var request = HttpRequestBuilder.Get($"https://www.instagram.com/explore/tags/{Hashtag}/?__a=1", _cookieContainer); request.Referer = $"https://www.instagram.com/explore/tags/{Hashtag}/"; request.Headers["X-Requested-With"] = "XMLHttpRequest"; request.Headers["X-IG-App-ID"] = "936619743392459"; request.Headers["X-Instagram-GIS"] = "07872401bf58d36857235616ae5cc596"; request.AllowAutoRedirect = false; using (var response = await request.GetResponseAsync() as HttpWebResponse) { _cookieContainer.Add(response.Cookies); // may be exep using (var responseStream = response.GetResponseStream()) using (var gzipStream = new GZipStream(responseStream, CompressionMode.Decompress)) using (var streamReader = new StreamReader(gzipStream)) { var data = streamReader.ReadToEnd(); return(JsonConvert.DeserializeObject <HashResult>(data)); } } } catch (Exception ex) { Debug.WriteLine("GetProfile progress occur exception " + ex.Message); if (ex.Message.Contains("404")) { return(null); } logging.Invoke(LogIO.mainLog, new Log() { Date = DateTime.Now, Message = ex.Message, Method = "FindHashtagPhotos" }); throw ex; } }
private void SetMail_Run(string filePath) { string[] str = File.ReadAllLines(filePath); _paths.Add(filePath); foreach (string user in str) { Dictionary <string, string> saveUser = new Dictionary <string, string>(); saveUser["fileName"] = filePath; saveUser["mail"] = user; _mailAndHisFile.Add(saveUser); try { string[] splitted = user.Split(':'); Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add("mailLogin", splitted[0]); dict.Add("mailPassword", splitted[1]); _mails.Add(dict); } catch { } } _currentPosition++; if (_filesCount == _currentPosition) { MailsReady = true; } string[] fileName = filePath.Split('\\'); lock (LogIO.locker) logging.Invoke(LogIO.mainLog, new Log() { UserName = null, Date = DateTime.Now, LogMessage = $"file {fileName[fileName.Count() - 1]} returned {str.Count()} mails", Method = "AccMails.SetMails" }); _currentPosition++; }
private void btnOk_Click(object sender, RoutedEventArgs e) { try { string hrefs = tbLinks.Text; var encode = Encoding.UTF32; File.WriteAllText(_cryPath, hrefs, encode); AllLinks = File.ReadAllLines(_cryPath).ToList(); this.Close(); } catch (Exception ex) { logging.Invoke("prvLog.log", new Log() { Date = DateTime.Now, LogMessage = $"{ex.Message}", Method = "btnOk_Click" }); } }
public void GetRefProxy(List <string> hrefs) { IsProxyReady = false; _countLinks = hrefs.Count; foreach (var href in hrefs) { if (String.IsNullOrWhiteSpace(href)) { lock (LogIO.locker) logging.Invoke(LogIO.mainLog, new Log() { UserName = null, Date = DateTime.Now, LogMessage = $"Link doesn't exist", Method = "Proxy.GetRefProxy" }); _countLinks--; continue; } Task.Run(() => AWMProxySetter_DoWork(href)); } }
private async void Start(object sender, RoutedEventArgs e) { string[] Proxy = File.ReadAllLines(tbProxy.Text); string[] UsersString = File.ReadAllLines(tbUsers.Text); foreach (var userString in UsersString) { if (rbBrowser.IsChecked == true) { Random random = new Random(); var UserDick = UsersParse.Parse(userString); var ProxyDict = ProxyParse.Parse(Proxy[random.Next(0, Proxy.Length)]); logging.Invoke(LogIO.path, new Log { Date = DateTime.Now, UserName = UserDick["username"], Method = "Loggining", Message = "Авторизация с браузера" }); Mail mail; logging.Invoke(LogIO.path, new Log { Date = DateTime.Now, UserName = UserDick["username"], Method = "Выделение потоков", Message = "Выделение потоков" }); try { mail = new Mail(UserDick["maillogin"], UserDick["mailpassword"]); } catch (Exception ex) { mail = null; logging.Invoke(LogIO.path, new Log { Date = DateTime.Now, UserName = UserDick["username"], Method = "Loggining", Message = Options.IsSafeAllLogsEnabled ? $"Error: {ex.Message}" : "Неудалось залогиниться на почту" }); } users.Add(new HTTPBrowser() { UserName = UserDick["username"], Password = UserDick["password"], ProxyUserName = ProxyDict["username"], ProxyPassword = ProxyDict["password"], ip = ProxyDict["ip"], port = Int32.Parse(ProxyDict["port"]), mail = mail }); } else { Random random = new Random(); var UserDick = UsersParse.Parse(userString); var ProxyDict = ProxyParse.Parse(Proxy[random.Next(0, Proxy.Length)]); Mail mail; logging.Invoke(LogIO.path, new Log { Date = DateTime.Now, UserName = UserDick["username"], Method = "Выделение потоков", Message = "Выделение потоков" }); try { mail = new Mail(UserDick["maillogin"], UserDick["mailpassword"]); } catch (Exception ex) { mail = null; logging.Invoke(LogIO.path, new Log { Date = DateTime.Now, UserName = UserDick["username"], Method = "Loggining", Message = Options.IsSafeAllLogsEnabled ? $"Error: {ex.Message}" : "Неудалось залогиниться на почту" }); } users.Add(new HTTPAndroid() { UserName = UserDick["username"], Password = UserDick["password"], ProxyUserName = ProxyDict["username"], ProxyPassword = ProxyDict["password"], ip = ProxyDict["ip"], port = Int32.Parse(ProxyDict["port"]), mail = mail }); } } for (var i = 0; i < users.Count; i++) { workers.Add(new BackgroundWorker()); workers[i].DoWork += new DoWorkEventHandler(InstagramTest_DoWork); // workers[i].RunWorkerCompleted += InstagramTest_RunWorkerCompleted; workers[i].WorkerReportsProgress = true; workers[i].ProgressChanged += new ProgressChangedEventHandler(bgw_ProgressChanged); List <Object> list = new List <object>(); workers[i].RunWorkerAsync(users[i]); } //request = new HTTPBrowser(); //Dictionary<string, string> parsed = ProxyParse.Parse("17t3080724:[email protected]:7951"); //request.Login("KalkisVienna", "PULUFLbxArbR", parsed["ip"], Int32.Parse(parsed["port"]), parsed["username"], parsed["password"]); }
public void InitAgents() { Task.Run(() => { _agents.GetAccountsFromBaseFile(); while (true) { if (_agents.AgentsReady) { break; } } lock (LogIO.locker) logging.Invoke(LogIO.mainLog, new Log() { UserName = null, Date = DateTime.Now, LogMessage = $"Agents inited! {_agents.CountAgents} agents are ready", Method = "Model.InitAgents" }); IsAgentsInited = true; }); }
public Mail(string login, string password) { UserPass = $"{login}:{password}"; random = new Random(); r = Randomer.Next(0, 1000000); ic = new ImapClient("imap.mail.ru", login, password, AuthMethods.Login, 993, true, true); lock (LogIO.locker) logging.Invoke(LogIO.mainLog, new Log() { UserName = $"{login}:{password}", Date = DateTime.Now, LogMessage = $"{ic.IsAuthenticated} + {ic.IsConnected}", Method = "Mail.Ctor" }); Thread.Sleep(1000); }
private void Delete_Run(string path) { List <string> allUsersFromFile; lock (locker) { allUsersFromFile = File.ReadAllLines(path).ToList(); } int usersCount = allUsersFromFile.Count; logging.Invoke(LogIO.mainLog, new Log() { Method = "Account.Delete_Run", Date = DateTime.Now, LogMessage = $"file returned - {usersCount}", UserName = path }); bool check = false; lock (locker) { foreach (string user in UsersForDeleting) { check = true; allUsersFromFile.Remove(user); } logging.Invoke(LogIO.mainLog, new Log() { Method = "Account.Delete_Run", Date = DateTime.Now, LogMessage = $"Users removed - {usersCount - allUsersFromFile.Count}", UserName = path }); _checkDelete++; if (_checkDelete == _all_paths.Count) { logging.Invoke(LogIO.mainLog, new Log() { Method = "Account.Delete_Run", Date = DateTime.Now, LogMessage = "Deleting users from UsersForDeleting", UserName = path }); foreach (string user in UsersForDeleting) { string[] delUser = user.Split(new char[] { ':' }); Dictionary <string, string> tempDict = new Dictionary <string, string>() { { "instaLogin", delUser[0] }, { "instaPassword", delUser[1] } }; for (int i = 0; i < _users.Count; i++) { if (_users[i]["instaLogin"] == tempDict["instaLogin"] && _users[i]["instaPassword"] == tempDict["instaPassword"]) { _users.Remove(_users[i]); } } } UsersForDeleting.Clear(); } logging.Invoke(LogIO.mainLog, new Log() { Method = "Account.Delete_Run", Date = DateTime.Now, LogMessage = "UsersForDeleting cleared", UserName = path }); } if (check) { logging.Invoke(LogIO.mainLog, new Log() { Method = "Account.Delete_Run", Date = DateTime.Now, LogMessage = "UsersDeleted", UserName = path }); lock (locker) File.WriteAllLines(path, allUsersFromFile); } if (allUsersFromFile.Count < 10) { lock (locker) File.Delete(path); lock (locker) _all_paths.Remove(path); if (_all_paths.Count == 0) { logging.Invoke(LogIO.mainLog, new Log() { Date = DateTime.Now, Method = "Account.Delete_Run", LogMessage = "Set User, as _all_paths = 0" }); SetUser(); } logging.Invoke(LogIO.mainLog, new Log() { Method = "Account.Delete_Run", Date = DateTime.Now, LogMessage = "File removed", UserName = path }); } }