|
本帖最后由 A23187 于 2020-3-13 23:14 编辑
看到有人发过python等其他的版本,自己在用的就一个 bash,再配合 cronrtab 就可以自动刷了
- #!/bin/bash
- cookie='这里放你的cookie'
- recipient='这里放你的邮箱'
- err() {
- echo $1 | mailx -s '【错误】全球主机交流论坛' $recipient
- }
- log() {
- # echo $1 | mailx -s '【成功】全球主机交流论坛' $recipient
- echo $1
- }
- # 签到
- curl -s 'https://hostloc.wiki/forum.php' -H 'authority: hostloc.wiki' -H 'upgrade-insecure-requests: 1' -H 'sec-fetch-user: ?1' \
- -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
- -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: zh-CN,zh;q=0.9' \
- -H "$cookie" --compressed --output /dev/null
- if [[ $? -ne 0 ]]; then
- err '签到失败,可能需要更新 cookie'
- exit 1
- fi
- sleep 2
- # 访问他人空间 10 次
- n=10
- while [[ $n -gt 0 ]]; do
- uid=$RANDOM
- if [[ ${uids[uid]} -eq 1 ]]; then
- continue
- fi
- uids[uid]=1
- curl -s "https://hostloc.wiki/space-uid-$uid.html" -H 'authority: hostloc.wiki' -H 'upgrade-insecure-requests: 1' -H 'sec-fetch-user: ?1' \
- -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
- -H 'sec-fetch-site: none' -H 'sec-fetch-mode: navigate' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: zh-CN,zh;q=0.9' \
- -H "$cookie" --compressed --output /dev/null
- if [[ $? -eq 0 ]]; then
- n=$((n-1))
- else
- err '刷积分失败,可能需要更新 cookie'
- exit 2
- fi
- sleep 2
- done
- log '成功签到 + 刷积分'
- exit 0
复制代码
脚本主要是先登录签到,然后随机访问他人空间,共10次。失败时会发邮件给自己提示要更新 cookie
至于结合 crontab,我想也不用我多说吧。 |
|