-
Notifications
You must be signed in to change notification settings - Fork 0
/
drcom_xzmu_wireless_4win.py
103 lines (85 loc) · 2.85 KB
/
drcom_xzmu_wireless_4win.py
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
#!/usr/bin/env python3
# author: [email protected]
# 配置你的信息
stu_number = "学号"
stu_passwd = "密码"
from plyer import notification
import re
import time
import json
import urllib
import requests
keep = False
rq = requests.Session()
def get_login_config():
try:
respone= rq.get("http://10.1.0.213/", timeout=1)
except:
return {}
redirect_url = set(re.findall('href="(.*?)"',respone.text)).pop()
print(redirect_url)
redirect_url = urllib.parse.unquote(redirect_url)
if "?w" not in redirect_url:
return None
print(f"[+] 🔗 登陆链接: {redirect_url}")
config_args = urllib.parse.parse_qs(redirect_url)
print(f"[+] ✌ 参数解析成功 ✅")
return {
'wlan_user_ip': config_args['wlanuserip'][0],
'wlan_user_mac': config_args['http://10.1.0.212?wlanusermac'][0].replace('-',''),
'wlan_ac_ip': config_args['wlanacip'][0],
'wlan_ac_name': config_args['wlanacname'][0],
}
def try_login():
global keep
start_time = time.time()
config = get_login_config()
if len(config.keys()) == 0: # 已登陆
if not keep:
keep = True
notification.notify(
title = 'XZMU 网络',
message = '已登录',
app_icon = None,
timeout = 5,
)
return True
if not config:
return False
login_url = "http://10.1.0.212:801/eportal/portal/login?callback=dr1003&login_method=1&terminal_type=1&lang=zh&lang=zh-cn&v=2833&jsVersion=4.2"\
+ f"&user_account=,0,{stu_number}"\
+ f"&user_password={stu_passwd}" \
+ f"&wlan_user_ip={config['wlan_user_ip']}&wlan_user_ipv6=" \
+ f"&wlan_user_mac={config['wlan_user_mac']}" \
+ f"&wlan_ac_ip={config['wlan_ac_ip']}" \
+ f"&wlan_ac_name={config['wlan_ac_name']}"
response = rq.get(login_url)
result = json.loads(re.findall("{.*?}",response.text).pop())
# dr1003({'result': 0, 'msg': 'ldap auth error', 'ret_code': 1})
# dr1003({'result': 1, 'msg': 'Portal协议认证成功!'})
if not keep:
keep = True
notification.notify(
title = 'XZMU 网络',
message = result['msg'],
app_icon = None,
timeout = 5,
)
print(f"[*] 👀 响应信息: {result['msg']}")
total = time.time() - start_time
print(f"[*] ⌚ 共耗费 {total}秒")
if result['result'] == 1:
return True
else:
return False
if __name__ == "__main__":
print("[*] Login 2 xzmu network (WIFI) [daemon] ver 1.0")
while True:
count = 0
if try_login():
print("[*] 💓 发送心跳包维持登陆状态")
time.sleep(60*15)
else:
count += 1
print(f"[*] 📚 正在重试 ({count})")
time.sleep(30)