资源简介
用来登录北工大lgn,lgn6
代码片段和文件信息
#!/usr/bin/env python3
# === Settings BEGIN ===
# Change it according to your school‘s network environment
LGN_LOGIN_URL = ‘https://lgn.bjut.edu.cn/‘
LGN_LOGOUT_URL = ‘https://lgn.bjut.edu.cn/F.htm‘
LGN6_JUMPING_URL = ‘https://lgn6.bjut.edu.cn/V6?https://lgn.bjut.edu.cn‘
SIMULATED_UA = ‘Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0‘
# === Settings END
from urllib import request
import urllib sys re
# Logout current account
def gateway_logout():
req = request.Request(LGN_LOGOUT_URL)
req.add_header(‘User-Agent‘ SIMULATED_UA)
f = request.urlopen(req)
data = f.read().decode(‘gb2312‘)
if data.find(‘Msg=14‘) != -1:
print(‘Logout successed‘)
else:
print(‘Logout failed have you already logged out?‘)
# Get account status
def gateway_account_status():
req = request.Request(LGN_LOGIN_URL)
req.add_header(‘User-Agent‘ SIMULATED_UA)
f = request.urlopen(req)
data = f.read().decode(‘gb2312‘)
# print(data)
评论
共有 条评论