private void PortCycle() { if (ServerList.Text != "") { //"smtp.gmail.com" for (int x = 0; x < 6; x++) { SmtpClient client = new SmtpClient(ServerList.Text, PortArr[x]); if (PortArr[x] == 587 || PortArr[x] == 26 || PortArr[x] == 465) { client.EnableSsl = true; } else { client.EnableSsl = false; } MailAddress from = new MailAddress(SenderEmail.Text, "Bug Bounty Test"); MailAddress to = new MailAddress(ReceiverEmail.Text, "Bug Bounty Tester"); MailMessage message = new MailMessage(from, to); message.Body = "This is a test for your bug bounty program"; message.Subject = "Bug Bounty Test"; //UseDefaultCredentials=true; //client.UseDefaultCredentials=true; client.Timeout = 5000; try { client.Send(message); PassedTextBox.AppendText(ServerList.Text + " Port: " + PortArr[x] + " PASSED" + Environment.NewLine); this.ProgBar.Increment(17); } catch (Exception ex) { //TextBox.AppendText("Exception is:" + ex.ToString()); TextBox.AppendText(ServerList.Text + " Port: " + PortArr[x] + " FAILED" + Environment.NewLine); this.ProgBar.Increment(17); } } } }
private void ServerCycle() { foreach (string s in ServerList.Items) { SmtpClient client = new SmtpClient(s, Convert.ToInt32(PortTextBox.Text)); if (PortTextBox.Text == "587" || PortTextBox.Text == "26" || PortTextBox.Text == "465") { client.EnableSsl = true; } else { client.EnableSsl = false; } MailAddress from = new MailAddress(SenderEmail.Text, "Bug Bounty Test"); MailAddress to = new MailAddress(ReceiverEmail.Text, "Bug Bounty Tester"); MailMessage message = new MailMessage(from, to); message.Body = "This is a test for your bug bounty program"; message.Subject = "Bug Bounty Test"; //UseDefaultCredentials=true; //client.UseDefaultCredentials=true; client.Timeout = 5000; try { client.Send(message); PassedTextBox.AppendText(s + " Port: " + PortTextBox.Text + " PASSED" + Environment.NewLine); this.ProgBar.Increment(100 / ServerList.Items.Count); } catch (Exception ex) { TextBox.AppendText(s + " Port: " + PortTextBox.Text + " FAILED" + Environment.NewLine); this.ProgBar.Increment(100 / ServerList.Items.Count); } } }
private void Start() { if (SenderEmail.Text != "" && ReceiverEmail.Text != "") { if (PortCycleCB.Checked.Equals(true) && checkBoxServer.Checked.Equals(false)) { StartButt.Enabled = false; PortCycle(); StartButt.Enabled = true; } else if (PortCycleCB.Checked.Equals(false) && checkBoxServer.Checked.Equals(true)) { StartButt.Enabled = false; ServerCycle(); StartButt.Enabled = true; } else if (PortCycleCB.Checked.Equals(true) && checkBoxServer.Checked.Equals(true)) { StartButt.Enabled = false; ServerCycle(); StartButt.Enabled = true; } else { SmtpClient client = new SmtpClient(ServerList.Text, Convert.ToInt32(PortTextBox.Text)); if (PortTextBox.Text == "587" || PortTextBox.Text == "26" || PortTextBox.Text == "465") { client.EnableSsl = true; } else { client.EnableSsl = false; } MailAddress from = new MailAddress(SenderEmail.Text, "Bug Bounty Test"); MailAddress to = new MailAddress(ReceiverEmail.Text, "Bug Bounty Tester"); MailMessage message = new MailMessage(from, to); message.Body = "This is a test for your bug bounty program"; message.Subject = "Bug Bounty Test"; //UseDefaultCredentials=true; //client.UseDefaultCredentials=true; client.Timeout = 5000; try { client.Send(message); PassedTextBox.AppendText(ServerList.Text + " Port: " + PortTextBox.Text + " PASSED" + Environment.NewLine); this.ProgBar.Increment(100); } catch (Exception ex) { TextBox.AppendText(ServerList.Text + " Port: " + PortTextBox.Text + " FAILED" + Environment.NewLine); this.ProgBar.Increment(100); } } } }