背景
ools在安全圈占据着举足轻重的位置,甚至有hw招聘者招聘时声明未拥有tools账号者不要。但tools签到问题一直令人烦躁,论坛也有许多自动签到的例子,今天公共号也分享个例子给大家参考。
所用技术
python 3.7.7
server酱
vps定时任务
教程及代码
server酱(此为参考tools大佬)教程:http://sc.ftqq.com/3.version
Linux定时任务:百度即可
python部分代码:
#登录
def login(username,passwd,questionid,answer):
headers = {"Content-Type":"application/x-www-form-urlencoded","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"}
data = {'username':username,'password':pwd,'questionid':questionid,'answer':answer}
#response = requests.post(url=login_url,headers=headers,data=data,proxies=proxies,verify=False)
response = requests.post(url=login_url,headers=headers,data=data)
error = re.findall('密码错误次数过多,请 15 分钟后重新登录',response.text)
cookie = requests.utils.dict_from_cookiejar(response.cookies)
if not re.findall('.*'+username+'.*',response.text):
print ('第'+str(i+1)+'个账号登陆失败,请检查用户名与密码')
print (error[0])
print ()
return 1
else:
print ('登陆成功')
return cookie
#签到
def Attendance(Att_ID,username):
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0",
"Accept":"application/json, text/javascript, */*; q=0.01",
"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With":"XMLHttpRequest",
}
data = {"formhash":Att_ID,"signsubmit":"apply"}
#response = requests.post(url=Attendance_url,headers=headers,cookies = cookies,data=data,proxies=proxies,verify=False)
response = requests.post(url=Attendance_url,headers=headers,cookies = cookies,data=data)
with open('tools_index.html',mode='w+') as f:
userinfo = f.write(response.text)
if re.findall('{"status":"(fail|success)"',response.text):
# print (re.findall('{"status":"(fail|success)"',response.text))
if re.findall('{"status":"(fail|success)"',response.text)[0] == 'fail':
print ('签到失败')
if username == "your-name":
requests.get('https://sc.ftqq.com/serverkey.send?text=t00ls签到&desp=签到失败')
elif username == "wdadelege":
requests.get('https://sc.ftqq.com/serverkey.send?text=t00ls签到&desp=签到失败')
else:
pass
else:
print ('签到成功')
if username == 'your-name':
requests.get('https://sc.ftqq.com/serverkey.send?text=t00ls签到&desp=签到成功')
elif username == 'wdadelege':
requests.get('https://sc.ftqq.com/serverkey.send?text=t00ls签到&desp=签到成功')
else:
pass
else:
print ('签到出错')
if username == 'your-name':
requests.get('https://sc.ftqq.com/serverkey.send?text=t00ls签到&desp=签到出错')
elif username == 'your-name':
requests.get('https://sc.ftqq.com/serverkey.send?text=t00ls签到&desp=签到出错')
else:
pass
备注
python源码关注公招回复tools签到即可
源码无法直接执行,需更换你的server-key
● 免责声明
本文章仅供安全人员学习研究,请遵守《中华人民共和国网络安全法》,勿利用本文中内容做违法的事,如有违反本公众号概不负责。
本文始发于微信公众号(凌晨安全):python+server酱+vps定时任务实现tools自动签到
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论