| from requests import post |
| import urllib.request |
| from urllib.error import URLError |
| from time import sleep |
| import threading |
| |
| url = "http://10.255.0.19/a79.htm" |
| print("----------------AUST-认证脚本------------------") |
| user = input("学号:") |
| password = input("密码:") |
| server = input("\n电信:aust\n联通:unicom\n移动:cmcc\n运营商: ") |
| |
| data = { |
| "callback": "dr1003", |
| "DDDDD": "{}@{}".format(user, server), |
| "upass": "{}".format(password), |
| "0MKKey": "123456", |
| "R1": "0", |
| "R3": "0", |
| "R6": "0", |
| "para": "00", |
| "v6ip": "", |
| "v": "" |
| } |
| |
| |
| stop_flag = False |
| |
| |
| |
| def check_internet_connection(): |
| try: |
| url = 'https://www.baidu.com' |
| headers = {'User-Agent': 'Mozilla/5.0', 'Content-Length': '1'} |
| req = urllib.request.Request(url, headers=headers) |
| urllib.request.urlopen(req, timeout=1) |
| return True |
| except URLError: |
| return False |
| |
| |
| def user_input_thread(): |
| while True: |
| global stop_flag |
| user_input = input() |
| if (user_input.lower() == "q"): |
| stop_flag = True |
| break |
| |
| |
| input_thread = threading.Thread(target=user_input_thread) |
| input_thread.start() |
| |
| while not stop_flag: |
| if check_internet_connection(): |
| print("\r已连接到Internet", end = ' ') |
| |
| else: |
| print("未连接到Internet, 正在尝试重新连接...") |
| conn = post(url=url, data=data) |
| sleep(1) |
| import requests |
| |
| import urllib.request |
| |
| import time |
| |
| import threading |
| |
| url = "http://10.255.0.41/0.htm" |
| |
| print("----------------AUST-认证脚本------------------") |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| data = { |
| |
| "DDDDD":"", |
| |
| "upass":"", |
| |
| "0MKKey":"%B5%C7%A1%A1%C2%BC", |
| |
| "v6ip":"" |
| |
| } |
| |
| |
| |
| stop_flag = False |
| |
| |
| |
| def check_internet_connection(): |
| |
| try: |
| |
| url = 'https://www.baidu.com' |
| |
| headers = {'User-Agent': 'Mozilla/5.0', 'Content-Length': '1'} |
| |
| req = urllib.request.Request(url, headers=headers) |
| |
| urllib.request.urlopen(req, timeout=1) |
| |
| return True |
| |
| except urllib.error.URLError: |
| |
| return False |
| |
| |
| |
| def user_input_thread(): |
| |
| while True: |
| |
| global stop_flag |
| |
| user_input = input() |
| |
| if (user_input.lower() == "q"): |
| |
| stop_flag = True |
| |
| break |
| |
| |
| |
| input_thread = threading.Thread(target=user_input_thread) |
| |
| input_thread.start() |
| |
| |
| |
| while not stop_flag: |
| |
| if check_internet_connection(): |
| |
| print("已连接到Internet") |
| |
| |
| |
| else: |
| |
| print("未连接到Internet") |
| |
| print("正在尝试重新连接...") |
| |
| conn = requests.post(url=url, data=data) |
| |
| time.sleep(2) |
Comments NOTHING