discuz论坛Python签到刷分
签到代码
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
account={
'帐号1':'密码1',
'帐号2':'密码2',
'帐号3':'密码3'
}
url='http://www.hostloc.com/member.php?
mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1'
def loopacc(account):
for user,password in account.items():
yield {
'username': user,
'password': password
}
for acc in loopacc(account):
s=requests.session()
s.post(url,data=acc)
for x in range(110,120):
uurl='http://www.hostloc.com/space-uid-{}.html'.format(x)
s.get(uurl)
print('{0:{1}<6s}\t刷分完成!'.format(acc.get('username'),chr(12288)))
刷分代码
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from urllib import request
from http import cookiejar
account_dict = {
'0': {'username': 'xxxx', 'password': 'xxx'},
'1': {'username': 'yyyy', 'password': 'xxx'},
'2': {'username': 'zzzz', 'password': 'xxx'},
}
def Login(URL, UserData):
__cookies = ''
__cookie = cookiejar.CookieJar()
__handler = request.HTTPCookieProcessor(__cookie)
__req = request.Request(URL, data=str(UserData).encode('utf-8'))
request.build_opener(__handler).open(__req)
for cookie in __cookie:
__cookies += cookie.name + '=' + cookie.value + ';'
return __cookies
def GetPage(URL, Header_Cookies):
__Header = {'Cookie': str(Header_Cookies)}
__req = request.Request(URL, headers=__Header)
return request.urlopen(__req).read().decode('utf-8')
def GetCredit(username, password):
Login_URL = 'http://www.hostloc.com/member.php?
mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1'
My_Home = 'http://www.hostloc.com/home.php?mod=spacecp&inajax=1'
user_data = 'username=' + str(username) + '&' + 'password=' + str(password)
My_Cookies = Login(Login_URL, user_data)
if '<td>' + str(username) + '</td>' not in GetPage(My_Home, My_Cookies):
isLogin = False
print('[%s] Login Fail!' % username)
else:
isLogin = True
print('[%s] Login Success!' % username)
if isLogin:
for __x in range(25297, 25309):
__url = 'http://www.hostloc.com/space-uid-{}.html'.format(__x)
GetPage(__url, My_Cookies)
if __name__ == '__main__':
for __i in range(0, len(account_dict)):
GetCredit(account_dict[str(__i)]['username'], account_dict[str(__i)]['password'])
文章来源
http://www.hostloc.com/thread-453002-1-1.html
http://www.hostloc.com/thread-452950-1-2.html