python脚本实现模拟登录
import requests """ http://182.92.130.63:8088/login """ url = "http://182.92.130.63:8088/login?action=login" user = "admin" passwd = "admin" type = "A" headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36', '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', 'Connection': 'keep-alive', } login_data = { 'user_id': user, 'pwd': passwd, 'tm_type':type } s = requests.post(url,data=login_data,headers=headers) print(s) print(s.status_code)
python脚本实现存活网站探测,即进行批量的网站请求
第一步
先将需要探测的网站全部写入文件:baidu.com子域名列表_Layer.txt
第二步
import requests with open("baidu.com子域名列表_Layer.txt", "r") as ff: a = ff.readlines() print(a) cleaned_list = [item.replace("\n", "") for item in a] print(len(cleaned_list)) print(cleaned_list) http = [] https = [] u = 0 for i in range(len(cleaned_list)): try: ull = cleaned_list[i] g = requests.get(f"http://{ull}", timeout=2) if g.status_code == 200: http.append(f"http://{ull}") u += 1 except: print('xx') for i in range(len(cleaned_list)): try: ull = cleaned_list[i] g = requests.get(f"https://{ull}", timeout=2) if g.status_code == 200: https.append(f"https://{ull}") u += 1 except: print('xx') with open("xhttp.txt", "w") as ss: for i in range(len(http)): ss.write(f"{http[i]}\n") with open("xhttps.txt", "w") as ss: for i in range(len(https)): ss.write(f"{https[i]}\n")