├── utils ├── JDJRValidator.js ├── .DS_Store ├── sharecodes.json ├── rs_config.js ├── proxy-wind.js ├── baseCookie.js ├── ql.js ├── jsToken.js ├── Rebels_proxy.js └── Rebels_3_0.js ├── function ├── config.js ├── .DS_Store ├── jdcookie.js ├── qlApi.js ├── ql.js ├── common.js └── getH5st3_0.js ├── docker ├── bot │ ├── jd.png │ ├── requirements.txt │ └── setup.py ├── proc_file.sh ├── docker_entrypoint.sh ├── Dockerfile ├── auto_help.sh ├── default_task.sh └── Readme.md ├── package.json ├── README.md ├── jdCookie.js ├── QLDependency.sh ├── HarbourJ ├── jdCookie.py ├── jd_dpcj.py └── jd_shopFollowGift.py ├── ql.js ├── jd_wxtoken_m.js ├── jd_wq_wxsign.js ├── jd_fans_videofangrowth.js ├── jd_mkredrain.js ├── jd_plus2bean.js └── jd_hbCount.js /utils/JDJRValidator.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /function/config.js: -------------------------------------------------------------------------------- 1 | module.exports = {"ThreadJs":[],"invokeKey":"RtKLB8euDo7KwsO0"} -------------------------------------------------------------------------------- /docker/bot/jd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wudongdefeng/tem-update/HEAD/docker/bot/jd.png -------------------------------------------------------------------------------- /utils/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wudongdefeng/tem-update/HEAD/utils/.DS_Store -------------------------------------------------------------------------------- /function/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wudongdefeng/tem-update/HEAD/function/.DS_Store -------------------------------------------------------------------------------- /utils/sharecodes.json: -------------------------------------------------------------------------------- 1 | { 2 | "cfd":["abcd", "abc123"], 3 | "jxfactory":["tuanid:123", "tuanid:234"] 4 | } 5 | -------------------------------------------------------------------------------- /docker/bot/requirements.txt: -------------------------------------------------------------------------------- 1 | python_telegram_bot==13.0 2 | requests==2.23.0 3 | MyQR==2.3.1 4 | telegram==0.0.1 5 | -------------------------------------------------------------------------------- /utils/rs_config.js: -------------------------------------------------------------------------------- 1 | //环境变量配置文件,一般请勿修改 2 | 3 | const rsbels_config = {} 4 | 5 | module.exports = rsbels_config 6 | -------------------------------------------------------------------------------- /docker/bot/setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Author : iouAkira(lof) 3 | # @mail : e.akimoto.akira@gmail.com 4 | # @CreateTime: 2020-11-02 5 | # @UpdateTime: 2021-03-21 6 | 7 | from setuptools import setup 8 | 9 | setup( 10 | name='jd-scripts-bot', 11 | version='0.2', 12 | scripts=['jd_bot', ], 13 | ) 14 | -------------------------------------------------------------------------------- /utils/proxy-wind.js: -------------------------------------------------------------------------------- 1 | // 引入必要的库 2 | const axios = require('axios'); 3 | 4 | // 将获取内容和赋值操作封装到一个函数中 5 | async function setGlobalHttpProxy() { 6 | let response = await axios.get(process.env.proxy_wind_url); 7 | let data = response.data; 8 | // 将结果赋值给global.GLOBAL_AGENT.HTTP_PROXY 9 | global.GLOBAL_AGENT = {HTTP_PROXY: data}; 10 | console.log(global.GLOBAL_AGENT.HTTP_PROXY); // 输出HTTP代理内容 11 | } 12 | 13 | // 导出函数,以便在其他脚本中使用 14 | module.exports = setGlobalHttpProxy; 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test": "echo \"Error: no test specified\" && exit 1" 4 | }, 5 | "dependencies": { 6 | "crypto-js": "^4.0.0", 7 | "download": "^6.2.5", 8 | "got": "^11.5.1", 9 | "http-server": "^0.12.3", 10 | "qrcode-terminal": "^0.12.0", 11 | "request": "^2.88.2", 12 | "tough-cookie": "^4.0.0", 13 | "tunnel": "0.0.6", 14 | "ws": "^7.4.3", 15 | "jsdom": "^17.0.0", 16 | "form-data": "^4.0.0", 17 | "js-base64": "^3.7.2", 18 | "png-js": "^1.0.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /docker/proc_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [[ -f /usr/bin/jd_bot && -z "$DISABLE_SPNODE" ]]; then 4 | CMD="spnode" 5 | else 6 | CMD="node" 7 | fi 8 | 9 | echo "处理jd_crazy_joy_coin任务。。。" 10 | if [ ! $CRZAY_JOY_COIN_ENABLE ]; then 11 | echo "默认启用jd_crazy_joy_coin杀掉jd_crazy_joy_coin任务,并重启" 12 | eval $(ps -ef | grep "jd_crazy_joy_coin" | grep -v "grep" | awk '{print "kill "$1}') 13 | echo '' >/scripts/logs/jd_crazy_joy_coin.log 14 | $CMD /scripts/jd_crazy_joy_coin.js | ts >>/scripts/logs/jd_crazy_joy_coin.log 2>&1 & 15 | echo "默认jd_crazy_joy_coin重启完成" 16 | else 17 | if [ $CRZAY_JOY_COIN_ENABLE = "Y" ]; then 18 | echo "配置启用jd_crazy_joy_coin,杀掉jd_crazy_joy_coin任务,并重启" 19 | eval $(ps -ef | grep "jd_crazy_joy_coin" | grep -v "grep" | awk '{print "kill "$1}') 20 | echo '' >/scripts/logs/jd_crazy_joy_coin.log 21 | $CMD /scripts/jd_crazy_joy_coin.js | ts >>/scripts/logs/jd_crazy_joy_coin.log 2>&1 & 22 | echo "配置jd_crazy_joy_coin重启完成" 23 | else 24 | eval $(ps -ef | grep "jd_crazy_joy_coin" | grep -v "grep" | awk '{print "kill "$1}') 25 | echo "已配置不启用jd_crazy_joy_coin任务,仅杀掉" 26 | fi 27 | fi 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 如果您要把代码用于非法用途,请不要下载。 2 | 如果用于非法用途,请自觉删除。 3 | 如果您用于非法用途,违反国家法律,作者概不负责! 4 | 5 | ## 自动登记实物奖品收货地址 6 | 7 | export WX_ADDRESS="" # 变量格式:收件人@手机号@省份@城市@区县@详细地址@6位行政区划代码@邮编,需按照顺序依次填写,多个用管道符分开(6位行政区划代码自己查地图,也可用身份证号前六位) 8 | 9 | export WX_ADDRESS_BLOCK="" # 黑名单关键词,多个关键词用@分开 10 | 11 | ## 代理组件库相关控制变量 12 | # 定义 HTTP 代理地址(必填) 13 | export RS_PROXY_TUNNRL="" # 例:http://127.0.0.1:8080 14 | # 过滤不需要代理的地址(必填) 15 | export RS_NO_PROXY='127.0.0.1,172.17.0.1,*.telegram.org,oapi.dingtalk.com' # 用英文逗号分割多个地址,这里特别注意要把用到的内网ip过滤掉 16 | # 定义代理白名单(js文件名关键字如fruit),多个用 & 隔开 17 | export RS_TUNNRL_WHITRLIST="" # 例:export RS_TUNNRL_WHITRLIST="fruit&car" # 用&隔开,代表含有‘fruit’,‘car’文件名的脚本会启用全局代理。前提是已经填写上述变量才能启用成功。 18 | 需要额外安装代理依赖库才能使用 npm install -g axios ,npm install -g https-proxy-agent 19 | 20 | ## 自定义SIGN 21 | export JD_SIGN_API="http://127.0.0.1:32772/sign" 22 | 23 | ## 全局或非全局禁止PIN运行任务 24 | 配置用法:变量 RS_FilterPin(任务1|任务2@pin1,pn2,pin3&任务3@pin4,pin5&pin6) 25 | 支持PIN全局不运行任务 26 | 支持部分PIN任务不运行 27 | 支持部分PIN多个任务不运行 28 | export RS_FilterPin="任务1|任务2@pin1,pn2,pin3&任务3@pin4,pin5&pin6" // 请注意修改成自己的任务名和PIN值 29 | 解释: 30 | 任务1和任务2,禁止pin1,pn2,pin3执行任务,任务3,禁止pin4,pin5执行任务,pin6全局不执行任务 31 | -------------------------------------------------------------------------------- /utils/baseCookie.js: -------------------------------------------------------------------------------- 1 | function setBaseCookie() { 2 | var cookie = []; 3 | 4 | function genUuid() { 5 | return new Date().getTime() + '' + parseInt(2147483647 * Math.random()); 6 | } 7 | 8 | function setCookie(e, t, i) { 9 | if (e) { 10 | var n = ''; 11 | if (i) { 12 | var a = new Date(); 13 | a.setTime(a.getTime() + i), (n = ';expires=' + a.toGMTString()); 14 | } 15 | document.cookie = e + '=' + t + n + ';path=/;domain=jd.com;'; 16 | } 17 | } 18 | 19 | function setJdv(e, t) { 20 | var i = isPrey(10) && (!e || e.length > 400) ? t + '|direct|-|none|-|' + new Date().getTime() : e; 21 | setCookie('__jdv', i, 1296000000); 22 | } 23 | 24 | function isPrey(e) { 25 | if (e >= 100) return !0; 26 | var t = uuid, 27 | r = t.substr(t.length - 2); 28 | return !!r && 1 * r < e; 29 | } 30 | 31 | var r = 122270672, 32 | i = genUuid(), 33 | s = parseInt(new Date().getTime() / 1e3); 34 | var uuid = i; 35 | 36 | setCookie('__jda', [r, i, s, s, s, 1].join('.'), 15552000000); 37 | setCookie('__jdb', [r, 1, i + '|' + 1, s].join('.'), 1800000); 38 | var j = encodeURIComponent([r, 'direct', '-', 'none', '-', new Date().getTime()].join('|')); 39 | setJdv(j, r); 40 | setCookie('__jdc', r); 41 | setCookie('mba_muid', encodeURI(i)); 42 | 43 | return cookie.join(''); 44 | } 45 | 46 | module.exports.setBaseCookie = setBaseCookie; 47 | -------------------------------------------------------------------------------- /jdCookie.js: -------------------------------------------------------------------------------- 1 | /* 2 | 此文件为Node.js专用。其他用户请忽略 3 | */ 4 | //此处填写京东账号cookie。 5 | let CookieJDs = [ 6 | '',//账号一ck,例:pt_key=XXX;pt_pin=XXX; 7 | '',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推 8 | ] 9 | // 判断环境变量里面是否有京东ck 10 | if (process.env.JD_COOKIE) { 11 | if (process.env.JD_COOKIE.indexOf('&') > -1) { 12 | CookieJDs = process.env.JD_COOKIE.split('&'); 13 | } else if (process.env.JD_COOKIE.indexOf('\n') > -1) { 14 | CookieJDs = process.env.JD_COOKIE.split('\n'); 15 | } else { 16 | CookieJDs = [process.env.JD_COOKIE]; 17 | } 18 | } 19 | if (JSON.stringify(process.env).indexOf('GITHUB')>-1) { 20 | console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`); 21 | !(async () => { 22 | await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`) 23 | await process.exit(0); 24 | })() 25 | } 26 | CookieJDs = [...new Set(CookieJDs.filter(item => !!item))] 27 | console.log(`\n====================共${CookieJDs.length}个京东账号Cookie=========\n`); 28 | console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}=====================\n`) 29 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; 30 | for (let i = 0; i < CookieJDs.length; i++) { 31 | if (!CookieJDs[i].match(/pt_pin=(.+?);/) || !CookieJDs[i].match(/pt_key=(.+?);/)) console.log(`\n提示:京东cookie 【${CookieJDs[i]}】填写不规范,可能会影响部分脚本正常使用。正确格式为: pt_key=xxx;pt_pin=xxx;(分号;不可少)\n`); 32 | const index = (i + 1 === 1) ? '' : (i + 1); 33 | exports['CookieJD' + index] = CookieJDs[i].trim(); 34 | } 35 | -------------------------------------------------------------------------------- /function/jdcookie.js: -------------------------------------------------------------------------------- 1 | /* 2 | 此文件为Node.js专用。其他用户请忽略 3 | */ 4 | //此处填写京东账号cookie。 5 | let CookieJDs = [ 6 | '',//账号一ck,例:pt_key=XXX;pt_pin=XXX; 7 | '',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推 8 | ] 9 | // 判断环境变量里面是否有京东ck 10 | if (process.env.JD_COOKIE) { 11 | if (process.env.JD_COOKIE.indexOf('&') > -1) { 12 | CookieJDs = process.env.JD_COOKIE.split('&'); 13 | } else if (process.env.JD_COOKIE.indexOf('\n') > -1) { 14 | CookieJDs = process.env.JD_COOKIE.split('\n'); 15 | } else { 16 | CookieJDs = [process.env.JD_COOKIE]; 17 | } 18 | } 19 | if (JSON.stringify(process.env).indexOf('GITHUB')>-1) { 20 | console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`); 21 | !(async () => { 22 | await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`) 23 | await process.exit(0); 24 | })() 25 | } 26 | CookieJDs = [...new Set(CookieJDs.filter(item => !!item))] 27 | console.log(`\n====================共${CookieJDs.length}个京东账号Cookie=================\n`); 28 | console.log(`============脚本执行时间:${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString('chinese',{hour12:false})}=============\n`) 29 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; 30 | for (let i = 0; i < CookieJDs.length; i++) { 31 | if (!CookieJDs[i].match(/pt_pin=(.+?);/) || !CookieJDs[i].match(/pt_key=(.+?);/)) console.log(`\n提示:京东cookie 【${CookieJDs[i]}】填写不规范,可能会影响部分脚本正常使用。正确格式为: pt_key=xxx;pt_pin=xxx;(分号;不可少)\n`); 32 | const index = (i + 1 === 1) ? '' : (i + 1); 33 | exports['CookieJD' + index] = CookieJDs[i].trim(); 34 | } 35 | console.log('>>>>>>>>>>>>>>Faker 提示:任务正常运行中>>>>>>>>>>>>>>>\n') -------------------------------------------------------------------------------- /docker/docker_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | #获取配置的自定义参数 5 | if [ -n "$1" ]; then 6 | run_cmd=$1 7 | fi 8 | 9 | ( 10 | if [ -f "/scripts/logs/pull.lock" ]; then 11 | echo "存在更新锁定文件,跳过git pull操作..." 12 | else 13 | echo "设定远程仓库地址..." 14 | cd /scripts 15 | git remote set-url origin "$REPO_URL" 16 | git reset --hard 17 | echo "git pull拉取最新代码..." 18 | git -C /scripts pull --rebase 19 | echo "npm install 安装最新依赖" 20 | npm install --prefix /scripts 21 | fi 22 | ) || exit 0 23 | 24 | # 默认启动telegram交互机器人的条件 25 | # 确认容器启动时调用的docker_entrypoint.sh 26 | # 必须配置TG_BOT_TOKEN、TG_USER_ID, 27 | # 且未配置DISABLE_BOT_COMMAND禁用交互, 28 | # 且未配置自定义TG_API_HOST,因为配置了该变量,说明该容器环境可能并能科学的连到telegram服务器 29 | if [[ -n "$run_cmd" && -n "$TG_BOT_TOKEN" && -n "$TG_USER_ID" && -z "$DISABLE_BOT_COMMAND" && -z "$TG_API_HOST" ]]; then 30 | ENABLE_BOT_COMMAND=True 31 | else 32 | ENABLE_BOT_COMMAND=False 33 | fi 34 | 35 | echo "------------------------------------------------执行定时任务任务shell脚本------------------------------------------------" 36 | #测试 37 | # sh /jd_docker/docker/default_task.sh "$ENABLE_BOT_COMMAND" "$run_cmd" 38 | #合并 39 | sh /scripts/docker/default_task.sh "$ENABLE_BOT_COMMAND" "$run_cmd" 40 | echo "--------------------------------------------------默认定时任务执行完成---------------------------------------------------" 41 | 42 | if [ -n "$run_cmd" ]; then 43 | # 增加一层jd_bot指令已经正确安装成功校验 44 | # 以上条件都满足后会启动jd_bot交互,否还是按照以前的模式启动,最大程度避免现有用户改动调整 45 | if [[ "$ENABLE_BOT_COMMAND" == "True" && -f /usr/bin/jd_bot ]]; then 46 | echo "启动crontab定时任务主进程..." 47 | crond 48 | echo "启动telegram bot指令交主进程..." 49 | jd_bot 50 | else 51 | echo "启动crontab定时任务主进程..." 52 | crond -f 53 | fi 54 | 55 | else 56 | echo "默认定时任务执行结束。" 57 | fi 58 | -------------------------------------------------------------------------------- /QLDependency.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | 4 | # 青龙一键安装脚本 5 | # GitHub仓库: https://github.com/wudongdefeng/tem-update 6 | 7 | # 安装报错,请提交Issue 8 | 9 | # 有其他需要的依赖,欢迎到源仓库提交Pull Request 10 | 11 | TIME() { 12 | [[ -z "$1" ]] && { 13 | echo -ne " " 14 | } || { 15 | case $1 in 16 | r) export Color="\e[31;1m";; 17 | g) export Color="\e[32;1m";; 18 | b) export Color="\e[34;1m";; 19 | y) export Color="\e[33;1m";; 20 | z) export Color="\e[35;1m";; 21 | l) export Color="\e[36;1m";; 22 | esac 23 | [[ $# -lt 2 ]] && echo -e "\e[36m\e[0m ${1}" || { 24 | echo -e "\e[36m\e[0m ${Color}${2}\e[0m" 25 | } 26 | } 27 | } 28 | echo 29 | echo 30 | echo 31 | TIME l "安装依赖..." 32 | echo 33 | TIME y "安装依赖需要时间,请耐心等待!" 34 | echo 35 | sleep 3 36 | echo 37 | echo 38 | 39 | echo 40 | 41 | #apk add python3 g++ lxml zlib-dev gcc jpeg-dev python3-dev musl-dev freetype-dev 42 | 43 | npm config set registry https://registry.npmmirror.com 44 | DIR="/ql/data/scripts" 45 | if [ -d "$DIR" ]; then 46 | echo "青龙版本2.12以上" 47 | cd /ql/data/scripts 48 | pnpm install adler-32 png-js date-fns axios@1.6.7 crypto-js ts-md5 tslib global-agent @types/node request jsdom crc qs moment cheerio dotenv got@11.8.6 sharp@0.32.6 tough-cookie https-proxy-agent@7.0.2 http-cookie-agent console-table-printer@2.12.0 49 | #pip3 install telebot bs4 pysocks socks cacheout requests canvas ping3 jieba PyExecJS aiohttp redis pycryptodome pytz typescript httpx success --upgrade pip pip telethon 50 | else 51 | echo "青龙版本2.12以下" 52 | cd /ql/scripts 53 | pnpm install adler-32 png-js date-fns axios@1.6.7 crypto-js ts-md5 tslib global-agent @types/node request jsdom crc qs moment cheerio dotenv got@11.8.6 sharp@0.32.6 tough-cookie https-proxy-agent@7.0.2 http-cookie-agent console-table-printer@2.12.0 54 | #pip3 install telebot bs4 pysocks socks cacheout requests canvas ping3 jieba PyExecJS aiohttp redis pycryptodome pytz typescript httpx success --upgrade pip pip telethon 55 | fi 56 | 57 | 58 | echo 59 | TIME g "依赖安装完毕...建议重启 Docker " 60 | 61 | echo 62 | TIME g "有任何问题,请在此仓库提交Issue: https://github.com/wudongdefeng/tem-update" 63 | echo 64 | exit 0 65 | -------------------------------------------------------------------------------- /HarbourJ/jdCookie.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # @Time : 2022/7/6 23:00 4 | # @Author : HarbourJ 5 | # @TG : https://t.me/HarbourToulu 6 | # @File : jdCookie.py 7 | 8 | import os #line:1 9 | import time #line:2 10 | from functools import partial #line:3 11 | print =partial (print ,flush =True )#line:4 12 | def get_cookies ():#line:7 13 | O000OO00000OO00O0 =[]#line:8 14 | if os .environ .get ("JD_COOKIE"):#line:9 15 | print ("已获取并使用Env环境 Cookie")#line:10 16 | if '&'in os .environ ["JD_COOKIE"]:#line:11 17 | O000OO00000OO00O0 =os .environ ["JD_COOKIE"].split ('&')#line:12 18 | elif '\n'in os .environ ["JD_COOKIE"]:#line:13 19 | O000OO00000OO00O0 =os .environ ["JD_COOKIE"].split ('\n')#line:14 20 | else :#line:15 21 | O000OO00000OO00O0 =[os .environ ["JD_COOKIE"]]#line:16 22 | else :#line:18 23 | if os .path .exists ("JD_COOKIE.txt"):#line:19 24 | with open ("JD_COOKIE.txt",'r')as OOOO0000O00OO0OO0 :#line:20 25 | O0O000OO0OOOOO000 =OOOO0000O00OO0OO0 .read ().strip ()#line:21 26 | if O0O000OO0OOOOO000 :#line:22 27 | if '&'in O0O000OO0OOOOO000 :#line:23 28 | O000OO00000OO00O0 =O0O000OO0OOOOO000 .split ('&')#line:24 29 | elif '\n'in O0O000OO0OOOOO000 :#line:25 30 | O000OO00000OO00O0 =O0O000OO0OOOOO000 .split ('\n')#line:26 31 | else :#line:27 32 | O000OO00000OO00O0 =[O0O000OO0OOOOO000 ]#line:28 33 | O000OO00000OO00O0 =sorted (set (O000OO00000OO00O0 ),key =O000OO00000OO00O0 .index )#line:29 34 | else :#line:31 35 | print ("未获取到正确✅格式的京东账号Cookie")#line:32 36 | return #line:33 37 | print (f"====================共{len(O000OO00000OO00O0)}个京东账号Cookie=========\n")#line:35 38 | print (f"==================脚本执行- 北京时间(UTC+8):{time.strftime('%Y/%m/%d %H:%M:%S', time.localtime())}=====================\n")#line:36 39 | print (f"==================🗣活动通知- https://t.me/HarbourToulu=====================\n")#line:37 40 | return O000OO00000OO00O0 #line:38 41 | 42 | # if __name__ == "__main__": 43 | # get_cookies() 44 | # print(os.environ.get("JD_COOKIE")) 45 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-alpine3.12 2 | 3 | LABEL AUTHOR="none" \ 4 | VERSION=0.1.4 5 | 6 | ARG KEY="-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn\nNhAAAAAwEAAQAAAQEAvRQk2oQqLB01iVnJKrnI3tTfJyEHzc2ULVor4vBrKKWOum4dbTeT\ndNWL5aS+CJso7scJT3BRq5fYVZcz5ra0MLMdQyFL1DdwurmzkhPYbwcNrJrB8abEPJ8ltS\nMoa0X9ecmSepaQFedZOZ2YeT/6AAXY+cc6xcwyuRVQ2ZJ3YIMBrRuVkF6nYwLyBLFegzhu\nJJeU5o53kfpbTCirwK0h9ZsYwbNbXYbWuJHmtl5tEBf2Hz+5eCkigXRq8EhRZlSnXfhPr2\n32VCb1A/gav2/YEaMPSibuBCzqVMVruP5D625XkxMdBdLqLBGWt7bCas7/zH2bf+q3zac4\nLcIFhkC6XwAAA9BjE3IGYxNyBgAAAAdzc2gtcnNhAAABAQC9FCTahCosHTWJWckqucje1N\n8nIQfNzZQtWivi8GsopY66bh1tN5N01YvlpL4ImyjuxwlPcFGrl9hVlzPmtrQwsx1DIUvU\nN3C6ubOSE9hvBw2smsHxpsQ8nyW1IyhrRf15yZJ6lpAV51k5nZh5P/oABdj5xzrFzDK5FV\nDZkndggwGtG5WQXqdjAvIEsV6DOG4kl5TmjneR+ltMKKvArSH1mxjBs1tdhta4kea2Xm0Q\nF/YfP7l4KSKBdGrwSFFmVKdd+E+vbfZUJvUD+Bq/b9gRow9KJu4ELOpUxWu4/kPrbleTEx\n0F0uosEZa3tsJqzv/MfZt/6rfNpzgtwgWGQLpfAAAAAwEAAQAAAQEAnMKZt22CBWcGHuUI\nytqTNmPoy2kwLim2I0+yOQm43k88oUZwMT+1ilUOEoveXgY+DpGIH4twusI+wt+EUVDC3e\nlyZlixpLV+SeFyhrbbZ1nCtYrtJutroRMVUTNf7GhvucwsHGS9+tr+96y4YDZxkBlJBfVu\nvdUJbLfGe0xamvE114QaZdbmKmtkHaMQJOUC6EFJI4JmSNLJTxNAXKIi3TUrS7HnsO3Xfv\nhDHElzSEewIC1smwLahS6zi2uwP1ih4fGpJJbU6FF/jMvHf/yByHDtdcuacuTcU798qT0q\nAaYlgMd9zrLC1OHMgSDcoz9/NQTi2AXGAdo4N+mnxPTHcQAAAIB5XCz1vYVwJ8bKqBelf1\nw7OlN0QDM4AUdHdzTB/mVrpMmAnCKV20fyA441NzQZe/52fMASUgNT1dQbIWCtDU2v1cP6\ncG8uyhJOK+AaFeDJ6NIk//d7o73HNxR+gCCGacleuZSEU6075Or2HVGHWweRYF9hbmDzZb\nCLw6NsYaP2uAAAAIEA3t1BpGHHek4rXNjl6d2pI9Pyp/PCYM43344J+f6Ndg3kX+y03Mgu\n06o33etzyNuDTslyZzcYUQqPMBuycsEb+o5CZPtNh+1klAVE3aDeHZE5N5HrJW3fkD4EZw\nmOUWnRj1RT2TsLwixB21EHVm7fh8Kys1d2ULw54LVmtv4+O3cAAACBANkw7XZaZ/xObHC9\n1PlT6vyWg9qHAmnjixDhqmXnS5Iu8TaKXhbXZFg8gvLgduGxH/sGwSEB5D6sImyY+DW/OF\nbmIVC4hwDUbCsTMsmTTTgyESwmuQ++JCh6f2Ams1vDKbi+nOVyqRvCrAHtlpaqSfv8hkjK\npBBqa/rO5yyYmeJZAAAAFHJvb3RAbmFzLmV2aW5lLnByZXNzAQIDBAUG\n-----END OPENSSH PRIVATE KEY-----" 7 | 8 | ENV DEFAULT_LIST_FILE=crontab_list.sh \ 9 | CUSTOM_LIST_MERGE_TYPE=append \ 10 | COOKIES_LIST=/scripts/logs/cookies.list \ 11 | REPO_URL=git@gitee.com:lxk0301/jd_scripts.git \ 12 | REPO_BRANCH=master 13 | 14 | RUN set -ex \ 15 | && apk update \ 16 | && apk upgrade \ 17 | && apk add --no-cache bash tzdata git moreutils curl jq openssh-client \ 18 | && rm -rf /var/cache/apk/* \ 19 | && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ 20 | && echo "Asia/Shanghai" > /etc/timezone \ 21 | && mkdir -p /root/.ssh \ 22 | && echo -e $KEY > /root/.ssh/id_rsa \ 23 | && chmod 600 /root/.ssh/id_rsa \ 24 | && ssh-keyscan gitee.com > /root/.ssh/known_hosts \ 25 | && git clone -b $REPO_BRANCH $REPO_URL /scripts \ 26 | && cd /scripts \ 27 | && mkdir logs \ 28 | && npm config set registry https://registry.npm.taobao.org \ 29 | && npm install \ 30 | && cp /scripts/docker/docker_entrypoint.sh /usr/local/bin \ 31 | && chmod +x /usr/local/bin/docker_entrypoint.sh 32 | 33 | WORKDIR /scripts 34 | 35 | ENTRYPOINT ["docker_entrypoint.sh"] 36 | 37 | CMD [ "crond" ] -------------------------------------------------------------------------------- /docker/auto_help.sh: -------------------------------------------------------------------------------- 1 | #set -e 2 | 3 | #日志路径 4 | logDir="/scripts/logs" 5 | 6 | # 处理后的log文件 7 | logFile=${logDir}/sharecodeCollection.log 8 | 9 | if [ -n "$1" ]; then 10 | parameter=${1} 11 | else 12 | echo "没有参数" 13 | fi 14 | 15 | # 收集助力码 16 | collectSharecode() { 17 | if [ -f ${2} ]; then 18 | echo "${1}:清理 ${logFile} 中的旧助力码,收集新助力码" 19 | #删除旧助力码 20 | sed -i '/'"${1}"'/d' ${logFile} 21 | 22 | sed -n '/'${1}'.*/'p ${2} | sed 's/京东账号/京东账号 /g' | sed 's/(/ (/g' | sed 's/】/】 /g' | awk '{print $4,$5,$6,$7}' | sort -gk2 | awk '!a[$2" "$3]++{print}' >>$logFile 23 | else 24 | echo "${1}:${2} 文件不存在,不清理 ${logFile} 中的旧助力码" 25 | fi 26 | 27 | } 28 | 29 | # 导出助力码 30 | exportSharecode() { 31 | if [ -f ${logFile} ]; then 32 | #账号数 33 | cookiecount=$(echo ${JD_COOKIE} | grep -o pt_key | grep -c pt_key) 34 | if [ -f /usr/local/bin/spnode ]; then 35 | cookiecount=$(cat "$COOKIES_LIST" | grep -o pt_key | grep -c pt_key) 36 | fi 37 | echo "cookie个数:${cookiecount}" 38 | 39 | # 单个账号助力码 40 | singleSharecode=$(sed -n '/'${1}'.*/'p ${logFile} | awk '{print $4}' | awk '{T=T"@"$1} END {print T}' | awk '{print substr($1,2)}') 41 | # | awk '{print $2,$4}' | sort -g | uniq 42 | # echo "singleSharecode:${singleSharecode}" 43 | 44 | # 拼接多个账号助力码 45 | num=1 46 | while [ ${num} -le ${cookiecount} ]; do 47 | local allSharecode=${allSharecode}"&"${singleSharecode} 48 | num=$(expr $num + 1) 49 | done 50 | 51 | allSharecode=$(echo ${allSharecode} | awk '{print substr($1,2)}') 52 | 53 | # echo "${1}:${allSharecode}" 54 | 55 | #判断合成的助力码长度是否大于账号数,不大于,则可知没有助力码 56 | if [ ${#allSharecode} -gt ${cookiecount} ]; then 57 | echo "${1}:导出助力码" 58 | export ${3}=${allSharecode} 59 | else 60 | echo "${1}:没有助力码,不导出" 61 | fi 62 | 63 | else 64 | echo "${1}:${logFile} 不存在,不导出助力码" 65 | fi 66 | 67 | } 68 | 69 | #生成助力码 70 | autoHelp() { 71 | if [ ${parameter} == "collect" ]; then 72 | 73 | # echo "收集助力码" 74 | collectSharecode ${1} ${2} ${3} 75 | 76 | elif [ ${parameter} == "export" ]; then 77 | 78 | # echo "导出助力码" 79 | exportSharecode ${1} ${2} ${3} 80 | fi 81 | } 82 | 83 | #日志需要为这种格式才能自动提取 84 | #Mar 07 00:15:10 【京东账号1(xxxxxx)的京喜财富岛好友互助码】3B41B250C4A369EE6DCA6834880C0FE0624BAFD83FC03CA26F8DEC7DB95D658C 85 | 86 | #新增自动助力活动格式 87 | # autoHelp 关键词 日志路径 变量名 88 | 89 | ############# 短期活动 ############# 90 | 91 | 92 | ############# 长期活动 ############# 93 | 94 | #东东农场 95 | autoHelp "东东农场好友互助码" "${logDir}/jd_fruit.log" "FRUITSHARECODES" 96 | 97 | #东东萌宠 98 | autoHelp "东东萌宠好友互助码" "${logDir}/jd_pet.log" "PETSHARECODES" 99 | 100 | #种豆得豆 101 | autoHelp "京东种豆得豆好友互助码" "${logDir}/jd_plantBean.log" "PLANT_BEAN_SHARECODES" 102 | 103 | #京喜工厂 104 | autoHelp "京喜工厂好友互助码" "${logDir}/jd_dreamFactory.log" "DREAM_FACTORY_SHARE_CODES" 105 | 106 | #东东工厂 107 | autoHelp "东东工厂好友互助码" "${logDir}/jd_jdfactory.log" "DDFACTORY_SHARECODES" 108 | 109 | #crazyJoy 110 | autoHelp "crazyJoy任务好友互助码" "${logDir}/jd_crazy_joy.log" "JDJOY_SHARECODES" 111 | 112 | #京喜财福岛 113 | autoHelp "京喜财富岛好友互助码" "${logDir}/jd_cfd.log" "JDCFD_SHARECODES" 114 | 115 | #京喜农场 116 | autoHelp "京喜农场好友互助码" "${logDir}/jd_jxnc.log" "JXNC_SHARECODES" 117 | 118 | #京东赚赚 119 | autoHelp "京东赚赚好友互助码" "${logDir}/jd_jdzz.log" "JDZZ_SHARECODES" 120 | 121 | ######### 日志打印格式需调整 ######### 122 | 123 | #口袋书店 124 | autoHelp "口袋书店好友互助码" "${logDir}/jd_bookshop.log" "BOOKSHOP_SHARECODES" 125 | 126 | #领现金 127 | autoHelp "签到领现金好友互助码" "${logDir}/jd_cash.log" "JD_CASH_SHARECODES" 128 | 129 | #闪购盲盒 130 | autoHelp "闪购盲盒好友互助码" "${logDir}/jd_sgmh.log" "JDSGMH_SHARECODES" 131 | 132 | #东东健康社区 133 | autoHelp "东东健康社区好友互助码" "${logDir}/jd_health.log" "JDHEALTH_SHARECODES" 134 | -------------------------------------------------------------------------------- /function/qlApi.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: chenghao 3 | * @Date: 2022-02-14 10:19:21 4 | * @Last Modified by: chenghao 5 | * @Last Modified time: 2022-03-20 13:57:10 6 | * @Desc: 青龙依赖 7 | * @From: https://github.com/whyour/qinglong/issues/1369 8 | */ 9 | const axios = require('axios') 10 | const QL_URL = 'http://127.0.0.1:5700' 11 | const CLIENT_ID = process.env.CLIENT_ID 12 | const CLIENT_SECRET = process.env.CLIENT_SECRET 13 | 14 | /** 15 | *获取青龙token 16 | */ 17 | function getQLToken() { 18 | return new Promise((resolve, reject) => { 19 | axios 20 | .get( 21 | QL_URL + 22 | `/open/auth/token?client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}` 23 | ) 24 | .then(res => { 25 | if (res.data.code === 200) { 26 | resolve(res.data.data.token) 27 | } else { 28 | reject(res.data.message) 29 | } 30 | }) 31 | }) 32 | } 33 | 34 | /** 35 | *构造请求头 36 | * @returns headers 37 | */ 38 | async function generateRequestHeader() { 39 | return new Promise(async resolve => { 40 | const token = await getQLToken() 41 | resolve({ 42 | Authorization: 'Bearer ' + token, 43 | 'User-Agent': 44 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4577.63 Safari/537.36', 45 | 'Content-Type': 'application/json;charset=UTF-8', 46 | 'Accept-Encoding': 'gzip, deflate', 47 | 'Accept-Language': 'zh-CN,zh;q=0.9' 48 | }) 49 | }) 50 | } 51 | 52 | /** 53 | *初始化请求实例 54 | * @returns axios instance 55 | */ 56 | async function init() { 57 | if (!CLIENT_ID || !CLIENT_SECRET) 58 | return Promise.reject('未获取到 CLIENT_ID 或 CLIENT_SECRET') 59 | const headers = await generateRequestHeader() 60 | return new Promise(resolve => { 61 | resolve( 62 | axios.create({ 63 | baseURL: QL_URL, 64 | timeout: 10000, 65 | headers 66 | }) 67 | ) 68 | }) 69 | } 70 | 71 | /** 72 | * 73 | *获取青龙环境变量 74 | * @param {*} instance 75 | * @returns [] envlist 76 | */ 77 | function getQLEnvs(instance, searchValue = 'JD_COOKIE') { 78 | return new Promise(resolve => { 79 | instance 80 | .get('/open/envs', { 81 | params: { 82 | searchValue, 83 | t: +new Date() 84 | } 85 | }) 86 | .then(res => { 87 | resolve(res.data.data.filter(v => v.status === 0)) 88 | }) 89 | }) 90 | } 91 | 92 | /** 93 | *创建ck环境变量 94 | * @param {*} instance 95 | * @param {*} [ck=[]] 96 | * @returns 97 | */ 98 | function createCkEnv(instance, ck = []) { 99 | return new Promise(resolve => { 100 | instance 101 | .post(`/open/envs?t=${+new Date()}`, ck) 102 | .then(res => { 103 | resolve(res.data) 104 | }) 105 | .catch(error => { 106 | console.log(error.response.data) 107 | }) 108 | }) 109 | } 110 | 111 | /** 112 | * 更新环境变量 113 | * @param {*} instance 114 | * @param {*} ck 115 | * @returns 116 | */ 117 | function updateCkEnv(instance, ck = {}) { 118 | return new Promise(resolve => { 119 | instance 120 | .put(`/open/envs?t=${+new Date()}`, ck) 121 | .then(res => { 122 | resolve(res.data) 123 | }) 124 | .catch(error => { 125 | console.log(error.response.data) 126 | }) 127 | }) 128 | } 129 | 130 | /** 131 | * 删除环境变量 132 | * @param {*} instance 133 | * @param {*} ckIds 134 | * @returns 135 | */ 136 | function deleteCkEnv(instance, ckIds = []) { 137 | return new Promise(resolve => { 138 | instance({ 139 | method: 'delete', 140 | url: `/open/envs?t=${+new Date()}`, 141 | data: ckIds 142 | }).then(resolve) 143 | }) 144 | } 145 | 146 | /** 147 | *切换ck状态 148 | * @param {*} instance 149 | * @param {*} path 150 | * @param {*} id 151 | * @returns 152 | */ 153 | function toggleCKEnv(instance, id, path = 'enable') { 154 | return new Promise(resolve => { 155 | instance.put(`/open/envs/${path}?t=${+new Date()}`, [id]).then(res => { 156 | resolve(res.data) 157 | }) 158 | }) 159 | } 160 | 161 | exports.createEnv = createCkEnv 162 | exports.deleteEnv = deleteCkEnv 163 | exports.getEnv = getQLEnvs 164 | exports.initInstance = init 165 | exports.updateCkEnv = updateCkEnv 166 | exports.toggleCKEnv = toggleCKEnv 167 | -------------------------------------------------------------------------------- /utils/ql.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const got = require('got'); 4 | require('dotenv').config(); 5 | const { readFile } = require('fs/promises'); 6 | const fs = require('fs'); 7 | 8 | let authFile = fs.existsSync('/ql/data/db/keyv.sqlite') ? '/ql/data/db/keyv.sqlite' : ''; 9 | authFile = fs.existsSync('/ql/data/config/auth.json') && "/ql/data/config/auth.json" || fs.existsSync('/ql/config/auth.json') && "/ql/config/auth.json" || authFile; 10 | const api = got.extend({ 11 | prefixUrl: 'http://127.0.0.1:5600', 12 | retry: { limit: 0 }, 13 | }); 14 | 15 | async function getToken() { 16 | try{ 17 | const authConfig = JSON.parse(await readFile(authFile)); 18 | return authConfig.token; 19 | }catch (e) { 20 | const authConfig = (await readFile(authFile)).toString(); 21 | return authConfig.match(/"token":"(.*?)"/)[1]; 22 | } 23 | 24 | } 25 | 26 | module.exports.getEnvs = async () => { 27 | const token = await getToken(); 28 | const body = await api({ 29 | url: 'api/envs', 30 | searchParams: { 31 | searchValue: 'JD_COOKIE', 32 | t: Date.now(), 33 | }, 34 | headers: { 35 | Accept: 'application/json', 36 | authorization: `Bearer ${token}`, 37 | }, 38 | }).json(); 39 | return body.data; 40 | }; 41 | 42 | module.exports.getEnvsCount = async () => { 43 | const data = await this.getEnvs(); 44 | return data.length; 45 | }; 46 | 47 | module.exports.addEnv = async (cookie, remarks) => { 48 | const token = await getToken(); 49 | const body = await api({ 50 | method: 'post', 51 | url: 'api/envs', 52 | params: { t: Date.now() }, 53 | json: [{ 54 | name: 'JD_COOKIE', 55 | value: cookie, 56 | remarks, 57 | }], 58 | headers: { 59 | Accept: 'application/json', 60 | authorization: `Bearer ${token}`, 61 | 'Content-Type': 'application/json;charset=UTF-8', 62 | }, 63 | }).json(); 64 | return body; 65 | }; 66 | 67 | module.exports.updateEnv = async (cookie, eid, remarks) => { 68 | const token = await getToken(); 69 | const body = await api({ 70 | method: 'put', 71 | url: 'api/envs', 72 | params: { t: Date.now() }, 73 | json: { 74 | name: 'JD_COOKIE', 75 | value: cookie, 76 | _id: eid, 77 | remarks, 78 | }, 79 | headers: { 80 | Accept: 'application/json', 81 | authorization: `Bearer ${token}`, 82 | 'Content-Type': 'application/json;charset=UTF-8', 83 | }, 84 | }).json(); 85 | return body; 86 | }; 87 | 88 | module.exports.updateEnv11 = async (cookie, eid, remarks) => { 89 | const token = await getToken(); 90 | const body = await api({ 91 | method: 'put', 92 | url: 'api/envs', 93 | params: { t: Date.now() }, 94 | json: { 95 | name: 'JD_COOKIE', 96 | value: cookie, 97 | id: eid, 98 | remarks, 99 | }, 100 | headers: { 101 | Accept: 'application/json', 102 | authorization: `Bearer ${token}`, 103 | 'Content-Type': 'application/json;charset=UTF-8', 104 | }, 105 | }).json(); 106 | return body; 107 | }; 108 | 109 | module.exports.DisableCk = async (eid) => { 110 | const token = await getToken(); 111 | const body = await api({ 112 | method: 'put', 113 | url: 'api/envs/disable', 114 | params: { t: Date.now() }, 115 | body: JSON.stringify([eid]), 116 | headers: { 117 | Accept: 'application/json', 118 | authorization: `Bearer ${token}`, 119 | 'Content-Type': 'application/json;charset=UTF-8', 120 | }, 121 | }).json(); 122 | return body; 123 | }; 124 | 125 | module.exports.EnableCk = async (eid) => { 126 | const token = await getToken(); 127 | const body = await api({ 128 | method: 'put', 129 | url: 'api/envs/enable', 130 | params: { t: Date.now() }, 131 | body: JSON.stringify([eid]), 132 | headers: { 133 | Accept: 'application/json', 134 | authorization: `Bearer ${token}`, 135 | 'Content-Type': 'application/json;charset=UTF-8', 136 | }, 137 | }).json(); 138 | return body; 139 | }; 140 | 141 | module.exports.getstatus = async(eid) => { 142 | const envs = await this.getEnvs(); 143 | var tempid = 0; 144 | for (let i = 0; i < envs.length; i++) { 145 | tempid = 0; 146 | if (envs[i]._id) { 147 | tempid = envs[i]._id; 148 | } 149 | if (envs[i].id) { 150 | tempid = envs[i].id; 151 | } 152 | if (tempid == eid) { 153 | return envs[i].status; 154 | } 155 | } 156 | return 99; 157 | }; 158 | 159 | module.exports.getEnvById = async(eid) => { 160 | const envs = await this.getEnvs(); 161 | var tempid = 0; 162 | for (let i = 0; i < envs.length; i++) { 163 | tempid = 0; 164 | if (envs[i]._id) { 165 | tempid = envs[i]._id; 166 | } 167 | if (envs[i].id) { 168 | tempid = envs[i].id; 169 | } 170 | if (tempid == eid) { 171 | return envs[i].value; 172 | } 173 | } 174 | return ""; 175 | }; 176 | 177 | module.exports.getEnvByPtPin = async (Ptpin) => { 178 | const envs = await this.getEnvs(); 179 | for (let i = 0; i < envs.length; i++) { 180 | var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]); 181 | if(tempptpin==Ptpin){ 182 | return envs[i]; 183 | } 184 | } 185 | return ""; 186 | }; 187 | 188 | module.exports.delEnv = async (eid) => { 189 | const token = await getToken(); 190 | const body = await api({ 191 | method: 'delete', 192 | url: 'api/envs', 193 | params: { t: Date.now() }, 194 | body: JSON.stringify([eid]), 195 | headers: { 196 | Accept: 'application/json', 197 | authorization: `Bearer ${token}`, 198 | 'Content-Type': 'application/json;charset=UTF-8', 199 | }, 200 | }).json(); 201 | return body; 202 | }; -------------------------------------------------------------------------------- /ql.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const axios = require('axios'); 3 | const got = require('got'); 4 | 5 | let strclientid= "",strclientsecret= "",strport="5700"; 6 | 7 | if (process.env.CHECKCK_STRCLIENTID) { 8 | strclientid = process.env.CHECKCK_STRCLIENTID; 9 | } 10 | if (process.env.CHECKCK_STRCLIENTSECRET) { 11 | strclientsecret = process.env.CHECKCK_STRCLIENTSECRET; 12 | } 13 | if (process.env.CHECKCK_PORT) { 14 | strport = process.env.CHECKCK_PORT; 15 | } 16 | 17 | const api = got.extend({ 18 | prefixUrl: 'http://127.0.0.1:'+strport, 19 | retry: { limit: 0 }, 20 | }); 21 | async function getToken() { 22 | var token = ""; 23 | const response = await axios.get(`http://127.0.0.1:${strport}/open/auth/token`, { 24 | params: { 25 | client_id: strclientid, 26 | client_secret: strclientsecret 27 | }, 28 | headers: { 29 | 'Accept': 'application/json' 30 | } 31 | }); 32 | 33 | if (response.status === 200) { 34 | token = response.data.data.token; 35 | } else { 36 | console.error("Error: " + response.status); 37 | } 38 | 39 | return token; 40 | 41 | } 42 | 43 | module.exports.getEnvs = async () => { 44 | const token = await getToken(); 45 | const body = await api({ 46 | url: 'open/envs', 47 | searchParams: { 48 | searchValue: 'JD_COOKIE', 49 | t: Date.now(), 50 | }, 51 | headers: { 52 | Accept: 'application/json', 53 | authorization: `Bearer ${token}`, 54 | }, 55 | }).json(); 56 | return body.data; 57 | }; 58 | 59 | module.exports.getEnvsCount = async () => { 60 | const data = await this.getEnvs(); 61 | return data.length; 62 | }; 63 | 64 | module.exports.addEnv = async (cookie, remarks) => { 65 | const token = await getToken(); 66 | const body = await api({ 67 | method: 'post', 68 | url: 'open/envs', 69 | params: { t: Date.now() }, 70 | json: [{ 71 | name: 'JD_COOKIE', 72 | value: cookie, 73 | remarks, 74 | }], 75 | headers: { 76 | Accept: 'application/json', 77 | authorization: `Bearer ${token}`, 78 | 'Content-Type': 'application/json;charset=UTF-8', 79 | }, 80 | }).json(); 81 | return body; 82 | }; 83 | 84 | module.exports.updateEnv = async (cookie, eid, remarks) => { 85 | const token = await getToken(); 86 | const body = await api({ 87 | method: 'put', 88 | url: 'open/envs', 89 | params: { t: Date.now() }, 90 | json: { 91 | name: 'JD_COOKIE', 92 | value: cookie, 93 | _id: eid, 94 | remarks, 95 | }, 96 | headers: { 97 | Accept: 'application/json', 98 | authorization: `Bearer ${token}`, 99 | 'Content-Type': 'application/json;charset=UTF-8', 100 | }, 101 | }).json(); 102 | return body; 103 | }; 104 | 105 | module.exports.updateEnv11 = async (cookie, eid, remarks) => { 106 | const token = await getToken(); 107 | const body = await api({ 108 | method: 'put', 109 | url: 'open/envs', 110 | params: { t: Date.now() }, 111 | json: { 112 | name: 'JD_COOKIE', 113 | value: cookie, 114 | id: eid, 115 | remarks, 116 | }, 117 | headers: { 118 | Accept: 'application/json', 119 | authorization: `Bearer ${token}`, 120 | 'Content-Type': 'application/json;charset=UTF-8', 121 | }, 122 | }).json(); 123 | return body; 124 | }; 125 | 126 | module.exports.DisableCk = async (eid) => { 127 | const token = await getToken(); 128 | const body = await api({ 129 | method: 'put', 130 | url: 'open/envs/disable', 131 | params: { t: Date.now() }, 132 | body: JSON.stringify([eid]), 133 | headers: { 134 | Accept: 'application/json', 135 | authorization: `Bearer ${token}`, 136 | 'Content-Type': 'application/json;charset=UTF-8', 137 | }, 138 | }).json(); 139 | return body; 140 | }; 141 | 142 | module.exports.EnableCk = async (eid) => { 143 | const token = await getToken(); 144 | const body = await api({ 145 | method: 'put', 146 | url: 'open/envs/enable', 147 | params: { t: Date.now() }, 148 | body: JSON.stringify([eid]), 149 | headers: { 150 | Accept: 'application/json', 151 | authorization: `Bearer ${token}`, 152 | 'Content-Type': 'application/json;charset=UTF-8', 153 | }, 154 | }).json(); 155 | return body; 156 | }; 157 | 158 | module.exports.getstatus = async(eid) => { 159 | const envs = await this.getEnvs(); 160 | var tempid = 0; 161 | for (let i = 0; i < envs.length; i++) { 162 | tempid = 0; 163 | if (envs[i]._id) { 164 | tempid = envs[i]._id; 165 | } 166 | if (envs[i].id) { 167 | tempid = envs[i].id; 168 | } 169 | if (tempid == eid) { 170 | return envs[i].status; 171 | } 172 | } 173 | return 99; 174 | }; 175 | 176 | module.exports.getEnvById = async(eid) => { 177 | const envs = await this.getEnvs(); 178 | var tempid = 0; 179 | for (let i = 0; i < envs.length; i++) { 180 | tempid = 0; 181 | if (envs[i]._id) { 182 | tempid = envs[i]._id; 183 | } 184 | if (envs[i].id) { 185 | tempid = envs[i].id; 186 | } 187 | if (tempid == eid) { 188 | return envs[i].value; 189 | } 190 | } 191 | return ""; 192 | }; 193 | 194 | module.exports.getEnvByPtPin = async (Ptpin) => { 195 | const envs = await this.getEnvs(); 196 | for (let i = 0; i < envs.length; i++) { 197 | var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]); 198 | if(tempptpin==Ptpin){ 199 | return envs[i]; 200 | } 201 | } 202 | return ""; 203 | }; 204 | 205 | module.exports.delEnv = async (eid) => { 206 | const token = await getToken(); 207 | const body = await api({ 208 | method: 'delete', 209 | url: 'open/envs', 210 | params: { t: Date.now() }, 211 | body: JSON.stringify([eid]), 212 | headers: { 213 | Accept: 'application/json', 214 | authorization: `Bearer ${token}`, 215 | 'Content-Type': 'application/json;charset=UTF-8', 216 | }, 217 | }).json(); 218 | return body; 219 | }; 220 | 221 | module.exports.getEnvinfoById = async(eid) => { 222 | const envs = await this.getEnvs(); 223 | var tempid = 0; 224 | for (let i = 0; i < envs.length; i++) { 225 | tempid = 0; 226 | if (envs[i]._id) { 227 | tempid = envs[i]._id; 228 | } 229 | if (envs[i].id) { 230 | tempid = envs[i].id; 231 | } 232 | if (tempid == eid) { 233 | return envs[i]; 234 | } 235 | } 236 | return null; 237 | }; -------------------------------------------------------------------------------- /function/ql.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const got = require('got'); 4 | require('dotenv').config(); 5 | const { readFile } = require('fs/promises'); 6 | const path = require('path'); 7 | const fs = require('fs'); 8 | const tokenFileList = ['/ql/data/db/keyv.sqlite', '/ql/data/config/auth.json', '/ql/config/auth.json']; 9 | let authFile = getLatestFile(tokenFileList); 10 | const api = got.extend({ 11 | prefixUrl: 'http://127.0.0.1:5600', 12 | retry: { limit: 0 }, 13 | }); 14 | function getLatestFile(files) { 15 | let latestFile = null; 16 | let latestMtime = 0; 17 | for (const file of files) { 18 | try { 19 | const stats = fs.statSync(file); 20 | const mtime = stats.mtimeMs; 21 | if (mtime > latestMtime) { 22 | latestMtime = mtime; 23 | latestFile = file; 24 | } 25 | } catch (e) { 26 | } 27 | } 28 | return latestFile; 29 | } 30 | async function getToken() { 31 | const authConfig = await readFile(authFile); 32 | // console.log(authConfig.toString().match(/"token":"(.*?)",/)[1]) 33 | return authConfig.toString().match(/"token":"([^"]*)"(?!.*"token":)/)[1]; 34 | } 35 | // getToken() 36 | module.exports.getEnvs = async () => { 37 | const token = await getToken(); 38 | const body = await api({ 39 | url: 'api/envs', 40 | searchParams: { 41 | searchValue: 'JD_COOKIE', 42 | t: Date.now(), 43 | }, 44 | headers: { 45 | Accept: 'application/json', 46 | authorization: `Bearer ${token}`, 47 | }, 48 | }).json(); 49 | return body.data; 50 | }; 51 | 52 | module.exports.getEnvsCount = async () => { 53 | const data = await this.getEnvs(); 54 | return data.length; 55 | }; 56 | 57 | module.exports.addEnv = async (cookie, remarks) => { 58 | const token = await getToken(); 59 | const body = await api({ 60 | method: 'post', 61 | url: 'api/envs', 62 | params: { t: Date.now() }, 63 | json: [{ 64 | name: 'JD_COOKIE', 65 | value: cookie, 66 | remarks, 67 | }], 68 | headers: { 69 | Accept: 'application/json', 70 | authorization: `Bearer ${token}`, 71 | 'Content-Type': 'application/json;charset=UTF-8', 72 | }, 73 | }).json(); 74 | return body; 75 | }; 76 | 77 | module.exports.updateEnv = async (cookie, eid, remarks) => { 78 | const token = await getToken(); 79 | const body = await api({ 80 | method: 'put', 81 | url: 'api/envs', 82 | params: { t: Date.now() }, 83 | json: { 84 | name: 'JD_COOKIE', 85 | value: cookie, 86 | _id: eid, 87 | remarks, 88 | }, 89 | headers: { 90 | Accept: 'application/json', 91 | authorization: `Bearer ${token}`, 92 | 'Content-Type': 'application/json;charset=UTF-8', 93 | }, 94 | }).json(); 95 | return body; 96 | }; 97 | 98 | module.exports.updateEnv11 = async (cookie, eid, remarks) => { 99 | const token = await getToken(); 100 | const body = await api({ 101 | method: 'put', 102 | url: 'api/envs', 103 | params: { t: Date.now() }, 104 | json: { 105 | name: 'JD_COOKIE', 106 | value: cookie, 107 | id: eid, 108 | remarks, 109 | }, 110 | headers: { 111 | Accept: 'application/json', 112 | authorization: `Bearer ${token}`, 113 | 'Content-Type': 'application/json;charset=UTF-8', 114 | }, 115 | }).json(); 116 | return body; 117 | }; 118 | 119 | module.exports.DisableCk = async (eid) => { 120 | const token = await getToken(); 121 | const body = await api({ 122 | method: 'put', 123 | url: 'api/envs/disable', 124 | params: { t: Date.now() }, 125 | body: JSON.stringify([eid]), 126 | headers: { 127 | Accept: 'application/json', 128 | authorization: `Bearer ${token}`, 129 | 'Content-Type': 'application/json;charset=UTF-8', 130 | }, 131 | }).json(); 132 | return body; 133 | }; 134 | 135 | module.exports.EnableCk = async (eid) => { 136 | const token = await getToken(); 137 | const body = await api({ 138 | method: 'put', 139 | url: 'api/envs/enable', 140 | params: { t: Date.now() }, 141 | body: JSON.stringify([eid]), 142 | headers: { 143 | Accept: 'application/json', 144 | authorization: `Bearer ${token}`, 145 | 'Content-Type': 'application/json;charset=UTF-8', 146 | }, 147 | }).json(); 148 | return body; 149 | }; 150 | 151 | module.exports.getstatus = async (eid) => { 152 | const envs = await this.getEnvs(); 153 | var tempid = 0; 154 | for (let i = 0; i < envs.length; i++) { 155 | tempid = 0; 156 | if (envs[i]._id) { 157 | tempid = envs[i]._id; 158 | } 159 | if (envs[i].id) { 160 | tempid = envs[i].id; 161 | } 162 | if (tempid == eid) { 163 | return envs[i].status; 164 | } 165 | } 166 | return 99; 167 | }; 168 | 169 | module.exports.getEnvById = async (eid) => { 170 | const envs = await this.getEnvs(); 171 | var tempid = 0; 172 | for (let i = 0; i < envs.length; i++) { 173 | tempid = 0; 174 | if (envs[i]._id) { 175 | tempid = envs[i]._id; 176 | } 177 | if (envs[i].id) { 178 | tempid = envs[i].id; 179 | } 180 | if (tempid == eid) { 181 | return envs[i].value; 182 | } 183 | } 184 | return ""; 185 | }; 186 | 187 | module.exports.getEnvByPtPin = async (Ptpin) => { 188 | const envs = await this.getEnvs(); 189 | for (let i = 0; i < envs.length; i++) { 190 | var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]); 191 | if (tempptpin == Ptpin) { 192 | return envs[i]; 193 | } 194 | } 195 | return ""; 196 | }; 197 | 198 | module.exports.delEnv = async (eid) => { 199 | const token = await getToken(); 200 | const body = await api({ 201 | method: 'delete', 202 | url: 'api/envs', 203 | params: { t: Date.now() }, 204 | body: JSON.stringify([eid]), 205 | headers: { 206 | Accept: 'application/json', 207 | authorization: `Bearer ${token}`, 208 | 'Content-Type': 'application/json;charset=UTF-8', 209 | }, 210 | }).json(); 211 | return body; 212 | }; -------------------------------------------------------------------------------- /function/common.js: -------------------------------------------------------------------------------- 1 | let request = require('request'); 2 | let CryptoJS = require('crypto-js'); 3 | let qs = require('querystring'); 4 | let urls = require('url'); 5 | let path = require('path'); 6 | let notify = require('./sendNotify'); 7 | let mainEval = require("./eval"); 8 | let assert = require('assert'); 9 | let jxAlgo = require("./jxAlgo"); 10 | let config = require("./config"); 11 | let user = {} 12 | try { 13 | user = require("./user") 14 | } catch (e) {} 15 | class env { 16 | constructor(name) { 17 | this.config = { ...config, 18 | ...process.env, 19 | ...user, 20 | }; 21 | this.name = name; 22 | this.message = []; 23 | this.sharecode = []; 24 | this.code = []; 25 | this.timestamp = new Date().getTime(); 26 | this.time = this.start = parseInt(this.timestamp / 1000); 27 | this.options = { 28 | 'headers': {} 29 | }; 30 | console.log(`\n🔔${this.name}, 开始!\n`) 31 | console.log(`=========== 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()} ===========\n`) 32 | } 33 | done() { 34 | let timestamp = new Date().getTime(); 35 | let work = ((timestamp - this.timestamp) / 1000).toFixed(2) 36 | console.log(`=========================脚本执行完成,耗时${work}s============================\n`) 37 | console.log(`🔔${this.name}, 结束!\n`) 38 | } 39 | notify(array) { 40 | let text = ''; 41 | for (let i of array) { 42 | text += `${i.user} -- ${i.msg}\n` 43 | } 44 | console.log(`\n=============================开始发送提醒消息=============================`) 45 | notify.sendNotify(this.name + "消息提醒", text) 46 | } 47 | wait(t) { 48 | return new Promise(e => setTimeout(e, t)) 49 | } 50 | setOptions(params) { 51 | this.options = params; 52 | } 53 | setCookie(cookie) { 54 | this.options.headers.cookie = cookie 55 | } 56 | jsonParse(str) { 57 | try { 58 | return JSON.parse(str); 59 | } catch (e) { 60 | try { 61 | let data = this.match([/try\s*\{\w+\s*\(([^\)]+)/, /\w+\s*\(([^\)]+)/], str) 62 | return JSON.parse(data); 63 | } catch (ee) { 64 | try { 65 | let cb = this.match(/try\s*\{\s*(\w+)/, str) 66 | if (cb) { 67 | let func = ""; 68 | let data = str.replace(cb, `func=`) 69 | eval(data); 70 | return func 71 | } 72 | } catch (eee) { 73 | return str 74 | } 75 | } 76 | } 77 | } 78 | curl(params, extra = '') { 79 | if (typeof(params) != 'object') { 80 | params = { 81 | 'url': params 82 | } 83 | } 84 | params = Object.assign({ ...this.options 85 | }, params); 86 | params.method = params.body ? 'POST' : 'GET'; 87 | if (params.hasOwnProperty('cookie')) { 88 | params.headers.cookie = params.cookie 89 | } 90 | if (params.hasOwnProperty('ua') || params.hasOwnProperty('useragent')) { 91 | params.headers['user-agent'] = params.ua 92 | } 93 | if (params.hasOwnProperty('referer')) { 94 | params.headers.referer = params.referer 95 | } 96 | if (params.hasOwnProperty('params')) { 97 | params.url += '?' + qs.stringify(params.params) 98 | } 99 | if (params.hasOwnProperty('form')) { 100 | params.method = 'POST' 101 | } 102 | return new Promise(resolve => { 103 | request(params, async (err, resp, data) => { 104 | try { 105 | if (params.console) { 106 | console.log(data) 107 | } 108 | this.source = this.jsonParse(data); 109 | if (extra) { 110 | this[extra] = this.source 111 | } 112 | } catch (e) { 113 | console.log(e, resp) 114 | } finally { 115 | resolve(data); 116 | } 117 | }) 118 | }) 119 | } 120 | dumps(dict) { 121 | return JSON.stringify(dict) 122 | } 123 | loads(str) { 124 | return JSON.parse(str) 125 | } 126 | notice(msg) { 127 | this.message.push({ 128 | 'index': this.index, 129 | 'user': this.user, 130 | 'msg': msg 131 | }) 132 | } 133 | notices(msg, user, index = '') { 134 | this.message.push({ 135 | 'user': user, 136 | 'msg': msg, 137 | 'index': index 138 | }) 139 | } 140 | urlparse(url) { 141 | return urls.parse(url, true, true) 142 | } 143 | md5(encryptString) { 144 | return CryptoJS.MD5(encryptString).toString() 145 | } 146 | haskey(data, key, value) { 147 | value = typeof value !== 'undefined' ? value : ''; 148 | var spl = key.split('.'); 149 | for (var i of spl) { 150 | i = !isNaN(i) ? parseInt(i) : i; 151 | try { 152 | data = data[i]; 153 | } catch (error) { 154 | return ''; 155 | } 156 | } 157 | if (data == undefined) { 158 | return '' 159 | } 160 | if (value !== '') { 161 | return data === value ? true : false; 162 | } else { 163 | return data 164 | } 165 | } 166 | match(pattern, string) { 167 | pattern = (pattern instanceof Array) ? pattern : [pattern]; 168 | for (let pat of pattern) { 169 | // var match = string.match(pat); 170 | var match = pat.exec(string) 171 | if (match) { 172 | var len = match.length; 173 | if (len == 1) { 174 | return match; 175 | } else if (len == 2) { 176 | return match[1]; 177 | } else { 178 | var r = []; 179 | for (let i = 1; i < len; i++) { 180 | r.push(match[i]) 181 | } 182 | return r; 183 | } 184 | break; 185 | } 186 | // console.log(pat.exec(string)) 187 | } 188 | return ''; 189 | } 190 | matchall(pattern, string) { 191 | pattern = (pattern instanceof Array) ? pattern : [pattern]; 192 | var match; 193 | var result = []; 194 | for (var pat of pattern) { 195 | while ((match = pat.exec(string)) != null) { 196 | var len = match.length; 197 | if (len == 1) { 198 | result.push(match); 199 | } else if (len == 2) { 200 | result.push(match[1]); 201 | } else { 202 | var r = []; 203 | for (let i = 1; i < len; i++) { 204 | r.push(match[i]) 205 | } 206 | result.push(r); 207 | } 208 | } 209 | } 210 | return result; 211 | } 212 | compare(property) { 213 | return function(a, b) { 214 | var value1 = a[property]; 215 | var value2 = b[property]; 216 | return value1 - value2; 217 | } 218 | } 219 | filename(file, rename = '') { 220 | if (!this.runfile) { 221 | this.runfile = path.basename(file).replace(".js", '').replace(/-/g, '_') 222 | } 223 | if (rename) { 224 | rename = `_${rename}`; 225 | } 226 | return path.basename(file).replace(".js", rename).replace(/-/g, '_'); 227 | } 228 | rand(n, m) { 229 | var random = Math.floor(Math.random() * (m - n + 1) + n); 230 | return random; 231 | } 232 | random(arr, num) { 233 | var temp_array = new Array(); 234 | for (var index in arr) { 235 | temp_array.push(arr[index]); 236 | } 237 | var return_array = new Array(); 238 | for (var i = 0; i < num; i++) { 239 | if (temp_array.length > 0) { 240 | var arrIndex = Math.floor(Math.random() * temp_array.length); 241 | return_array[i] = temp_array[arrIndex]; 242 | temp_array.splice(arrIndex, 1); 243 | } else { 244 | break; 245 | } 246 | } 247 | return return_array; 248 | } 249 | compact(lists, keys) { 250 | let array = {}; 251 | for (let i of keys) { 252 | if (lists[i]) { 253 | array[i] = lists[i]; 254 | } 255 | } 256 | return array; 257 | } 258 | unique(arr) { 259 | return Array.from(new Set(arr)); 260 | } 261 | end(args) { 262 | return args[args.length - 1] 263 | } 264 | } 265 | module.exports = { 266 | env, 267 | eval: mainEval, 268 | assert, 269 | jxAlgo, 270 | } 271 | -------------------------------------------------------------------------------- /docker/default_task.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # 放在这个初始化python3环境,目的减小镜像体积,一些不需要使用bot交互的用户可以不用拉体积比较大的镜像 5 | # 在这个任务里面还有初始化还有目的就是为了方便bot更新了新功能的话只需要重启容器就完成更新 6 | function initPythonEnv() { 7 | echo "开始安装运行jd_bot需要的python环境及依赖..." 8 | apk add --update python3-dev py3-pip py3-cryptography py3-numpy py-pillow 9 | echo "开始安装jd_bot依赖..." 10 | #测试 11 | #cd /jd_docker/docker/bot 12 | #合并 13 | cd /scripts/docker/bot 14 | pip3 install --upgrade pip 15 | pip3 install -r requirements.txt 16 | python3 setup.py install 17 | } 18 | 19 | #启动tg bot交互前置条件成立,开始安装配置环境 20 | if [ "$1" == "True" ]; then 21 | initPythonEnv 22 | if [ -z "$DISABLE_SPNODE" ]; then 23 | echo "增加命令组合spnode ,使用该命令spnode jd_xxxx.js 执行js脚本会读取cookies.conf里面的jd cokie账号来执行脚本" 24 | ( 25 | cat </usr/local/bin/spnode 50 | chmod +x /usr/local/bin/spnode 51 | fi 52 | 53 | echo "spnode需要使用的到,cookie写入文件,该文件同时也为jd_bot扫码获自动取cookies服务" 54 | if [ -z "$JD_COOKIE" ]; then 55 | if [ ! -f "$COOKIES_LIST" ]; then 56 | echo "" >"$COOKIES_LIST" 57 | echo "未配置JD_COOKIE环境变量,$COOKIES_LIST文件已生成,请将cookies写入$COOKIES_LIST文件,格式每个Cookie一行" 58 | fi 59 | else 60 | if [ -f "$COOKIES_LIST" ]; then 61 | echo "cookies.conf文件已经存在跳过,如果需要更新cookie请修改$COOKIES_LIST文件内容" 62 | else 63 | echo "环境变量 cookies写入$COOKIES_LIST文件,如果需要更新cookie请修改cookies.conf文件内容" 64 | echo $JD_COOKIE | sed "s/[ &]/\\n/g" | sed "/^$/d" >$COOKIES_LIST 65 | fi 66 | fi 67 | 68 | CODE_GEN_CONF=/scripts/logs/code_gen_conf.list 69 | echo "生成互助消息需要使用的到的 logs/code_gen_conf.list 文件,后续需要自己根据说明维护更新删除..." 70 | if [ ! -f "$CODE_GEN_CONF" ]; then 71 | ( 72 | cat <$CODE_GEN_CONF 106 | else 107 | echo "logs/code_gen_conf.list 文件已经存在跳过初始化操作" 108 | fi 109 | 110 | echo "容器jd_bot交互所需环境已配置安装已完成..." 111 | curl -sX POST "https://api.telegram.org/bot$TG_BOT_TOKEN/sendMessage" -d "chat_id=$TG_USER_ID&text=恭喜🎉你获得feature容器jd_bot交互所需环境已配置安装已完成,并启用。请发送 /help 查看使用帮助。如需禁用请在docker-compose.yml配置 DISABLE_BOT_COMMAND=True" >>/dev/null 112 | 113 | fi 114 | 115 | #echo "暂停更新配置,不要尝试删掉这个文件,你的容器可能会起不来" 116 | #echo '' >/scripts/logs/pull.lock 117 | 118 | echo "定义定时任务合并处理用到的文件路径..." 119 | defaultListFile="/scripts/docker/$DEFAULT_LIST_FILE" 120 | echo "默认文件定时任务文件路径为 ${defaultListFile}" 121 | mergedListFile="/scripts/docker/merged_list_file.sh" 122 | echo "合并后定时任务文件路径为 ${mergedListFile}" 123 | 124 | echo "第1步将默认定时任务列表添加到并后定时任务文件..." 125 | cat $defaultListFile >$mergedListFile 126 | 127 | echo "第2步判断是否存在自定义任务任务列表并追加..." 128 | if [ $CUSTOM_LIST_FILE ]; then 129 | echo "您配置了自定义任务文件:$CUSTOM_LIST_FILE,自定义任务类型为:$CUSTOM_LIST_MERGE_TYPE..." 130 | # 无论远程还是本地挂载, 均复制到 $customListFile 131 | customListFile="/scripts/docker/custom_list_file.sh" 132 | echo "自定义定时任务文件临时工作路径为 ${customListFile}" 133 | if expr "$CUSTOM_LIST_FILE" : 'http.*' &>/dev/null; then 134 | echo "自定义任务文件为远程脚本,开始下载自定义远程任务。" 135 | wget -O $customListFile $CUSTOM_LIST_FILE 136 | echo "下载完成..." 137 | elif [ -f /scripts/docker/$CUSTOM_LIST_FILE ]; then 138 | echo "自定义任务文件为本地挂载。" 139 | cp /scripts/docker/$CUSTOM_LIST_FILE $customListFile 140 | fi 141 | 142 | if [ -f "$customListFile" ]; then 143 | if [ $CUSTOM_LIST_MERGE_TYPE == "append" ]; then 144 | echo "合并默认定时任务文件:$DEFAULT_LIST_FILE 和 自定义定时任务文件:$CUSTOM_LIST_FILE" 145 | echo -e "" >>$mergedListFile 146 | cat $customListFile >>$mergedListFile 147 | elif [ $CUSTOM_LIST_MERGE_TYPE == "overwrite" ]; then 148 | echo "配置了自定义任务文件:$CUSTOM_LIST_FILE,自定义任务类型为:$CUSTOM_LIST_MERGE_TYPE..." 149 | cat $customListFile >$mergedListFile 150 | else 151 | echo "配置配置了错误的自定义定时任务类型:$CUSTOM_LIST_MERGE_TYPE,自定义任务类型为只能为append或者overwrite..." 152 | fi 153 | else 154 | echo "配置的自定义任务文件:$CUSTOM_LIST_FILE未找到,使用默认配置$DEFAULT_LIST_FILE..." 155 | fi 156 | else 157 | echo "当前只使用了默认定时任务文件 $DEFAULT_LIST_FILE ..." 158 | fi 159 | 160 | echo "第3步判断是否配置了随机延迟参数..." 161 | if [ $RANDOM_DELAY_MAX ]; then 162 | if [ $RANDOM_DELAY_MAX -ge 1 ]; then 163 | echo "已设置随机延迟为 $RANDOM_DELAY_MAX , 设置延迟任务中..." 164 | sed -i "/\(jd_bean_sign.js\|jd_blueCoin.js\|jd_joy_reward.js\|jd_joy_steal.js\|jd_joy_feedPets.js\|jd_car_exchange.js\)/!s/node/sleep \$((RANDOM % \$RANDOM_DELAY_MAX)); node/g" $mergedListFile 165 | fi 166 | else 167 | echo "未配置随机延迟对应的环境变量,故不设置延迟任务..." 168 | fi 169 | 170 | echo "第4步判断是否配置自定义shell执行脚本..." 171 | if [ 0"$CUSTOM_SHELL_FILE" = "0" ]; then 172 | echo "未配置自定shell脚本文件,跳过执行。" 173 | else 174 | if expr "$CUSTOM_SHELL_FILE" : 'http.*' &>/dev/null; then 175 | echo "自定义shell脚本为远程脚本,开始下载自定义远程脚本。" 176 | wget -O /scripts/docker/shell_script_mod.sh $CUSTOM_SHELL_FILE 177 | echo "下载完成,开始执行..." 178 | echo "#远程自定义shell脚本追加定时任务" >>$mergedListFile 179 | sh -x /scripts/docker/shell_script_mod.sh 180 | echo "自定义远程shell脚本下载并执行结束。" 181 | else 182 | if [ ! -f $CUSTOM_SHELL_FILE ]; then 183 | echo "自定义shell脚本为docker挂载脚本文件,但是指定挂载文件不存在,跳过执行。" 184 | else 185 | echo "docker挂载的自定shell脚本,开始执行..." 186 | echo "#docker挂载自定义shell脚本追加定时任务" >>$mergedListFile 187 | sh -x $CUSTOM_SHELL_FILE 188 | echo "docker挂载的自定shell脚本,执行结束。" 189 | fi 190 | fi 191 | fi 192 | 193 | echo "第5步删除不运行的脚本任务..." 194 | if [ $DO_NOT_RUN_SCRIPTS ]; then 195 | echo "您配置了不运行的脚本:$DO_NOT_RUN_SCRIPTS" 196 | arr=${DO_NOT_RUN_SCRIPTS//&/ } 197 | for item in $arr; do 198 | sed -ie '/'"${item}"'/d' ${mergedListFile} 199 | done 200 | 201 | fi 202 | 203 | echo "第6步设定下次运行docker_entrypoint.sh时间..." 204 | echo "删除原有docker_entrypoint.sh任务" 205 | sed -ie '/'docker_entrypoint.sh'/d' ${mergedListFile} 206 | 207 | # 12:00前生成12:00后的cron,12:00后生成第二天12:00前的cron,一天只更新两次代码 208 | if [ $(date +%-H) -lt 12 ]; then 209 | random_h=$(($RANDOM % 12 + 12)) 210 | else 211 | random_h=$(($RANDOM % 12)) 212 | fi 213 | random_m=$(($RANDOM % 60)) 214 | 215 | echo "设定 docker_entrypoint.sh cron为:" 216 | echo -e "\n# 必须要的默认定时任务请勿删除" >>$mergedListFile 217 | echo -e "${random_m} ${random_h} * * * docker_entrypoint.sh >> /scripts/logs/default_task.log 2>&1" | tee -a $mergedListFile 218 | 219 | echo "第7步 自动助力" 220 | if [ -n "$ENABLE_AUTO_HELP" ]; then 221 | #直接判断变量,如果未配置,会导致sh抛出一个错误,所以加了上面一层 222 | if [ "$ENABLE_AUTO_HELP" = "true" ]; then 223 | echo "开启自动助力" 224 | #在所有脚本执行前,先执行助力码导出 225 | sed -i 's/node/ . \/scripts\/docker\/auto_help.sh export > \/scripts\/logs\/auto_help_export.log \&\& node /g' ${mergedListFile} 226 | else 227 | echo "未开启自动助力" 228 | fi 229 | fi 230 | 231 | echo "第8步增加 |ts 任务日志输出时间戳..." 232 | sed -i "/\( ts\| |ts\|| ts\)/!s/>>/\|ts >>/g" $mergedListFile 233 | 234 | echo "第9步执行proc_file.sh脚本任务..." 235 | sh /scripts/docker/proc_file.sh 236 | 237 | echo "第10步加载最新的定时任务文件..." 238 | if [[ -f /usr/bin/jd_bot && -z "$DISABLE_SPNODE" ]]; then 239 | echo "bot交互与spnode 前置条件成立,替换任务列表的node指令为spnode" 240 | sed -i "s/ node / spnode /g" $mergedListFile 241 | #conc每个cookies独立并行执行脚本示例,cookies数量多使用该功能可能导致内存爆掉,默认不开启 有需求,请在自定义shell里面实现 242 | #sed -i "/\(jd_xtg.js\|jd_car_exchange.js\)/s/spnode/spnode conc/g" $mergedListFile 243 | fi 244 | crontab $mergedListFile 245 | 246 | echo "第11步将仓库的docker_entrypoint.sh脚本更新至系统/usr/local/bin/docker_entrypoint.sh内..." 247 | cat /scripts/docker/docker_entrypoint.sh >/usr/local/bin/docker_entrypoint.sh 248 | 249 | echo "发送通知" 250 | export NOTIFY_CONTENT="" 251 | cd /scripts/docker 252 | node notify_docker_user.js 253 | -------------------------------------------------------------------------------- /HarbourJ/jd_dpcj.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | File: jd_dpcj.py(店铺抽奖-JK) 6 | Author: HarbourJ 7 | Date: 2022/10/15 23:00 8 | TG: https://t.me/HarbourToulu 9 | cron: 1 1 1 1 1 1 10 | new Env('店铺抽奖-JK'); 11 | ActivityEntry:https://shop.m.jd.com/shop/lottery?shopId=xxxxx&venderId=xxxxx 12 | Description: 变量:export DPCJID="shopId1&shopId2" #变量为店铺🆔 13 | """ 14 | 15 | import requests ,time ,re ,os ,sys ,json #line:1 16 | from datetime import datetime #line:2 17 | from sendNotify import *#line:3 18 | from urllib .parse import quote_plus ,unquote_plus #line:4 19 | import warnings #line:5 20 | warnings .filterwarnings ("ignore",category =DeprecationWarning )#line:6 21 | from functools import partial #line:7 22 | print =partial (print ,flush =True )#line:8 23 | try :#line:9 24 | from jd_sign import *#line:10 25 | except ImportError as e :#line:11 26 | print (e )#line:12 27 | if "No module"in str (e ):#line:13 28 | print ("请先运行HarbourJ库依赖一键安装脚本(jd_check_dependent.py),安装jd_sign.so依赖")#line:14 29 | sys .exit ()#line:15 30 | try :#line:16 31 | from jdCookie import get_cookies #line:17 32 | getCk =get_cookies ()#line:18 33 | except :#line:19 34 | print ("请先下载依赖脚本,\n下载链接:https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")#line:20 35 | sys .exit (3 )#line:21 36 | dpcj =os .environ .get ("DPCJID")if os .environ .get ("DPCJID")else ""#line:23 37 | if not dpcj :#line:25 38 | print ("⚠️未发现有效店铺签到活动变量DPCJID,退出程序!")#line:26 39 | sys .exit ()#line:27 40 | def check (OO000OO0000OO0OOO ,OO0O0OO0O0O00O000 ):#line:29 41 | try :#line:30 42 | O0OO0O00OO0OOOO0O ='https://me-api.jd.com/user_new/info/GetJDUserInfoUnion'#line:31 43 | O00000O00OOO0000O ={"Host":"me-api.jd.com","Accept":"*/*","Connection":"keep-alive","Cookie":OO0O0OO0O0O00O000 ,"User-Agent":OO000OO0000OO0OOO ,"Accept-Language":"zh-cn","Referer":"https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&","Accept-Encoding":"gzip, deflate",}#line:41 44 | O0O0000OOOOO0OOO0 =requests .get (url =O0OO0O00OO0OOOO0O ,headers =O00000O00OOO0000O ,timeout =None ).text #line:42 45 | OO0OO00O0O0O0000O =json .loads (O0O0000OOOOO0OOO0 )#line:43 46 | if OO0OO00O0O0O0000O ['retcode']=='1001':#line:44 47 | O00OO0OO000O00000 ="⚠️当前ck已失效,请检查"#line:45 48 | return {'code':1001 ,'data':O00OO0OO000O00000 }#line:46 49 | elif OO0OO00O0O0O0000O ['retcode']=='0'and 'userInfo'in OO0OO00O0O0O0000O ['data']:#line:47 50 | O0OO0OOO0000OO0OO =OO0OO00O0O0O0000O ['data']['userInfo']['baseInfo']['nickname']#line:48 51 | return {'code':200 ,'name':O0OO0OOO0000OO0OO ,'ck':OO0O0OO0O0O00O000 }#line:49 52 | except Exception as O000O0OOO0O000OOO :#line:50 53 | return {'code':0 ,'data':O000O0OOO0O000OOO }#line:51 54 | def get_time ():#line:53 55 | OO0OOOOOO0000000O =round (time .time ()*1000 )#line:54 56 | return OO0OOOOOO0000000O #line:55 57 | def getSignInfo (O0O000000OO0O0O00 ,O00OO0O000O0O00OO ,OO0000O000OO0O000 ,OO0000OO00OO00O00 ):#line:57 58 | OOO0O0O00000O0OO0 =f"https://api.m.jd.com/client.action?functionId=whx_getSignInfo&body=%7B%22shopId%22%3A%22{OO0000O000OO0O000}%22%2C%22venderId%22%3A%22{OO0000OO00OO00O00}%22%2C%22source%22%3A%22m-shop%22%7D&t=1665848303470&appid=shop_view&clientVersion=11.0.0&client=wh5&area=1_88_2888_8&uuid=16587341419872043913507"#line:58 59 | O0O00OOO00O0O0OO0 ={'accept':'*/*','accept-encoding':'gzip, deflate, br','accept-language':'zh-CN,zh;q=0.9','cookie':O00OO0O000O0O00OO ,'origin':'https://shop.m.jd.com','referer':'https://shop.m.jd.com/','user-agent':O0O000000OO0O0O00 }#line:67 60 | OOOOOO000OO0OOO0O =requests .request ("GET",OOO0O0O00000O0OO0 ,headers =O0O00OOO00O0O0OO0 )#line:68 61 | OO000O0OO0O00OO00 =OOOOOO000OO0OOO0O .json ()#line:69 62 | return OO000O0OO0O00OO00 #line:70 63 | def sign (OOOOOO0OO00OOOO0O ,OO0O0OOOO00O00000 ,O00O0O00OO0O00OO0 ,OO0O0OOO000OO0O0O ):#line:72 64 | O0O000OO0OOO0O00O =f"https://api.m.jd.com/client.action?functionId=whx_sign&body=%7B%22shopId%22%3A%22{O00O0O00OO0O00OO0}%22%2C%22venderId%22%3A%22{OO0O0OOO000OO0O0O}%22%2C%22source%22%3A%22m-shop%22%7D&t=1665847166130&appid=shop_view&clientVersion=11.0.0&client=wh5&area=1_88_2888_8&uuid=16587341419872043913507"#line:73 65 | OOO0O0OO0OO00O0O0 ={'accept':'*/*','accept-encoding':'gzip, deflate, br','accept-language':'zh-CN,zh;q=0.9','cookie':OO0O0OOOO00O00000 ,'origin':'https://shop.m.jd.com','referer':'https://shop.m.jd.com/','user-agent':OOOOOO0OO00OOOO0O }#line:82 66 | O0O0OOO0OOO0O0OO0 =requests .request ("GET",O0O000OO0OOO0O00O ,headers =OOO0O0OO0OO00O0O0 )#line:83 67 | OO0OO0OOO00OO000O =O0O0OOO0OOO0O0OO0 .json ()#line:84 68 | return OO0OO0OOO00OO000O #line:85 69 | def get_venderId (O00OOO0OO00O0O00O ,O0000OOO00O0O0OO0 ,O0OOOOO0OO00O00O0 ):#line:87 70 | O00000OO0OO00O0O0 =f'https://api.m.jd.com/client.action?functionId=whx_getMShopOutlineInfo&body=%7B%22shopId%22%3A%22{O0OOOOO0OO00O00O0}%22%2C%22source%22%3A%22m-shop%22%7D&appid=shop_view&clientVersion=11.0.0&client=wh5'#line:88 71 | O000OOOO0O0000O00 ={'accept':'*/*','accept-encoding':'gzip, deflate, br','accept-language':'zh-CN,zh;q=0.9','origin':'https://shop.m.jd.com','referer':'https://shop.m.jd.com/','user-agent':O00OOO0OO00O0O00O ,'cookie':O0000OOO00O0O0OO0 }#line:97 72 | OOO00O0000OOO0OO0 =requests .request ("GET",O00000OO0OO00O0O0 ,headers =O000OOOO0O0000O00 )#line:98 73 | O00OO0O000OOO00O0 =OOO00O0000OOO0OO0 .json ()#line:99 74 | try :#line:100 75 | if O00OO0O000OOO00O0 ['success']:#line:101 76 | O00000000O0O0OO00 =O00OO0O000OOO00O0 ['data']['shopInfo']['venderId']#line:102 77 | return O00000000O0O0OO00 #line:103 78 | else :#line:104 79 | return O0OOOOO0OO00O00O0 #line:105 80 | except :#line:106 81 | return #line:107 82 | if __name__ =="__main__":#line:110 83 | global msg #line:111 84 | msg =''#line:112 85 | shopIds =dpcj .split ('&')#line:113 86 | print (f"✅成功获取{len(shopIds)}个DPCJ🆔变量")#line:114 87 | try :#line:115 88 | cks =getCk #line:116 89 | if not cks :#line:117 90 | sys .exit ()#line:118 91 | except :#line:119 92 | print ("未获取到有效COOKIE,退出程序!")#line:120 93 | sys .exit ()#line:121 94 | num =0 #line:122 95 | for cookie in cks :#line:123 96 | num +=1 #line:124 97 | if num %9 ==0 :#line:125 98 | print ("⏰等待3s,休息一下")#line:126 99 | time .sleep (3 )#line:127 100 | ua =userAgent ()#line:128 101 | try :#line:129 102 | pt_pin =re .compile (r'pt_pin=(.*?);').findall (cookie )[0 ]#line:130 103 | pt_pin =unquote_plus (pt_pin )#line:131 104 | except IndexError :#line:132 105 | pt_pin =f'用户{num}'#line:133 106 | print (f'\n******开始【京东账号{num}】{pt_pin} *********\n')#line:134 107 | print (datetime .now ())#line:135 108 | result =check (ua ,cookie )#line:137 109 | if result ['code']!=200 :#line:138 110 | print (f"‼️{result['data']}")#line:139 111 | continue #line:140 112 | signRewards =[]#line:141 113 | for shopId in shopIds :#line:142 114 | try :#line:143 115 | print (f"{shopId}")#line:144 116 | venderId =get_venderId (ua ,cookie ,shopId )#line:145 117 | time .sleep (0.2 )#line:146 118 | if not venderId :#line:147 119 | continue #line:148 120 | signInfo =getSignInfo (ua ,cookie ,shopId ,venderId )#line:149 121 | time .sleep (0.2 )#line:150 122 | if signInfo ['isSuccess']:#line:151 123 | try :#line:152 124 | signInfo_ =signInfo ['result']['result']['signInfo']#line:153 125 | except :#line:154 126 | print (f"\t⛈店铺抽奖已过期")#line:155 127 | continue #line:156 128 | if signInfo_ ['isSign']==2 :#line:157 129 | print (f"\t⛈店铺已抽奖")#line:158 130 | else :#line:159 131 | toSign =sign (ua ,cookie ,shopId ,venderId )#line:160 132 | if toSign ['isSuccess']and 'isWin'in str (toSign ):#line:161 133 | if toSign ['result']['result']['isWin']:#line:162 134 | signReward =toSign ['result']['result']['signReward']['name']#line:163 135 | print (f"\t🎉{signReward}")#line:164 136 | if "东券"in signReward or "购原价"in signReward :#line:165 137 | continue #line:166 138 | signRewards .append (signReward )#line:167 139 | else :#line:168 140 | print ("\t💨💨💨")#line:169 141 | else :#line:170 142 | print ("\t💨💨💨")#line:171 143 | except Exception as e :#line:172 144 | print (e )#line:173 145 | time .sleep (1 )#line:174 146 | continue #line:175 147 | if signRewards :#line:176 148 | price =','.join (signRewards )#line:177 149 | msg +=f'【账号{num}】{pt_pin} 🎉{price}\n'#line:178 150 | time .sleep (0.5 )#line:180 151 | title ="🗣消息提醒:店铺抽奖-JK"#line:182 152 | msg =f"⏰{str(datetime.now())[:19]}\n"+msg #line:183 153 | send (title ,msg ) -------------------------------------------------------------------------------- /utils/jsToken.js: -------------------------------------------------------------------------------- 1 | var axios = require('axios'); 2 | var qs = require('qs'); 3 | 4 | function TDEncrypt(l) { 5 | l = JSON.stringify(l); 6 | l = encodeURIComponent(l); 7 | var k = '', 8 | f = 0; 9 | do { 10 | var h = l.charCodeAt(f++); 11 | var d = l.charCodeAt(f++); 12 | var a = l.charCodeAt(f++); 13 | var b = h >> 2; 14 | h = ((h & 3) << 4) | (d >> 4); 15 | var e = ((d & 15) << 2) | (a >> 6); 16 | var c = a & 63; 17 | isNaN(d) ? (e = c = 64) : isNaN(a) && (c = 64); 18 | k = 19 | k + 20 | '23IL 0) { 43 | inputUrl = inputUrl.substring(0, queryIndex); 44 | } 45 | 46 | d = inputUrl.substring(l.length); 47 | } catch (error) { 48 | console.error('Error parsing URL:', error); 49 | } 50 | 51 | return d; 52 | } 53 | 54 | async function getJsToken( 55 | userAgent = 'jdapp;android;11.2.8;;;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36', 56 | url = 'https://plus.m.jd.com/', 57 | bizId = 'JD-PLUS', 58 | ) { 59 | const d = TDEncrypt({ 60 | ts: { deviceTime: Date.now(), deviceEndTime: Date.now() + 10 }, 61 | ca: { 62 | tdHash: '5b7096a993d442aef38ceb90cce4b485', 63 | contextName: 'webgl,experimental-webgl', 64 | webglversion: 'WebGL 1.0 (OpenGL ES 2.0 Chromium)', 65 | shadingLV: 'WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)', 66 | vendor: 'WebKit', 67 | renderer: 'WebKit WebGL', 68 | extensions: [ 69 | 'ANGLE_instanced_arrays', 70 | 'EXT_blend_minmax', 71 | 'EXT_clip_control', 72 | 'EXT_color_buffer_half_float', 73 | 'EXT_depth_clamp', 74 | 'EXT_disjoint_timer_query', 75 | 'EXT_float_blend', 76 | 'EXT_frag_depth', 77 | 'EXT_polygon_offset_clamp', 78 | 'EXT_shader_texture_lod', 79 | 'EXT_texture_compression_bptc', 80 | 'EXT_texture_compression_rgtc', 81 | 'EXT_texture_filter_anisotropic', 82 | 'EXT_texture_mirror_clamp_to_edge', 83 | 'EXT_sRGB', 84 | 'KHR_parallel_shader_compile', 85 | 'OES_element_index_uint', 86 | 'OES_fbo_render_mipmap', 87 | 'OES_standard_derivatives', 88 | 'OES_texture_float', 89 | 'OES_texture_float_linear', 90 | 'OES_texture_half_float', 91 | 'OES_texture_half_float_linear', 92 | 'OES_vertex_array_object', 93 | 'WEBGL_blend_func_extended', 94 | 'WEBGL_color_buffer_float', 95 | 'WEBGL_compressed_texture_s3tc', 96 | 'WEBGL_compressed_texture_s3tc_srgb', 97 | 'WEBGL_debug_renderer_info', 98 | 'WEBGL_debug_shaders', 99 | 'WEBGL_depth_texture', 100 | 'WEBGL_draw_buffers', 101 | 'WEBGL_lose_context', 102 | 'WEBGL_multi_draw', 103 | 'WEBGL_polygon_mode', 104 | ], 105 | wuv: 'Google Inc. (Intel)', 106 | wur: 'ANGLE (Intel, Intel(R) UHD Graphics 730 (0x00004C8B) Direct3D11 vs_5_0 ps_5_0, D3D11)', 107 | }, 108 | m: { compatMode: 'CSS1Compat' }, 109 | n: { 110 | vendorSub: '', 111 | productSub: '20030107', 112 | vendor: 'Google Inc.', 113 | maxTouchPoints: 1, 114 | pdfViewerEnabled: false, 115 | hardwareConcurrency: 12, 116 | cookieEnabled: true, 117 | appCodeName: 'Mozilla', 118 | appName: 'Netscape', 119 | appVersion: getAppVersionFromUserAgent(userAgent), 120 | platform: 'Win32', 121 | product: 'Gecko', 122 | userAgent: userAgent, 123 | language: 'zh-CN', 124 | onLine: true, 125 | webdriver: false, 126 | javaEnabled: false, 127 | deprecatedRunAdAuctionEnforcesKAnonymity: true, 128 | deviceMemory: 8, 129 | enumerationOrder: [ 130 | 'vendorSub', 131 | 'productSub', 132 | 'vendor', 133 | 'maxTouchPoints', 134 | 'scheduling', 135 | 'userActivation', 136 | 'doNotTrack', 137 | 'geolocation', 138 | 'connection', 139 | 'plugins', 140 | 'mimeTypes', 141 | 'pdfViewerEnabled', 142 | 'webkitTemporaryStorage', 143 | 'webkitPersistentStorage', 144 | 'windowControlsOverlay', 145 | 'hardwareConcurrency', 146 | 'cookieEnabled', 147 | 'appCodeName', 148 | 'appName', 149 | 'appVersion', 150 | 'platform', 151 | 'product', 152 | 'userAgent', 153 | 'language', 154 | 'languages', 155 | 'onLine', 156 | 'webdriver', 157 | 'getGamepads', 158 | 'javaEnabled', 159 | 'sendBeacon', 160 | 'vibrate', 161 | 'deprecatedRunAdAuctionEnforcesKAnonymity', 162 | 'protectedAudience', 163 | 'bluetooth', 164 | 'storageBuckets', 165 | 'clipboard', 166 | 'credentials', 167 | 'keyboard', 168 | 'managed', 169 | 'mediaDevices', 170 | 'storage', 171 | 'serviceWorker', 172 | 'virtualKeyboard', 173 | 'wakeLock', 174 | 'deviceMemory', 175 | 'userAgentData', 176 | 'login', 177 | 'ink', 178 | 'mediaCapabilities', 179 | 'hid', 180 | 'locks', 181 | 'gpu', 182 | 'mediaSession', 183 | 'permissions', 184 | 'presentation', 185 | 'usb', 186 | 'xr', 187 | 'serial', 188 | 'adAuctionComponents', 189 | 'runAdAuction', 190 | 'canLoadAdAuctionFencedFrame', 191 | 'canShare', 192 | 'share', 193 | 'clearAppBadge', 194 | 'getBattery', 195 | 'getUserMedia', 196 | 'requestMIDIAccess', 197 | 'requestMediaKeySystemAccess', 198 | 'setAppBadge', 199 | 'webkitGetUserMedia', 200 | 'clearOriginJoinedAdInterestGroups', 201 | 'createAuctionNonce', 202 | 'joinAdInterestGroup', 203 | 'leaveAdInterestGroup', 204 | 'updateAdInterestGroups', 205 | 'deprecatedReplaceInURN', 206 | 'deprecatedURNToURL', 207 | 'getInstalledRelatedApps', 208 | 'registerProtocolHandler', 209 | 'unregisterProtocolHandler', 210 | ], 211 | }, 212 | p: [], 213 | w: { devicePixelRatio: 4, screenTop: 0, screenLeft: 0 }, 214 | s: { availHeight: 740, availWidth: 360, colorDepth: 24, height: 740, width: 360, pixelDepth: 24 }, 215 | sc: { 216 | ActiveBorder: 'rgb(0, 0, 0)', 217 | ActiveCaption: 'rgb(0, 0, 0)', 218 | AppWorkspace: 'rgb(255, 255, 255)', 219 | Background: 'rgb(255, 255, 255)', 220 | ButtonFace: 'rgb(240, 240, 240)', 221 | ButtonHighlight: 'rgb(240, 240, 240)', 222 | ButtonShadow: 'rgb(240, 240, 240)', 223 | ButtonText: 'rgb(0, 0, 0)', 224 | CaptionText: 'rgb(0, 0, 0)', 225 | GrayText: 'rgb(109, 109, 109)', 226 | Highlight: 'rgba(0, 86, 205, 0.8)', 227 | HighlightText: 'rgb(255, 255, 255)', 228 | InactiveBorder: 'rgb(0, 0, 0)', 229 | InactiveCaption: 'rgb(255, 255, 255)', 230 | InactiveCaptionText: 'rgb(128, 128, 128)', 231 | InfoBackground: 'rgb(255, 255, 255)', 232 | InfoText: 'rgb(0, 0, 0)', 233 | Menu: 'rgb(255, 255, 255)', 234 | MenuText: 'rgb(0, 0, 0)', 235 | Scrollbar: 'rgb(255, 255, 255)', 236 | ThreeDDarkShadow: 'rgb(0, 0, 0)', 237 | ThreeDFace: 'rgb(240, 240, 240)', 238 | ThreeDHighlight: 'rgb(0, 0, 0)', 239 | ThreeDLightShadow: 'rgb(0, 0, 0)', 240 | ThreeDShadow: 'rgb(0, 0, 0)', 241 | Window: 'rgb(255, 255, 255)', 242 | WindowFrame: 'rgb(0, 0, 0)', 243 | WindowText: 'rgb(0, 0, 0)', 244 | }, 245 | ss: { cookie: true, localStorage: true, sessionStorage: true, globalStorage: false, indexedDB: true }, 246 | tz: -480, 247 | lil: '', 248 | wil: '', 249 | }); 250 | 251 | const a = TDEncrypt({ 252 | pin: '', 253 | oid: '', 254 | bizId: bizId, 255 | fc: '', 256 | mode: 'strict', 257 | p: 's', 258 | fp: 'b772d9635edebaa1a47c5a1fd086186a', 259 | ctype: 1, 260 | v: '3.2.1.0', 261 | f: '3', 262 | o: getCurrentPageUrl(url), 263 | qs: '', 264 | qi: '', 265 | }); 266 | 267 | let { status, data } = await axios({ 268 | method: 'POST', 269 | url: `https://jra.jd.com/jsTk.do?a=${encodeURIComponent(a)}`, 270 | headers: { 271 | 'User-Agent': userAgent, 272 | 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8', 273 | }, 274 | data: qs.stringify({ 275 | d: d, 276 | }), 277 | }); 278 | if (status === 200 && data.data) { 279 | return data.data; 280 | } else return null; 281 | } 282 | 283 | module.exports.getJsToken = getJsToken; 284 | 285 | -------------------------------------------------------------------------------- /utils/Rebels_proxy.js: -------------------------------------------------------------------------------- 1 | var iil='jsjiami.com.v7';const l1llII=iii1II;(function(l11i11,IilIl1,lIII1l,l1iIIi,lilIi,l1l11I,lilIl){return l11i11=l11i11>>0x2,l1l11I='hs',lilIl='hs',function(IilIlI,iIli11,Iiiil,Iiiii,l11i1I){const illIl1=iii1II;Iiiii='tfi',l1l11I=Iiiii+l1l11I,l11i1I='up',lilIl+=l11i1I,l1l11I=Iiiil(l1l11I),lilIl=Iiiil(lilIl),Iiiil=0x0;const IiII=IilIlI();while(!![]&&--l1iIIi+iIli11){try{Iiiii=-parseInt(illIl1(0x189,'HzvD'))/0x1*(parseInt(illIl1(0x1a1,'0B71'))/0x2)+parseInt(illIl1(0x191,'Z!9h'))/0x3*(-parseInt(illIl1(0x1a0,'BnGu'))/0x4)+-parseInt(illIl1(0x1c9,'XJv8'))/0x5+parseInt(illIl1(0x1a9,'NRqG'))/0x6+parseInt(illIl1(0x1b1,'hGq4'))/0x7+parseInt(illIl1(0x1af,'YmN^'))/0x8+-parseInt(illIl1(0x1d6,'jMWo'))/0x9*(-parseInt(illIl1(0x1ce,'Z!9h'))/0xa);}catch(llIIli){Iiiii=Iiiil;}finally{l11i1I=IiII[l1l11I]();if(l11i11<=l1iIIi)Iiiil?lilIi?Iiiii=l11i1I:lilIi=l11i1I:Iiiil=l11i1I;else{if(Iiiil==lilIi['replace'](/[MUQVbFRhweuTrgLWKNEp=]/g,'')){if(Iiiii===iIli11){IiII['un'+l1l11I](l11i1I);break;}IiII[lilIl](l11i1I);}}}}}(lIII1l,IilIl1,function(lIII1I,illIlI,liIiI,l1il1I,Iiili,IilIli,li1){return illIlI='\x73\x70\x6c\x69\x74',lIII1I=arguments[0x0],lIII1I=lIII1I[illIlI](''),liIiI=`\x72\x65\x76\x65\x72\x73\x65`,lIII1I=lIII1I[liIiI]('\x76'),l1il1I=`\x6a\x6f\x69\x6e`,(0x151ab5,lIII1I[l1il1I](''));});}(0x2f8,0x669a0,Iii11l,0xc0),Iii11l)&&(iil=0xc0);const IiiIll=require(l1llII(0x183,'XPUz'));let IIlii=require('https-proxy-agent')[l1llII(0x1ae,'5F6h')],IlI1il=process[l1llII(0x1ad,'e&Du')][l1llII(0x19a,'NRqG')]||'',IilliI=process['env']['RS_PROXY_TIMEOUT']||0x4e20,IlI1ii=0x1,lIIiii='',iI1lli=0x0;async function ll1iI(IIli1I){const lI11Ii=l1llII,I1i11I={'JYtxg':function(I1l1I1){return I1l1I1();}};if(!IIli1I)return;const llIliI=await IiiIll['get'](IIli1I,{'timeout':{'request':0x7530}})['catch'](I1i111=>{const IilIll=iii1II;console[IilIll(0x1b7,'Asf*')](I1i111);});lIIiii=llIliI?.[lI11Ii(0x1c1,'MaO8')]?llIliI[lI11Ii(0x18a,'XPUz')][lI11Ii(0x19e,'qDou')]('\x0a','')['replace'](/^.*:\/\//,''):'',I1i11I[lI11Ii(0x1cc,'uS2G')](while_get_proxy);}function iii1II(_0x30d447,_0x2e6c1f){const _0x3defaf=Iii11l();return iii1II=function(_0x2db4cd,_0xdf893d){_0x2db4cd=_0x2db4cd-0x182;let _0x37e9e3=_0x3defaf[_0x2db4cd];if(iii1II['YjFGvk']===undefined){var _0x5df719=function(_0x45dca4){const _0x4166dd='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x52ce88='',_0x1f6893='';for(let _0x599a5e=0x0,_0x225d5c,_0x407851,_0x181903=0x0;_0x407851=_0x45dca4['charAt'](_0x181903++);~_0x407851&&(_0x225d5c=_0x599a5e%0x4?_0x225d5c*0x40+_0x407851:_0x407851,_0x599a5e++%0x4)?_0x52ce88+=String['fromCharCode'](0xff&_0x225d5c>>(-0x2*_0x599a5e&0x6)):0x0){_0x407851=_0x4166dd['indexOf'](_0x407851);}for(let _0x1a208e=0x0,_0x1bfe81=_0x52ce88['length'];_0x1a208e<_0x1bfe81;_0x1a208e++){_0x1f6893+='%'+('00'+_0x52ce88['charCodeAt'](_0x1a208e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1f6893);};const _0xd50752=function(_0x13a937,_0x4fe47d){let _0x4886b9=[],_0x4edfea=0x0,_0x2f939b,_0x426dac='';_0x13a937=_0x5df719(_0x13a937);let _0x958a91;for(_0x958a91=0x0;_0x958a91<0x100;_0x958a91++){_0x4886b9[_0x958a91]=_0x958a91;}for(_0x958a91=0x0;_0x958a91<0x100;_0x958a91++){_0x4edfea=(_0x4edfea+_0x4886b9[_0x958a91]+_0x4fe47d['charCodeAt'](_0x958a91%_0x4fe47d['length']))%0x100,_0x2f939b=_0x4886b9[_0x958a91],_0x4886b9[_0x958a91]=_0x4886b9[_0x4edfea],_0x4886b9[_0x4edfea]=_0x2f939b;}_0x958a91=0x0,_0x4edfea=0x0;for(let _0x1827bd=0x0;_0x1827bd<_0x13a937['length'];_0x1827bd++){_0x958a91=(_0x958a91+0x1)%0x100,_0x4edfea=(_0x4edfea+_0x4886b9[_0x958a91])%0x100,_0x2f939b=_0x4886b9[_0x958a91],_0x4886b9[_0x958a91]=_0x4886b9[_0x4edfea],_0x4886b9[_0x4edfea]=_0x2f939b,_0x426dac+=String['fromCharCode'](_0x13a937['charCodeAt'](_0x1827bd)^_0x4886b9[(_0x4886b9[_0x958a91]+_0x4886b9[_0x4edfea])%0x100]);}return _0x426dac;};iii1II['cOkkSn']=_0xd50752,_0x30d447=arguments,iii1II['YjFGvk']=!![];}const _0x639674=_0x3defaf[0x0],_0x4e1272=_0x2db4cd+_0x639674,_0xc69e27=_0x30d447[_0x4e1272];return!_0xc69e27?(iii1II['ZlDlYG']===undefined&&(iii1II['ZlDlYG']=!![]),_0x37e9e3=iii1II['cOkkSn'](_0x37e9e3,_0xdf893d),_0x30d447[_0x4e1272]=_0x37e9e3):_0x37e9e3=_0xc69e27,_0x37e9e3;},iii1II(_0x30d447,_0x2e6c1f);}ll1iI(IlI1il),while_get_proxy=async()=>{const Iiill=l1llII,ilI1li={'pVncq':function(IIliI,ilI1ll){return IIliI(ilI1ll);},'VPXkA':function(Iillii,IlI1iI,Iillil){return Iillii(IlI1iI,Iillil);}};ilI1li[Iiill(0x1c7,'Sna3')](clearTimeout,iI1lli),iI1lli=ilI1li[Iiill(0x18e,'!hGp')](setTimeout,()=>{const l11i1i=Iiill;ilI1li[l11i1i(0x1be,'e&Du')](ll1iI,IlI1il);},IilliI);};async function iI1lll(l1lIli){return new Promise(lIIiiI=>{setTimeout(lIIiiI,l1lIli);});}function l1lIll(II1lil,IIli1l,II1lii=![]){const lI11I1=l1llII,lIIii1={'pmhab':function(ll1i1,IIli1i){return ll1i1!==IIli1i;},'XJxIW':lI11I1(0x18f,'nc0t'),'rDfAJ':function(I1iIi1,lliil1){return I1iIi1(lliil1);},'BFEXL':lI11I1(0x1b2,'@Q%3'),'wXMcE':lI11I1(0x1cf,'jMWo'),'VbREE':function(IIllI,lliilI){return IIllI===lliilI;},'rTAHo':'nxLJY','xtIPj':function(lili1,ll1l1){return lili1{const liI=lI11I1,IiiIiI={'WNPAr':function(lilii,l1iiI,ll1li,Illl1I){const l1il11=iii1II;return lIIii1[l1il11(0x1d5,'uS2G')](lilii,l1iiI,ll1li,Illl1I);},'HzVKZ':function(lliiiI,lilil){const IiI1=iii1II;return lIIii1[IiI1(0x1d4,'Z!9h')](lliiiI,lilil);}};if(IlI1il&&(this[liI(0x194,'lVfI')]||II1lii)){let ll1ll=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;this['ip']=lIIiii;if(lIIii1['pmhab'](ll1ll['test'](this['ip']),![]))this[liI(0x1d0,'mwQi')]=this['ip']?new IIlii(liI(0x1a5,'i(Pr')+this['ip']):undefined;this['agent']?console[liI(0x18c,'heN#')](lIIii1[liI(0x1bc,'zFSH')]+this['ip']):'',IIll1[liI(0x192,'i(Pr')]={'https':this[liI(0x1d0,'mwQi')],'http':this[liI(0x1d1,'qDou')]};}IIll1['timeout']={'request':0x1388,'response':0x1388};try{lIIii1[liI(0x193,'BnGu')](lIIii1[liI(0x196,'nc0t')],lIIii1[liI(0x1a8,'JN@l')])?(i1illI(i1IIl),I1lll1['log'](i1IIi),IiiIiI[liI(0x1d8,'YmN^')](IIII1I,Iii111,l1l1II,Iil1I1=![])):II1lil[IIli1l](IIll1,async(ii1lI,I1ilIl,I11iII)=>{const l11i1l=liI,I1ilIi={'xlWeQ':function(IiiiI,llIlli){const illIli=iii1II;return lIIii1[illIli(0x1b5,'!hGp')](IiiiI,llIlli);},'xwOKJ':function(llIlll,lliii1){return llIlll+lliii1;},'XTYMe':lIIii1[l11i1l(0x1d9,'ffHi')],'OGvWY':function(Iiii1,lIIili){return lIIii1['rDfAJ'](Iiii1,lIIili);},'FZwLz':function(IiiIil,IiiIii){return IiiIil(IiiIii);},'bautL':function(IIlll,liliI){return lIIii1['rDfAJ'](IIlll,liliI);},'EZeOU':function(ll1lI,l1iii,IIlli){return ll1lI(l1iii,IIlli);}};if(lIIii1[l11i1l(0x1a3,'qDou')](lIIii1[l11i1l(0x1ab,'XPUz')],lIIii1['BFEXL'])){let ii1l1=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;this['ip']=iii1Il;if(I1ilIi['xlWeQ'](ii1l1[l11i1l(0x1c0,'heN#')](this['ip']),![]))this[l11i1l(0x18b,'1yUt')]=this['ip']?new lI1IiI(l11i1l(0x1c8,'LLh4')+this['ip']):i1lI;this[l11i1l(0x185,'LLh4')]?IlI1l[l11i1l(0x1b3,'%PR)')](I1ilIi[l11i1l(0x1b9,'LLh4')](I1ilIi[l11i1l(0x199,'@Q%3')],this['ip'])):'',lilIil[l11i1l(0x1d2,'!ec#')]={'https':this[l11i1l(0x1b6,'@Q%3')],'http':this[l11i1l(0x1b0,'g)$6')]};}else try{if(lIIii1['pmhab'](lIIii1['wXMcE'],l11i1l(0x1ba,'zFSH')))ii1lI?lIIii1['VbREE'](lIIii1[l11i1l(0x1a6,'Z!9h')],lIIii1[l11i1l(0x198,'mwQi')])?lIIii1[l11i1l(0x195,'WZ%6')](this[l11i1l(0x1a4,'mwQi')],0x1)?(this[l11i1l(0x1b8,'5F6h')]=!![],this[l11i1l(0x19f,'JN@l')]++,await lIIii1[l11i1l(0x184,'5F6h')](ddd,IIll1,ll1il)):lIIii1['pmhab'](lIIii1['iGLFA'],lIIii1['iGLFA'])?(IiiIiI[l11i1l(0x182,'YmN^')](i1illi,i1illl),I1llil[l11i1l(0x1a7,'YmN^')](I1llii),IiiIiI[l11i1l(0x197,'qDou')](lilIll,l1i111,iliII1,II11I1=![])):(this[l11i1l(0x19c,'XJv8')]=!![],this[l11i1l(0x1cb,'kWBG')]=0x0,lIIii1[l11i1l(0x1bb,'lVfI')](ll1il,ii1lI,I1ilIl,I11iII)):I1ilIi[l11i1l(0x1bf,'Vigu')](I1iIl1,i1il):(IlI1ii++,this[l11i1l(0x1c6,'NRqG')]=![],this[l11i1l(0x1d7,'i(Pr')]=0x0,lIIii1['BODyi'](ll1il,ii1lI,I1ilIl,I11iII));else return new IliI1I(I11iIl=>{li1II(I11iIl,IliI11);});}catch(l1l11l){l11i1l(0x186,'jMWo')===lIIii1[l11i1l(0x1c4,'Z!9h')]?(I1ilIi['bautL'](IlI1I,II11Ii),II11Il=I1ilIi[l11i1l(0x19b,'lVfI')](IlI11,()=>{const lIII11=l11i1l;I1ilIi[lIII11(0x1c5,'nwlo')](iIIIIi,iii1I1);},lilIlI)):(lIIii1[l11i1l(0x1cd,'@Q%3')](ll1iI,IlI1il),console[l11i1l(0x190,'kb@M')](l1l11l),lIIii1[l11i1l(0x19d,'i(Pr')](l1lIll,II1lil,IIli1l,II1lii=![]));}});}catch(l1iIi){lIIii1[liI(0x1ca,'I[jC')](ll1iI,IlI1il),console[liI(0x1bd,'^11e')](l1iIi),lIIii1[liI(0x1c2,'j5iF')](l1lIll,II1lil,IIli1l,II1lii=![]);}};}function Iii11l(){const IiilI=(function(){return[...[iil,'rULjbLsgNjFMiWaeEmiR.TVLcopmh.uvTK7WppwQ==','qhmv','bSohW6tcM8k9','CuPSW6dcTa','5l+L55At5lQZ55ojW7DU776F','WRNcRSov','uSkZWQbIBmo9aSoRFxFcUa','aCoVwSkNuq','W57dT35gWQK','ks/dSmoeW4mR','W7BdGa7cHqC','W4ddTrxcVCov','W67cLNlcL8kI','bmoQW53cT8kJ','WRrGWObkpa','fCkOveHWhKZcSmkCWQS1Bq','cHtdVmoNW7m','reBdSSkxWOKr','gCoXv8kZBa','W4VcVvlcUSkXyNO','pCouWPTcW7O9WOu','WPRcOK9IWQxdRSoFW7G','WRJcHttcIsP4WRNcUHfx','tN3dHCkbW6ddSSoU','W4NcTuRcT8kY','emoFW7xcK8kIW7JcRq','cmo8s8k5h8ojza','fCouW5GBma','r8o5DW','aCo7WRDCW78'],...(function(){return[...['DSoooc8xz0dcRSk1WOGJqq','vSonWQNdPMOFE8od','be8ZFCoJ','W4jGBSolWOG9W5b/WQ3cNu0','bSkBWQS','fNrLWOldV8kiDN9nWQvDBLHZWPm','gCkIimkTlCo8W7LSW6FdTqNdRxa','u8kinqXt','W7rcW6BcOmkjqCo2y0LoEsD7','WQnzWPDGdG','WQSxWPe','BdqHW4BcTCoHnKPaWPbXyLq','v3DCW6RcLW','WO1tWRXPlq','WOLQWQy','ogf4WP7dQCk8','W5qtdsaU','W5BdPSkKW6pdSG','dqhdNCorW48','W6/dQ8kmW6xdOW','W7dcTa4','e8kJWRpdNf8','zCkfyuVdPG','whKbEq','zXa2iW','WRmnW67dPgO','WOxdIXxcN8oOC1RdLSoJyW','d8oVW6Swna','mSkHW4PbW7W','iCkAyNrhnq','W50DbfldVq'],...(function(){return['W4qqnHTEFmk8','eblcR8ocW59eW6qwW4pcNmkMdNW','WOpcPmkUz8op','WR/cQmkZW4ddPCovkG','WPRcHGJcMa0','WR1tWOPfna','umkYWQbMBmkxpSo3tLxcHsy','W7LAoKpcPG','f8ozW7NcKCk4','W5JcV0FcUmkK','ywFcMdtcHG','g8o3jcVcISorptpcPCo2cSog','nSoNW4OrmG','WPlcKdJcMqm','WOSleLFcRHhdMfq','bSoPvSkLs8ktjG','FmoyqmoyzG','WPFdQSkIW7dcVW','y8oSrSostG','iwyc','heT1WPNdPW','W40djWuq','W6TOgLRcUW','WPDeWQ/cTmoe','WQOMWPNdMSoc','hJ3dGCk3W5BdJmoRyW','jgysxa','W6ezjuVcKG'];}())];}())];}());Iii11l=function(){return IiilI;};return Iii11l();};function I1l1II(){}module[l1llII(0x1a2,'HzvD')]={'intoRequest':l1lIll};var version_ = 'jsjiami.com.v7'; -------------------------------------------------------------------------------- /utils/Rebels_3_0.js: -------------------------------------------------------------------------------- 1 | /* 2 | new Env('Rebels_3_0'); 3 | */ 4 | var iil='jsjiami.com.v7';const ilI1lI=iii1II;(function(IiiIl1,lIIil1,IIli1,II1liI,IlI1i1,l1lIl1,IiiIlI){return IiiIl1=IiiIl1>>0x4,l1lIl1='hs',IiiIlI='hs',function(Iilli1,I1l1Il,llIll1,Illl1l,Illl1i){const llIlii=iii1II;Illl1l='tfi',l1lIl1=Illl1l+l1lIl1,Illl1i='up',IiiIlI+=Illl1i,l1lIl1=llIll1(l1lIl1),IiiIlI=llIll1(IiiIlI),llIll1=0x0;const lIIiil=Iilli1();while(!![]&&--II1liI+I1l1Il){try{Illl1l=-parseInt(llIlii(0x8f,'@isu'))/0x1*(parseInt(llIlii(0xa3,'oIbJ'))/0x2)+-parseInt(llIlii(0xa1,'guTq'))/0x3+parseInt(llIlii(0xa4,'AeS('))/0x4+parseInt(llIlii(0x92,'r5XH'))/0x5*(-parseInt(llIlii(0x87,'JVa9'))/0x6)+-parseInt(llIlii(0x9d,'$zW!'))/0x7*(parseInt(llIlii(0x8b,'3o@]'))/0x8)+-parseInt(llIlii(0x8d,'WQ]H'))/0x9+-parseInt(llIlii(0x96,'$zW!'))/0xa*(-parseInt(llIlii(0xaf,'EQjZ'))/0xb);}catch(l1lIii){Illl1l=llIll1;}finally{Illl1i=lIIiil[l1lIl1]();if(IiiIl1<=II1liI)llIll1?IlI1i1?Illl1l=Illl1i:IlI1i1=Illl1i:llIll1=Illl1i;else{if(llIll1==IlI1i1['replace'](/[dKGtDJRXeYUyHMwbCQB=]/g,'')){if(Illl1l===I1l1Il){lIIiil['un'+l1lIl1](Illl1i);break;}lIIiil[IiiIlI](Illl1i);}}}}}(IIli1,lIIil1,function(I11iI1,l1lIil,IiiIli,iillli,I1l1Ii,I1i11i,I1i11l){return l1lIil='\x73\x70\x6c\x69\x74',I11iI1=arguments[0x0],I11iI1=I11iI1[l1lIil](''),IiiIli=`\x72\x65\x76\x65\x72\x73\x65`,I11iI1=I11iI1[IiiIli]('\x76'),iillli=`\x6a\x6f\x69\x6e`,(0x14f566,I11iI1[iillli](''));});}(0xbc0,0xbb097,Iii11l,0xbe),Iii11l)&&(iil=Iii11l);const i1l1ll=require('jsdom');let I1iIiI=null,li1I1=null;async function i1ilil(iIIl1l){const llIli1={'cjJmi':function(iliIII,iIIl1i){return iliIII(iIIl1i);},'ISZTM':function(I1lllI,ill111,Iliil1){return I1lllI(ill111,Iliil1);}};return new Promise((i1III,Ii1iIi)=>{llIli1['ISZTM'](setTimeout,()=>{const llIlil=iii1II;llIli1[llIlil(0x9e,'y&Np')](i1III,iIIl1l);},iIIl1l);});}async function lilIii(iliIIl){const IIlil=iii1II,Ii1iIl={'FFCoM':IIlil(0x94,'oIbJ'),'vjWLO':'Mozilla/5.0\x20(Macintosh;\x20Intel\x20Mac\x20OS\x20X\x2010.15;\x20rv:91.0)\x20Gecko/20100101\x20Firefox/91.0','FHRri':IIlil(0xb0,'f[zq'),'FDIoN':IIlil(0xb3,'T(5r'),'fbfMW':IIlil(0x86,'T(5r'),'RIKxB':function(Iliiii,i1illI){return Iliiii(i1illI);}},{JSDOM:iliIIi}=i1l1ll;let ill11I=new i1l1ll[(IIlil(0x9c,'#4@$'))]({'userAgent':'Mozilla/5.0\x20(Macintosh;\x20Intel\x20Mac\x20OS\x20X\x2010.15;\x20rv:91.0)\x20Gecko/20100101\x20Firefox/91.0','referrer':'https://msitepp-fm.jd.com/rest/priceprophone/priceProPhoneMenu'}),Iliiil=new i1l1ll[(IIlil(0x8e,'&As9'))](),li1Il={'url':Ii1iIl[IIlil(0xa2,'T5ky')],'referrer':Ii1iIl[IIlil(0xab,'3o@]')],'userAgent':Ii1iIl[IIlil(0xa8,'W4[]')],'runScripts':Ii1iIl['FHRri'],'resources':ill11I,'includeNodeLocations':!![],'storageQuota':0x989680,'pretendToBeVisual':!![],'virtualConsole':Iliiil};const li1Ii=new iliIIi('\x0a\x20\x20\x20\x20\x0a\x20\x20\x20\x20>(-0x2*_0xce138f&0x6)):0x0){_0x3e9ef4=_0x7f7e4b['indexOf'](_0x3e9ef4);}for(let _0x492d9f=0x0,_0x2ee623=_0xabd09['length'];_0x492d9f<_0x2ee623;_0x492d9f++){_0x2906b5+='%'+('00'+_0xabd09['charCodeAt'](_0x492d9f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2906b5);};const _0x5cccb4=function(_0x4927f1,_0x2645db){let _0x4d2871=[],_0x203a97=0x0,_0x44018c,_0x3fa1df='';_0x4927f1=_0x44e1b1(_0x4927f1);let _0x519f62;for(_0x519f62=0x0;_0x519f62<0x100;_0x519f62++){_0x4d2871[_0x519f62]=_0x519f62;}for(_0x519f62=0x0;_0x519f62<0x100;_0x519f62++){_0x203a97=(_0x203a97+_0x4d2871[_0x519f62]+_0x2645db['charCodeAt'](_0x519f62%_0x2645db['length']))%0x100,_0x44018c=_0x4d2871[_0x519f62],_0x4d2871[_0x519f62]=_0x4d2871[_0x203a97],_0x4d2871[_0x203a97]=_0x44018c;}_0x519f62=0x0,_0x203a97=0x0;for(let _0x2e5e72=0x0;_0x2e5e72<_0x4927f1['length'];_0x2e5e72++){_0x519f62=(_0x519f62+0x1)%0x100,_0x203a97=(_0x203a97+_0x4d2871[_0x519f62])%0x100,_0x44018c=_0x4d2871[_0x519f62],_0x4d2871[_0x519f62]=_0x4d2871[_0x203a97],_0x4d2871[_0x203a97]=_0x44018c,_0x3fa1df+=String['fromCharCode'](_0x4927f1['charCodeAt'](_0x2e5e72)^_0x4d2871[(_0x4d2871[_0x519f62]+_0x4d2871[_0x203a97])%0x100]);}return _0x3fa1df;};iii1II['MLJCYC']=_0x5cccb4,_0x2cf802=arguments,iii1II['ShUtdE']=!![];}const _0xf3c2c4=_0x1edb9e[0x0],_0x38e182=_0x2865b8+_0xf3c2c4,_0x2e1843=_0x2cf802[_0x38e182];return!_0x2e1843?(iii1II['XbqsKb']===undefined&&(iii1II['XbqsKb']=!![]),_0x1d161b=iii1II['MLJCYC'](_0x1d161b,_0x283592),_0x2cf802[_0x38e182]=_0x1d161b):_0x1d161b=_0x2e1843,_0x1d161b;},iii1II(_0x2cf802,_0x379743);}async function i1ill1(i1IIl,I1lll1,i1IIi=ilI1lI(0x84,'*wPq')){const IiiIll=ilI1lI,IIII1I={'ZUIDH':'function','FSjMj':function(Iii111,l1l1II){return Iii111(l1l1II);},'cMNDA':function(Iil1I1,Ii1iII){return Iil1I1===Ii1iII;},'eqOnp':function(l1i11I,II11II,Ii1iI1){return l1i11I(II11II,Ii1iI1);},'NjTAw':function(lilIli,Iliili){return lilIli===Iliili;},'qTJaP':function(Iliill,IIII11,i1illi){return Iliill(IIII11,i1illi);},'WPcSj':'4.1'};i1IIi!=='3.1'&&(i1IIi=IIII1I[IiiIll(0xb2,'Xpdc')]);switch(i1IIi[IiiIll(0x99,'Bvg0')](0x0)){case'3':!I1iIiI&&await lilIii(i1IIi);break;case'4':!li1I1&&await IIII1I[IiiIll(0xa7,'lnHM')](lilIii,i1IIi);break;}return new Promise(async i1illl=>{const IIlii=IiiIll,I1llil={'ljYNf':IIII1I[IIlii(0x98,'J@1s')],'VAIXx':function(I1llii,lilIll){return IIII1I['FSjMj'](I1llii,lilIll);},'fYYhj':function(l1i111,iliII1){return IIII1I['FSjMj'](l1i111,iliII1);},'uzDJD':function(II11I1,Iii11I){return II11I1(Iii11I);}};switch(i1IIi[IIlii(0xaa,'tfl!')](0x0)){case'3':if(IIII1I[IIlii(0x81,'rWZg')](typeof I1iIiI['signWaap'],IIlii(0x95,'f(&H'))){const Iil1II=await I1iIiI[IIlii(0xb6,'r5XH')](i1IIl,I1lll1);i1illl(Iil1II);}else{let iIIl1I=null;iIIl1I=IIII1I[IIlii(0x90,'WQ]H')](setInterval,async()=>{const IlI1il=IIlii;if(typeof I1iIiI[IlI1il(0x85,'rHKN')]===I1llil[IlI1il(0xb8,'3#9L')]){I1llil[IlI1il(0x93,'oIbJ')](clearInterval,iIIl1I),iIIl1I=null;const I1iIli=await I1iIiI[IlI1il(0xa5,'EQjZ')](i1IIl,I1lll1);I1llil[IlI1il(0x9f,'J@1s')](i1illl,I1iIli);}},0x64);}break;case'4':if(IIII1I[IIlii(0xa9,'$zW!')](typeof li1I1[IIlii(0xa6,'J@1s')],IIlii(0x82,'J@45'))){const lI1Ill=await li1I1['signWaap'](i1IIl,I1lll1);IIII1I[IIlii(0x89,'@isu')](i1illl,lI1Ill);}else{let lI1Ili=null;lI1Ili=IIII1I['qTJaP'](setInterval,async()=>{const IilliI=IIlii;if(typeof li1I1[IilliI(0xb7,'T5ky')]===I1llil[IilliI(0x91,'DXNM')]){I1llil['fYYhj'](clearInterval,lI1Ili),lI1Ili=null;const IliilI=await li1I1[IilliI(0x88,'lnHM')](i1IIl,I1lll1);I1llil[IilliI(0x83,'4#A1')](i1illl,IliilI);}},0x64);}break;}});}module['exports']=i1ill1;function Iii11l(){const IlI1ii=(function(){return[...[iil,'dtwjUMsbjYiaXHmBCiHyQ.BDcoJtRm.MUvGe7KKD==','FMZdKqziE8khWOC','W6fCDSoYgq','W6hdPSo0W5RcIW','tH7cMmomtSkXWOJdGq','jMSYW6pdNa','W4BdMru','WPaXqCkahvTXW54','hrLiE8kdcJldVW','dtpdOG0ixtVdMxG+WRhdJW','W4nZW6LqW7ekW5yh','WR1rtxtdOq','W5nbidZdKvO','l8owpSkYBCoVBa','WQCjW4NcINrHW6vAmqnojda','cJmuDwKDlSovW6NcI8oMWQ4k','k0PYt1JcOu4FWRrQrmoWWO1q','W4Pmx3FdUtTv','v3DQiYK'],...(function(){return[...['ymkEpSkrWPq','WQe5vrFdQ8kwhvRdUq','WRaodrldRq','WO47mdRdPSkEg3vfWRW4emo1W4mgW7RcTLD5z8kGwtCkWORdVJWnbNejfZ5wW6pcT8k6WQ7cLCo+WPKMz8kyy8oznfLlmCo7W5JcHYFcJLbCWQBdTKNdP8oL','WPvKWP3dU8ogWPP0kW','z8orWP7cS3NcS8kLWPRdQ8o5','dvnwW7JcTCkuW6qBgKHGW4vl','WQLSbhddSG','W5RdSqfZpCkp','tNpcNCkRrSkrW6xdU1LVhGNcNG','iGCEW4iB','WPvqWO1pWQpdObVcU8kBy8k7WPT6W6i','A8owWPlcUZxdNCoLWQJdHSoyWRlcIt0','W5zBzMyd','WQv4bgZdGG','BLVdRCkaW4mTwmoTsmoCda','WOdcTmoigCkuwt0zwtalW6Sr','s0pdTqDs','W5v4CNRcP8kwFdj+WOWFdW','WQvozmkez3ldQq8DWR9FFSot'],...(function(){return['aYCYW5qoWQ9SWP4','WObqkLRdRCk9sdq','W7zjW6rZW4W','af7dNq3dOq','hmknW7ldGNy','WPJcJSkjW4uUuq','uCo7kmkQEG','FmknW5xcOt/dMCoZWR7dRSoaWPpcMWatDSkdxCoNWP8BW4RdVSkdlCoBEw0LW6xcS8kLWQ7cKa/dOLikW5Obn8kqwrPkWPGygCkWjmkVW6b2WR7dNXueC0DgzSkUi8ojfSowWPBdQCoXlaRcLuuCkt9mW7VdHmo2WPdcHSoTvYimW7atWQNcIL5kWQ5pW5hdIZ7dGqxdPYCzWPaMFmodbCkdzCo4nSkVwSkLFJm9rCk1daxdMG','wSoDzmoPW7VcHG','W5r4CN/cRCkwqbnmWROllG','shTLWO5OWRLGWRBcOtpdJW','xCouA8o8W5/cGbpdQSo8W6RcSa','W7NdUIegvG','AZChWPRdQW','hrLiE8kdcJldTa','ruHvthFcTe8','WOrqi1ddLCkR','W6nGbY/dLCkVdMa'];}())];}())];}());Iii11l=function(){return IlI1ii;};return Iii11l();};var version_ = 'jsjiami.com.v7'; 5 | -------------------------------------------------------------------------------- /jd_wxtoken_m.js: -------------------------------------------------------------------------------- 1 | /* 2 | 快速获取token 3 | 38 11 11 11 * jd_wxtoken_m.js 4 | */ 5 | let lnrun = 0; 6 | 7 | const $ = new Env('快速缓存token'); 8 | const _0x397d2d = $.isNode() ? require("./jdCookie.js") : "", 9 | _0x1210e5 = require("./function/dylank"); 10 | 11 | let _0x3fe89e = [], 12 | _0x1b13db = "", 13 | _0x312024 = 0; 14 | 15 | if ($.isNode()) { 16 | Object.keys(_0x397d2d).forEach(_0xdad163 => { 17 | _0x3fe89e.push(_0x397d2d[_0xdad163]); 18 | }); 19 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === "false") console.log = () => { }; 20 | } else _0x3fe89e = [$.getdata("CookieJD"), $.getdata("CookieJD2"), ..._0x4bc8ae($.getdata("CookiesJD") || "[]").map(_0x286aa9 => _0x286aa9.cookie)].filter(_0x29b175 => !!_0x29b175); 21 | 22 | !(async () => { 23 | if (!_0x3fe89e[0]) { 24 | $.msg($.name, "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", "https://bean.m.jd.com/bean/signIndex.action", { 25 | "open-url": "https://bean.m.jd.com/bean/signIndex.action" 26 | }); 27 | return; 28 | } 29 | 30 | $.log("快速缓存token,用于开卡类任务"); 31 | $.log("token有效期20多分钟,定时按需改"); 32 | $.log("支持代理PAI DY_PROXY='url'"); 33 | 34 | for (let _0xdbc1ac = 0; _0xdbc1ac < _0x3fe89e.length; _0xdbc1ac++) { 35 | if (_0x3fe89e[_0xdbc1ac]) { 36 | _0x1b13db = _0x3fe89e[_0xdbc1ac]; 37 | $.UserName = decodeURIComponent(_0x1b13db.match(/pt_pin=([^; ]+)(?=;?)/) && _0x1b13db.match(/pt_pin=([^; ]+)(?=;?)/)[1]); 38 | $.index = _0xdbc1ac + 1; 39 | $.nickName = ""; 40 | 41 | if (_0x312024 > 2) { 42 | console.log("连续三次获取失败,可能限制ip,停止执行!!!"); 43 | break; 44 | } 45 | 46 | console.log("\n------开始【账号" + $.index + "】" + ($.nickName || $.UserName) + "------\n"); 47 | $.Token = await _0x1210e5(_0x1b13db, "https://lzdz1-isv.isvjcloud.com"); 48 | $.Token == "" ? _0x312024++ : _0x312024 = 0; 49 | await $.wait(2000); 50 | } 51 | } 52 | })().catch(_0x4b0d5 => { 53 | $.log("", "❌ " + $.name + ", 失败! 原因: " + _0x4b0d5 + "!", ""); 54 | }).finally(() => { 55 | $.done(); 56 | }); 57 | 58 | function _0x4bc8ae(_0x51f9c6) { 59 | if (typeof _0x51f9c6 == "string") try { 60 | return JSON.parse(_0x51f9c6); 61 | } catch (_0x3a39c5) { 62 | return console.log(_0x3a39c5), $.msg($.name, "", "请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie"), []; 63 | } 64 | } 65 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } -------------------------------------------------------------------------------- /function/getH5st3_0.js: -------------------------------------------------------------------------------- 1 | function qvOoC_(){}var bqv9RD=Object['defineProperty'],BahnH7w,nk_U0E,jad0dpX,Lwi9dV,wopLnSr,MjNBoca,_EBMaR,qbvHvuG,BVDpnIh,CJHx15,d3J8_T,w8BPtN,LnkAPIo,AeK_tkO,c09sHmx,T3eOMJk,DimuA5j,uGw2fr,KS8mHlo,dhf2NH,i36nOsn;function Ok7H2Bu(qvOoC_){return BahnH7w[qvOoC_>0x3e?qvOoC_+0x3b:qvOoC_-0x2d]}BahnH7w=oqEjZ55();var YjlprKs=[],wbfE0H=['06JVI','`A','Kt.o8^A','bnu)C(j+X','UnlV/7geK','DOJVI','5#r)/9y','b8SxRa#tiUVLny,cj*3@hq*5/6**2^=W,g~RK3+s','Ztg"7{A','}XvBY(ESw5Dv~i/ZUaRW%9ZrS*evxCDF1|fWw}3S','n_MVI6>(m@u]0.HeV1lk?dse.B)*6CVe{&^uirms','d&wGW!#`ZCO9nCS7)6g','PkkH,+VUKMP#161y,X,G/{Ycg>xtYFm%9|=G|@Ms','@fPaX`ed&J@:{c7c8|Y(X@*dL6ixintF','AtZ"y#0[oOxU3m6T@1cah.)I8l','({?uTuDt3nU"dd0FRO3F1[9Xz|o"M8`_(|H(D','Z(xHz{Z(}BZLJy@.eOFI/G*Gk','tG}Pu*#U,Yvqkn7p}8EbAOqh|Opufy@hw6]aFaJ@~&2,!OY','bOKph##c_|NlLeC','sqS"Nm4teTlg:1_R>GpW^v:c}YZFH"wN;]g','B({]r!=I95+Js','<80X[(|hm{bgAnPym_}on+nj|aA#Yg+F[TF)ha_um@L9A','@#@KVykL*{|]<^,r,%g','LZpWb#x0T*l0US','sk2)g@`Yj>sSid_Re|zRbqrraMP#tL7c7Gqo$:OUX','B(6Pbd2M2Otq96"j:X2Ie}Qc+*h.UH~yiO,H','oasXy!H[$UFXPF#Uv|/"&OSrLT=)9cBU[.LTF*T&uc:cpx6{:0C,RX.lRp!2fEMr','raKbH+Etp68Z"&;=TU*YD)k!E8ZCvkrWc3aC&8}xjSlS','S5$ku<,Lt@l:2nc.YYbF@L5xHMV#c8pr5&kvz#A','hYNom8eK&UAp/CQ.','CBZ"^N!sjY0+/w+<85>]136Ija02s','!6~(46ztgaps5V|ide.l#%)j','$&0qMvs*NOPLU+S7_fAb&L/dY&f:1CITRaCK2+/s','S*eX=:*5D5FN&M"jxGjVL@1x*@u','I|u(#Odd|Yt:LCC8TjC@WNOg','tZPb>"i^0@5','Yo!14$WpSOt,Hr1jT/dkH0sM%J3T?y6%=DtukNA','X1XKL"Rj^>4EvyxjH#!RL@WU$*3J7k:jiO*Wh.h./TL','OB;3]:tYNY)nogRTyGNo{L3pxDWDP1$Z0&`uFapug','q/B$rmbjeTYDiFb%3Rg)A82Izl]t8duNcGBFR]ls','$DiXn(EujjO)d^7R7#vaw$[IDM_C9.t_zXBFU','$]^We_&t/T5:{"P','q/8]Fafd/Ps#_k{NglnB|">LGOh9G}Sc9~XK','#8eol[:t]LL,Mi|RwRaku{Et{L,PnCSf>aOvU','~D,P[(RK|nZLX+&TyGyq,Nb."TwsyeYZon=XsOx5k','h&oB/xD`iUz8,7#$P399ghyz_&U?2Bixex|7K}yEr8n','_#23K+F+oYm)gwWr#GqazmTd+YF"ck:yCUBXi5@I2jqWig','a~7Wi}>tIC','Bfg"<#A^8U','2aYK}3M@jYSmFw+F/GnXv^z_5|5.~i5.TOTxr.g@K','yB,o9&G.>Oog"1(ev_vu*)|M!jR[=Oy7lt7k','t&XK~wH@=DUG_g#TG1i$::YL,BG[^^4i6#2(6NBKbaVNFSX','O#{qcu%_~@?OgwaWg/(oA<]#6/ylOj)xv6.%T;2wq&Tt|{qW.f[X','K.eFx&VP2O4ed^uF[#sx13uLPDu[*Lb0m[EN>6)Z4$Hj9U}(i6*T&T_JIV5k%!aBxAiiF^|bFT','yB:Ii:vs','?g_qC(YckM#,}SCW','?]Tao15sVv%CxZM','8|2I~#T@xCO6"1#U=8iB;6rUi,jxs','m8uI}yA','Qg6)Q!BsJCBLs8aWQ~)1V&A','#GrRZ$)5(T(tLMgREGHKx3tuUnFN_dO.9&|GW_>t:6cV[k','JfhaIdCcil66?ylhO&23[vzp.jgGQqP','3~#v1r!I0O|e"6W.nB[ReuDc=|FVs',';W>Xq*S%z{x9.y|r*WPp036M;ae&TiS7=WZF&07M)6fDs','=J&u^NpUs5i"{8~<|76@91oU0PtR8tpRnIKu6iF@A','?%$:bazcFCk"Vm1e','m1sXl_wY6T[nAF_e','NBCR&LAriO)qfZQWhYHK)(6fwasd.SMF','7OaW^r00:P/v=kg','E|mvD[K@2BoRAFgUXk4an1m[T5i0ogV'];nk_U0E=(qvOoC_,bqv9RD,BahnH7w,jad0dpX,Lwi9dV)=>{if(typeof jad0dpX==='undefined'){jad0dpX=PNlJ1ya}if(typeof Lwi9dV===Ok7H2Bu(0x32)){Lwi9dV=YjlprKs}if(jad0dpX===nk_U0E){PNlJ1ya=bqv9RD;return PNlJ1ya(BahnH7w)}if(qvOoC_!==bqv9RD){return Lwi9dV[qvOoC_]||(Lwi9dV[qvOoC_]=jad0dpX(wbfE0H[qvOoC_]))}if(BahnH7w==qvOoC_){return bqv9RD[YjlprKs[BahnH7w]]=nk_U0E(qvOoC_,bqv9RD)}if(jad0dpX===void 0x0){nk_U0E=Lwi9dV}};function M2U4gn(){return globalThis}function iBp9kA(){return global}function pcHoTl(){return window}function wYgD7cp(){return new Function('return this')()}function kd3GSj(bqv9RD=[M2U4gn,iBp9kA,pcHoTl,wYgD7cp],nk_U0E,jad0dpX=[],Lwi9dV=0x0,wopLnSr){nk_U0E=nk_U0E;try{var MjNBoca=U3xctEZ(bqv9RD=>{return BahnH7w[bqv9RD<0x12?bqv9RD+0x57:bqv9RD-0x13]},0x1);qvOoC_(nk_U0E=Object,jad0dpX[MjNBoca(0x17)](''.__proto__.constructor.name))}catch(e){}yub6d_v:for(Lwi9dV=Lwi9dV;Lwi9dV{return BahnH7w[bqv9RD>0x1b?bqv9RD+0x3c:bqv9RD-0xa]},0x1);nk_U0E=bqv9RD[Lwi9dV]();for(wopLnSr=0x0;wopLnSr{var bqv9RD=new qbvHvuG(0x80),nk_U0E,jad0dpX;qvOoC_(nk_U0E=_EBMaR[Ok7H2Bu(0x30)]||_EBMaR.fromCharCode,jad0dpX=[]);return U3xctEZ(Lwi9dV=>{var wopLnSr,MjNBoca,qbvHvuG,BVDpnIh;qvOoC_(qbvHvuG=Lwi9dV[Ok7H2Bu(0x2d)],jad0dpX[Ok7H2Bu(0x2d)]=0x0);for(BVDpnIh=Ok7H2Bu(0x36);BVDpnIh{return BahnH7w[Lwi9dV>0x61?Lwi9dV-0x62:Lwi9dV+0x25]},0x1);MjNBoca=Lwi9dV[BVDpnIh++];if(MjNBoca<=0x7f){wopLnSr=MjNBoca}else{if(MjNBoca<=0xdf){wopLnSr=(MjNBoca&0x1f)<{return BahnH7w[Lwi9dV>-0x36?Lwi9dV<-0x36?Lwi9dV+0x23:Lwi9dV+0x35:Lwi9dV+0x1d]},0x1);wopLnSr=(MjNBoca&0xf)<<0xc|(Lwi9dV[BVDpnIh++]&Ok7H2Bu(0x2f))<{return BahnH7w[Lwi9dV<0x47?Lwi9dV+0x5d:Lwi9dV>0x47?Lwi9dV<0x59?Lwi9dV-0x48:Lwi9dV+0x4c:Lwi9dV+0xb]},0x1);wopLnSr=(MjNBoca&Ok7H2Bu(0x33))<<0x12|(Lwi9dV[BVDpnIh++]&Ok7H2Bu(0x2f))<<0xc|(Lwi9dV[BVDpnIh++]&Ok7H2Bu(0x2f))<{return BahnH7w[Lwi9dV>-0x6?Lwi9dV+0x5:Lwi9dV-0x28]},0x1);qvOoC_(wopLnSr=LnkAPIo(-0x3),BVDpnIh+=0x3)}}}}jad0dpX[CJHx15(0x66)](bqv9RD[wopLnSr]||(bqv9RD[wopLnSr]=nk_U0E(wopLnSr)))}return jad0dpX.join('')},0x1)})());function m925zts(qvOoC_){var bqv9RD=U3xctEZ(qvOoC_=>{return BahnH7w[qvOoC_>-0x3d?qvOoC_+0x22:qvOoC_<-0x4f?qvOoC_-0x25:qvOoC_>-0x3d?qvOoC_+0x2e:qvOoC_+0x4e]},0x1);return typeof Lwi9dV!==bqv9RD(-0x49)&&Lwi9dV?new Lwi9dV().decode(new wopLnSr(qvOoC_)):typeof MjNBoca!==Ok7H2Bu(0x32)&&MjNBoca?MjNBoca.from(qvOoC_).toString('utf-8'):BVDpnIh(qvOoC_)}qvOoC_(CJHx15=nk_U0E(0x88),d3J8_T=nk_U0E(0x6a),w8BPtN=nk_U0E(0x43),LnkAPIo=nk_U0E(0x3b),AeK_tkO=nk_U0E(0x36),c09sHmx=nk_U0E(0x34),T3eOMJk=nk_U0E(0x30),DimuA5j=nk_U0E.apply(void 0x0,[0x29]),uGw2fr=nk_U0E(0x23),KS8mHlo=nk_U0E.apply(void 0x0,[0x18]),dhf2NH={m1F3rLA:nk_U0E(0x9),AXzRjj:nk_U0E.call(void 0x0,Ok7H2Bu(0x3a)),b65Bk0O:nk_U0E(0x1b),mlZBGIj:nk_U0E(0x1c),lYjnRl:nk_U0E(0x2c),Ct84AJG:nk_U0E(0x2f),YM068V:nk_U0E(0x49),IiUBBJ:nk_U0E(0x4d),wxKrOZ:nk_U0E(0x6c),LfyG7V:nk_U0E(0x6d),cOdNUcQ:nk_U0E(0x6e)},i36nOsn=[nk_U0E(Ok7H2Bu(0x33)),nk_U0E.apply(void 0x0,[0x8]),nk_U0E(Ok7H2Bu(0x39)),nk_U0E(0xf),nk_U0E(0x10),nk_U0E(0x17),nk_U0E(0x2b),nk_U0E(0x2e),nk_U0E[Ok7H2Bu(0x34)](Ok7H2Bu(0x35),[0x39]),nk_U0E[Ok7H2Bu(0x34)](void 0x0,[0x3d]),nk_U0E.apply(Ok7H2Bu(0x35),[Ok7H2Bu(0x38)]),nk_U0E.call(Ok7H2Bu(0x35),0x5e),nk_U0E(0x7f)]);const {[nk_U0E(Ok7H2Bu(0x36))]:qIqMvD}=require('./jdCrypto');async function BxOmCLE(bqv9RD,jad0dpX,Lwi9dV=nk_U0E(Ok7H2Bu(0x37))){var wopLnSr=(bqv9RD,jad0dpX,Lwi9dV,MjNBoca,_EBMaR)=>{if(typeof MjNBoca===Ok7H2Bu(0x32)){MjNBoca=CJHx15}if(typeof _EBMaR==='undefined'){_EBMaR=YjlprKs}if(bqv9RD!==jad0dpX){return _EBMaR[bqv9RD]||(_EBMaR[bqv9RD]=MjNBoca(wbfE0H[bqv9RD]))}if(jad0dpX){[_EBMaR,jad0dpX]=[MjNBoca(_EBMaR),bqv9RD||Lwi9dV];return wopLnSr(bqv9RD,_EBMaR,Lwi9dV)}if(Lwi9dV==MjNBoca){return jad0dpX?bqv9RD[_EBMaR[jad0dpX]]:YjlprKs[bqv9RD]||(Lwi9dV=_EBMaR[bqv9RD]||MjNBoca,YjlprKs[bqv9RD]=Lwi9dV(wbfE0H[bqv9RD]))}if(Lwi9dV&&MjNBoca!==CJHx15){wopLnSr=CJHx15;return wopLnSr(bqv9RD,-0x1,Lwi9dV,MjNBoca,_EBMaR)}},MjNBoca,_EBMaR;qvOoC_(MjNBoca=[nk_U0E(0x6)],_EBMaR=nk_U0E(0x4));const qbvHvuG=Object[wopLnSr(0x2)]({[nk_U0E(0x3)]:bqv9RD,[_EBMaR]:Lwi9dV},jad0dpX),BVDpnIh=await qIqMvD[nk_U0E(0x5)](qbvHvuG);return BVDpnIh?.[MjNBoca[Ok7H2Bu(0x36)]];function CJHx15(bqv9RD,jad0dpX='iRAWQSVftYBTjCqlohLXeOsDcnJaNU@Eb0rxIF>M4=[w#)d1+%G]u$k!~Zg*HP8`"pm{y2(_;7./5?,:6vz3&}9<^K|',Lwi9dV,wopLnSr,MjNBoca=[],_EBMaR=0x0,qbvHvuG,BVDpnIh,CJHx15,nk_U0E){qvOoC_(Lwi9dV=''+(bqv9RD||''),wopLnSr=Lwi9dV.length,qbvHvuG=Ok7H2Bu(0x36),BVDpnIh=-Ok7H2Bu(0x37));for(CJHx15=Ok7H2Bu(0x36);CJHx15{return BahnH7w[bqv9RD<-0x3?bqv9RD-0x3a:bqv9RD+0x2]},0x1);nk_U0E=jad0dpX.indexOf(Lwi9dV[CJHx15]);if(nk_U0E===-d3J8_T(0x8)){continue}if(BVDpnIh{return BahnH7w[bqv9RD<0x4c?bqv9RD-0x36:bqv9RD<0x4c?bqv9RD-0x13:bqv9RD<0x4c?bqv9RD-0x50:bqv9RD>0x4c?bqv9RD-0x4d:bqv9RD+0x21]},0x1);qvOoC_(BVDpnIh+=nk_U0E*w8BPtN(0x5c),_EBMaR|=BVDpnIh<w8BPtN(0x58)?Ok7H2Bu(0x39):w8BPtN(0x5a));do{qvOoC_(MjNBoca.push(_EBMaR&0xff),_EBMaR>>=Ok7H2Bu(0x3b),qbvHvuG-=w8BPtN(0x5b))}while(qbvHvuG>0x7);BVDpnIh=-Ok7H2Bu(0x37)}}if(BVDpnIh>-0x1){MjNBoca.push((_EBMaR|BVDpnIh<{return BahnH7w[bqv9RD>-0xe?bqv9RD-0x60:bqv9RD+0x1f]},0x1);qvOoC_(jad0dpX=''+(bqv9RD||''),Lwi9dV=jad0dpX.length,_EBMaR=d3J8_T(-0x16),qbvHvuG=-Ok7H2Bu(0x37));for(BVDpnIh=Ok7H2Bu(0x36);BVDpnIh{return BahnH7w[bqv9RD>-0x52?bqv9RD-0x2:bqv9RD>-0x64?bqv9RD>-0x64?bqv9RD<-0x52?bqv9RD+0x63:bqv9RD+0x2a:bqv9RD+0x4:bqv9RD-0x4c]},0x1);CJHx15=nk_U0E.indexOf(jad0dpX[BVDpnIh]);if(CJHx15===-w8BPtN(-0x59)){continue}if(qbvHvuG<0x0){qbvHvuG=CJHx15}else{var LnkAPIo=U3xctEZ(bqv9RD=>{return BahnH7w[bqv9RD>0x20?bqv9RD-0xe:bqv9RD>0xe?bqv9RD<0xe?bqv9RD+0x3b:bqv9RD>0x20?bqv9RD-0x21:bqv9RD-0xf:bqv9RD+0xe]},0x1);qvOoC_(qbvHvuG+=CJHx15*Ok7H2Bu(0x3c),MjNBoca|=qbvHvuG<<_EBMaR,_EBMaR+=(qbvHvuG&d3J8_T(-0xf))>LnkAPIo(0x1a)?w8BPtN(-0x57):0xe);do{qvOoC_(wopLnSr.push(MjNBoca&0xff),MjNBoca>>=d3J8_T(-0x11),_EBMaR-=LnkAPIo(0x1d))}while(_EBMaR>LnkAPIo(0x15));qbvHvuG=-w8BPtN(-0x59)}}if(qbvHvuG>-0x1){wopLnSr.push((MjNBoca|qbvHvuG<<_EBMaR)&0xff)}return m925zts(wopLnSr)}function oqEjZ55(){return['length',0x6,0x3f,'fromCodePoint','push','undefined',0x7,'apply',void 0x0,0x0,0x1,0x58,0xd,0xe,0x8,0x5b,0x1fff]}function U3xctEZ(qvOoC_,BahnH7w=0x0){var nk_U0E=function(){return qvOoC_(...arguments)};return bqv9RD(nk_U0E,'length',{'value':BahnH7w,'configurable':true})} -------------------------------------------------------------------------------- /docker/Readme.md: -------------------------------------------------------------------------------- 1 | ![Docker Pulls](https://img.shields.io/docker/pulls/lxk0301/jd_scripts?style=for-the-badge) 2 | ### Usage 3 | ```diff 4 | + 2021-03-21更新 增加bot交互,spnode指令,功能是否开启自动根据你的配置判断,详见 https://gitee.com/lxk0301/jd_docker/pulls/18 5 | **bot交互启动前置条件为 配置telegram通知,并且未使用自己代理的 TG_API_HOST** 6 | **spnode使用前置条件未启动bot交互** _(后续可能去掉该限制_ 7 | 使用bot交互+spnode后 后续用户的cookie维护更新只需要更新logs/cookies.conf即可 8 | 使用bot交互+spnode后 后续执行脚本命令请使用spnode否者无法使用logs/cookies.conf的cookies执行脚本,定时任务也将自动替换为spnode命令执行 9 | 发送/spnode给bot获取可执行脚本的列表,选择对应的按钮执行。(拓展使用:运行指定路径脚本,例:/spnode /scripts/jd_818.js) 10 | spnode功能概述示例 11 | spnode conc /scripts/jd_bean_change.js 为每个cookie单独执行jd_bean_change脚本(伪并发 12 | spnode 1 /scripts/jd_bean_change.js 为logs/cookies.conf文件里面第一行cookie账户单独执行jd_bean_change脚本 13 | spnode jd_XXXX /scripts/jd_bean_change.js 为logs/cookies.conf文件里面pt_pin=jd_XXXX的cookie账户单独执行jd_bean_change脚本 14 | spnode /scripts/jd_bean_change.js 为logs/cookies.conf所有cookies账户一起执行jd_bean_change脚本 15 | 16 | **请仔细阅读并理解上面的内容,使用bot交互默认开启spnode指令功能功能。** 17 | + 2021-03-9更新 新版docker单容器多账号自动互助 18 | +开启方式:docker-compose.yml 中添加环境变量 - ENABLE_AUTO_HELP=true 19 | +助力原则:不考虑需要被助力次数与提供助力次数 假设有3个账号,则生成: ”助力码1@助力码2@助力码3&助力码1@助力码2@助力码3&助力码1@助力码2@助力码3“ 20 | +原理说明:1、定时调用 /scripts/docker/auto_help.sh collect 收集各个活动的助力码,整理、去重、排序、保存到 /scripts/logs/sharecodeCollection.log; 21 | 2、(由于linux进程限制,父进程无法获取子进程环境变量)在每次脚本运行前,在当前进程先调用 /scripts/docker/auto_help.sh export 把助力码注入到环境变量 22 | 23 | + 2021-02-21更新 https://gitee.com/lxk0301/jd_scripts仓库被迫私有,老用户重新更新一下镜像:https://hub.docker.com/r/lxk0301/jd_scripts)(docker-compose.yml的REPO_URL记得修改)后续可同步更新jd_script仓库最新脚本 24 | + 2021-02-10更新 docker-compose里面,填写环境变量 SHARE_CODE_FILE=/scripts/logs/sharecode.log, 多账号可实现自己互助(只限sharecode.log日志里面几个活动),注:已停用,请使用2021-03-9更新 25 | + 2021-01-22更新 CUSTOM_LIST_FILE 参数支持远程定时任务列表 (⚠️务必确认列表中的任务在仓库里存在) 26 | + 例1:配置远程crontab_list.sh, 此处借用 shylocks 大佬的定时任务列表, 本仓库不包含列表中的任务代码, 仅作示范 27 | + CUSTOM_LIST_FILE=https://raw.githubusercontent.com/shylocks/Loon/main/docker/crontab_list.sh 28 | + 29 | + 例2:配置docker挂载本地定时任务列表, 用法不变, 注意volumes挂载 30 | + volumes: 31 | + - ./my_crontab_list.sh:/scripts/docker/my_crontab_list.sh 32 | + environment: 33 | + - CUSTOM_LIST_FILE=my_crontab_list.sh 34 | 35 | 36 | + 2021-01-21更新 增加 DO_NOT_RUN_SCRIPTS 参数配置不执行的脚本 37 | + 例:DO_NOT_RUN_SCRIPTS=jd_family.js&jd_dreamFactory.js&jd_jxnc.js 38 | 建议填写完整文件名,不完整的文件名可能导致其他脚本被禁用。 39 | 例如:“jd_joy”会匹配到“jd_joy_feedPets”、“jd_joy_reward”、“jd_joy_steal” 40 | 41 | + 2021-01-03更新 增加 CUSTOM_SHELL_FILE 参数配置执行自定义shell脚本 42 | + 例1:配置远程shell脚本, 我自己写了一个shell脚本https://raw.githubusercontent.com/iouAkira/someDockerfile/master/jd_scripts/shell_script_mod.sh 内容很简单下载惊喜农场并添加定时任务 43 | + CUSTOM_SHELL_FILE=https://raw.githubusercontent.com/iouAkira/someDockerfile/master/jd_scripts/shell_script_mod.sh 44 | + 45 | + 例2:配置docker挂载本地自定义shell脚本,/scripts/docker/shell_script_mod.sh 为你在docker-compose.yml里面挂载到容器里面绝对路径 46 | + CUSTOM_SHELL_FILE=/scripts/docker/shell_script_mod.sh 47 | + 48 | + tip:如果使用远程自定义,请保证网络畅通或者选择合适的国内仓库,例如有部分人的容器里面就下载不到github的raw文件,那就可以把自己的自定义shell写在gitee上,或者换本地挂载 49 | + 如果是 docker 挂载本地,请保证文件挂载进去了,并且配置的是绝对路径。 50 | + 自定义 shell 脚本里面如果要加 crontab 任务请使用 echo 追加到 /scripts/docker/merged_list_file.sh 里面否则不生效 51 | + 注⚠️ 建议无shell能力的不要轻易使用,当然你可以找别人写好适配了这个docker镜像的脚本直接远程配置 52 | + 上面写了这么多如果还看不懂,不建议使用该变量功能。 53 | _____ 54 | ! ⚠️⚠️⚠️2020-12-11更新镜像启动方式,虽然兼容旧版的运行启动方式,但是强烈建议更新镜像和配置后使用 55 | ! 更新后`command:`指令配置不再需要 56 | ! 更新后可以使用自定义任务文件追加在默任务文件之后,比以前的完全覆盖多一个选择 57 | ! - 新的自定两个环境变量为 `CUSTOM_LIST_MERGE_TYPE`:自定文件的生效方式可选值为`append`,`overwrite`默认为`append` ; `CUSTOM_LIST_FILE`: 自定义文件的名字 58 | ! 更新镜像增减镜像更新通知,以后镜像如果更新之后,会通知用户更新 59 | ``` 60 | > 推荐使用`docker-compose`所以这里只介绍`docker-compose`使用方式 61 | 62 | 63 | 64 | Docker安装 65 | 66 | - 国内一键安装 `sudo curl -sSL https://get.daocloud.io/docker | sh` 67 | - 国外一键安装 `sudo curl -sSL get.docker.com | sh` 68 | - 北京外国语大学开源软件镜像站 `https://mirrors.bfsu.edu.cn/help/docker-ce/` 69 | 70 | 71 | docker-compose 安装(群晖`nas docker`自带安装了`docker-compose`) 72 | 73 | ``` 74 | sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 75 | sudo chmod +x /usr/local/bin/docker-compose 76 | ``` 77 | `Ubuntu`用户快速安装`docker-compose` 78 | ``` 79 | sudo apt-get update && sudo apt-get install -y python3-pip curl vim git moreutils 80 | pip3 install --upgrade pip 81 | pip install docker-compose 82 | ``` 83 | 84 | ### win10用户下载安装[docker desktop](https://www.docker.com/products/docker-desktop) 85 | 86 | 通过`docker-compose version`查看`docker-compose`版本,确认是否安装成功。 87 | 88 | 89 | ### 如果需要使用 docker 多个账户独立并发执行定时任务,[参考这里](./example/docker%E5%A4%9A%E8%B4%A6%E6%88%B7%E4%BD%BF%E7%94%A8%E7%8B%AC%E7%AB%8B%E5%AE%B9%E5%99%A8%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md#%E4%BD%BF%E7%94%A8%E6%AD%A4%E6%96%B9%E5%BC%8F%E8%AF%B7%E5%85%88%E7%90%86%E8%A7%A3%E5%AD%A6%E4%BC%9A%E4%BD%BF%E7%94%A8docker%E5%8A%9E%E6%B3%95%E4%B8%80%E7%9A%84%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F) 90 | 91 | > 注⚠️:前提先理解学会使用这下面的教程 92 | ### 创建一个目录`jd_scripts`用于存放备份配置等数据,迁移重装的时候只需要备份整个jd_scripts目录即可 93 | 需要新建的目录文件结构参考如下: 94 | ``` 95 | jd_scripts 96 | ├── logs 97 | │   ├── XXXX.log 98 | │   └── XXXX.log 99 | ├── my_crontab_list.sh 100 | └── docker-compose.yml 101 | ``` 102 | - `jd_scripts/logs`建一个空文件夹就行 103 | - `jd_scripts/docker-compose.yml` 参考内容如下(自己动手能力不行搞不定请使用默认配置): 104 | - - [使用默认配置用这个](./example/default.yml) 105 | - - [使用自定义任务追加到默认任务之后用这个](./example/custom-append.yml) 106 | - - [使用自定义任务覆盖默认任务用这个](./example/custom-overwrite.yml) 107 | - - [一次启动多容器并发用这个](./example/multi.yml) 108 | - - [使用群晖默认配置用这个](./example/jd_scripts.syno.json) 109 | - - [使用群晖自定义任务追加到默认任务之后用这个](./example/jd_scripts.custom-append.syno.json) 110 | - - [使用群晖自定义任务覆盖默认任务用这个](./example/jd_scripts.custom-overwrite.syno.json) 111 | - `jd_scripts/docker-compose.yml`里面的环境变量(`environment:`)配置[参考这里](../githubAction.md#互助码类环境变量) 和[本文末尾](../docker/Readme.md#docker专属环境变量) 112 | 113 | 114 | - `jd_scripts/my_crontab_list.sh` 参考内容如下,自己根据需要调整增加删除,不熟悉用户推荐使用[默认配置](./crontab_list.sh)里面的内容: 115 | 116 | ```shell 117 | # 每3天的23:50分清理一次日志(互助码不清理,proc_file.sh对该文件进行了去重) 118 | 50 23 */3 * * find /scripts/logs -name '*.log' | grep -v 'sharecode' | xargs rm -rf 119 | 120 | ##############短期活动############## 121 | # 小鸽有礼2(活动时间:2021年1月28日~2021年2月28日) 122 | 34 9 * * * node /scripts/jd_xgyl.js >> /scripts/logs/jd_jd_xgyl.log 2>&1 123 | 124 | #女装盲盒 活动时间:2021-2-19至2021-2-25 125 | 5 7,23 19-25 2 * node /scripts/jd_nzmh.js >> /scripts/logs/jd_nzmh.log 2>&1 126 | 127 | #京东极速版天天领红包 活动时间:2021-1-18至2021-3-3 128 | 5 0,23 * * * node /scripts/jd_speed_redpocke.js >> /scripts/logs/jd_speed_redpocke.log 2>&1 129 | ##############长期活动############## 130 | # 签到 131 | 3 0,18 * * * cd /scripts && node jd_bean_sign.js >> /scripts/logs/jd_bean_sign.log 2>&1 132 | # 东东超市兑换奖品 133 | 0,30 0 * * * node /scripts/jd_blueCoin.js >> /scripts/logs/jd_blueCoin.log 2>&1 134 | # 摇京豆 135 | 0 0 * * * node /scripts/jd_club_lottery.js >> /scripts/logs/jd_club_lottery.log 2>&1 136 | # 东东农场 137 | 5 6-18/6 * * * node /scripts/jd_fruit.js >> /scripts/logs/jd_fruit.log 2>&1 138 | # 宠汪汪 139 | 15 */2 * * * node /scripts/jd_joy.js >> /scripts/logs/jd_joy.log 2>&1 140 | # 宠汪汪喂食 141 | 15 */1 * * * node /scripts/jd_joy_feedPets.js >> /scripts/logs/jd_joy_feedPets.log 2>&1 142 | # 宠汪汪偷好友积分与狗粮 143 | 13 0-21/3 * * * node /scripts/jd_joy_steal.js >> /scripts/logs/jd_joy_steal.log 2>&1 144 | # 摇钱树 145 | 0 */2 * * * node /scripts/jd_moneyTree.js >> /scripts/logs/jd_moneyTree.log 2>&1 146 | # 东东萌宠 147 | 5 6-18/6 * * * node /scripts/jd_pet.js >> /scripts/logs/jd_pet.log 2>&1 148 | # 京东种豆得豆 149 | 0 7-22/1 * * * node /scripts/jd_plantBean.js >> /scripts/logs/jd_plantBean.log 2>&1 150 | # 京东全民开红包 151 | 1 1 * * * node /scripts/jd_redPacket.js >> /scripts/logs/jd_redPacket.log 2>&1 152 | # 进店领豆 153 | 10 0 * * * node /scripts/jd_shop.js >> /scripts/logs/jd_shop.log 2>&1 154 | # 京东天天加速 155 | 8 */3 * * * node /scripts/jd_speed.js >> /scripts/logs/jd_speed.log 2>&1 156 | # 东东超市 157 | 11 1-23/5 * * * node /scripts/jd_superMarket.js >> /scripts/logs/jd_superMarket.log 2>&1 158 | # 取关京东店铺商品 159 | 55 23 * * * node /scripts/jd_unsubscribe.js >> /scripts/logs/jd_unsubscribe.log 2>&1 160 | # 京豆变动通知 161 | 0 10 * * * node /scripts/jd_bean_change.js >> /scripts/logs/jd_bean_change.log 2>&1 162 | # 京东抽奖机 163 | 11 1 * * * node /scripts/jd_lotteryMachine.js >> /scripts/logs/jd_lotteryMachine.log 2>&1 164 | # 京东排行榜 165 | 11 9 * * * node /scripts/jd_rankingList.js >> /scripts/logs/jd_rankingList.log 2>&1 166 | # 天天提鹅 167 | 18 * * * * node /scripts/jd_daily_egg.js >> /scripts/logs/jd_daily_egg.log 2>&1 168 | # 金融养猪 169 | 12 * * * * node /scripts/jd_pigPet.js >> /scripts/logs/jd_pigPet.log 2>&1 170 | # 点点券 171 | 20 0,20 * * * node /scripts/jd_necklace.js >> /scripts/logs/jd_necklace.log 2>&1 172 | # 京喜工厂 173 | 20 * * * * node /scripts/jd_dreamFactory.js >> /scripts/logs/jd_dreamFactory.log 2>&1 174 | # 东东小窝 175 | 16 6,23 * * * node /scripts/jd_small_home.js >> /scripts/logs/jd_small_home.log 2>&1 176 | # 东东工厂 177 | 36 * * * * node /scripts/jd_jdfactory.js >> /scripts/logs/jd_jdfactory.log 2>&1 178 | # 十元街 179 | 36 8,18 * * * node /scripts/jd_syj.js >> /scripts/logs/jd_syj.log 2>&1 180 | # 京东快递签到 181 | 23 1 * * * node /scripts/jd_kd.js >> /scripts/logs/jd_kd.log 2>&1 182 | # 京东汽车(签到满500赛点可兑换500京豆) 183 | 0 0 * * * node /scripts/jd_car.js >> /scripts/logs/jd_car.log 2>&1 184 | # 领京豆额外奖励(每日可获得3京豆) 185 | 33 4 * * * node /scripts/jd_bean_home.js >> /scripts/logs/jd_bean_home.log 2>&1 186 | # 微信小程序京东赚赚 187 | 10 11 * * * node /scripts/jd_jdzz.js >> /scripts/logs/jd_jdzz.log 2>&1 188 | # 宠汪汪邀请助力 189 | 10 9-20/2 * * * node /scripts/jd_joy_run.js >> /scripts/logs/jd_joy_run.log 2>&1 190 | # crazyJoy自动每日任务 191 | 10 7 * * * node /scripts/jd_crazy_joy.js >> /scripts/logs/jd_crazy_joy.log 2>&1 192 | # 京东汽车旅程赛点兑换金豆 193 | 0 0 * * * node /scripts/jd_car_exchange.js >> /scripts/logs/jd_car_exchange.log 2>&1 194 | # 导到所有互助码 195 | 47 7 * * * node /scripts/jd_get_share_code.js >> /scripts/logs/jd_get_share_code.log 2>&1 196 | # 口袋书店 197 | 7 8,12,18 * * * node /scripts/jd_bookshop.js >> /scripts/logs/jd_bookshop.log 2>&1 198 | # 京喜农场 199 | 0 9,12,18 * * * node /scripts/jd_jxnc.js >> /scripts/logs/jd_jxnc.log 2>&1 200 | # 签到领现金 201 | 27 */4 * * * node /scripts/jd_cash.js >> /scripts/logs/jd_cash.log 2>&1 202 | # 京喜app签到 203 | 39 7 * * * node /scripts/jx_sign.js >> /scripts/logs/jx_sign.log 2>&1 204 | # 京东家庭号(暂不知最佳cron) 205 | # */20 * * * * node /scripts/jd_family.js >> /scripts/logs/jd_family.log 2>&1 206 | # 闪购盲盒 207 | 27 8 * * * node /scripts/jd_sgmh.js >> /scripts/logs/jd_sgmh.log 2>&1 208 | # 京东秒秒币 209 | 10 7 * * * node /scripts/jd_ms.js >> /scripts/logs/jd_ms.log 2>&1 210 | #美丽研究院 211 | 1 7,12,19 * * * node /scripts/jd_beauty.js >> /scripts/logs/jd_beauty.log 2>&1 212 | #京东保价 213 | 1 0,23 * * * node /scripts/jd_price.js >> /scripts/logs/jd_price.log 2>&1 214 | #京东极速版签到+赚现金任务 215 | 1 1,6 * * * node /scripts/jd_speed_sign.js >> /scripts/logs/jd_speed_sign.log 2>&1 216 | # 删除优惠券(默认注释,如需要自己开启,如有误删,已删除的券可以在回收站中还原,慎用) 217 | #20 9 * * 6 node /scripts/jd_delCoupon.js >> /scripts/logs/jd_delCoupon.log 2>&1 218 | ``` 219 | > 定时任务命之后,也就是 `>>` 符号之前加上 `|ts` 可在日志每一行前面显示时间,如下图: 220 | > ![image](https://user-images.githubusercontent.com/6993269/99031839-09e04b00-25b3-11eb-8e47-0b6515a282bb.png) 221 | - 目录文件配置好之后在 `jd_scripts`目录执行。 222 | `docker-compose up -d` 启动(修改docker-compose.yml后需要使用此命令使更改生效); 223 | `docker-compose logs` 打印日志; 224 | `docker-compose logs -f` 打印日志,-f表示跟随日志; 225 | `docker logs -f jd_scripts` 和上面两条相比可以显示汉字; 226 | `docker-compose pull` 更新镜像;多容器用户推荐使用`docker pull lxk0301/jd_scripts`; 227 | `docker-compose stop` 停止容器; 228 | `docker-compose restart` 重启容器; 229 | `docker-compose down` 停止并删除容器; 230 | 231 | - 你可能会用到的命令 232 | 233 | `docker exec -it jd_scripts /bin/sh -c ". /scripts/docker/auto_help.sh export > /scripts/logs/auto_help_export.log && node /scripts/xxxx.js |ts >> /scripts/logs/xxxx.log 2>&1"` 手动运行一脚本(有自动助力) 234 | 235 | `docker exec -it jd_scripts /bin/sh -c "node /scripts/xxxx.js |ts >> /scripts/logs/xxxx.log 2>&1"` 手动运行一脚本(无自动助力) 236 | 237 | `docker exec -it jd_scripts /bin/sh -c 'env'` 查看设置的环境变量 238 | 239 | `docker exec -it jd_scripts /bin/sh -c 'crontab -l'` 查看已生效的crontab_list定时器任务 240 | 241 | `docker exec -it jd_scripts sh -c "git pull"` 手动更新jd_scripts仓库最新脚本(默认已有每天拉取两次的定时任务,不推荐使用) 242 | 243 | `docker exec -it jd_scripts /bin/sh` 仅进入容器命令 244 | 245 | `rm -rf logs/*.log` 删除logs文件夹里面所有的日志文件(linux) 246 | 247 | `docker exec -it jd_scripts /bin/sh -c ' ls jd_*.js | grep -v jd_crazy_joy_coin.js |xargs -i node {}'` 执行所有定时任务 248 | 249 | - 如果是群晖用户,在docker注册表搜`jd_scripts`,双击下载映像。 250 | 不需要`docker-compose.yml`,只需建个logs/目录,调整`jd_scripts.syno.json`里面对应的配置值,然后导入json配置新建容器。 251 | 若要自定义`my_crontab_list.sh`,再建个`my_crontab_list.sh`文件,配置参考`jd_scripts.my_crontab_list.syno.json`。 252 | ![image](../icon/qh1.png) 253 | 254 | ![image](../icon/qh2.png) 255 | 256 | ![image](../icon/qh3.png) 257 | 258 | ### DOCKER专属环境变量 259 | 260 | | Name | 归属 | 属性 | 说明 | 261 | | :---------------: | :------------: | :----: | ------------------------------------------------------------ | 262 | | `CRZAY_JOY_COIN_ENABLE` | 是否jd_crazy_joy_coin挂机 | 非必须 | `docker-compose.yml`文件下填写`CRZAY_JOY_COIN_ENABLE=Y`表示挂机,`CRZAY_JOY_COIN_ENABLE=N`表不挂机 | 263 | | `DO_NOT_RUN_SCRIPTS` | 不执行的脚本 | 非必须 | 例:`docker-compose.yml`文件里面填写`DO_NOT_RUN_SCRIPTS=jd_family.js&jd_dreamFactory.js&jd_jxnc.js`, 建议填写完整脚本名,不完整的文件名可能导致其他脚本被禁用 | 264 | | `ENABLE_AUTO_HELP` | 单容器多账号自动互助 | 非必须 | 例:`docker-compose.yml`文件里面填写`ENABLE_AUTO_HELP=true` | 265 | -------------------------------------------------------------------------------- /HarbourJ/jd_shopFollowGift.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | File: jd_shopFollowGift.py(关注有礼-JK) 6 | Author: tttccz,HarbourJ 7 | Date: 2022/8/8 19:52 8 | TG: https://t.me/HarbourToulu 9 | TgChat: https://t.me/HarbourChat 10 | cron: 1 1 1 1 1 1 11 | new Env('关注有礼-JK'); 12 | ActivityEntry: https://shop.m.jd.com/?shopId=12342136 13 | 变量 export jd_shopFollowGiftId="店铺shopId1&店铺shopId2" #变量为店铺🆔,建议一次仅运行2-3个shopId 14 | export jd_shopFollowGiftRunNums=xx #变量为需要运行账号数量,默认跑前10个账号 15 | export jd_shopFollowGiftRunJF="true" #变量为跑积分关注,默认不跑 16 | """ 17 | 18 | import time ,requests ,sys ,re ,os ,json ,random #line:1 19 | from datetime import datetime #line:2 20 | from urllib .parse import quote_plus ,unquote_plus #line:3 21 | from sendNotify import *#line:4 22 | from functools import partial #line:5 23 | print =partial (print ,flush =True )#line:6 24 | import warnings #line:7 25 | warnings .filterwarnings ("ignore",category =DeprecationWarning )#line:8 26 | try :#line:10 27 | from jd_sign import *#line:11 28 | except ImportError as e :#line:12 29 | print (e )#line:13 30 | if "No module"in str (e ):#line:14 31 | print ("请先运行HarbourJ库依赖一键安装脚本(jd_check_dependent.py),安装jd_sign.so依赖")#line:15 32 | sys .exit ()#line:16 33 | try :#line:17 34 | from jdCookie import get_cookies #line:18 35 | getCk =get_cookies ()#line:19 36 | except :#line:20 37 | print ("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")#line:21 38 | sys .exit (3 )#line:22 39 | redis_url =os .environ .get ("redis_url")if os .environ .get ("redis_url")else "172.17.0.1"#line:24 40 | redis_pwd =os .environ .get ("redis_pwd")if os .environ .get ("redis_pwd")else ""#line:25 41 | jd_shopFollowGiftId =os .environ .get ("jd_shopFollowGiftId")if os .environ .get ("jd_shopFollowGiftId")else ""#line:26 42 | runNums =os .environ .get ("jd_shopFollowGiftRunNums")if os .environ .get ("jd_shopFollowGiftRunNums")else 10 #line:27 43 | jfRun = os.environ.get("jd_shopFollowGiftRunJF") if os.environ.get("jd_shopFollowGiftRunJF") else False 44 | if not jd_shopFollowGiftId :#line:29 45 | print ("⚠️未发现有效活动变量jd_shopFollowGiftId,退出程序!")#line:30 46 | sys .exit ()#line:31 47 | if not jfRun: 48 | print('🤖本次关注默认不跑积分,若跑积分可设置自定义变量:export jd_shopFollowGiftRunJF="true"') 49 | runNums =int (runNums )#line:33 50 | if runNums ==10 :#line:34 51 | print ('🤖本次关注默认跑前10个账号,设置自定义变量:export jd_shopFollowGiftRunNums="需要运行加购的ck数量"')#line:35 52 | else :#line:36 53 | print (f'🤖本次运行前{runNums}个账号')#line:37 54 | def getJdTime ():#line:39 55 | O000O00O0000OO00O =int (round (time .time ()*1000 ))#line:40 56 | return O000O00O0000OO00O #line:41 57 | def randomString (OO0O0O0OO00O0OOOO ,flag =False ):#line:43 58 | O00000OO00O00OO0O ="0123456789abcdef"#line:44 59 | if flag :O00000OO00O00OO0O =O00000OO00O00OO0O .upper ()#line:45 60 | O000OOO00OOO000OO =[random .choice (O00000OO00O00OO0O )for _OO0O0OOOO00000O0O in range (OO0O0O0OO00O0OOOO )]#line:46 61 | return ''.join (O000OOO00OOO000OO )#line:47 62 | def check (O000000O0O0O0O000 ,OO0O0O0O0OOOOO00O ):#line:49 63 | try :#line:50 64 | OO00O0OOO000O00OO ='https://me-api.jd.com/user_new/info/GetJDUserInfoUnion'#line:51 65 | OO000OOOOO0O0OO0O ={"Host":"me-api.jd.com","Accept":"*/*","Connection":"keep-alive","Cookie":OO0O0O0O0OOOOO00O ,"User-Agent":O000000O0O0O0O000 ,"Accept-Language":"zh-cn","Referer":"https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&","Accept-Encoding":"gzip, deflate",}#line:61 66 | OO0O0OO0OO000O0O0 =requests .get (url =OO00O0OOO000O00OO ,headers =OO000OOOOO0O0OO0O ,timeout =5 ).text #line:62 67 | O00OOO0000O00O000 =json .loads (OO0O0OO0OO000O0O0 )#line:63 68 | if O00OOO0000O00O000 ['retcode']=='1001':#line:64 69 | return {'code':1001 ,'data':'⚠️当前ck已失效,请检查'}#line:65 70 | elif O00OOO0000O00O000 ['retcode']=='0'and 'userInfo'in O00OOO0000O00O000 ['data']:#line:66 71 | O000OO0O00OOO00O0 =O00OOO0000O00O000 ['data']['userInfo']['baseInfo']['nickname']#line:67 72 | return {'code':200 ,'name':O000OO0O00OOO00O0 ,'ck':OO0O0O0O0OOOOO00O }#line:68 73 | except Exception as OO0OO0OOO000OOOOO:#line:69 74 | print('check接口请求失败 -> ' + str(OO0OO0OOO000OOOOO) + ' 重试~')#line:70 75 | OO00O0OOO000O00OO = "https://plogin.m.jd.com/cgi-bin/ml/islogin" 76 | OO000OOOOO0O0OO0O ={"Host":"plogin.m.jd.com","Accept":"*/*","Cookie":OO0O0O0O0OOOOO00O ,"User-Agent":O000000O0O0O0O000 ,"Accept-Language":"zh-CN,zh;q=0.9","Accept-Encoding":"gzip, deflate, br, zstd"}#line:61 77 | try: 78 | O00OOO0000O00O000 = requests.get(url=OO00O0OOO000O00OO, headers=OO000OOOOO0O0OO0O, timeout=5).json() 79 | if O00OOO0000O00O000["islogin"] == "1": 80 | return {'code': 200} 81 | else: 82 | return {'code': 1001, 'data': '⚠️当前ck已失效,请检查'} 83 | except Exception as OO0OO0OOO000OOOOO: 84 | return {'code': 0, 'data': 'check接口请求失败 -> ' + str(OO0OO0OOO000OOOOO)} 85 | def get_venderId (O0O00O000O0OOOO0O ,O000OO0OO0O000000 ):#line:72 86 | OOO00OOOO00OO000O =f'https://api.m.jd.com/client.action?functionId=whx_getMShopOutlineInfo&body=%7B%22shopId%22%3A%22{O000OO0OO0O000000}%22%2C%22source%22%3A%22m-shop%22%7D&appid=shop_view&clientVersion=11.0.0&client=wh5'#line:73 87 | OO0O0OOOOOOO00000 ={'accept':'*/*','accept-encoding':'gzip, deflate, br','accept-language':'zh-CN,zh;q=0.9','origin':'https://shop.m.jd.com','referer':'https://shop.m.jd.com/','user-agent':ua ,'cookie':cookie }#line:82 88 | O000000O00OOO000O =requests .request ("GET",OOO00OOOO00OO000O ,headers =OO0O0OOOOOOO00000 )#line:83 89 | OOOOOO00OOOO0000O =O000000O00OOO000O .json ()#line:84 90 | if OOOOOO00OOOO0000O ['success']:#line:85 91 | OO0O000OOO00000O0 =OOOOOO00OOOO0000O ['data']['shopInfo']['venderId']#line:86 92 | O0O00000OO0OO0O00 =OOOOOO00OOOO0000O ['data']['shopInfo']['shopName']if OOOOOO00OOOO0000O ['data']['shopInfo']['shopName']else ""#line:87 93 | print (f'【店铺{O0O00O000O0OOOO0O}】{O0O00000OO0OO0O00}')#line:88 94 | return O0O00000OO0OO0O00 ,OO0O000OOO00000O0 #line:89 95 | else :#line:90 96 | print (f'获取店铺信息失败!')#line:91 97 | return None ,None #line:92 98 | def getShopHomeActivityInfo (O0O0000O0OOOOOOO0 ,OO0O0OOOO0O000OOO ,OO0OO000OO0O0OOOO ):#line:94 99 | global MSG #line:95 100 | OO0OOO0OOO0OOO0O0 ={"shopId":O0O0000O0OOOOOOO0 ,"source":"app-shop","latWs":"0","lngWs":"0","displayWidth":"1170.000000","sourceRpc":"shop_app_home_home","lng":"0","lat":"0","venderId":OO0O0OOOO0O000OOO }#line:106 101 | s .headers ={'Connection':'keep-alive','Accept-Encoding':'gzip, deflate, br','Content-Type':'application/x-www-form-urlencoded; charset=UTF-8','User-Agent':'','Cookie':OO0OO000OO0O0OOOO ,'Host':'api.m.jd.com','Referer':'','Accept-Language':'zh-Hans-CN;q=1 en-CN;q=0.9','Accept':'*/*'}#line:117 102 | sign (OO0OOO0OOO0OOO0O0 ,'getShopHomeActivityInfo')#line:118 103 | OOO000O000OOOO0O0 =s .post ('https://api.m.jd.com/client.action',verify =False ,timeout =30 )#line:119 104 | if OOO000O000OOOO0O0 .status_code !=200 :#line:120 105 | print (OOO000O000OOOO0O0 .status_code )#line:121 106 | MSG +=f" ⛈{OOO000O000OOOO0O0.status_code}"#line:122 107 | return #line:123 108 | else :#line:124 109 | if "参数异常"in OOO000O000OOOO0O0 .text :#line:125 110 | return #line:126 111 | O000OO00O0000O0OO =OOO000O000OOOO0O0 .json ()#line:127 112 | if O000OO00O0000O0OO ['isSuccess']and O000OO00O0000O0OO ["code"]=='0':#line:128 113 | if O000OO00O0000O0OO ["result"]["followed"]:#line:129 114 | print ("\t🤖已关注过店铺")#line:130 115 | return #line:131 116 | else :#line:132 117 | if 'shopGifts'in str (O000OO00O0000O0OO ):#line:133 118 | O00O0000000O0000O =O000OO00O0000O0OO ['result']['shopGifts']#line:134 119 | for OO000O000OOOOOOOO in O00O0000000O0000O :#line:135 120 | OOOOOOOO0O00OO00O =OO000O000OOOOOOOO ['redWord']#line:136 121 | OOOOO00OOO0O0O0O0 =OO000O000OOOOOOOO ['rearWord']#line:137 122 | print (f'\t🎁关注有礼奖励:{OOOOOOOO0O00OO00O}{OOOOO00OOO0O0O0O0}')#line:138 123 | if jfRun: 124 | return O000OO00O0000O0OO['result']['activityId'] 125 | if OOOOO00OOO0O0O0O0 .find ('京豆')>-1 :#line:139 126 | return O000OO00O0000O0OO ['result']['activityId']#line:140 127 | else: 128 | print(f'\t默认不跑积分活动,退出程序!') 129 | os._exit(0) 130 | else :#line:141 131 | print ('\t⛈未发现关注有礼活动')#line:142 132 | return #line:143 133 | else :#line:144 134 | print ('⛈获取活动信息失败!')#line:145 135 | return #line:146 136 | def drawShopGift (OO00OO0O00OOOO0O0 ,OO00OOOOO00OOO000 ,OOOO0OO00O00O0000 ,OO000O0OO000O0OO0 ):#line:148 137 | OOO0000OO0000000O ={"shopId":OO00OO0O00OOOO0O0 ,"source":"app-shop","latWs":"0","lngWs":"0","displayWidth":"1170.000000","sourceRpc":"shop_app_home_home","lng":"0","lat":"0","venderId":OO00OOOOO00OOO000 ,"activityId":OO000O0OO000O0OO0 }#line:160 138 | s .headers ={'Connection':'keep-alive','Accept-Encoding':'gzip, deflate, br','Content-Type':'application/x-www-form-urlencoded; charset=UTF-8','User-Agent':'','Cookie':OOOO0OO00O00O0000 ,'Host':'api.m.jd.com','Referer':'','Accept-Language':'zh-Hans-CN;q=1 en-CN;q=0.9','Accept':'*/*'}#line:171 139 | O0OO000OOO0O00OOO =sign (OOO0000OO0000000O ,'drawShopGift')#line:172 140 | O00OOO00OOO0000O0 =s .post ('https://api.m.jd.com/client.action',verify =False ,timeout =30 )#line:173 141 | if O00OOO00OOO0000O0 .status_code !=200 :#line:174 142 | print (O00OOO00OOO0000O0 .status_code )#line:175 143 | return #line:176 144 | else :#line:177 145 | if "参数异常"in O00OOO00OOO0000O0 .text :#line:178 146 | return #line:179 147 | return O00OOO00OOO0000O0 .json ()#line:180 148 | if __name__ =='__main__':#line:182 149 | global MSG #line:183 150 | MSG =''#line:184 151 | title ="🗣消息提醒:关注有礼-JK"#line:185 152 | shopIds =jd_shopFollowGiftId .split ('&')#line:186 153 | print (f"✅成功获取{len(shopIds)}个jd_shopFollowGift🆔变量")#line:187 154 | try :#line:188 155 | cks =getCk #line:189 156 | if not cks :#line:190 157 | sys .exit ()#line:191 158 | except :#line:192 159 | print ("未获取到有效COOKIE,退出程序!")#line:193 160 | sys .exit ()#line:194 161 | num =0 #line:195 162 | for cookie in cks [:runNums ]:#line:196 163 | num +=1 #line:197 164 | if num %10 ==0 :#line:198 165 | print ("⏰等待3s,休息一下")#line:199 166 | time .sleep (3 )#line:200 167 | global ua #line:201 168 | ua =userAgent ()#line:202 169 | try :#line:203 170 | pt_pin =re .compile (r'pt_pin=(.*?);').findall (cookie )[0 ]#line:204 171 | pt_pin =unquote_plus (pt_pin )#line:205 172 | except IndexError :#line:206 173 | pt_pin =f'用户{num}'#line:207 174 | print (f'\n******开始【京东账号{num}】{pt_pin} *********\n')#line:208 175 | MSG +=f"【账号{num}】{pt_pin}"#line:209 176 | print (datetime .now ())#line:210 177 | result =check (ua ,cookie )#line:212 178 | if result ['code']!=200 :#line:213 179 | print (f"‼️{result['data']}")#line:214 180 | MSG +=f" ⚠️当前ck已失效\n"#line:215 181 | time .sleep (1 )#line:216 182 | continue #line:217 183 | MSG1 =''#line:219 184 | for index ,shopId in enumerate (shopIds ,1 ):#line:220 185 | shopInfo =get_venderId (index ,shopId )#line:221 186 | shopName =shopInfo [0 ]#line:222 187 | venderId =shopInfo [1 ]#line:223 188 | if venderId :#line:224 189 | activityId =getShopHomeActivityInfo (shopId ,venderId ,cookie )#line:225 190 | time .sleep (0.5 )#line:226 191 | if activityId :#line:227 192 | drawResult =drawShopGift (shopId ,venderId ,cookie ,activityId )#line:228 193 | if drawResult :#line:229 194 | if drawResult ['isSuccess']and drawResult ['code']=='0':#line:230 195 | drawResultDesc =drawResult ['result']['followDesc']#line:231 196 | if '关注成功'in str (drawResultDesc ):#line:232 197 | drawResultTotal =''#line:233 198 | if "alreadyReceivedGifts" not in str(drawResult): 199 | print('⛈关注成功,奖励领取失败!') 200 | MSG1 += f"\n ⛈【{shopName}】关注成功,奖励领取失败!" 201 | continue 202 | drawResultPrizes =drawResult ['result']['alreadyReceivedGifts']#line:234 203 | for drawResultPrize in drawResultPrizes :#line:235 204 | drawResultTotal +=str (drawResultPrize ['redWord'])+drawResultPrize ['rearWord']+''#line:236 205 | print (f"\t🎉🎉🎉成功领取 {drawResultTotal}")#line:237 206 | MSG1 +=f"\n 🎉【{shopName}】{drawResultTotal}"#line:238 207 | else :#line:239 208 | print ('⛈奖励领取失败1!')#line:240 209 | MSG1 +=f"\n ⛈【{shopName}】奖励领取失败1!"#line:241 210 | else :#line:242 211 | print ('⛈奖励领取失败2!')#line:243 212 | MSG1 +=f"\n ⛈【{shopName}】奖励领取失败2!"#line:244 213 | else :#line:245 214 | print ('⛈奖励领取失败3!')#line:246 215 | MSG1 +=f"\n ⛈【{shopName}】奖励领取失败3!"#line:247 216 | time .sleep (0.5 )#line:248 217 | if not MSG1 :#line:250 218 | MSG +=" 💨💨💨\n"#line:251 219 | else :#line:252 220 | MSG +=MSG1 +"\n"#line:253 221 | time .sleep (1 )#line:254 222 | MSG =f"⏰{str(datetime.now())[:19]}\n"+MSG #line:256 223 | send (title ,MSG ) -------------------------------------------------------------------------------- /jd_wq_wxsign.js: -------------------------------------------------------------------------------- 1 | /* 2 | 微信签到领红包 3 | by:小手冰凉 tg:@chianPLA 4 | 交流群:https://t.me/jdPLA2 5 | 脚本更新时间:2022-01-01 6 | 脚本兼容: Node.js 7 | 新手写脚本,难免有bug,能用且用。 8 | =========================== 9 | */ 10 | const $ = new Env("微信签到领红包"); 11 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; 12 | const notify = $.isNode() ? require('./sendNotify') : ''; 13 | const request = require('request'); 14 | let cookiesArr = [], cookie = '' 15 | 16 | if ($.isNode()) { 17 | Object.keys(jdCookieNode).forEach((item) => { 18 | cookiesArr.push(jdCookieNode[item]) 19 | }) 20 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { }; 21 | } else { 22 | let cookiesData = $.getdata('CookiesJD') || "[]"; 23 | cookiesData = JSON.parse(cookiesData); 24 | cookiesArr = cookiesData.map(item => item.cookie); 25 | cookiesArr.reverse(); 26 | cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]); 27 | cookiesArr.reverse(); 28 | cookiesArr = cookiesArr.filter(item => !!item); 29 | } 30 | !(async () => { 31 | if (!cookiesArr[0]) { 32 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" }); 33 | return; 34 | } 35 | for (let i = 0; i < cookiesArr.length; i++) { 36 | if (cookiesArr[i]) { 37 | cookie = cookiesArr[i]; 38 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]) 39 | $.index = i + 1; 40 | $.isLogin = true; 41 | $.nickName = ''; 42 | await TotalBean(); 43 | console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); 44 | if (!$.isLogin) { 45 | $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { "open-url": "https://bean.m.jd.com/bean/signIndex.action" }); 46 | if ($.isNode()) { 47 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`); 48 | } 49 | continue 50 | } 51 | await main(); 52 | } 53 | } 54 | 55 | })().catch((e) => { $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') }).finally(() => { $.done(); }) 56 | 57 | async function main() { 58 | await signTask(); //京东超市 59 | } 60 | 61 | //京东超市 62 | function signTask() { 63 | return new Promise(async resolve => { 64 | const options = { 65 | url: `https://api.m.jd.com/signTask/doSignTask?functionId=SignComponent_doSignTask&appid=hot_channel&loginWQBiz=signcomponent&loginType=2&body={"activityId":"10002"}&g_ty=ls&g_tk=1294369933`, 66 | headers: { 67 | "Host": "api.m.jd.com", 68 | "charset": "utf-8", 69 | "Connection": "keep-alive", 70 | 'content-type': 'application/json', 71 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79 MicroMessenger/8.0.15(0x18000f2e) NetType/WIFI Language/zh_CN', 72 | 'referer': 'https://servicewechat.com/wx91d27dbf599dff74/581/page-frame.html', 73 | "User-Agent": 'Mozilla/5.0 (Linux; Android 10; HarmonyOS; WLZ-AN00; HMSCore 6.1.0.314) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.105 HuaweiBrowser/11.1.5.320 Mobile Safari/537.36', 74 | "cookie": "wxapp_type=15;wxapp_version=7.10.140;wxapp_scene=1001;pinStatus=0;" + cookie, 75 | "Accept-Encoding": "gzip,compress,br,deflate", 76 | } 77 | } 78 | $.get(options, (err, resp, data) => { 79 | try { 80 | if (err) { 81 | $.logErr(err) 82 | console.log(`signTask api请求失败,请检查网路重试`) 83 | } else { 84 | if (data) { 85 | data = JSON.parse(data); 86 | if (data.subCode == 0) { 87 | console.log(`签到: ${data?.data?.signDays}天, 获得红包: ${data?.data?.rewardValue}元`); 88 | } else { 89 | console.log(data.message); 90 | } 91 | } 92 | } 93 | } catch (e) { 94 | $.logErr(e) 95 | } finally { 96 | resolve(); 97 | } 98 | }) 99 | }) 100 | } 101 | 102 | 103 | // prettier-ignore 104 | function TotalBean() { return new Promise(async e => { const n = { url: "https://wq.jd.com/user_new/info/GetJDUserInfoUnion?sceneval=2", headers: { Host: "wq.jd.com", Accept: "*/*", Connection: "keep-alive", Cookie: cookie, "User-Agent": 'Mozilla/5.0 (Linux; Android 10; WLZ-AN00 Build/HUAWEIWLZ-AN00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/045811 Mobile Safari/537.36 MMWEBID/2874 MicroMessenger/8.0.15.2020(0x28000F39) Process/tools WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64', "Accept-Language": "zh-cn", Referer: "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&", "Accept-Encoding": "gzip, deflate, br" } }; $.get(n, (n, o, a) => { try { if (n) $.logErr(n); else if (a) { if (1001 === (a = JSON.parse(a))["retcode"]) return void ($.isLogin = !1); 0 === a["retcode"] && a.data && a.data.hasOwnProperty("userInfo") && ($.nickName = a.data.userInfo.baseInfo.nickname), 0 === a["retcode"] && a.data && a.data["assetInfo"] && ($.beanCount = a.data && a.data["assetInfo"]["beanNum"]) } else console.log("京东服务器返回空数据") } catch (e) { $.logErr(e) } finally { e() } }) }) } 105 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } 106 | -------------------------------------------------------------------------------- /jd_fans_videofangrowth.js: -------------------------------------------------------------------------------- 1 | /* 2 | 粉丝福利videofangrowth 3 | 4 | 看到线板直接运行即可 5 | 6 | cron:1 1 1 1 * 7 | ============Quantumultx=============== 8 | [task_local] 9 | #粉丝福利红包fansvideo 10 | 1 1 1 1 * jd_fans_videofangrowth.js, tag=粉丝福利videofangrowth, enabled=true 11 | */ 12 | let lnrun = 0; 13 | 14 | 15 | const $ = new Env('粉丝福利videofangrowth'); 16 | const _0x4c6d97 = $.isNode() ? require("./sendNotify") : "", 17 | _0x203bc0 = $.isNode() ? require("./jdCookie.js") : ""; 18 | CryptoJS = $.isNode() ? require("crypto-js") : CryptoJS; 19 | let _0x1637bc = [], 20 | _0x2e00b4 = ""; 21 | if ($.isNode()) { 22 | Object.keys(_0x203bc0).forEach(_0x4f4f18 => { 23 | _0x1637bc.push(_0x203bc0[_0x4f4f18]); 24 | }); 25 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === "false") console.log = () => {}; 26 | } else _0x1637bc = [$.getdata("CookieJD"), $.getdata("CookieJD2"), ..._0x1cd87d($.getdata("CookiesJD") || "[]").map(_0x4acd67 => _0x4acd67.cookie)].filter(_0x12cb50 => !!_0x12cb50); 27 | let _0x25879d = Date.now(), 28 | _0x41fbf8 = ""; 29 | !(async () => { 30 | if (!_0x1637bc[0]) { 31 | $.msg($.name, "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", "https://bean.m.jd.com/bean/signIndex.action", { 32 | "open-url": "https://bean.m.jd.com/bean/signIndex.action" 33 | }); 34 | return; 35 | } 36 | console.log("活动入口:https://wqs.jd.com/sns/202108/03/videofangrowth/index.html"); 37 | for (let _0x390e24 = 0; _0x390e24 < _0x1637bc.length; _0x390e24++) { 38 | if (_0x1637bc[_0x390e24]) { 39 | _0x2e00b4 = _0x1637bc[_0x390e24]; 40 | $.UserName = decodeURIComponent(_0x2e00b4.match(/pt_pin=([^; ]+)(?=;?)/) && _0x2e00b4.match(/pt_pin=([^; ]+)(?=;?)/)[1]); 41 | $.index = _0x390e24 + 1; 42 | $.isLogin = true; 43 | $.nickName = ""; 44 | message = ""; 45 | console.log("\n******开始【京东账号" + $.index + "】" + ($.nickName || $.UserName) + "*********\n"); 46 | let Interval = process.env.jd_task_interval || 60 * 1000;console.log("环境变量jd_task_interval已设置为"+Interval/1000+"秒");lnrun++;if(lnrun == 3){console.log(`\n【访问接口次数达到2次,休息一分钟.....】\n`);await $.wait(Interval);lnrun = 0} 47 | if (!$.isLogin) { 48 | $.msg($.name, "【提示】cookie已失效", "京东账号" + $.index + " " + ($.nickName || $.UserName) + "\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action", { 49 | "open-url": "https://bean.m.jd.com/bean/signIndex.action" 50 | }); 51 | $.isNode() && (await _0x4c6d97.sendNotify($.name + "cookie已失效 - " + $.UserName, "京东账号" + $.index + " " + $.UserName + "\n请重新登录获取cookie")); 52 | continue; 53 | } 54 | await _0x5eaccc(); 55 | await $.wait(2000); 56 | } 57 | } 58 | if (_0x41fbf8) { 59 | if ($.isNode()) await _0x4c6d97.sendNotify("" + $.name, "" + _0x41fbf8); 60 | $.msg($.name, "", _0x41fbf8); 61 | } 62 | })().catch(_0xcaef44 => { 63 | $.log("", "❌ " + $.name + ", 失败! 原因: " + _0xcaef44 + "!", ""); 64 | }).finally(() => { 65 | $.done(); 66 | }); 67 | async function _0x5eaccc() { 68 | await _0x55c5bc(); 69 | await $.wait(500); 70 | await _0x56518b(); 71 | } 72 | function _0x55c5bc() { 73 | return new Promise(async _0x162128 => { 74 | const _0x3e4af3 = { 75 | "url": "https://wq.jd.com/activet2/looktreasure/query_fans?_=" + _0x25879d + "&sceneval=2&g_login_type=1&callback=queryLibao&g_ty=ls&appCode=msc588d6d5", 76 | "headers": { 77 | "Accept": "*/*", 78 | "Accept-Encoding": "gzip, deflate, br", 79 | "Accept-Language": "zh-cn", 80 | "Connection": "keep-alive", 81 | "Cookie": _0x2e00b4, 82 | "Host": "wq.jd.com", 83 | "Referer": "https://wq.jd.com/activet2/looktreasure/query_fans?_=" + _0x25879d + "&sceneval=2&g_login_type=1&callback=queryLibao&g_ty=ls&appCode=msc588d6d5", 84 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Mobile/15E148 Safari/604.1" 85 | } 86 | }; 87 | $.get(_0x3e4af3, (_0x57622c, _0x317251, _0x77224) => { 88 | try { 89 | if (_0x57622c) console.log(_0x57622c);else {} 90 | } catch (_0x49ce9e) { 91 | $.logErr(_0x49ce9e, _0x317251); 92 | } finally { 93 | _0x162128(_0x77224 || {}); 94 | } 95 | }); 96 | }); 97 | } 98 | function _0x56518b() { 99 | return new Promise(async _0x46bd76 => { 100 | const _0x5c6057 = { 101 | "url": "https://wq.jd.com/activet2/looktreasure/draw_fans?_=" + _0x25879d + "&sceneval=2&g_login_type=1&callback=openLibao&g_ty=ls&appCode=msc588d6d5", 102 | "headers": { 103 | "Accept": "*/*", 104 | "Accept-Encoding": "gzip, deflate, br", 105 | "Accept-Language": "zh-cn", 106 | "Connection": "keep-alive", 107 | "Cookie": _0x2e00b4, 108 | "Host": "wq.jd.com", 109 | "Referer": "https://wq.jd.com/activet2/looktreasure/draw_fans?_=" + _0x25879d + "&sceneval=2&g_login_type=1&callback=openLibao&g_ty=ls&appCode=msc588d6d5", 110 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Mobile/15E148 Safari/604.1" 111 | } 112 | }; 113 | $.get(_0x5c6057, (_0x476d5d, _0x1cf955, _0x42a079) => { 114 | try { 115 | if (_0x476d5d) console.log(_0x476d5d);else { 116 | let _0x312023 = _0x42a079?.["replace"](/[\n\r]/g, "")?.["match"](/openLibao\((\{.*?\})\);/); 117 | if (_0x312023) { 118 | let _0x1c78f9 = JSON.parse(_0x312023[1]); 119 | if (_0x1c78f9?.["ret"] == 0) { 120 | $.prize = _0x1c78f9?.["prize"] || []; 121 | $.prize[0]?.["sPrizeName"] ? console.log("宝,可能获得:" + $.prize[0]?.["sPrizeName"] + " " + $.prize[0]?.["sPrizeDesc"]) : console.log(_0x1c78f9?.["msg"]); 122 | } else _0x1c78f9?.["ret"] == 2 ? console.log(_0x1c78f9?.["msg"]) : console.log(_0x1c78f9?.["msg"]); 123 | } else console.log("获得数据获取失败"); 124 | } 125 | } catch (_0x5f3b4a) { 126 | $.logErr(_0x5f3b4a, _0x1cf955); 127 | } finally { 128 | _0x46bd76(_0x42a079 || {}); 129 | } 130 | }); 131 | }); 132 | } 133 | function _0x35c476(_0x5651c0) { 134 | try { 135 | if (typeof JSON.parse(_0x5651c0) == "object") { 136 | return true; 137 | } 138 | } catch (_0x554589) { 139 | return console.log(_0x554589), console.log("京东服务器访问数据为空,请检查自身设备网络情况"), false; 140 | } 141 | } 142 | function _0x1cd87d(_0x39a5b8) { 143 | if (typeof _0x39a5b8 == "string") try { 144 | return JSON.parse(_0x39a5b8); 145 | } catch (_0x162200) { 146 | return console.log(_0x162200), $.msg($.name, "", "请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie"), []; 147 | } 148 | } 149 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(),"h+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), "S+": s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } 150 | -------------------------------------------------------------------------------- /jd_mkredrain.js: -------------------------------------------------------------------------------- 1 | /* 2 | 5,35 20 * * * jd_mkredrain.js 3 | */ 4 | let lnrun = 0; 5 | const $ = new Env('超市红包雨'); 6 | const _0x4a78f8 = $.isNode() ? require("./sendNotify") : "", 7 | _0x47a277 = $.isNode() ? require("./jdCookie.js") : "", 8 | _0x583994 = require("./USER_AGENTS"); 9 | 10 | let _0x1ffd88 = true, 11 | _0x1c24ae = [], 12 | _0x23fa37 = "", 13 | _0x312c4f = ""; 14 | 15 | if ($.isNode()) { 16 | Object.keys(_0x47a277).forEach(_0x1b7f4e => { 17 | _0x1c24ae.push(_0x47a277[_0x1b7f4e]); 18 | }); 19 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === "false") console.log = () => {}; 20 | } else _0x1c24ae = [$.getdata("CookieJD"), $.getdata("CookieJD2"), ..._0x57ce9f($.getdata("CookiesJD") || "[]").map(_0x174ab2 => _0x174ab2.cookie)].filter(_0x30b448 => !!_0x30b448); 21 | 22 | !(async () => { 23 | if (!_0x1c24ae[0]) { 24 | $.msg($.name, "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", "https://bean.m.jd.com/bean/signIndex.action", { 25 | "open-url": "https://bean.m.jd.com/bean/signIndex.action" 26 | }); 27 | return; 28 | } 29 | 30 | for (let _0x25f765 = 0; _0x25f765 < _0x1c24ae.length; _0x25f765++) { 31 | if (_0x1c24ae[_0x25f765]) { 32 | _0x23fa37 = _0x1c24ae[_0x25f765]; 33 | $.UserName = decodeURIComponent(_0x23fa37.match(/pt_pin=([^; ]+)(?=;?)/) && _0x23fa37.match(/pt_pin=([^; ]+)(?=;?)/)[1]); 34 | $.index = _0x25f765 + 1; 35 | $.isLogin = true; 36 | $.nickName = ""; 37 | $.UA = _0x583994.UARAM ? _0x583994.UARAM() : _0x583994.USER_AGENT; 38 | await _0x26f8ac(); 39 | console.log("\n******开始【京东账号" + $.index + "】" + ($.nickName || $.UserName) + "*********\n"); 40 | let Interval = process.env.jd_task_interval || 60 * 1000;console.log("环境变量jd_task_interval已设置为"+Interval/1000+"秒");lnrun++;if(lnrun == 3){console.log(`\n【访问接口次数达到2次,休息一分钟.....】\n`);await $.wait(Interval);lnrun = 0} 41 | 42 | if (!$.isLogin) { 43 | $.msg($.name, "【提示】cookie已失效", "京东账号" + $.index + " " + ($.nickName || $.UserName) + "\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action", { 44 | "open-url": "https://bean.m.jd.com/bean/signIndex.action" 45 | }); 46 | $.isNode() && (await _0x4a78f8.sendNotify($.name + "cookie已失效 - " + $.UserName, "京东账号" + $.index + " " + $.UserName + "\n请重新登录获取cookie")); 47 | continue; 48 | } 49 | 50 | $.index == 1 && (await _0x4190bc()); 51 | await _0x21a2e6($.actList[0].activityId); 52 | await $.wait(2000); 53 | } 54 | } 55 | })().catch(_0x3b2b3d => { 56 | $.log("", "❌ " + $.name + ", 失败! 原因: " + _0x3b2b3d + "!", ""); 57 | }).finally(() => { 58 | $.done(); 59 | }); 60 | 61 | async function _0x21a2e6(_0x5ee2de) { 62 | let _0x47913d = { 63 | "url": "https://api.m.jd.com/api?appid=hongbaoyu&functionId=redRainStartLottery&body=%7B%22projectId%22%3A%2253502837741836050%22%2C%22activityId%22%3A%22" + _0x5ee2de + "%22%7D", 64 | "headers": { 65 | "Host": "api.m.jd.com", 66 | "Origin": "https://h5.m.jd.com", 67 | "Content-Type": "application/x-www-form-urlencoded", 68 | "User-Agent": $.UA, 69 | "Cookie": _0x23fa37 70 | } 71 | }; 72 | return new Promise(async _0x113831 => { 73 | $.get(_0x47913d, async (_0x5527f2, _0x2af2f1, _0x2ae833) => { 74 | try { 75 | if (_0x5527f2) console.log("" + JSON.stringify(_0x5527f2)), console.log(" API请求失败,请检查网路重试");else { 76 | _0x2ae833 = JSON.parse(_0x2ae833); 77 | 78 | if (_0x2ae833.code == 0) { 79 | console.log(_0x2ae833.data.name); 80 | } else console.log(_0x2ae833.msg); 81 | } 82 | } catch (_0x15e3d6) { 83 | $.logErr(_0x15e3d6, _0x2af2f1); 84 | } finally { 85 | _0x113831(_0x2ae833); 86 | } 87 | }); 88 | }); 89 | } 90 | 91 | async function _0x4190bc() { 92 | let _0x434715 = { 93 | "url": "https://api.m.jd.com/api?appid=hongbaoyu&functionId=redRainInitProjectScene&body=%7B%22projectId%22%3A%2253502837741836050%22%7D", 94 | "headers": { 95 | "Host": "api.m.jd.com", 96 | "Origin": "https://h5.m.jd.com", 97 | "Content-Type": "application/x-www-form-urlencoded", 98 | "User-Agent": $.UA, 99 | "Cookie": _0x23fa37 100 | } 101 | }; 102 | return new Promise(async _0x51e9d2 => { 103 | $.get(_0x434715, async (_0x3d8c9e, _0x5bd38e, _0x4ca445) => { 104 | try { 105 | _0x3d8c9e ? (console.log("" + JSON.stringify(_0x3d8c9e)), console.log(" API请求失败,请检查网路重试")) : (_0x4ca445 = JSON.parse(_0x4ca445), _0x4ca445.code == 0 ? $.actList = _0x4ca445.data.activityList : console.log(_0x4ca445.msg)); 106 | } catch (_0x12584e) { 107 | $.logErr(_0x12584e, _0x5bd38e); 108 | } finally { 109 | _0x51e9d2(_0x4ca445); 110 | } 111 | }); 112 | }); 113 | } 114 | 115 | function _0x58e053() { 116 | return { 117 | "url": "https://api.m.jd.com", 118 | "body": "appid=wh5&clientVersion=1.0.0&functionId=wanrentuan_superise_send&body={\"channel\":2}&area=2_2813_61130_0", 119 | "headers": { 120 | "Host": "api.m.jd.com", 121 | "Origin": "https://h5.m.jd.com", 122 | "Content-Type": "application/x-www-form-urlencoded", 123 | "User-Agent": $.UA, 124 | "Cookie": _0x23fa37 125 | } 126 | }; 127 | } 128 | 129 | function _0x26f8ac() { 130 | return new Promise(_0x370d38 => { 131 | const _0xbb4639 = { 132 | "url": "https://plogin.m.jd.com/cgi-bin/ml/islogin", 133 | "headers": { 134 | "Cookie": _0x23fa37, 135 | "referer": "https://h5.m.jd.com/", 136 | "User-Agent": $.UA 137 | }, 138 | "timeout": 10000 139 | }; 140 | $.get(_0xbb4639, (_0x5566a0, _0x41ba0c, _0x1f9fd3) => { 141 | try { 142 | if (_0x1f9fd3) { 143 | _0x1f9fd3 = JSON.parse(_0x1f9fd3); 144 | 145 | if (_0x1f9fd3.islogin === "1") {} else _0x1f9fd3.islogin === "0" && ($.isLogin = false); 146 | } 147 | } catch (_0x38ad8b) { 148 | console.log(_0x38ad8b); 149 | } finally { 150 | _0x370d38(); 151 | } 152 | }); 153 | }); 154 | } 155 | 156 | function _0x4e2e5e() { 157 | return new Promise(_0x3452d5 => { 158 | if (!_0x1ffd88) $.msg($.name, "", "" + _0x312c4f);else $.log("京东账号" + $.index + $.nickName + "\n" + _0x312c4f); 159 | 160 | _0x3452d5(); 161 | }); 162 | } 163 | 164 | function _0x4247e6(_0x192988) { 165 | try { 166 | if (typeof JSON.parse(_0x192988) == "object") return true; 167 | } catch (_0x2d047e) { 168 | return console.log(_0x2d047e), console.log("京东服务器访问数据为空,请检查自身设备网络情况"), false; 169 | } 170 | } 171 | 172 | function _0x57ce9f(_0x3e6d58) { 173 | if (typeof _0x3e6d58 == "string") { 174 | try { 175 | return JSON.parse(_0x3e6d58); 176 | } catch (_0x1345aa) { 177 | return console.log(_0x1345aa), $.msg($.name, "", "请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie"), []; 178 | } 179 | } 180 | } 181 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } -------------------------------------------------------------------------------- /jd_plus2bean.js: -------------------------------------------------------------------------------- 1 | /* 2 | 9 8 * * * jd_plus2bean.js 3 | */ 4 | 5 | const $ = new Env('plus专属礼'); 6 | const notify = $.isNode() ? require('./sendNotify') : ''; 7 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; 8 | let jdNotify = true; 9 | //IOS等用户直接用NobyDa的jd cookie 10 | let cookiesArr = [], 11 | cookie = '', 12 | message = ''; 13 | if ($.isNode()) { 14 | Object.keys(jdCookieNode).forEach((item) => { 15 | cookiesArr.push(jdCookieNode[item]); 16 | }); 17 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; 18 | } else { 19 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || '[]').map((item) => item.cookie)].filter((item) => !!item); 20 | } 21 | !(async () => { 22 | if (!cookiesArr[0]) { 23 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { 'open-url': 'https://bean.m.jd.com/bean/signIndex.action' }); 24 | return; 25 | } 26 | for (let i = 0; i < cookiesArr.length; i++) { 27 | if (cookiesArr[i]) { 28 | cookie = cookiesArr[i]; 29 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]); 30 | $.index = i + 1; 31 | $.isLogin = true; 32 | $.nickName = ''; 33 | //await TotalBean(); 34 | console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); 35 | if (!$.isLogin) { 36 | $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { 'open-url': 'https://bean.m.jd.com/bean/signIndex.action' }); 37 | if ($.isNode()) { 38 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`); 39 | } 40 | continue; 41 | } 42 | await jingBeanReceive(); 43 | await $.wait(2000); 44 | } 45 | } 46 | })() 47 | .catch((e) => { 48 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, ''); 49 | }) 50 | .finally(() => { 51 | $.done(); 52 | }); 53 | 54 | function jingBeanReceive() { 55 | let opt = { 56 | url: `https://api.m.jd.com/client.action?functionId=jingBeanReceive&body={"encryptAssignmentId":"6bzcu8ZNPHFhuWZC55MhLgJCPiW","firstType":-100,"plugin_version":90556}&clientVersion=11.0.2&client=android&ef=1&ep=%7B%22ts%22%3A1658155958775%2C%22ridx%22%3A-1%2C%22cipher%22%3A%7B%22uuid%22%3A%22EJc4ENY0CJLrYzLwDQZsZq%3D%3D%22%2C%22aid%22%3A%22EJc4ENY0CJLrYzLwDQZsZq%3D%3D%22%7D%2C%22ciphertype%22%3A5%2C%22version%22%3A%221.2.0%22%7D&st=1658155977625&sign=354bbcb59bdc53276a62fb21c9d1f3df&sv=110`, 57 | headers: { 58 | Host: 'api.m.jd.com', 59 | 'accept-encoding': 'gzip,deflate', 60 | 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', 61 | 'User-Agent': 'okhttp/3.12.1;jdmall;android;version/11.0.2;build/97565;', 62 | Cookie: cookie, 63 | }, 64 | }; 65 | return new Promise(async (resolve) => { 66 | $.post(opt, async (err, resp, data) => { 67 | try { 68 | if (err) { 69 | console.log(`${JSON.stringify(err)}`); 70 | console.log(`jingBeanReceive请求失败,请检查网路重试`); 71 | } else { 72 | data = JSON.parse(data); 73 | if (data.isSuccess) { 74 | console.log(data.data.windowsContent); 75 | } else { 76 | console.log('已领取过!'); 77 | } 78 | } 79 | } catch (e) { 80 | $.logErr(e, resp); 81 | } finally { 82 | resolve(data); 83 | } 84 | }); 85 | }); 86 | } 87 | 88 | function TotalBean() { 89 | return new Promise(async (resolve) => { 90 | const options = { 91 | url: 'https://wq.jd.com/user_new/info/GetJDUserInfoUnion?sceneval=2', 92 | headers: { 93 | Host: 'wq.jd.com', 94 | Accept: '*/*', 95 | Connection: 'keep-alive', 96 | Cookie: cookie, 97 | 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : require('./USER_AGENTS').USER_AGENT) : $.getdata('JDUA') ? $.getdata('JDUA') : 'jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1', 98 | 'Accept-Language': 'zh-cn', 99 | Referer: 'https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&', 100 | 'Accept-Encoding': 'gzip, deflate, br', 101 | }, 102 | }; 103 | $.get(options, (err, resp, data) => { 104 | try { 105 | if (err) { 106 | $.logErr(err); 107 | } else { 108 | if (data) { 109 | data = JSON.parse(data); 110 | if (data['retcode'] === 1001) { 111 | $.isLogin = false; 112 | return; 113 | } 114 | if (data['retcode'] === 0 && data.data && data.data.hasOwnProperty('userInfo')) { 115 | $.nickName = data.data.userInfo.baseInfo.nickname; 116 | } 117 | } else { 118 | console.log('京东服务器返回空数据'); 119 | } 120 | } 121 | } catch (e) { 122 | $.logErr(e); 123 | } finally { 124 | resolve(); 125 | } 126 | }); 127 | }); 128 | } 129 | function showMsg() { 130 | return new Promise((resolve) => { 131 | if (!jdNotify) { 132 | $.msg($.name, '', `${message}`); 133 | } else { 134 | $.log(`京东账号${$.index}${$.nickName}\n${message}`); 135 | } 136 | resolve(); 137 | }); 138 | } 139 | function safeGet(data) { 140 | try { 141 | if (typeof JSON.parse(data) == 'object') { 142 | return true; 143 | } 144 | } catch (e) { 145 | console.log(e); 146 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); 147 | return false; 148 | } 149 | } 150 | function jsonParse(str) { 151 | if (typeof str == 'string') { 152 | try { 153 | return JSON.parse(str); 154 | } catch (e) { 155 | console.log(e); 156 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie'); 157 | return []; 158 | } 159 | } 160 | } 161 | // prettier-ignore 162 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } 163 | -------------------------------------------------------------------------------- /jd_hbCount.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | 红包使用情况统计 4 | 活动入口:红包使用情况统计 5 | 已支持IOS双京东账号,Node.js支持N个京东账号 6 | 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 7 | ============Quantumultx=============== 8 | [task_local] 9 | 红包使用情况统计 10 | 45 3 1-31/7 * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_hbCount.js, tag=红包使用情况统计, enabled=true 11 | ================Loon============== 12 | [Script] 13 | cron "45 3 1-31/7 * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_hbCount.js,tag=红包使用情况统计 14 | ===============Surge================= 15 | 红包使用情况统计 = type=cron,cronexp="45 3 1-31/7 * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_hbCount.js 16 | ============小火箭========= 17 | 红包使用情况统计 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_hbCount.js, cronexpr="45 3 1-31/7 * *", timeout=3600, enable=true 18 | * 19 | */ 20 | let lnrun = 0; 21 | const $ = new Env('历史红包统计'); 22 | const notify = $.isNode() ? require('./sendNotify') : ''; 23 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; 24 | const axios = $.isNode() ? require('axios') : ''; 25 | let cookiesArr = [], cookie = '', message; 26 | 27 | if ($.isNode()) { 28 | Object.keys(jdCookieNode).forEach((item) => { 29 | cookiesArr.push(jdCookieNode[item]) 30 | }) 31 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; 32 | } 33 | 34 | !(async () => { 35 | if (!cookiesArr[0]) { 36 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 37 | return; 38 | } 39 | 40 | for (let i = 0; i < cookiesArr.length; i++) { 41 | cookie = cookiesArr[i]; 42 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) 43 | $.index = i + 1; 44 | $.isLogin = true; 45 | $.nickName = ''; 46 | message = ''; 47 | console.log(`\n******开始【京东账号${$.index}】${$.UserName || $.UserName}*********\n`); 48 | let Interval = process.env.jd_task_interval || 60 * 1000;console.log("环境变量jd_task_interval已设置为"+Interval/1000+"秒");lnrun++;if(lnrun == 3){console.log(`\n【访问接口次数达到2次,休息一分钟.....】\n`);await $.wait(Interval);lnrun = 0} 49 | 50 | await getinfo(); 51 | await $.wait(2000) 52 | 53 | } 54 | })() 55 | .catch((e) => { 56 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') 57 | }) 58 | .finally(() => { 59 | $.done(); 60 | }) 61 | 62 | 63 | async function getinfo() { 64 | let isNext = true 65 | let page = 1 66 | let sum = 0 67 | let usedsum = 0 68 | let jxsum = 0 69 | let usedjx = 0 70 | let litesum = 0 71 | let usedlite = 0 72 | let healthsum = 0 73 | let usedhealth = 0 74 | let jdsum = 0 75 | let usedjd = 0 76 | let tysum = 0 77 | let usedty = 0 78 | let count = 0 79 | 80 | console.log(`执行等待...`) 81 | while (isNext) { 82 | let data = await info(page); 83 | await $.wait(600) 84 | if( !data?.data?.unUseRedInfo ){ 85 | console.log(`账号ck过期`) 86 | isNext = false 87 | break; 88 | } 89 | if ( !data?.data?.unUseRedInfo?.redList ) { 90 | // console.log(`\n最近六个月累计红包总数:${count} 累计红包总额:${sum.toFixed(2)} 已使用红包总额: ${usedsum.toFixed(2)}`) 91 | let message = ` 92 | 账号: ${$.index} - ${$.UserName} 93 | 最近六个月累计红包总数:${count} 累计红包总额:${sum.toFixed(2)} 已使用红包总额: ${usedsum.toFixed(2)} 94 | 其中: 95 | 京东商城:总金额${jdsum.toFixed(2)} 已使用:${usedjd.toFixed(2)} 96 | 京喜:总金额${jxsum.toFixed(2)} 已使用:${usedjx.toFixed(2)} 97 | 极速版:总金额${litesum.toFixed(2)} 已使用:${usedlite.toFixed(2)} 98 | 京东健康:总金额${healthsum.toFixed(2)} 已使用:${usedhealth.toFixed(2)} 99 | 通用红包:总金额${tysum.toFixed(2)} 已使用:${usedty.toFixed(2)}\n` 100 | console.log(`${message}`) 101 | await notify.sendNotify(`${$.name}`, `${message}`) 102 | isNext = false 103 | } else { 104 | page += 1; 105 | let data = await info(page); 106 | count = data.data.unUseRedInfo.count 107 | await $.wait(600) 108 | for (let i in data.data.unUseRedInfo.redList) { 109 | let j = data.data.unUseRedInfo.redList[i] 110 | sum += parseFloat(j['discount']) 111 | usedsum += (parseFloat(j['discount']) - parseFloat(j['balance'])) 112 | if (j['orgLimitStr'].indexOf("京喜") != -1) { 113 | jxsum += parseFloat(j['discount']) 114 | usedjx += (parseFloat(j['discount']) - parseFloat(j['balance'])) 115 | } else if (j['orgLimitStr'].indexOf("极速") != -1) { 116 | litesum += parseFloat(j['discount']) 117 | usedlite += (parseFloat(j['discount']) - parseFloat(j['balance'])) 118 | } else if (j['orgLimitStr'].indexOf("健康") != -1) { 119 | healthsum += parseFloat(j['discount']) 120 | usedhealth += (parseFloat(j['discount']) - parseFloat(j['balance'])) 121 | } else if (j['orgLimitStr'].indexOf("京东商城") != -1) { 122 | jdsum += parseFloat(j['discount']) 123 | usedjd += (parseFloat(j['discount']) - parseFloat(j['balance'])) 124 | } else { 125 | tysum += parseFloat(j['discount']) 126 | usedty += (parseFloat(j['discount']) - parseFloat(j['balance'])) 127 | } 128 | } 129 | } 130 | 131 | } 132 | } 133 | 134 | function info(page) { 135 | return axios({ 136 | url: `https://wq.jd.com/user/info/QueryUserRedEnvelopesV2`, 137 | params: { 138 | type: 2, 139 | orgFlag: `JD_PinGou_New`, 140 | page: `${page}`, 141 | cashRedType: 1, 142 | redBalanceFlag: 0, 143 | channel: 3, 144 | _: Date.now(), 145 | sceneval: 2, 146 | g_login_type: 1, 147 | g_ty: `ls` 148 | }, 149 | data: {}, 150 | method: 'get', 151 | timeout: 5000, 152 | headers: { 153 | 'accept': '*/*', 154 | 'accept-encoding': 'gzip, deflate, br', 155 | 'accept-language': 'zh-CN,zh;q=0.9', 156 | 'dnt': '1', 157 | 'referer': 'https://wqs.jd.com/', 158 | 'sec-fetch-dest': 'script', 159 | 'sec-fetch-mode': 'no-cors', 160 | 'sec-fetch-site': 'same-site', 161 | 'user-agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"), 162 | 'cookie': cookie 163 | }, 164 | }).catch(e => { 165 | console.log(e.message) 166 | }) 167 | .then(res => { 168 | if (res.status == 200 && res.data) { 169 | let data = getObject(res.data); 170 | return data; 171 | } 172 | }).catch(e => console.log(e.message)) 173 | 174 | } 175 | 176 | function getObject(data) { 177 | if (typeof data == 'string') { 178 | return JSON.parse(data); 179 | } 180 | if (typeof data == 'object') { 181 | return data; 182 | } 183 | } 184 | 185 | 186 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(),"h+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), "S+": s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) } 187 | --------------------------------------------------------------------------------