Python 实现 NWU 校园网登陆

我懒得写思路了 hhh
#!usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2,urllib
URL = "http://10.0.1.250/a70.htm"

username = '2015117187'
password = '********'
data = r"DDDDD="+username+"&upass="+password+"&R1=0&R2=&R6=0¶=00&0MKKey=123456&v6ip=&hid1=1131&hid2=38540002&cn=1"
#gett = urllib2.urlopen(URL)

req = urllib2.Request(URL)
req.add_header('Host',"10.0.1.250")
req.add_header('User-Agent',"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.3637.220 Safari/537.36")
req.add_header('Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",)
req.add_header('Accept-Language',"zh-CN,zh;q=0.8")
req.add_header('Accept-Encoding',"gzip, deflate")
req.add_header('Accept-Type',"application/x-www-form-urlencoded")
req.add_header('Content-Length',"99")
req.add_header('Referer',"http://10.0.1.237/a70.htm")
req.add_header('Cookie',"PHPSESSID=37hfnmarc6d9o8l2naegqdi806")
req.add_header('Connection',"keep-alive")
req.add_header('Upgrade-Insecure-Requests',"1")
req.add_header('Cache-Control','max-age=0')
req.add_header('Origin','http://10.0.1.250')
req.add_header('Referer','http://10.0.1.250/a70.htm')
response = urllib2.urlopen(req,data.encode('utf-8'))
code = response.getcode()
print code


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值