Untitled
unknown
plain_text
a year ago
5.1 kB
6
Indexable
DateTime timestart = DateTime.Now; Task.Delay(3000).Wait(); while (DateTime.Now - timestart < TimeSpan.FromSeconds(60) && string.IsNullOrEmpty(otp)) { using (var client = new Pop3Client()) { client.ServerCertificateValidationCallback = (s, c, h, e) => true; if (string.IsNullOrEmpty(proxyemail)) { if (listProxyTempMail.Count() > 0) { string proc = listProxyTempMail.GetQueue(); if (!string.IsNullOrEmpty(proc)) proxyemail = proc; } } if (!string.IsNullOrEmpty(proxyemail)) { proxyemail = trueproxy(proxyemail); string[] prox = proxyemail.Replace(" ", "").Replace("|", ":").Split(':'); string proxyUserName = ""; string proxyPassword = ""; string proxyHost = prox[0]; string proxyPort = ""; if (!string.IsNullOrEmpty(proxyHost) && prox.Length >= 2) { proxyPort = prox[1]; if (prox.Length > 2) { proxyUserName = prox[2]; proxyPassword = prox[3]; System.Net.NetworkCredential objNetworkCredential = new System.Net.NetworkCredential(proxyUserName, proxyPassword); MailKit.Net.Proxy.HttpProxyClient objHttpProxyClient = new HttpProxyClient(proxyHost, int.Parse(proxyPort), objNetworkCredential); client.ProxyClient = objHttpProxyClient; } else { MailKit.Net.Proxy.HttpProxyClient objHttpProxyClient = new HttpProxyClient(proxyHost, int.Parse(proxyPort)); client.ProxyClient = objHttpProxyClient; } } } client.SslProtocols = SslProtocols.Ssl3 | SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12; client.Connect(host, port, true); //client.AuthenticationMechanisms.Remove("XOAUTH2"); client.Authenticate(Email, PasEmail); #region lấy otp from email int count = client.Count; int countmess = count; while (count > 0 && countmess > 0) { MimeMessage mess = client.GetMessage(countmess - 1); countmess--; if (DateTime.UtcNow - mess.Date.UtcDateTime > TimeSpan.FromMinutes(60)) { break; } if (!mess.From.Any(x => x.Name.IsContains("acebook"))) continue; string textinput = mess.TextBody; if (string.IsNullOrEmpty(textinput)) textinput = mess.HtmlBody; textinput = textinput.Replace("\r", "").Replace("\n", "").Replace(Email, "").Replace(": ", ":").Replace(" :", ":").Replace("> ", ">").Replace(" <", "<").Replace("1501092823525282", ""); otp = RegexMatch(mess.HtmlBody, ">(\\d{5,8})<").Groups[1].Value; if (string.IsNullOrEmpty(otp)) otp = RegexMatch(textinput, "code:(\\d{5,8})").Groups[1].Value; if (string.IsNullOrEmpty(otp)) otp = RegexMatch(textinput, "code([^:]+):(\\d{5,8})").Groups[2].Value; if (string.IsNullOrEmpty(otp)) otp = RegexMatch(textinput, "(\\d{" + num + "})").Groups[1].Value; if (string.IsNullOrEmpty(otp)) otp = RegexMatch(textinput, ">(\\d{" + num + "})<").Groups[1].Value; if (string.IsNullOrEmpty(otp)) otp = RegexMatch(textinput, "confirmcontact[.]php[?]c=(\\d+)").Groups[1].Value; if (string.IsNullOrEmpty(otp)) { continue; } if (!string.IsNullOrEmpty(otp)) break; } #endregion client.Disconnect(true); } if (string.IsNullOrEmpty(otp)) Task.Delay(5000).Wait(); }
Editor is loading...
Leave a Comment