openwrt/gargoyle自动签京豆

用永华WR330 刷routeros做主路由后,ea8500 CPU性能强劲,只是作为AP有点浪费。
gargoyle石像鬼1.14.0,安装docker存在版本兼容问题。改为安装python环境,自己写个函数。
ea8500存储空间Flash128MB,安装了adguardhome做广告过滤。有个1GB的微软优盘做extroot扩容,gargoyle这个省事,openwrt需要输入指令。

在这里插入图片描述安装python3 。

  • 将取得的cookie放在一个txt文件中,python脚本读取它。
  • 添加定时命令
0 5 * * * /usr/bin/python /root/jd.py >/dev/null 2>&1
  • python脚本
import requests
import asyncio
import random

url = "https://api.m.jd.com/client.action?functionId=signBeanAct&body=%7B%22fp%22%3A%22-1%22%2C%22shshshfp%22%3A%22-1%22%2C%22shshshfpa%22%3A%22-1%22%2C%22referUrl%22%3A%22-1%22%2C%22userAgent%22%3A%22-1%22%2C%22jda%22%3A%22-1%22%2C%22rnVersion%22%3A%223.9%22%7D&appid=ld&client=apple&clientVersion=10.0.4&networkType=wifi&osVersion=14.8.1&uuid=3acd1f6361f86fc0a1bc23971b2e7bbe6197afb6&openudid=3acd1f6361f86fc0a1bc23971b2e7bbe6197afb6&jsonp=jsonp_1645885800574_58482";
f=open('/root/c.txt','rb')
a=f.readlines()[0]

headers  = {"Connection":'keep-alive',
            "Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
            "Cache-Control": 'no-cache',
            "User-Agent": "okhttp/3.12.1;jdmall;android;version/10.3.4;build/92451;",
            "accept": "*/*",
            "connection": "Keep-Alive",
            "Accept-Encoding": "gzip,deflate",
            "Cookie":a
            }


r=random.randint(100,600)
async def main():
	await asyncio.sleep(r)
	response = requests.post(url=url, headers=headers)

asyncio.run(main())

避免定时打卡,这里用异步来做随机的时间延迟,就不写在定时任务命令上。

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

容沁风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值