Пример #1
0
        public Account Read(Account acc)
        {
            string pass = (new Settings().GetEmailPassword(acc.Email) == null) ? acc.EmailPassword : new Settings().GetEmailPassword(acc.Email);

            MailServer oServer = new MailServer(new Settings().GetEmailHost(acc.Email), acc.Email, acc.EmailPassword, ServerProtocol.Pop3);
            MailClient oClient = new MailClient("TryIt");

            // Please add the following codes:
            oServer.SSLConnection = true;
            oServer.Port          = 995;

            if (acc.Email.Contains("gmail"))
            {
                oServer.Port = 993;
            }


            acc.Time = DateTime.Now;
            try
            {
                oClient.Connect(oServer);
                MailInfo[] infos = oClient.GetMailInfos();
                infos = infos.Reverse().ToArray();
                for (int i = 0; i < 25; i++)
                {
                    string   resetEmailUrl = null;
                    MailInfo info          = infos[i];
                    Mail     oMail         = oClient.GetMail(info);
                    if ((DateTime.Today - oMail.SentDate).TotalHours > 12)
                    {
                        continue;
                    }

                    var subj = oMail.Subject;
                    var rep  = oMail.To[0].Address;

                    if (acc.Email.Contains("@gmail.com"))
                    {
                        if (acc.Email != rep)
                        {
                            continue;
                        }
                    }

                    if (acc.Email == "*****@*****.**")
                    {
                        var x = 0;
                    }

                    //false
                    if (oMail.From.Address.ToString().Contains("pinterest.com"))
                    {
                        resetEmailUrl = new GetLink().FindLink(oMail.HtmlBody);
                    }


                    if (resetEmailUrl != null)
                    {
                        TryReset(acc, resetEmailUrl, rep);
                        // yea we do reset here
                    }
                    File.AppendAllText(this._res + '/' + acc.Nick + ".html",
                                       "<h1>" + acc.Email + "</h1><h3>" + oMail.From.Address + "</h3><h3>" + oMail.ReceivedDate + "</h3><br>" + oMail.HtmlBody + "<br><br><br>");

                    // Mark email as deleted from POP3 server.
                    oClient.Delete(info);
                }

                // Quit and pure emails marked as deleted from POP3 server.
                oClient.Quit();
                return(acc);
            }
            catch (Exception ep)
            {
                File.AppendAllText(this._res + System.IO.Path.DirectorySeparatorChar + "total_bad.txt", acc.Email + Environment.NewLine);
                acc.Status = ep.Message;
                return(acc);
            }
        }
Пример #2
0
        private void tryFindLostedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //load acc

            myCons.Text = "load data" + Environment.NewLine;
            var loadAcc = new LoadAccount()
            {
                Path = this.Path
            };

            acc = loadAcc.GetAccountList(Path + '/' + _blaster, Path + '/' + _base, Path);

            var allGmail = acc.FindAll(w => w.Email.Contains("@gmail.com"));

            List <string> done = new List <string>();

            foreach (var acc in allGmail)
            {
                myCons.Text = acc.Email;
                string clearEmail = acc.Email.Replace(".", "");
                if (done.Contains(clearEmail))
                {
                    continue;
                }
                done.Add(clearEmail);

                string pass = (new Settings().GetEmailPassword(acc.Email) == null) ? acc.EmailPassword : new Settings().GetEmailPassword(acc.Email);

                MailServer oServer = new MailServer(new Settings().GetEmailHost(acc.Email), acc.Email, pass, ServerProtocol.Pop3);
                MailClient oClient = new MailClient("TryIt");
                // Please add the following codes:
                oServer.SSLConnection = true;
                oServer.Port          = 995;
                acc.Time = DateTime.Now;
                try
                {
                    oClient.Connect(oServer);
                    MailInfo[] infos = oClient.GetMailInfos();
                    infos = infos.Reverse().ToArray();
                    for (int i = 0; i < 75; i++)
                    {
                        string   resetEmailUrl = null;
                        MailInfo info          = infos[i];
                        Mail     oMail         = oClient.GetMail(info);
                        if ((DateTime.Today - oMail.SentDate).TotalHours > 24)
                        {
                            continue;
                        }

                        var subj = oMail.Subject;
                        var rep  = oMail.To[0].Address;
                        myCons.Text += i.ToString();

                        var x = allGmail.FindAll(em => em.Email == rep);

                        if (allGmail.FindAll(em => em.Email == rep).Count > 0)
                        {
                            continue;
                        }

                        //false
                        if (oMail.From.Address.ToString().Contains("pinterest"))
                        {
                            resetEmailUrl = new GetLink().FindLink(oMail.HtmlBody);
                        }


                        if (resetEmailUrl != null)
                        {
                            TryReset(acc, resetEmailUrl, rep, "missed.txt");

                            // yea we do reset here
                        }
                        File.AppendAllText(this._res + '/' + acc.Nick + ".html",
                                           "<h1>" + acc.Email + "</h1><h3>" + oMail.From.Address + "</h3><h3>" + oMail.ReceivedDate + "</h3><br>" + oMail.HtmlBody + "<br><br><br>");

                        // Mark email as deleted from POP3 server.
                        oClient.Delete(info);
                    }

                    // Quit and pure emails marked as deleted from POP3 server.
                    oClient.Quit();
                }
                catch (Exception ep)
                {
                    File.AppendAllText(this._res + System.IO.Path.DirectorySeparatorChar + "total_bad.txt", acc.Email + Environment.NewLine);
                }
            }
            //naiti vse gmail
            // proverit vse pochti gmail gde netu acc
        }
Пример #3
0
        //private static PhantomJSDriverService _GetJsSettings()
        //{
        //    var serviceJs = PhantomJSDriverService.CreateDefaultService();
        //    serviceJs.HideCommandPromptWindow = true;
        //    return serviceJs;
        //}
        public void Read(int x)
        {
            count++;
            // this.Text = count.ToString();

            Account account = acc[x];
            string  pass    = (new Settings().GetEmailPassword(account.Email) == null)
                ? account.EmailPassword : new Settings().GetEmailPassword(account.Email);


            var serverproto = (account.Email.Contains("@gmail.com")) ? ServerProtocol.Imap4 : ServerProtocol.Pop3;


            MailServer oServer = new MailServer(new Settings().GetEmailHost(account.Email), account.Email, pass, serverproto);
            MailClient oClient = new MailClient("TryIt");

            // oClient.LogFileName = "maillog.txt";
            // Please add the following codes:
            oServer.SSLConnection = true;
            oServer.Port          = (account.Email.Contains("@gmail.com")) ? 993 : 995;
            account.Time          = DateTime.Now;
            try
            {
                oClient.Connect(oServer);
                MailInfo[] infos = oClient.GetMailInfos();
                infos = infos.Reverse().ToArray();

                /////////////// here :) just read all

                int gmailCount = account.Email.Contains("gmail") ? 100 : 25;


                for (int i = 0; i < gmailCount; i++)
                {
                    string resetEmailUrl = null;

                    MailInfo info = infos[i];
                    Mail     oMail;


                    oMail = oClient.GetMail(info);


                    if (oMail.HtmlBody.Contains("suspended your Pinterest"))
                    {
                        HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                        doc.LoadHtml(oMail.HtmlBody);
                        HtmlNodeCollection links = doc.DocumentNode.SelectNodes("//a");
                        foreach (HtmlNode link in links)
                        {
                            if (link.InnerText.Contains("this link"))
                            {
                                var driver = GetDriver();
                                driver.Navigate().GoToUrl(link.GetAttributeValue("href", null));
                                Thread.Sleep(5000);
                                driver.Quit();
                                myCons.Text = "spam policy";
                                oClient.Delete(info);
                            }
                        }
                        continue;
                    }
                    else if (oMail.HtmlBody.Contains("Confirm your email"))
                    {
                        HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                        doc.LoadHtml(oMail.HtmlBody);
                        HtmlNodeCollection links = doc.DocumentNode.SelectNodes("//a");
                        foreach (HtmlNode link in links)
                        {
                            if (link.InnerText.Contains("Confirm your email"))
                            {
                                var driver = GetDriver();

                                driver.Navigate().GoToUrl(link.GetAttributeValue("href", null));
                                Thread.Sleep(5000);
                                driver.Quit();
                                myCons.Text = "Confirm";
                                oClient.Delete(info);
                            }
                        }
                        continue;
                    }



                    if ((DateTime.Today - oMail.SentDate).TotalHours > 12)
                    {
                        continue;
                    }

                    var subj = oMail.Subject;
                    var rep  = oMail.To[0].Address;

                    //if (account.Email.Contains("@gmail.com"))
                    //{
                    //    if (account.Email != rep)
                    //    {
                    //        continue;
                    //    }
                    //}

                    //false
                    if (oMail.From.Address.ToString().Contains("pinterest"))
                    {
                        resetEmailUrl = new GetLink().FindLink(oMail.HtmlBody);
                    }


                    if (resetEmailUrl != null)
                    {
                        TryReset(account, resetEmailUrl, rep);
                    }
                }

                // Quit and pure emails marked as deleted from POP3 server.

                acc[x] = account;
                dataGridView.Update();
                dataGridView.Refresh();
            }
            catch (Exception ep)
            {
                try
                {
                    File.AppendAllText(this._res + System.IO.Path.DirectorySeparatorChar + "total_bad.txt", account.Email + ep.Message + Environment.NewLine);
                    account.Status = ep.Message;
                }
                catch { }
            }
            finally
            {
                try
                {
                    oClient.Quit();
                }
                catch { }
            }
        }