用浏览器后台脚本导入指定cookie实现后台登录

动作需求 · 3752 次浏览
哈哈哈12345 创建于 2021-11-13 15:36

要实现的目标或功能:在浏览器用后台脚本的方式导入指定cookie实现后台登录

期望的结果:用户选中一段cookie,获取cookie值后点击动作即可后台实现导入这个cookie值,整个动作后台完成不影响用户当前的操作,不占用鼠标

实际的结果:本人知识有限,目前折中安装了一个导入cookie的扩展插件,然后通过模拟按键的方式点击插件复制粘贴cookie导入,而且由于模拟按键是通过识图的方式识别点击插件,一个速度慢,一个成功率不高,有的时候换个环境,换台电脑,就不行了,或者操作的时候不小心用了鼠标也会失败,效率实在不高

 

 

我搜了论坛里面跟cookie相关的话题,好像只有讨论获取cookie的一些动作和子程序,暂时没有找到有导入cookie的动作和子程序,希望有厉害的大神们帮忙看下怎么写这个脚本才能实现我这需求呢,感激不尽!!

 

以下是我提供的一个拼多多账号的示例cookie,大神可以拿来测试下登录

 

[{"domain":".mobile.yangkeduo.com","expirationDate":1668323828.873189,"hostOnly":false,"httpOnly":false,"name":"jrpl","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"SSK0kDOWS3pk8UL3b7hzCiH7PQHI3FH3"},{"domain":".mobile.yangkeduo.com","expirationDate":1668323828.873328,"hostOnly":false,"httpOnly":false,"name":"njrpl","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"SSK0kDOWS3pk8UL3b7hzCiH7PQHI3FH3"},{"domain":".mobile.yangkeduo.com","expirationDate":1668323828.873421,"hostOnly":false,"httpOnly":false,"name":"dilx","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"PESWnjyiEdURmtiSOqQVP"},{"domain":".yangkeduo.com","expirationDate":2145916555.177029,"hostOnly":false,"httpOnly":false,"name":"api_uid","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"Ckgi3WGOA2QH/ABrmOJVAg=="},{"domain":"mobile.yangkeduo.com","expirationDate":2500610538,"hostOnly":true,"httpOnly":false,"name":"_nano_fp","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"XpEqn5Ebn5Uql0dJnT_n0IeE~pxsDhFpSlDxk7Vb"},{"domain":"mobile.yangkeduo.com","expirationDate":1638519813.920014,"hostOnly":true,"httpOnly":false,"name":"13125-boutique_hub_monthly_card","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"do0l3ytjw7ms3aou"},{"domain":"mobile.yangkeduo.com","hostOnly":true,"httpOnly":true,"name":"JSESSIONID","path":"/","sameSite":"unspecified","secure":false,"session":true,"storeId":"0","value":"8DD6492FD2ED6E970F27F406B0109D53"},{"domain":"mobile.yangkeduo.com","expirationDate":1639381622.758874,"hostOnly":true,"httpOnly":false,"name":"webp","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"1"},{"domain":"mobile.yangkeduo.com","hostOnly":true,"httpOnly":false,"name":"ua","path":"/","sameSite":"unspecified","secure":false,"session":true,"storeId":"0","value":"Mozilla%2F5.0%20(iPhone%3B%20CPU%20iPhone%20OS%2014_2%20like%20Mac%20OS%20X)%20AppleWebKit%2F605.1.15%20(KHTML%2C%20like%20Gecko)%20Version%2F14.0.1%20Mobile%2F15E148%20Safari%2F604.1"},{"domain":"mobile.yangkeduo.com","expirationDate":1637394413.875934,"hostOnly":true,"httpOnly":false,"name":"pdd_vds","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"gaeLuInOeoLoOidmIbmQsinmxbeLGLbElIbGsONGLOItNnOmdtmtGaeIIEeN"},{"domain":"mobile.yangkeduo.com","expirationDate":1668325621,"hostOnly":true,"httpOnly":false,"name":"PDDAccessToken","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"3G4RR6ODYBJWKDPWMV3KREMABOZBVFD6DVW5VPCFRAIHVJKHXS5A1107e3f"},{"domain":"mobile.yangkeduo.com","expirationDate":1636791422.690768,"hostOnly":true,"httpOnly":false,"name":"rec_list_personal","path":"/","sameSite":"unspecified","secure":false,"session":false,"storeId":"0","value":"rec_list_personal_jxokmj"}]

 

 

哈哈哈12345 最后更新于 2021/11/13

回复内容
双鱼6688 2021-11-16 15:18
#1

应该可以用JS设置cookies,对标签页运行js脚本,然后再刷新标签页,不知道这样可行不。

BIG_DEVIL 2021-11-23 09:55
#2

登录不单单只是需要cookie吧,账号等信息本身也是请求的参数

回复主贴