0-8-4 / miui-auto-tasks

一个自动化完成小米社区任务的脚本
MIT License
957 stars 174 forks source link

[Bug] Cookie有效检测有问题 #236

Closed Pandaver closed 11 months ago

Pandaver commented 12 months ago

Verify Steps

MIUITask Version

v1.7.3

Bug Found in Environment

Linux

Bug Found in Python Version

3.7

Describe the Bug

无法正确判断Cookie是否有效,多个账号出现相同情况

MIUITask Log

image

MIUITask Config

No response

Screenshots

No response

Night-stars-1 commented 12 months ago

提供log

Pandaver commented 12 months ago
09:52:01 - INFO  | system_info.print_info:13 - MIUI-AUTO-TASK v1.7.3
09:52:01 - INFO  | system_info.print_info:14 - ---------- 系统信息 -------------
09:52:01 - INFO  | system_info.system_info:25 - 操作系统平台: Linux-5.15.0-1036-oracle-aarch64-with
09:52:01 - INFO  | system_info.system_info:26 - 操作系统版本: #42~20.04.1-Ubuntu SMP Sat May 20 22:04:14 UTC 2023
09:52:01 - INFO  | system_info.system_info:27 - 操作系统名称: Linux
09:52:01 - INFO  | system_info.system_info:28 - 操作系统位元: ('64bit', '')
09:52:01 - INFO  | system_info.system_info:29 - 操作系统类型: aarch64
09:52:01 - INFO  | system_info.system_info:30 - 处理器信息: 
09:52:01 - INFO  | system_info.system_info:31 - Python 版本: 3.10.13 ('main', 'Oct 19 2023 07:01:22')
09:52:01 - INFO  | system_info.print_info:16 - ---------- 项目信息 -------------
09:52:01 - INFO  | system_info.print_info:17 - 这是一个免费且开源的项目,如果你是付费购买获得请务必退款
09:52:01 - INFO  | system_info.print_info:18 - 项目地址:https://github.com/0-8-4/miui-auto-tasks
09:52:01 - INFO  | system_info.print_info:19 - 欢迎 star,感谢所有项目贡献者,已经提交issues的人,帮助项目发展的人
09:52:01 - INFO  | system_info.print_info:20 - ---------- 脚本日志 -------------
09:52:02 - DEBUG | sign.check_daily_tasks:46 - {"time":0,"message":"success","entity":[{"head":{"img":"https://cdn.cnbj1.fds.api.mi-img.com/vipmlmodel/community_grow_up_level_icon/Color_48_3.png?GalaxyAccessKeyId\u003d5151729087601\u0026Expires\u003d9223372036854775807\u0026Signature\u003dNaYUKYhaQeRM7qaJQhnK8nTXZQU\u003d","showType":1,"title":"3段 初级成员","jumpText":"","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/growth?skipLocal\u003dtrue","desc":"社区成长等级"},"cakeType":1},{"head":{"img":"https://cdn.cnbj1.fds.api.mi-img.com/vipmlmodel/icons/badge/1/社区勋章_60s.png?GalaxyAccessKeyId\u003dAKU25VNGWI6E4RUEAW\u0026Expires\u003d9223372036854775807\u0026Signature\u003dUId7rM4TsrONiivzGigL4KJYPi0\u003d","showType":1,"title":"全新升级","jumpText":"","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/badge?skipLocal\u003dtrue","desc":"社区勋章"},"cakeType":1},{"head":{"title":"每日任务","jumpText":"查看成长值规则","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/growthRules"},"data":[{"secondTitle":"火爆","showType":1,"title":"抢先体验小米澎湃OS!","jumpText":"去参加","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/blindBox/signUp?skipLocal\u003dtrue\u0026activityKey\u003dHyper2023\u0026isOnline\u003d1","desc":"火热进行中"},{"showType":1,"title":"每日签到","jumpText":"","jumpUrl":"","desc":"签到奖励随机,以实际获得为准"},{"showType":1,"title":"浏览帖子超过10秒","jumpText":"去浏览","jumpUrl":"mio://vipaccount.miui.com/main?tab\u003dmio\u0026sub_tab\u003drecommend","desc":"每次成长值+1,每日上限1分"}],"cakeType":2},{"head":{"title":"新手任务","jumpUrl":""},"data":[{"showType":0,"title":"首次完善个人资料","jumpText":"已完成","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/personalInfo","desc":"成长值+10,仅限首次"},{"showType":0,"title":"首次完成实名认证","jumpText":"已完成","jumpUrl":"https://certify.mipay.com/","desc":"成长值+10,仅限首次"}],"cakeType":2},{"head":{"title":"其他任务","jumpText":"更多任务","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/newshop/gold"},"data":[{"showType":1,"title":"参与拔萝卜获得奖励","jumpText":"去看看","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/arrive","desc":"以活动页面为准"}],"cakeType":2}],"status":200}
09:52:02 - INFO  | login.login:84 - Cookie有效,跳过登录
09:52:04 - DEBUG | sign.check_daily_tasks:46 - {"time":0,"message":"success","entity":[{"head":{"img":"https://cdn.cnbj1.fds.api.mi-img.com/vipmlmodel/community_grow_up_level_icon/Color_48_3.png?GalaxyAccessKeyId\u003d5151729087601\u0026Expires\u003d9223372036854775807\u0026Signature\u003dNaYUKYhaQeRM7qaJQhnK8nTXZQU\u003d","showType":1,"title":"3段 初级成员","jumpText":"","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/growth?skipLocal\u003dtrue","desc":"社区成长等级"},"cakeType":1},{"head":{"img":"https://cdn.cnbj1.fds.api.mi-img.com/vipmlmodel/icons/badge/1/社区勋章_60s.png?GalaxyAccessKeyId\u003dAKU25VNGWI6E4RUEAW\u0026Expires\u003d9223372036854775807\u0026Signature\u003dUId7rM4TsrONiivzGigL4KJYPi0\u003d","showType":1,"title":"全新升级","jumpText":"","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/badge?skipLocal\u003dtrue","desc":"社区勋章"},"cakeType":1},{"head":{"title":"每日任务","jumpText":"查看成长值规则","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/growthRules"},"data":[{"secondTitle":"火爆","showType":1,"title":"抢先体验小米澎湃OS!","jumpText":"去参加","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/blindBox/signUp?skipLocal\u003dtrue\u0026activityKey\u003dHyper2023\u0026isOnline\u003d1","desc":"火热进行中"},{"showType":1,"title":"每日签到","jumpText":"","jumpUrl":"","desc":"签到奖励随机,以实际获得为准"},{"showType":1,"title":"浏览帖子超过10秒","jumpText":"去浏览","jumpUrl":"mio://vipaccount.miui.com/main?tab\u003dmio\u0026sub_tab\u003drecommend","desc":"每次成长值+1,每日上限1分"}],"cakeType":2},{"head":{"title":"新手任务","jumpUrl":""},"data":[{"showType":0,"title":"首次完善个人资料","jumpText":"已完成","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/personalInfo","desc":"成长值+10,仅限首次"},{"showType":0,"title":"首次完成实名认证","jumpText":"已完成","jumpUrl":"https://certify.mipay.com/","desc":"成长值+10,仅限首次"}],"cakeType":2},{"head":{"title":"其他任务","jumpText":"更多任务","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/newshop/gold"},"data":[{"showType":1,"title":"参与拔萝卜获得奖励","jumpText":"去看看","jumpUrl":"https://web.vip.miui.com/page/info/mio/mio/arrive","desc":"以活动页面为准"}],"cakeType":2}],"status":200}
09:52:04 - INFO  | miuitask.main:33 - 开始执行抢先体验小米澎湃OS!任务
09:52:04 - ERROR | miuitask.main:41 - 未找到抢先体验小米澎湃OS!任务
09:52:04 - INFO  | miuitask.main:33 - 开始执行每日签到任务
09:52:04 - DEBUG | utils.get_token:221 - {"msg":"","code":0,"data":{"result":false,"id":"b2f270ef14bf4c65a879831632734398","url":"https://static-verify.sec.xiaomi.com/v2/html/check.html?t=1&k=3dc42a135a8d45118034d1ab68213073&e=471QJiJ38K%2BBHnEzkjCUq4Zl7FFJ97%2FX%2FwbNqlpy7AY9E4zk3G4T0GU7x0D1QK4alcqR6NeRlB1t1VKC5XpJL4UchjlYygmCmyXQ728AaUfIDoBBLbivYBboySt%2BRsr%2BdxNRAvJvQUkg5y%2FobUwS2CXLVNdla1ywB0HB1usFmeHB4Gq3szFAfwdI0YmqgSQ1%2BmfVKUh9j8sjAqEGv1RpMC201%2Foje77X0nyK7s3eQDs1NmeZr6MJyyFnSUt%2B5HeqlfIVkEtjd8Fut78SDCUH9mrGkVJrYEGzs%2FxN9FswnNEmcRsF8V2r3RZMHwKjoH6FA3kOWbArVgS%2BK8kwLFVMC8TLBEgoN8uC6WqPQMfC9To%3D&locale=zh_cn&eventId=b2f270ef14bf4c65a879831632734398&c=8351ae0ef2e0b2afdbafc3c4a2d22e6e&l=f35d968591db3e4698f14e1fb1c8cbf5","token":""}}
09:52:04 - ERROR | utils.get_token:227 - 遇到人机验证码, 尝试调用解决方案
09:52:14 - DEBUG | captcha.get_validate:41 - {"status":"success","data":{"result":"success","validate":"23c32faac171b127019f67936770cb17","challenge":"f35d968591db3e4698f14e1fb1c8cbf545","score":"1","msg":[]}}
09:52:15 - DEBUG | utils.get_token_by_captcha:118 - {"msg":"","code":0,"data":{"result":true,"id":"b2f270ef14bf4c65a879831632734398","token":"vPyYxUgH6oAC1IFUmCk6gMW3TySCbyp4BTnzO66D0h/vSz7NwFW6sDtHnHTBVYaFtbEO46PtuVbDVVwgBR3htn8A/oWhpxGbA8akqA/SKs64Fk4eNT5C+IXrNAYBc5BKkfmD8RwrQ1w7T3ixH+vrZSIm8oet8SmjIX6hRRuXrJTZufNx0ysmCAPeC4XLiMpBPlt9RWo24y/GU+is4GWI2W6c2SJ6WGhVutsdlQSLQJS5WeaIRJiPK2p56i0A1hr1yFJqiTtVzrfTma5V8nAEmBZ7kYkxr2BkRgcrqWj1BzEOXUYairfR+2mhWawHHcz8"}}
09:52:16 - DEBUG | sign.sign:92 - {"code":401}
09:52:16 - ERROR | sign.sign:102 - 每日签到失败: Cookie无效
09:52:16 - INFO  | miuitask.main:33 - 开始执行浏览帖子超过10秒任务
09:52:16 - DEBUG | sign.sign:92 - {"code":401}
09:52:16 - ERROR | sign.sign:102 - 浏览帖子超过10秒失败: Cookie无效
09:52:16 - INFO  | miuitask.main:33 - 开始执行参与拔萝卜获得奖励任务
09:52:17 - DEBUG | sign.sign:92 - {"code":401,"loginUrl":"https://account.xiaomi.com/pass/serviceLogin?callback=https%3A%2F%2Fapi.vip.miui.com%2Fsts%3Fsign%3DMC4VA4SOyxWQ6u34zUTdMvRssgk%253D%26followup%3Dhttps%253A%252F%252Fapi.vip.miui.com%252Fapi%252Fcarrot%252Fpull%253Fmiui_vip_ph%253DPnhHE7E4aZpGfZmlmpoULA%25253D%25253D%2526token%253D%25257B%252527miui_vip_ph%252527%25253A%252520%252527PnhHE7E4aZpGfZmlmpoULA%25253D%25253D%252527%25252C%252520%252527token%252527%25253A%252520%25257B...%25257D%25257D&sid=miui_vip"}
09:52:17 - ERROR | sign.sign:102 - 参与拔萝卜获得奖励失败: Cookie无效
gzmars commented 11 months ago

重新抓包,更新一下miui_vip_ph= miui_vip_slh= miui_vip_serviceToken=

Night-stars-1 commented 11 months ago

暂时无法复现

a312354805 commented 11 months ago

暂时无法复现

小米社区签到

MIUI-AUTO-TASK v1.7.3 ---------- 系统信息 ------------- 操作系统平台: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.22.90 操作系统版本: #1 SMP Wed May 18 16:02:34 UTC 2022 操作系统名称: Linux 操作系统位元: ('64bit', 'ELF') 操作系统类型: x86_64 处理器信息: x86_64 Python 版本: 3.10.9 ('main', 'Nov 24 2023 16:40:18') ---------- 项目信息 ------------- 这是一个免费且开源的项目,如果你是付费购买获得请务必退款 项目地址:https://github.com/0-8-4/miui-auto-tasks 欢迎 star,感谢所有项目贡献者,已经提交issues的人,帮助项目发展的人 ---------- 脚本日志 ------------- Cookie有效,跳过登录 开始执行抢先体验小米澎湃OS!任务 未找到抢先体验小米澎湃OS!任务 开始执行每日签到任务 遇到人机验证码, 尝试调用解决方案 开始使用[2Captcha]解密验证码 获取解密参数成功 每日签到失败: Cookie无效 开始执行浏览帖子超过10秒任务 浏览帖子超过10秒失败: Cookie无效 开始执行参与拔萝卜获得奖励任务 参与拔萝卜获得奖励失败: Cookie无效

我也出现了这个情况,但是第二次会重新登陆账号。

Pandaver commented 11 months ago

截图_20231212122334

经常出现,再运行一次就可以正常了

截图_20231212122511

Adlyq commented 11 months ago

@a312354805 cookies好像就一天有效期,你在每天相同时间执行的脚本

在cookies失效之前检测的,所以有效,但是,检测后下一秒失效了,所以寄了 我的解决方案是加一个sleep random -m 60 -x 10

Pandaver commented 11 months ago

@a312354805 cookies好像就一天有效期,你在每天相同时间执行的脚本

在cookies失效之前检测的,所以有效,但是,检测后下一秒失效了,所以寄了 我的解决方案是加一个sleep random -m 60 -x 10

牛逼,确实是这样,这都被你想到了!

Pandaver commented 11 months ago

执行前随机延迟0-60秒

delay=$(($RANDOM % 61)); echo "随机延迟 $delay 秒"; sleep $delay

截图_20231212125114

过几天看看还会不会出现这个情况

gzmars commented 11 months ago

青龙 v2.16.5 配置文件里有设置随机时间和定点不随机的设置呀 image

Pandaver commented 11 months ago

好使