东南大学seu-wlan自动登陆脚本+批处理文件

这个真的没什么好讲的了。就放下代码,在红色的引号内加上学号和密码就可以用了。

唯一要说的就是校园网密码在post的时候是base64编码了一下,不是明文传输(这就是传说中的密码加密吗?牛皮啊)

再写个批处理文件(windows bat文件),放在桌面,连上seu-wlan后直接运行批处理 美滋滋!

d:

python seulogin.py

seulogin.py是下面脚本的文件名,脚本放在d盘下

import urllib.request
import urllib.parse
import ssl
import http.cookiejar
import base64

ssl._create_default_https_context = ssl._create_unverified_context

url = "http://w.seu.edu.cn/index.php/index/login"

password = base64.b64encode(''.encode('utf-8'))

postdata = urllib.parse.urlencode({
'username':'',
'password':password,
'enablemacauth':'0'
}).encode('utf-8')

req = urllib.request.Request(url,postdata)
req.add_header("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36")
cjar = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cjar))
urllib.request.install_opener(opener)

opener.open(req).read()

猜你喜欢

转载自www.cnblogs.com/CooperXia-847550730/p/10009973.html