coding:utf-8
**import **re
**import **time
**import **urllib
**import **urllib2
**import **cookielib
**class *phpwind():
**def **init(self,url,username,password,jumpurl=""):
self.host=url
self.username=username
self.password=password
self.hash=re.findall("var verifyhash = '.?’;",urllib.urlopen(self.host).read())[0][18:-2]
self.loginurl=self.host+"/login.php?nowtime="+self.getTime()+"&verify=%s"%self.hash
self.siginurl=self.host+’/u.php’
self.siginsss=(self.host+"/jobcenter.php?action=punch&verify=%s&nowtime="+self.getTime()+"&verify=%s")%(self.hash,self.hash)
self.jumpurl =jumpurl
**if **self.jumpurl==’’:
self.jumpurl=self.host+"/index.php"
self.cookie=cookielib.CookieJar()
self.opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie))
**def **login(self):
postdata = urllib.urlencode({
‘ajax’: ‘1’,
‘cktime’: ‘31536000’,
‘jumpurl’: self.jumpurl,
‘lgt’: ‘0’,
‘pwpwd’: self.password,
‘pwuser’: self.username,
‘step’: ‘2’
})
self.opener.open(self.loginurl, postdata)
result=self.opener.open(self.jumpurl)
**if **len(re.findall(“var windid = '”+self.username+"’;",result.read())):
print “login secuss”
**return **True
# print "login faild"
**return **False
**def ****getTime**(self):
**return **str(time.time()).replace(’.’, ‘’) + ‘0’
**def **read(self):
**return **self.opener.open(self.host).read().decode(‘gbk’).encode(‘utf-8’)
**def **issigin(self):
**if **“每日打卡” **in **self.opener.open(self.siginurl).read().decode(‘gbk’).encode(‘utf-8’):
**return **False
**return **True
**def **sigin(self):
postdata = urllib.urlencode({
‘step’: ‘2’
})
**if **“你已经打卡,请明天再试” **in **self.opener.open(self.siginsss, postdata).read().decode(“gbk”).encode(“utf-8”):
**return **True
**return **False
**def *pinfo(self):
**print **’=====================================’
**print **‘站点名称: %s’%re.findall(".?",self.opener.open(self.host).read().decode(“gbk”).encode(“utf-8”))[0][7:-8]
**print **‘用户: %s %s’%(self.username,“已经签到” **if **self.issigin() **else **“并没有签到” )
**for **x **in **re.findall("
**print **x[4:-5]
**print **’=====================================’
‘’‘http://bbs.mydigit.cn/jobcenter.php?action=punch&verify=1849a44a&nowtime=1475251499535&verify=1849a44a’’’
a=phpwind(“http://bbs.mydigit.cn”,“user”,‘pass’)
**if **a.login():
a.pinfo()
本想说网上没有自己写的,,结果发晚了,,我暑假写的,,当时真没有,,
大家可以自己改改,当时本来还想写写其他的比如一天送出去所有评分刷好感度之类的,后来怕有人举报封号就不值得了。。