打赏

校园网自动登陆脚本

基于Python的校园网自动登陆脚本


#conding:utf-8
import requests
import time
import os
//此为深澜校园网的登陆配置,不同平台略有不同
url = "http://注册IP地址/srun_portal_pc.php?ac_id=1&"
my_headers = {
                'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
                'Accept-Language': 'zh-CN,zh;q=0.9',
                'Cache-Control': 'max-age=0',
                'Connection': 'keep-alive',
                'Content-Length': '100',
                'Content-Type': 'application/x-www-form-urlencoded',
                'Cookie': 'login=bQ0pOyR6IXU7PJaQQqRAcBPxGAvxAcroYf0isl5Gaw8sMPTcvF2g0tCpWv8%252FPWsjGpLotUs8WEO5vhHwzVPBBWKbzPkTdy3QbG7oa7UJspfXCmgWtxkdjwPQurY3mxc15WSEILtfW%252FEbRiAPc2iCgYBsI25i6dat0XQCWerte2Gj8MHA%252BAacTVQJc6g%253D',
                'Host': '注册IP',
                'Origin': 'http://注册IP',
                'Referer': 'http://注册IP/srun_portal_pc.php?ac_id=1&',
                'Upgrade-Insecure-Requests': '1',
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
}
data = {
        'action': 'login',
        'ac_id': '1',
        'drop': '0',
        'username': '校园网账号',
        'password': '账号密码',
        'save_me': '1',
}
for i in range(1,4):
    requests.post(url, data=data, headers=my_headers)
os.system("ping www.baidu.com")

 

posted @ 2023-02-16 09:51  不像话  阅读(98)  评论(0编辑  收藏  举报