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
| import requests
import re
xuehao = "" passwd = "" ip = "172.19.75.100"
url = "http://1.1.1.1/" headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,tr;q=0.7,ee;q=0.6", "Cache-Control": "no-cache", "Connection": "keep-alive", "DNT": "1", "Pragma": "no-cache", "Referer": "http://172.168.254.4/", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" }
response = requests.get(url, headers=headers, verify=False)
pattern = r'wlanuserip=(.*?)&'
match = re.search(pattern, str(response.url))
wlanuserip = match.group(1)
print("wlanuserip 的值是:", wlanuserip)
session = requests.Session()
session.headers.update({ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" })
cookies = { "program": "aygxy1807", "vlan": "0", "ssid": "null", "areaID": "null", "ISP_select": "", "md5_login2": f"%2C0%2C{xuehao}%7C{passwd}", "ip": f"{ip}" } session.cookies.update(cookies)
headers = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,tr;q=0.7,ee;q=0.6", "Cache-Control": "no-cache", "DNT": "1", "Pragma": "no-cache", "Referer": "http://172.168.254.4/" }
url = "http://172.168.254.4:801/eportal/portal/login?callback=dr1003&login_method=1&user_account=%2C0%2C"+str(xuehao)+"&user_password="+str(passwd)+"&wlan_user_ip="+str(wlanuserip)+"&wlan_user_ipv6=&wlan_user_mac=000000000000&wlan_ac_ip=172.168.254.100&wlan_ac_name=&jsVersion=4.2.1&terminal_type=1&lang=zh-cn&v=1540&lang=zh"
response = session.get(url, headers=headers)
print(response.text)
|