1
0
mirror of https://github.com/6dylan6/jdpro.git synced 2026-05-02 10:46:41 +08:00

Compare commits

..

36 Commits

Author SHA1 Message Date
dylan 88ab477e4d 1 2023-06-01 14:20:34 +08:00
dylan 2a69a2dba2 1 2023-06-01 13:13:09 +08:00
dylan 6f6dde0d7c 1 2023-06-01 12:33:56 +08:00
dylan d8e77d11fc 1 2023-06-01 09:02:09 +08:00
dylan 81190a3411 1 2023-06-01 00:17:20 +08:00
dylan 5a4715ec12 1 2023-05-31 22:00:37 +08:00
dylan 63e582adc7 1 2023-05-31 21:25:30 +08:00
dylan 69dc0b5c55 1 2023-05-31 18:53:53 +08:00
dylan 212c639c0c 1 2023-05-31 18:31:06 +08:00
dylan bcf6b8ceb8 1 2023-05-31 08:47:41 +08:00
dylan 084fe07388 1 2023-05-31 07:24:48 +08:00
dylan 2a35540432 1 2023-05-30 20:21:57 +08:00
dylan cbb1004759 1 2023-05-30 19:39:24 +08:00
dylan 680b18b8bd 1 2023-05-30 09:02:06 +08:00
dylan 59576a8455 1 2023-05-30 08:43:25 +08:00
dylan 63c952a9bf 1 2023-05-29 23:58:13 +08:00
dylan c7f81779a7 1 2023-05-29 22:37:51 +08:00
dylan 4879e970e8 1 2023-05-28 19:26:15 +08:00
dylan 66ad0a0aac 1 2023-05-28 15:52:10 +08:00
dylan 12114bfe05 1 2023-05-28 15:37:32 +08:00
dylan 8f33649efa 1 2023-05-28 14:28:55 +08:00
dylan e2d9e67507 1 2023-05-28 14:20:48 +08:00
dylan 23954af6c6 1 2023-05-28 13:58:54 +08:00
dylan 5393adcac9 1 2023-05-27 23:26:55 +08:00
dylan 82c997eeea 1 2023-05-27 16:36:07 +08:00
dylan 2359e4df3d 1 2023-05-27 15:32:01 +08:00
dylan e7647882cd 1 2023-05-27 15:07:24 +08:00
dylan 69757b61d7 1 2023-05-27 13:04:12 +08:00
dylan af12a56895 1 2023-05-27 12:29:11 +08:00
dylan a5a0d26ca8 1 2023-05-27 10:42:50 +08:00
dylan d869884a9f 1 2023-05-27 10:38:55 +08:00
dylan 361ad8e3dd 1 2023-05-27 01:09:52 +08:00
dylan 50d774b6f2 1 2023-05-26 17:19:55 +08:00
dylan 5c25e84251 1 2023-05-26 16:36:17 +08:00
dylan 521bb61c5a 1 2023-05-26 16:34:06 +08:00
dylan fdaaf475a8 1 2023-05-25 20:24:00 +08:00
236 changed files with 28026 additions and 3495 deletions
-18
View File
@@ -1,18 +0,0 @@
name: 问题反馈 🐞
description: 有问题先更新订阅,不行才提
body:
- type: input
id: version
attributes:
label: 青龙版本
validations:
required: true
- type: textarea
id: description
attributes:
label: 问题描述
description: 尽量详细描述问题,附上错误日志或截图。
placeholder: 请描述
validations:
required: true
-5
View File
@@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: TG Chat
url: https://t.me/dylan_jdpro
about: 关注tg不迷路
@@ -1,9 +0,0 @@
name: "💡功能建议"
description: 为项目提想法
labels: ["pending","feature"]
body:
- type: textarea
id: require
attributes:
label: 需求描述
placeholder: 请描述
+67 -55
View File
@@ -1,43 +1,78 @@
## 6dy ## 6dy
声明: 此库所有内容仅用于个人学习!!! >加密审查,无重复,默认不开卡加购,内部互助(可调模式);
### [TG CHANEL](https://t.me/dylan_jdpro)
国内机(带加速,也不太稳): >欢迎大家issue、pr,会一一回复!
### 注意ck安全,谨慎执行不明来历的js、app、exe、插件等,过期ck都能复活(还有其他不为人知的手段。。。)!
### 已知MaiARK短信登录工具偷CK,不要使用!!!
### 防走失[TG频道](https://t.me/dylan_jdpro)
### 一键部署(2.11.3版本青龙,默认国内机拉库命令,建好后根据自己情况调整)
使用root用户运行下面一串命令,仅在Centos/Ubuntu系统测试,其他系统自测
``` ```
ql repo https://js.googo.win/https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify|utils" curl -sSL https://js.nbplay.site/https://raw.githubusercontent.com/6dylan6/jdpro/main/docker/ql1key.sh -o install.sh && bash install.sh
```
## 拉库指令
【注意】2.11.1前版本青龙config.sh配置把GithubProxyUrl="https://ghproxy.com/ (差不在多19行)" 修改为GithubProxyUrl="",否则拉取失败,以上版本无需配置。
2.13版本以上青龙拉库方式变了,到订阅管理新建订阅,正确配置[参考](https://github.com/6dylan6/jdpro/discussions/680)
国内机用下面指令(带代理):
```
ql repo https://ghproxy.com/https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify"
```
如默认代理ghproxy.com 拉不动,换备用的 js.nbplay.site 试试
国外机用下面指令(无需代理):
```
ql repo https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify"
``` ```
Gitee版不能正常拉取,已停止维护!(20220711)
国外机(国外ip有限制可能有些任务不能正常运行):
```
ql repo https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify|utils"
```
任务定时建议(每2小时的45分更新) 45 7-23/2 * * *
## 使用 (定时可随意,不一定按这个来,但不要设置为每秒或每分钟)
1、部署青龙登陆,版本不用追新,稳定才好,推荐部署到内网(不要外网访问,2.20.2以下版本面板会被免密登录偷家,如果必须外网就用最新版本吧)。
2、到订阅管理创建订阅并运行;正确配置[参考](https://github.com/6dylan6/jdpro/issues/22) 线报监控类脚本,需要的到 https://github.com/6dylan6/jdm.git
3、订阅执行完,到定时任务搜索依赖安装(jd_indeps)任务执行; 带图自动评价(PC版CK)需要的到 https://github.com/6dylan6/auto_comment.git
4、到环境变量,创建变量,名称: JD_COOKIE,值:抓的CK(要安全就手抓),多个每行建一个,不要全写在一个;
5、配置通知,通知的key填写到配置管理config.sh文件; ## 使用流程
1、青龙部署。
2、修改青龙config.sh配置,差不多在17行(特别注意,没有修改此配置,任务拉不全,一键部署可忽略此处);
RepoFileExtensions="js py"修改为 RepoFileExtensions="js py sh ts" 保存;
3、新建拉库任务或订阅,并执行,刷新浏览器即可看到添加的任务;
4、添加CK环境变量,多CK不要写在一起,每个都新建JD_COOKIE变量;
5,通知key变量请添加到配置管理config.sh文件,否则收不到通知;
<details> <details>
<summary>笔记</summary> <summary>使用技巧与问题解答</summary>
<pre><code> <pre><code>
1、任务并发和分组 1、任务并发和分组
@@ -68,55 +103,32 @@ export NOTIFY_SHOWNAMETYPE="4" 效果是 : 账号名称:备注
3、因为青龙有随机延时(可以在配置文件设置为0,默认300秒),所以涉及准点运行的任务,最后加now,如果是desi或conc不用加也会准时跑。 3、因为青龙有随机延时(可以在配置文件设置为0,默认300秒),所以涉及准点运行的任务,最后加now,如果是desi或conc不用加也会准时跑。
4、脚本的通知,需把通知key变量在config.sh文件配置 4、青龙系统通知(新增删除任务、登录等通知,需把通知变量写到config.sh文件,在环境变量里只发脚本运行通知哈
5、建议调整任务运行超时时间,青龙默认1小时有些跑不完就被强制结束,config.sh里配置。CommandTimeoutTime="3h" 即改为3小时,根据自己ck数量调整 5、如果通知文件发现和库里的不一致,那是被青龙自带的覆盖了,手动拷贝一份到deps目录下
6、ck掉线,不是常用地ip,短时间内连续获得豆可能就会会触发风控掉线 6、建议调整任务运行超时时间,青龙默认1小时有些跑不完就被强制结束,config.sh里配置。CommandTimeoutTime="3h" 即改为3小时,根据自己ck数量调整。
</code></pre>
</details>
## 通用环境变量(到配置管理-config.sh里添加变量,export xxx='xxx'格式) ## 互助模式使用说明
AUTOCFG='true' 自动配置sendNotify文件到deps目录 集成互助研究院taskbefore,code模块,可实现临时禁止某些CK参加所有活动或某些活动功能,实现重组CK顺序功能,包括随机、优先、轮换、组队、分段等功能
代理API模式(API代理是通过url接得到随机可用代理ip,格式是:xxx.xxx.xxx.xxx:xxxx 常用变量举例:
DY_PROXY='URL1#URL2' 多个#分割 Recombin_CK_Mode="1" 全部顺序随机
PERMIT_API='test' 需要走API代理的js关键词,多个&分割,可不设置,支持的js都会走 Recombin_CK_Mode="2" Recombin_CK_ARG1="15" 假设有100个CK,前15个CK按正常顺序靠前,其余CK随机乱序
DY_PROXY_RENUM='5' 获取IP失败重试次数 Recombin_CK_Mode="3" Recombin_CK_ARG1="5" Recombin_CK_ARG2="5" 假设有100个CK,希望前5个账号始终保持在前部,剩余95个账号按照轮换模式每天轮换5个
DY_PROXY_REDELAY='3' 获取失败重试间隔 单位秒 其他用法具体参考[文档](https://docs.qq.com/doc/DTXh6QUVjRXJ1TFdN)
代理池模式(就是一个代理服务器的地址)
DP_POOL='http://xxx' 代理池url
PERMIT_JS='farm&plant&opencard' 需要走代理池的js关键词,多个&分割(可不设置,如果不设置就是所有的js都会走)
BANPIN 禁止某pin执行任务
ALLOWPIN 只执行某pin执行任务
多个任务同pin:任务1|任务2@pin1,pin2
多个任务不同pin:任务1@pin,pin2&任务2@pin2,pin3
不指定任务只写pin:全部任务
示例
export BANPIN='draw@pin1,pin2'
export ALLOWPIN='draw@pin1,pin2'
## 支持的通知方式 ## 支持的通知方式
server酱,go-cqhttppushdeerBark Apptg bot,钉钉bot,企业微信bot,企业微信应用消息,飞书,iGotpush plusWxPushergotify server酱,go-cqhttppushdeerBark Apptg bot,钉钉bot,企业微信bot,企业微信应用消息,飞书,iGotpush plusWxPushergotify
请在配置管理config文件里填写对应key 请在配置管理config文件里写变量
+399
View File
@@ -0,0 +1,399 @@
import axios from "axios"
import {Md5} from "ts-md5"
import * as dotenv from "dotenv"
import {existsSync, readFileSync} from "fs"
import {sendNotify} from './sendNotify'
dotenv.config()
let fingerprint: string | number, token: string = '', enCryptMethodJD: any
const USER_AGENTS: Array<string> = [
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
"jdapp;iPhone;10.0.2;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",
"jdapp;android;10.0.2;9;network/4g;Mozilla/5.0 (Linux; Android 9; Mi Note 3 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36",
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; GM1910 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
"jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; 16T Build/PKQ1.190616.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
"jdapp;iPhone;10.0.2;13.6;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;13.6;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;13.5;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;13.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;13.7;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;13.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;13.4;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
"jdapp;android;10.0.2;11;network/wifi;Mozilla/5.0 (Linux; Android 11; Redmi K30 5G Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045511 Mobile Safari/537.36",
"jdapp;iPhone;10.0.2;11.4;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79",
"jdapp;android;10.0.2;10;;network/wifi;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36",
"jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; MHA-AL00 Build/HUAWEIMHA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
"jdapp;android;10.0.2;8.1.0;network/wifi;Mozilla/5.0 (Linux; Android 8.1.0; 16 X Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
"jdapp;android;10.0.2;8.0.0;network/wifi;Mozilla/5.0 (Linux; Android 8.0.0; HTC U-3w Build/OPR6.170623.013; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36",
"jdapp;iPhone;10.0.2;14.0.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; LYA-AL00 Build/HUAWEILYA-AL00L; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36",
"jdapp;iPhone;10.0.2;14.2;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;14.2;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;android;10.0.2;8.1.0;network/wifi;Mozilla/5.0 (Linux; Android 8.1.0; MI 8 Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36",
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; Redmi K20 Pro Premium Edition Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36",
"jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
"jdapp;iPhone;10.0.2;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",
"jdapp;android;10.0.2;11;network/wifi;Mozilla/5.0 (Linux; Android 11; Redmi K20 Pro Premium Edition Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36",
"jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36",
"jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
]
function TotalBean(cookie: string) {
return {
cookie: cookie,
isLogin: true,
nickName: ''
}
}
function getRandomNumberByRange(start: number, end: number) {
end <= start && (end = start + 100)
return Math.floor(Math.random() * (end - start) + start)
}
let USER_AGENT = USER_AGENTS[getRandomNumberByRange(0, USER_AGENTS.length)]
async function getBeanShareCode(cookie: string) {
let {data}: any = await axios.post('https://api.m.jd.com/client.action',
`functionId=plantBeanIndex&body=${encodeURIComponent(
JSON.stringify({version: "9.0.0.1", "monitor_source": "plant_app_plant_index", "monitor_refer": ""})
)}&appid=ld&client=apple&area=5_274_49707_49973&build=167283&clientVersion=9.1.0`, {
headers: {
Cookie: cookie,
Host: "api.m.jd.com",
Accept: "*/*",
Connection: "keep-alive",
"User-Agent": USER_AGENT
}
})
if (data.data?.jwordShareInfo?.shareUrl)
return data.data.jwordShareInfo.shareUrl.split('Uuid=')![1]
else
return ''
}
async function getFarmShareCode(cookie: string) {
let {data}: any = await axios.post('https://api.m.jd.com/client.action?functionId=initForFarm', `body=${encodeURIComponent(JSON.stringify({"version": 4}))}&appid=wh5&clientVersion=9.1.0`, {
headers: {
"cookie": cookie,
"origin": "https://home.m.jd.com",
"referer": "https://home.m.jd.com/myJd/newhome.action",
"User-Agent": USER_AGENT,
"Content-Type": "application/x-www-form-urlencoded"
}
})
if (data.farmUserPro)
return data.farmUserPro.shareCode
else
return ''
}
async function requireConfig(check: boolean = false): Promise<string[]> {
let cookiesArr: string[] = []
const jdCookieNode = require('./jdCookie.js')
let keys: string[] = Object.keys(jdCookieNode)
for (let i = 0; i < keys.length; i++) {
let cookie = jdCookieNode[keys[i]]
if (!check) {
cookiesArr.push(cookie)
} else {
if (await checkCookie(cookie)) {
cookiesArr.push(cookie)
} else {
let username = decodeURIComponent(jdCookieNode[keys[i]].match(/pt_pin=([^;]*)/)![1])
console.log('Cookie失效', username)
await sendNotify('Cookie失效', '【京东账号】' + username)
}
}
}
console.log(`${cookiesArr.length}个京东账号\n`)
return cookiesArr
}
async function checkCookie(cookie: string) {
await wait(3000)
try {
let {data}: any = await axios.get(`https://api.m.jd.com/client.action?functionId=GetJDUserInfoUnion&appid=jd-cphdeveloper-m&body=${encodeURIComponent(JSON.stringify({"orgFlag": "JD_PinGou_New", "callSource": "mainorder", "channel": 4, "isHomewhite": 0, "sceneval": 2}))}&loginType=2&_=${Date.now()}&sceneval=2&g_login_type=1&callback=GetJDUserInfoUnion&g_ty=ls`, {
headers: {
'authority': 'api.m.jd.com',
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1',
'referer': 'https://home.m.jd.com/',
'cookie': cookie
}
})
data = JSON.parse(data.match(/GetJDUserInfoUnion\((.*)\)/)[1])
return data.retcode === '0';
} catch (e) {
return false
}
}
function wait(timeout: number) {
return new Promise(resolve => {
setTimeout(resolve, timeout)
})
}
async function requestAlgo(appId: number = 10032) {
fingerprint = generateFp()
return new Promise<void>(async resolve => {
let {data}: any = await axios.post('https://cactus.jd.com/request_algo?g_ty=ajax', {
"version": "1.0",
"fp": fingerprint,
"appId": appId,
"timestamp": Date.now(),
"platform": "web",
"expandParams": ""
}, {
"headers": {
'Authority': 'cactus.jd.com',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
'Accept': 'application/json',
'User-Agent': USER_AGENT,
'Content-Type': 'application/json',
'Origin': 'https://st.jingxi.com',
'Sec-Fetch-Site': 'cross-site',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://st.jingxi.com/',
'Accept-Language': 'zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.7'
},
})
if (data['status'] === 200) {
token = data.data.result.tk
let enCryptMethodJDString = data.data.result.algo
if (enCryptMethodJDString) enCryptMethodJD = new Function(`return ${enCryptMethodJDString}`)()
} else {
console.log(`fp: ${fingerprint}`)
console.log('request_algo 签名参数API请求失败:')
}
resolve()
})
}
function generateFp() {
let e = "0123456789"
let a = 13
let i = ''
for (; a--;)
i += e[Math.random() * e.length | 0]
return (i + Date.now()).slice(0, 16)
}
function getJxToken(cookie: string, phoneId: string = '') {
function generateStr(input: number) {
let src = 'abcdefghijklmnopqrstuvwxyz1234567890'
let res = ''
for (let i = 0; i < input; i++) {
res += src[Math.floor(src.length * Math.random())]
}
return res
}
if (!phoneId)
phoneId = generateStr(40)
let timestamp = Date.now().toString()
let nickname = cookie.match(/pt_pin=([^;]*)/)![1]
let jstoken = Md5.hashStr('' + decodeURIComponent(nickname) + timestamp + phoneId + 'tPOamqCuk9NLgVPAljUyIHcPRmKlVxDy')
return {
'strPgtimestamp': timestamp,
'strPhoneID': phoneId,
'strPgUUNum': jstoken
}
}
function exceptCookie(filename: string = 'x.ts') {
let except: any = []
if (existsSync('./utils/exceptCookie.json')) {
try {
except = JSON.parse(readFileSync('./utils/exceptCookie.json').toString() || '{}')[filename] || []
} catch (e) {
console.log('./utils/exceptCookie.json JSON格式错误')
}
}
return except
}
function randomString(e: number, word?: number) {
e = e || 32
let t = word === 26 ? "012345678abcdefghijklmnopqrstuvwxyz" : "0123456789abcdef", a = t.length, n = ""
for (let i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a))
return n
}
function o2s(arr: object, title: string = '') {
title ? console.log(title, JSON.stringify(arr)) : console.log(JSON.stringify(arr))
}
function randomNumString(e: number) {
e = e || 32
let t = '0123456789', a = t.length, n = ""
for (let i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a))
return n
}
function randomWord(n: number = 1) {
let t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', a = t.length
let rnd: string = ''
for (let i = 0; i < n; i++) {
rnd += t.charAt(Math.floor(Math.random() * a))
}
return rnd
}
async function getshareCodeHW(key: string) {
let shareCodeHW: string[] = []
for (let i = 0; i < 5; i++) {
try {
let {data}: any = await axios.get('https://api.jdsharecode.xyz/api/HW_CODES')
shareCodeHW = data[key] || []
if (shareCodeHW.length !== 0) {
break
}
} catch (e) {
console.log("getshareCodeHW Error, Retry...")
await wait(getRandomNumberByRange(2000, 6000))
}
}
return shareCodeHW
}
async function getShareCodePool(key: string, num: number) {
let shareCode: string[] = []
for (let i = 0; i < 2; i++) {
try {
let {data}: any = await axios.get(`https://api.jdsharecode.xyz/api/${key}/${num}`)
shareCode = data.data || []
console.log(`随机获取${num}${key}成功:${JSON.stringify(shareCode)}`)
if (shareCode.length !== 0) {
break
}
} catch (e) {
console.log("getShareCodePool Error, Retry...")
await wait(getRandomNumberByRange(2000, 6000))
}
}
return shareCode
}
/*async function wechat_app_msg(title: string, content: string, user: string) {
let corpid: string = "", corpsecret: string = ""
let {data: gettoken} = await axios.get(`https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}`)
let access_token: string = gettoken.access_token
let {data: send} = await axios.post(`https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${access_token}`, {
"touser": user,
"msgtype": "text",
"agentid": 1000002,
"text": {
"content": `${title}\n\n${content}`
},
"safe": 0
})
if (send.errcode === 0) {
console.log('企业微信应用消息发送成功')
} else {
console.log('企业微信应用消息发送失败', send)
}
}*/
function obj2str(obj: object) {
return JSON.stringify(obj)
}
async function getDevice() {
let {data} = await axios.get('https://betahub.cn/api/apple/devices/iPhone', {
headers: {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
}
})
data = data[getRandomNumberByRange(0, 16)]
return data.identifier
}
async function getVersion(device: string) {
let {data} = await axios.get(`https://betahub.cn/api/apple/firmwares/${device}`, {
headers: {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
}
})
data = data[getRandomNumberByRange(0, data.length)]
return data.firmware_info.version
}
async function jdpingou() {
let device: string, version: string;
device = await getDevice();
version = await getVersion(device);
return `jdpingou;iPhone;5.19.0;${version};${randomString(40)};network/wifi;model/${device};appBuild/100833;ADID/;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/${getRandomNumberByRange(10, 90)};pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
}
function get(url: string, headers?: any): Promise<any> {
return new Promise((resolve, reject) => {
axios.get(url, {
headers: headers
}).then(res => {
if (typeof res.data === 'string' && res.data.includes('jsonpCBK')) {
resolve(JSON.parse(res.data.match(/jsonpCBK.?\(([\w\W]*)\);?/)[1]))
} else {
resolve(res.data)
}
}).catch(err => {
reject({
code: err?.response?.status || -1,
msg: err?.response?.statusText || err.message || 'error'
})
})
})
}
function post(url: string, prarms?: string | object, headers?: any): Promise<any> {
return new Promise((resolve, reject) => {
axios.post(url, prarms, {
headers: headers
}).then(res => {
resolve(res.data)
}).catch(err => {
reject({
code: err?.response?.status || -1,
msg: err?.response?.statusText || err.message || 'error'
})
})
})
}
export default USER_AGENT
export {
TotalBean,
getBeanShareCode,
getFarmShareCode,
requireConfig,
wait,
getRandomNumberByRange,
requestAlgo,
getJxToken,
exceptCookie,
randomString,
o2s,
randomNumString,
getshareCodeHW,
getShareCodePool,
randomWord,
obj2str,
jdpingou,
get,
post
}
+11 -6
View File
@@ -1,12 +1,17 @@
version: '2' version: '2'
services: services:
ql_web: ql_web:
image: whyour/qinglong:2.17.9 image: whyour/qinglong:2.11.3
container_name: ql container_name: ql
volumes: volumes:
- ./qinglong/data:/ql/data - ./data/config:/ql/config
- ./qinglong/deps/pnpm:/root/.local/share/pnpm - ./data/log:/ql/log
- ./qinglong/deps/pip3:/usr/local/lib/python3.11/site-packages - ./data/db:/ql/db
- ./data/scripts:/ql/scripts
- ./data/repo:/ql/repo
ports: ports:
- "5700:5700" - "0.0.0.0:5700:5700"
restart: unless-stopped environment:
- ENABLE_HANGUP=true
- ENABLE_WEB_PANEL=true
restart: always
+17 -8
View File
@@ -46,16 +46,25 @@ cd $ql_path
cat > docker-compose.yml <<EOF cat > docker-compose.yml <<EOF
version: '2' version: '2'
services: services:
ql_web: qinglong:
image: whyour/qinglong:2.17.9 image: whyour/qinglong:2.11.3
container_name: ql container_name: qinglong
volumes: volumes:
- ./qinglong/data:/ql/data - ./data/config:/ql/config
- ./qinglong/deps/pnpm:/root/.local/share/pnpm - ./data/log:/ql/log
- ./qinglong/deps/pip3:/usr/local/lib/python3.11/site-packages - ./data/db:/ql/db
- ./data/scripts:/ql/scripts
- ./data/repo:/ql/repo
ports: ports:
- "5700:5700" - "0.0.0.0:5500:5700"
restart: unless-stopped networks:
- net
environment:
- ENABLE_HANGUP=true
- ENABLE_WEB_PANEL=true
restart: always
networks:
net:
EOF EOF
docker-compose up -d docker-compose up -d
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
+37 -47
View File
@@ -1,24 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
## Build 20220831-001-test ## Build 20220831-001-test
## 6dylan6_20240905 ## 6dylan6_0126
name_js=( name_js=(
jd_farm_help jd_farm_help
jd_farmnew_code_help jd_pet
#jd_pet jd_plantBean
jd_plantBean_help jd_dreamFactory
#jd_dreamFactory jd_jdfactory
#jd_jdfactory
#jd_crazy_joy #jd_crazy_joy
#jd_jdzz #jd_jdzz
#jd_jxnc jd_jxnc
#jd_bookshop #jd_bookshop
#jd_cash #jd_cash
#jd_sgmh jd_sgmh
#jd_cfd jd_cfd
jd_health jd_health
jd_farmshare
#jd_carnivalcity #jd_carnivalcity
#jd_city #jd_city
#jd_moneyTree #jd_moneyTree
@@ -26,20 +24,18 @@ name_js=(
) )
name_config=( name_config=(
Fruit Fruit
Fruit_new Pet
#Pet
Bean Bean
#DreamFactory DreamFactory
#JdFactory JdFactory
#Joy #Joy
#Jdzz #Jdzz
#Jxnc Jxnc
#BookShop #BookShop
#Cash #Cash
#Sgmh Sgmh
#Cfd Cfd
Health Health
Fruit_new
#Carni #Carni
#City #City
#MoneyTree #MoneyTree
@@ -47,20 +43,18 @@ name_config=(
) )
name_chinese=( name_chinese=(
东东农场 东东农场
新农场助力 东东萌宠
#东东萌宠 京东种豆得豆
种豆得豆助力 京喜工厂
#京喜工厂 东东工厂
#东东工厂
#crazyJoy任务 #crazyJoy任务
#京东赚赚 #京东赚赚
#京喜农场 京喜农场
#口袋书店 #口袋书店
#签到领现金 #签到领现金
#闪购盲盒 闪购盲盒
#京喜财富岛 京喜财富岛
东东健康社区 东东健康社区
农场小程序助力
#京东手机狂欢城 #京东手机狂欢城
#城城领现金 #城城领现金
#摇钱树 #摇钱树
@@ -68,20 +62,18 @@ name_chinese=(
) )
env_name=( env_name=(
FRUITSHARECODES ## 1、东东农场互助码 FRUITSHARECODES ## 1、东东农场互助码
NEWFRUITSHARECODES ## 1、新东东农场互助码 PETSHARECODES ## 2、东东萌宠互助码
#PETSHARECODES ## 2、东东萌宠互助码
PLANT_BEAN_SHARECODES ## 3、种豆得豆互助码 PLANT_BEAN_SHARECODES ## 3、种豆得豆互助码
#DREAM_FACTORY_SHARE_CODES ## 4、京喜工厂互助码 DREAM_FACTORY_SHARE_CODES ## 4、京喜工厂互助码
#DDFACTORY_SHARECODES ## 5、东东工厂互助码 DDFACTORY_SHARECODES ## 5、东东工厂互助码
#JDJOY_SHARECODES ## 6、疯狂的JOY互助码 #JDJOY_SHARECODES ## 6、疯狂的JOY互助码
#JDZZ_SHARECODES ## 7、京东赚赚互助码 #JDZZ_SHARECODES ## 7、京东赚赚互助码
#JXNC_SHARECODES ## 8、京喜农场助力码 JXNC_SHARECODES ## 8、京喜农场助力码
#BOOKSHOP_SHARECODES ## 9、口袋书店互助码 #BOOKSHOP_SHARECODES ## 9、口袋书店互助码
#JD_CASH_SHARECODES ## 10、签到领现金互助码 #JD_CASH_SHARECODES ## 10、签到领现金互助码
#JDSGMH_SHARECODES ## 11、闪购盲盒互助码 JDSGMH_SHARECODES ## 11、闪购盲盒互助码
#JDCFD_SHARECODES ## 12、京喜财富岛互助码 JDCFD_SHARECODES ## 12、京喜财富岛互助码
JDHEALTH_SHARECODES ## 13、东东健康社区互助码 JDHEALTH_SHARECODES ## 13、东东健康社区互助码
NEWFRUITSHARECODES ## 14、新农场小程序
#JD818_SHARECODES ## 14、京东手机狂欢城互助码 #JD818_SHARECODES ## 14、京东手机狂欢城互助码
#CITY_SHARECODES ## 15、城城领现金互助码 #CITY_SHARECODES ## 15、城城领现金互助码
#MONEYTREE_SHARECODES ## 16、摇钱树 #MONEYTREE_SHARECODES ## 16、摇钱树
@@ -89,23 +81,21 @@ env_name=(
) )
var_name=( var_name=(
ForOtherFruit ## 1、东东农场互助规则 ForOtherFruit ## 1、东东农场互助规则
ForOtherFruit_new ## 1、东东农场互助规则 ForOtherPet ## 2、东东萌宠互助规则
#ForOtherPet ## 2、东东萌宠互助规则
ForOtherBean ## 3、种豆得豆互助规则 ForOtherBean ## 3、种豆得豆互助规则
#ForOtherDreamFactory ## 4、京喜工厂互助规则 ForOtherDreamFactory ## 4、京喜工厂互助规则
#ForOtherJdFactory ## 5、东东工厂互助规则 ForOtherJdFactory ## 5、东东工厂互助规则
#ForOtherJoy ## 6、疯狂的JOY互助规则 #ForOtherJoy ## 6、疯狂的JOY互助规则
#ForOtherJdzz ## 7、京东赚赚互助规则 #ForOtherJdzz ## 7、京东赚赚互助规则
#ForOtherJxnc ## 8、京喜农场助力码 ForOtherJxnc ## 8、京喜农场助力码
#ForOtherBookShop ## 9、口袋书店互助规则 #ForOtherBookShop ## 9、口袋书店互助规则
#ForOtherCash ## 10、签到领现金互助规则 #ForOtherCash ## 10、签到领现金互助规则
#ForOtherSgmh ## 11、闪购盲盒互助规则 ForOtherSgmh ## 11、闪购盲盒互助规则
#ForOtherCfd ## 12、京喜财富岛互助规则 ForOtherCfd ## 12、京喜财富岛互助规则
ForOtherHealth ## 13、东东健康社区互助规则 ForOtherHealth ## 13、东东健康社区互助规则
ForOtherFruit_new ## 新农场小程序
#ForOtherCarni ## 14、京东手机狂欢城互助规则 #ForOtherCarni ## 14、京东手机狂欢城互助规则
#ForOtherCity ## 15、城城领现金互助规则 #ForOtherCity ## 15、城城领现金互助规则
#ForOtherMoneyTree ## 16、摇钱树 ForOtherMoneyTree ## 16、摇钱树
#TokenJxnc ## 17、京喜Token(京喜财富岛提现用) #TokenJxnc ## 17、京喜Token(京喜财富岛提现用)
) )
@@ -635,7 +625,7 @@ Recombin_CK_cal(){
[[ $interval_time != "0" ]] && echo -e "# 等待 $interval_time 秒后开始进行下一组队任务 ..." [[ $interval_time != "0" ]] && echo -e "# 等待 $interval_time 秒后开始进行下一组队任务 ..."
sleep $interval_time sleep $interval_time
else else
$which_program $local_scr_dir/$local_scr_name $which_program $local_scr_dir/$local_scr_name &
sleep $delay_time sleep $delay_time
fi fi
fi fi
@@ -805,7 +795,7 @@ Recombin_CK_cal(){
[[ $interval_time != "0" ]] && echo -e "# 等待`format_time $interval_time`后开始进行下一段任务 ..." [[ $interval_time != "0" ]] && echo -e "# 等待`format_time $interval_time`后开始进行下一段任务 ..."
sleep $interval_time sleep $interval_time
else else
$which_program $local_scr_dir/$local_scr_name $which_program $local_scr_dir/$local_scr_name &
sleep $delay_time sleep $delay_time
fi fi
fi fi
@@ -958,7 +948,7 @@ gen_pt_pin_array
#JS_Deps_Replace #JS_Deps_Replace
TempBlock_CK TempBlock_CK
#remove_void_ck #remove_void_ck
if [[ $* != *desi* && $* != *conc* ]];then if [[ -z $cookieStr ]];then
Recombin_CK Recombin_CK
fi fi
combine_only combine_only
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
var il='jsjiami.com.v7';const lIIl11l1=IIii1IlI;(function(IiilIlil,llIi1iii,lIIiiIil,ll1IiiII,illIli1l,l1liIliI,iI1li1I){return IiilIlil=IiilIlil>>0x8,l1liIliI='hs',iI1li1I='hs',function(lliii1I,liIIillI,lIl1i1li,iI1i1iIl,I1IIIlll){const i1lIll1i=IIii1IlI;iI1i1iIl='tfi',l1liIliI=iI1i1iIl+l1liIliI,I1IIIlll='up',iI1li1I+=I1IIIlll,l1liIliI=lIl1i1li(l1liIliI),iI1li1I=lIl1i1li(iI1li1I),lIl1i1li=0x0;const ii1iII1l=lliii1I();while(!![]&&--ll1IiiII+liIIillI){try{iI1i1iIl=parseInt(i1lIll1i(0xb2,'5C4['))/0x1+parseInt(i1lIll1i(0xb4,'UgCK'))/0x2+-parseInt(i1lIll1i(0xa0,'Mtzj'))/0x3*(parseInt(i1lIll1i(0xa6,'Kx83'))/0x4)+parseInt(i1lIll1i(0xb0,'MU[H'))/0x5*(parseInt(i1lIll1i(0xae,'rJx$'))/0x6)+parseInt(i1lIll1i(0xa1,'A#cN'))/0x7*(parseInt(i1lIll1i(0xac,'Elur'))/0x8)+parseInt(i1lIll1i(0xad,'Ud90'))/0x9+-parseInt(i1lIll1i(0xa9,')SXP'))/0xa;}catch(II1liIl1){iI1i1iIl=lIl1i1li;}finally{I1IIIlll=ii1iII1l[l1liIliI]();if(IiilIlil<=ll1IiiII)lIl1i1li?illIli1l?iI1i1iIl=I1IIIlll:illIli1l=I1IIIlll:lIl1i1li=I1IIIlll;else{if(lIl1i1li==illIli1l['replace'](/[UKJAISyMDurRdTQqCEWV=]/g,'')){if(iI1i1iIl===liIIillI){ii1iII1l['un'+l1liIliI](I1IIIlll);break;}ii1iII1l[iI1li1I](I1IIIlll);}}}}}(lIIiiIil,llIi1iii,function(IiIli1lI,ilII1l,IIIIil1,IIIi111i,l1III1Il,l1iiIII,IiiliIl){return ilII1l='\x73\x70\x6c\x69\x74',IiIli1lI=arguments[0x0],IiIli1lI=IiIli1lI[ilII1l](''),IIIIil1=`\x72\x65\x76\x65\x72\x73\x65`,IiIli1lI=IiIli1lI[IIIIil1]('\x76'),IIIi111i=`\x6a\x6f\x69\x6e`,(0x15b906,IiIli1lI[IIIi111i](''));});}(0xbe00,0x4f0f2,iIIIlil1,0xc0),iIIIlil1)&&(il=0x230e);function IIii1IlI(_0x1ec280,_0x300e6e){const _0x5c54c9=iIIIlil1();return IIii1IlI=function(_0x725f54,_0x41e333){_0x725f54=_0x725f54-0x9c;let _0x1fc311=_0x5c54c9[_0x725f54];if(IIii1IlI['YUFSvd']===undefined){var _0x5a0984=function(_0x50c1b0){const _0x19ff44='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2f2a33='',_0x3542ef='';for(let _0x12300f=0x0,_0x51fe7d,_0x5b7af0,_0x4ee540=0x0;_0x5b7af0=_0x50c1b0['charAt'](_0x4ee540++);~_0x5b7af0&&(_0x51fe7d=_0x12300f%0x4?_0x51fe7d*0x40+_0x5b7af0:_0x5b7af0,_0x12300f++%0x4)?_0x2f2a33+=String['fromCharCode'](0xff&_0x51fe7d>>(-0x2*_0x12300f&0x6)):0x0){_0x5b7af0=_0x19ff44['indexOf'](_0x5b7af0);}for(let _0x15def8=0x0,_0x7998fd=_0x2f2a33['length'];_0x15def8<_0x7998fd;_0x15def8++){_0x3542ef+='%'+('00'+_0x2f2a33['charCodeAt'](_0x15def8)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3542ef);};const _0x2907f7=function(_0xda0c54,_0x28f503){let _0x14a5ba=[],_0x17b980=0x0,_0x43a8c6,_0x4d4762='';_0xda0c54=_0x5a0984(_0xda0c54);let _0x23c696;for(_0x23c696=0x0;_0x23c696<0x100;_0x23c696++){_0x14a5ba[_0x23c696]=_0x23c696;}for(_0x23c696=0x0;_0x23c696<0x100;_0x23c696++){_0x17b980=(_0x17b980+_0x14a5ba[_0x23c696]+_0x28f503['charCodeAt'](_0x23c696%_0x28f503['length']))%0x100,_0x43a8c6=_0x14a5ba[_0x23c696],_0x14a5ba[_0x23c696]=_0x14a5ba[_0x17b980],_0x14a5ba[_0x17b980]=_0x43a8c6;}_0x23c696=0x0,_0x17b980=0x0;for(let _0x3711a3=0x0;_0x3711a3<_0xda0c54['length'];_0x3711a3++){_0x23c696=(_0x23c696+0x1)%0x100,_0x17b980=(_0x17b980+_0x14a5ba[_0x23c696])%0x100,_0x43a8c6=_0x14a5ba[_0x23c696],_0x14a5ba[_0x23c696]=_0x14a5ba[_0x17b980],_0x14a5ba[_0x17b980]=_0x43a8c6,_0x4d4762+=String['fromCharCode'](_0xda0c54['charCodeAt'](_0x3711a3)^_0x14a5ba[(_0x14a5ba[_0x23c696]+_0x14a5ba[_0x17b980])%0x100]);}return _0x4d4762;};IIii1IlI['vnCAfj']=_0x2907f7,_0x1ec280=arguments,IIii1IlI['YUFSvd']=!![];}const _0x3baa53=_0x5c54c9[0x0],_0x17bc77=_0x725f54+_0x3baa53,_0x490163=_0x1ec280[_0x17bc77];return!_0x490163?(IIii1IlI['bnDExB']===undefined&&(IIii1IlI['bnDExB']=!![]),_0x1fc311=IIii1IlI['vnCAfj'](_0x1fc311,_0x41e333),_0x1ec280[_0x17bc77]=_0x1fc311):_0x1fc311=_0x490163,_0x1fc311;},IIii1IlI(_0x1ec280,_0x300e6e);}function iIIIlil1(){const iIilli11=(function(){return[...[il,'RUKjrsjViDaCdmSiAd.qcQMouCumIqD.TvJ7WJEy==','FmopWRZcKSkxsde','WPi9qve8jCoazLxdPq','WPNdN8kjW4lcJ8kHW4etWQhcN8kfcGy','WPhcQaNcJ1RcQGe','rxldIG','WPNdMmkmW4tcISkLWPajWQNcP8kxaG','gq7cNtFdTSk8WRS+WQekmmoYW7u','qq0+W6W'],...(function(){return[...['WPNdNmkjW4FcISolWOWjWPpcS8kO','mG7cLXOGeqm','W58ZWPXVo8oonv8gW7f7W7RcOG','WQeTW6hdOSozWPxdJ39UWPdcLa','eSk7W4hcMbVcGaG','AmkkW7GowSozWR0yW5a','xez/W4yhnG','W75GWPpdM2ZcS8oGmNxdMMX2','xafwbeRcUJ1RWRxdO8oBWOlcKa','W7m9W77dHSo3zZZcQmk8pXPW'],...(function(){return['dam8WP1sBxT9pSkbfmk8wG','WP3cS8kuwCkmpCkx','FSk/W7ddSSkhWRdcMG','W43dJCorW5dcNCohW4D1na','WPBdTNBcICowBCkvWRxcUfm2xq','bWVdRZZcQh9PFtaYnmkctW','oSkmvMBcRCktWQP9fxCudW'];}())];}())];}());iIIIlil1=function(){return iIilli11;};return iIIIlil1();};const {H5st}=require(lIIl11l1(0xa4,'wwG^'));async function getH5st(iIiIl1i1,iIIIi111,Il1l1ili=lIIl11l1(0xa7,'J*Zq')){const iIIi1i11=lIIl11l1,l11lilI=Object[iIIi1i11(0xb1,'edxX')]({'appId':iIiIl1i1,'version':Il1l1ili},iIIIi111),l1lllil1=await H5st[iIIi1i11(0x9e,'Nkmp')](l11lilI);return l1lllil1?.[iIIi1i11(0xaa,'FHZ3')];}module[lIIl11l1(0xaf,'8byO')]=getH5st;var version_ = 'jsjiami.com.v7';
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+72
View File
@@ -0,0 +1,72 @@
import axios from "axios"
import {format} from "date-fns"
import * as CryptoJS from 'crypto-js'
class H5ST {
tk: string;
timestamp: string;
rd: string;
appId: string;
fp: string;
time: number;
ua: string
enc: string;
constructor(appId: string, ua: string, fp: string) {
this.appId = appId
this.ua = ua
this.fp = fp || this.__genFp()
}
__genFp() {
let e = "0123456789";
let a = 13;
let i = '';
for (; a--;)
i += e[Math.random() * e.length | 0];
return (i + Date.now()).slice(0, 16)
}
async __genAlgo() {
this.time = Date.now()
this.timestamp = format(this.time, "yyyyMMddHHmmssSSS")
let {data} = await axios.post(`https://cactus.jd.com/request_algo?g_ty=ajax`, {
'version': '3.0',
'fp': this.fp,
'appId': this.appId.toString(),
'timestamp': this.time,
'platform': 'web',
'expandParams': ''
}, {
headers: {
'Host': 'cactus.jd.com',
'accept': 'application/json',
'content-type': 'application/json',
'user-agent': this.ua,
}
})
this.tk = data.data.result.tk
this.rd = data.data.result.algo.match(/rd='(.*)'/)[1]
this.enc = data.data.result.algo.match(/algo\.(.*)\(/)[1]
}
__genKey(tk: string, fp: string, ts: string, ai: string, algo: object) {
let str = `${tk}${fp}${ts}${ai}${this.rd}`;
return algo[this.enc](str, tk)
}
__genH5st(body: object) {
let y = this.__genKey(this.tk, this.fp, this.timestamp, this.appId, CryptoJS).toString(CryptoJS.enc.Hex)
let s = ''
for (let key of Object.keys(body)) {
key === 'body' ? s += `${key}:${CryptoJS.SHA256(body[key]).toString(CryptoJS.enc.Hex)}&` : s += `${key}:${body[key]}&`
}
s = s.slice(0, -1)
s = CryptoJS.HmacSHA256(s, y).toString(CryptoJS.enc.Hex)
return encodeURIComponent(`${this.timestamp};${this.fp};${this.appId.toString()};${this.tk};${s};3.0;${this.time.toString()}`)
}
}
export {
H5ST
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -15
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -5
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+136 -149
View File
@@ -4,160 +4,147 @@ const got = require('got');
require('dotenv').config(); require('dotenv').config();
const { readFile } = require('fs/promises'); const { readFile } = require('fs/promises');
const path = require('path'); const path = require('path');
const qlDir = '/ql';
const fs = require('fs'); const fs = require('fs');
const tokenFileList = ['/ql/data/db/keyv.sqlite', '/ql/data/config/auth.json', '/ql/config/auth.json']; let Fileexists = fs.existsSync('/ql/data/config/auth.json');
let authFile = getLatestFile(tokenFileList); let authFile="";
const HOSTS = ['http://127.0.0.1:5600','http://127.0.0.1:5700']; if (Fileexists)
function api(options){ authFile="/ql/data/config/auth.json"
const req = got.extend({prefixUrl: HOSTS[0],retry:{limit:0},timeout:{request:5000}})(options); else
['json','text','buffer'].forEach(m=>{ authFile="/ql/config/auth.json"
const orig=req[m].bind(req); //const authFile = path.join(qlDir, 'config/auth.json');
req[m]=()=>orig().catch(e=>['ECONNREFUSED','ETIMEDOUT'].includes(e.code)?got.extend({prefixUrl:HOSTS[1],retry:{limit:0},timeout:{request:5000}})(options)[m]():Promise.reject(e));
}); const api = got.extend({
return req; prefixUrl: 'http://127.0.0.1:5600',
} retry: { limit: 0 },
function getLatestFile(files) { });
let latestFile = null;
let latestMtime = 0;
for (const file of files) {
try {
const stats = fs.statSync(file);
const mtime = stats.mtimeMs;
if (mtime > latestMtime) {
latestMtime = mtime;
latestFile = file;
}
} catch (e) {
}
}
return latestFile;
}
async function getToken() { async function getToken() {
const authConfig = await readFile(authFile); const authConfig = JSON.parse(await readFile(authFile));
// console.log(authConfig.toString().match(/"token":"(.*?)",/)[1]) return authConfig.token;
return authConfig.toString().match(/"token":"([^"]*)"(?!.*"token":)/)[1];
} }
// getToken()
module.exports.getEnvs = async () => { module.exports.getEnvs = async () => {
const token = await getToken(); const token = await getToken();
const body = await api({ const body = await api({
url: 'api/envs', url: 'api/envs',
searchParams: { searchParams: {
searchValue: 'JD_COOKIE', searchValue: 'JD_COOKIE',
t: Date.now(), t: Date.now(),
}, },
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
authorization: `Bearer ${token}`, authorization: `Bearer ${token}`,
}, },
}).json(); }).json();
return body.data; return body.data;
}; };
module.exports.getEnvsCount = async () => { module.exports.getEnvsCount = async () => {
const data = await this.getEnvs(); const data = await this.getEnvs();
return data.length; return data.length;
}; };
module.exports.addEnv = async (cookie, remarks) => { module.exports.addEnv = async (cookie, remarks) => {
const token = await getToken(); const token = await getToken();
const body = await api({ const body = await api({
method: 'post', method: 'post',
url: 'api/envs', url: 'api/envs',
params: { t: Date.now() }, params: { t: Date.now() },
json: [{ json: [{
name: 'JD_COOKIE', name: 'JD_COOKIE',
value: cookie, value: cookie,
remarks, remarks,
}], }],
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
authorization: `Bearer ${token}`, authorization: `Bearer ${token}`,
'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',
}, },
}).json(); }).json();
return body; return body;
}; };
module.exports.updateEnv = async (cookie, eid, remarks) => { module.exports.updateEnv = async (cookie, eid, remarks) => {
const token = await getToken(); const token = await getToken();
const body = await api({ const body = await api({
method: 'put', method: 'put',
url: 'api/envs', url: 'api/envs',
params: { t: Date.now() }, params: { t: Date.now() },
json: { json: {
name: 'JD_COOKIE', name: 'JD_COOKIE',
value: cookie, value: cookie,
_id: eid, _id: eid,
remarks, remarks,
}, },
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
authorization: `Bearer ${token}`, authorization: `Bearer ${token}`,
'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',
}, },
}).json(); }).json();
return body; return body;
}; };
module.exports.updateEnv11 = async (cookie, eid, remarks) => { module.exports.updateEnv11 = async (cookie, eid, remarks) => {
const token = await getToken(); const token = await getToken();
const body = await api({ const body = await api({
method: 'put', method: 'put',
url: 'api/envs', url: 'api/envs',
params: { t: Date.now() }, params: { t: Date.now() },
json: { json: {
name: 'JD_COOKIE', name: 'JD_COOKIE',
value: cookie, value: cookie,
id: eid, id: eid,
remarks, remarks,
}, },
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
authorization: `Bearer ${token}`, authorization: `Bearer ${token}`,
'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',
}, },
}).json(); }).json();
return body; return body;
}; };
module.exports.DisableCk = async (eid) => { module.exports.DisableCk = async (eid) => {
const token = await getToken(); const token = await getToken();
const body = await api({ const body = await api({
method: 'put', method: 'put',
url: 'api/envs/disable', url: 'api/envs/disable',
params: { t: Date.now() }, params: { t: Date.now() },
body: JSON.stringify([eid]), body: JSON.stringify([eid]),
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
authorization: `Bearer ${token}`, authorization: `Bearer ${token}`,
'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',
}, },
}).json(); }).json();
return body; return body;
}; };
module.exports.EnableCk = async (eid) => { module.exports.EnableCk = async (eid) => {
const token = await getToken(); const token = await getToken();
const body = await api({ const body = await api({
method: 'put', method: 'put',
url: 'api/envs/enable', url: 'api/envs/enable',
params: { t: Date.now() }, params: { t: Date.now() },
body: JSON.stringify([eid]), body: JSON.stringify([eid]),
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
authorization: `Bearer ${token}`, authorization: `Bearer ${token}`,
'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',
}, },
}).json(); }).json();
return body; return body;
}; };
module.exports.getstatus = async (eid) => { module.exports.getstatus = async(eid) => {
const envs = await this.getEnvs(); const envs = await this.getEnvs();
var tempid = 0; var tempid = 0;
for (let i = 0; i < envs.length; i++) { for (let i = 0; i < envs.length; i++) {
tempid = 0; tempid = 0;
if (envs[i]._id) { if (envs[i]._id) {
tempid = envs[i]._id; tempid = envs[i]._id;
} }
@@ -171,7 +158,7 @@ module.exports.getstatus = async (eid) => {
return 99; return 99;
}; };
module.exports.getEnvById = async (eid) => { module.exports.getEnvById = async(eid) => {
const envs = await this.getEnvs(); const envs = await this.getEnvs();
var tempid = 0; var tempid = 0;
for (let i = 0; i < envs.length; i++) { for (let i = 0; i < envs.length; i++) {
@@ -190,28 +177,28 @@ module.exports.getEnvById = async (eid) => {
}; };
module.exports.getEnvByPtPin = async (Ptpin) => { module.exports.getEnvByPtPin = async (Ptpin) => {
const envs = await this.getEnvs(); const envs = await this.getEnvs();
for (let i = 0; i < envs.length; i++) { for (let i = 0; i < envs.length; i++) {
var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]); var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
if (tempptpin == Ptpin) { if(tempptpin==Ptpin){
return envs[i]; return envs[i];
} }
} }
return ""; return "";
}; };
module.exports.delEnv = async (eid) => { module.exports.delEnv = async (eid) => {
const token = await getToken(); const token = await getToken();
const body = await api({ const body = await api({
method: 'delete', method: 'delete',
url: 'api/envs', url: 'api/envs',
params: { t: Date.now() }, params: { t: Date.now() },
body: JSON.stringify([eid]), body: JSON.stringify([eid]),
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
authorization: `Bearer ${token}`, authorization: `Bearer ${token}`,
'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',
}, },
}).json(); }).json();
return body; return body;
}; };
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -21,7 +21,7 @@ const querystring = require('querystring');
const exec = require('child_process').exec; const exec = require('child_process').exec;
const $ = new Env(); const $ = new Env();
const timeout = 15000; //超时时间(单位毫秒) const timeout = 15000; //超时时间(单位毫秒)
console.log("加载sendNotify,当前版本: 20230712"); console.log("加载sendNotify,当前版本: 20230314");
// =======================================go-cqhttp通知设置区域=========================================== // =======================================go-cqhttp通知设置区域===========================================
//gobot_url 填写请求地址http://127.0.0.1/send_private_msg //gobot_url 填写请求地址http://127.0.0.1/send_private_msg
//gobot_token 填写在go-cqhttp文件设置的访问密钥 //gobot_token 填写在go-cqhttp文件设置的访问密钥
@@ -1916,7 +1916,7 @@ function PushDeerNotify(text, desp) {
desp = desp.replace(/%0A/g, '%0A%0A'); desp = desp.replace(/%0A/g, '%0A%0A');
const options = { const options = {
url: `https://api2.pushdeer.com/message/push`, url: `https://api2.pushdeer.com/message/push`,
body: `pushkey=${PUSHDEER_KEY}&text=${text}&desp=${desp}&type="markdown"`, body: `pushkey=${PUSHDEER_KEY}&text=${text}&desp=${desp}&type=markdown`,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
}, },
+5130
View File
File diff suppressed because one or more lines are too long
+31 -117
View File
@@ -3,27 +3,27 @@
*/ */
//此处填写京东账号cookie。 //此处填写京东账号cookie。
let CookieJDs = [ let CookieJDs = [
'',//账号一ck,例:pt_key=XXX;pt_pin=XXX; '',//账号一ck,例:pt_key=XXX;pt_pin=XXX;
'',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推 '',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推
] ]
let IP = ''; let IP='';
// 判断环境变量里面是否有京东ck // 判断环境变量里面是否有京东ck
if (process.env.JD_COOKIE) { if (process.env.JD_COOKIE) {
if (process.env.JD_COOKIE.indexOf('&') > -1) { if (process.env.JD_COOKIE.indexOf('&') > -1) {
CookieJDs = process.env.JD_COOKIE.split('&'); CookieJDs = process.env.JD_COOKIE.split('&');
} else if (process.env.JD_COOKIE.indexOf('\n') > -1) { } else if (process.env.JD_COOKIE.indexOf('\n') > -1) {
CookieJDs = process.env.JD_COOKIE.split('\n'); CookieJDs = process.env.JD_COOKIE.split('\n');
} else { } else {
CookieJDs = [process.env.JD_COOKIE]; CookieJDs = [process.env.JD_COOKIE];
} }
}
if (JSON.stringify(process.env).indexOf('GITHUB')>-1) {
console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`);
!(async () => {
await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`)
await process.exit(0);
})()
} }
//if (JSON.stringify(process.env).indexOf('GITHUB') > -1) {
// console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`);
// !(async () => {
// await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`)
// await process.exit(0);
// })()
//}
//!(async () => { //!(async () => {
// IP = await getIP(); // IP = await getIP();
// try { // try {
@@ -32,95 +32,18 @@ if (process.env.JD_COOKIE) {
// } catch (e) { } // } catch (e) { }
//})() //})()
CookieJDs = [...new Set(CookieJDs.filter(item => !!item))] CookieJDs = [...new Set(CookieJDs.filter(item => !!item))]
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { }; if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
if (process.env.BANPIN) { console.log(`\n====================共${CookieJDs.length}个京东账号Cookie=================\n`);
try { console.log(`============脚本执行时间:${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString('chinese',{hour12:false})}=============\n`)
let banpin = process.env.BANPIN; console.log('>>>>>>>>>>>>>>6Dylan6 提示:任务正常运行中>>>>>>>>>>>>>>>\n')
if (banpin.includes('@')) {
const arr = banpin.split('&');
for (let i of arr) {
//if (process.mainModule.filename.includes(i.split('^')[0])) {
if (i.split('@')[0].split('|').filter(x => process.argv[1].includes(x)).length != 0) {
let pinarr = i.split('@')[1].split(',');
console.log(`\n❗已配置该任务不执行pin: ${JSON.stringify(pinarr)}`);
for (let j of pinarr) {
j = decodeURIComponent(j);
CookieJDs = CookieJDs.filter(x => !x.includes(encodeURIComponent(j)));
}
}
}
} else {
let pinarr = banpin.split(',');
console.log(`\n❗已配置全部任务不执行pin: ${JSON.stringify(pinarr)}`);
for (let i of pinarr) {
i = decodeURIComponent(i);
CookieJDs = CookieJDs.filter(x => !x.includes(encodeURIComponent(i)));
}
}
} catch { }
}
if (process.env.ALLOWPIN) {
try {
const pin = process.env.ALLOWPIN;
const runck = [];
if (pin.includes('@')) {
const arr = pin.split('&');
for (let i of arr) {
//if (process.mainModule.filename.includes(i.split('^')[0])) {
if (i.split('@')[0].split('|').filter(x => process.argv[1].includes(x)).length != 0) {
let pinarr = i.split('@')[1].split(',');
console.log(`\n❗已配置该任务只执行pin: ${JSON.stringify(pinarr)}`);
for (let j of pinarr) {
j = decodeURIComponent(j);
runck.push(...CookieJDs.filter(x => x.includes(encodeURIComponent(j))));
}
}
}
} else {
let pinarr = pin.split(',');
console.log(`\n❗已配置全部任务只执行pin: ${JSON.stringify(pinarr)}`);
for (let i of pinarr) {
i = decodeURIComponent(i);
runck.push(...CookieJDs.filter(x => x.includes(encodeURIComponent(i))));
}
}
if (runck.length > 0) {
CookieJDs = runck
}
} catch { }
}
console.log(`\n====================共${CookieJDs.length}个京东账号Cookie=================`);
console.log(`===========脚本执行时间:${formatdate(new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000))}============`);
console.log('>>>>>>>>>>>>6dylan6提醒您:有问题先更新不行在反馈>>>>>>>>>>>>>\n');
console.log(`Tips:‼️青龙2.20.2以下版本不要外网访问,已被爆破可任意登录!必须要外网的就全新安装新版吧,升级不行\n`);
for (let i = 0; i < CookieJDs.length; i++) { for (let i = 0; i < CookieJDs.length; i++) {
if (!CookieJDs[i].match(/pt_pin=(.+?);/) || !CookieJDs[i].match(/pt_key=(.+?);/)) console.log(`\n提示:京东cookie 【${CookieJDs[i]}】填写不规范,可能会影响部分脚本正常使用。正确格式为: pt_key=xxx;pt_pin=xxx;(分号;不可少)\n`); if (!CookieJDs[i].match(/pt_pin=(.+?);/) || !CookieJDs[i].match(/pt_key=(.+?);/)) console.log(`\n提示:京东cookie 【${CookieJDs[i]}】填写不规范,可能会影响部分脚本正常使用。正确格式为: pt_key=xxx;pt_pin=xxx;(分号;不可少)\n`);
CookieJDs[i] = CookieJDs[i].replace(/[\u4e00-\u9fa5]/g, (str) => encodeURI(str)); CookieJDs[i] = CookieJDs[i].replace(/[\u4e00-\u9fa5]/g, (str) => encodeURI(str));
const index = (i + 1 === 1) ? '' : (i + 1); const index = (i + 1 === 1) ? '' : (i + 1);
exports['CookieJD' + index] = CookieJDs[i].trim(); exports['CookieJD' + index] = CookieJDs[i].trim();
} }
let permit = process.env.PERMIT_JS ? process.env.PERMIT_JS.split('&') : '';
if (process.env.DP_POOL) {
if (permit && permit.filter(x => process.mainModule.filename.includes(x)).length != 0) {
try {
require("global-agent/bootstrap");
global.GLOBAL_AGENT.HTTP_PROXY = process.env.DP_POOL;
global.GLOBAL_AGENT.NO_PROXY = process.env.NO_PROXY || '127.0.0.1,localhost';
console.log(`\n---------------使用代理池模式---------------\n`);
} catch {
throw new Error(`请安装global-agent依赖,才能启用代理!`);
}
} else {
}
}
function getIP() { function getIP() {
const https = require('https'); const https = require('https');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@@ -135,11 +58,11 @@ function getIP() {
timeout: 5000 timeout: 5000
} }
const req = https.request(opt, (res) => { const req = https.request(opt, (res) => {
res.setEncoding('utf-8'); res.setEncoding('utf-8');
let tmp = ''; let tmp = '';
res.on('error', reject); res.on('error', reject);
res.on('data', d => tmp += d); res.on('data', d => tmp += d);
res.on('end', () => resolve(tmp)); res.on('end',() => resolve(tmp));
}); });
req.on('error', reject); req.on('error', reject);
@@ -159,7 +82,7 @@ function SetShareCodesEnv(nameChinese = "", nameConfig = "", envName = "") {
// rawCodeConfig = ini.parse(fs.readFileSync(shareCodeLogPath, 'utf-8')) // rawCodeConfig = ini.parse(fs.readFileSync(shareCodeLogPath, 'utf-8'))
// 使用env模块 // 使用env模块
require('dotenv').config({ path: shareCodeLogPath }) require('dotenv').config({path: shareCodeLogPath})
rawCodeConfig = process.env rawCodeConfig = process.env
} }
@@ -244,12 +167,3 @@ let envName = process.env.ShareCodeEnvName
if (nameChinese && nameConfig && envName) { if (nameChinese && nameConfig && envName) {
SetShareCodesEnv(nameChinese, nameConfig, envName) SetShareCodesEnv(nameChinese, nameConfig, envName)
} }
function formatdate(date) {
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2);
const day = ('0' + date.getDate()).slice(-2);
const hours = ('0' + date.getHours()).slice(-2);
const minutes = ('0' + date.getMinutes()).slice(-2);
const seconds = ('0' + date.getSeconds()).slice(-2);
return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
}
+35
View File
@@ -0,0 +1,35 @@
/*
京喜工厂互助码
此文件为Node.js专用其他用户请忽略
支持京东N个账号
*/
//云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
let shareCodes = [
]
// 从日志获取互助码
// const logShareCodes = require('./utils/jdShareCodes');
// if (logShareCodes.DREAM_FACTORY_SHARE_CODES.length > 0 && !process.env.DREAM_FACTORY_SHARE_CODES) {
// process.env.DREAM_FACTORY_SHARE_CODES = logShareCodes.DREAM_FACTORY_SHARE_CODES.join('&');
// }
// 判断环境变量里面是否有京喜工厂互助码
if (process.env.DREAM_FACTORY_SHARE_CODES) {
if (process.env.DREAM_FACTORY_SHARE_CODES.indexOf('&') > -1) {
console.log(`您的互助码选择的是用&隔开\n`)
shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split('&');
} else if (process.env.DREAM_FACTORY_SHARE_CODES.indexOf('\n') > -1) {
console.log(`您的互助码选择的是用换行隔开\n`)
shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split('\n');
} else {
shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split();
}
} else {
console.log(`由于您环境变量(DREAM_FACTORY_SHARE_CODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
}
for (let i = 0; i < shareCodes.length; i++) {
const index = (i + 1 === 1) ? '' : (i + 1);
exports['shareCodes' + index] = shareCodes[i];
}
+37
View File
@@ -0,0 +1,37 @@
/*
京喜农场助力码
此助力码要求种子 active 相同才能助力多个账号的话可以种植同样的种子如果种子不同的话会自动跳过使用云端助力
此文件为Node.js专用其他用户请忽略
支持京东N个账号
*/
//云服务器腾讯云函数等NOde.js用户在此处填写京京喜农场的好友码。
// 同一个京东账号的好友助力码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
// 注意:京喜农场 种植种子发生变化的时候,互助码也会变!!
// 注意:京喜农场 种植种子发生变化的时候,互助码也会变!!
// 注意:京喜农场 种植种子发生变化的时候,互助码也会变!!
// 每个账号 shareCdoe 是一个 json,示例如下
// {"smp":"22bdadsfaadsfadse8a","active":"jdnc_1_btorange210113_2","joinnum":"1"}
let JxncShareCodes = [
'',//账号一的好友shareCode,不同好友中间用@符号隔开
'',//账号二的好友shareCode,不同好友中间用@符号隔开
]
// 判断github action里面是否有京喜农场助力码
if (process.env.JXNC_SHARECODES) {
if (process.env.JXNC_SHARECODES.indexOf('&') > -1) {
console.log(`您的京喜农场助力码选择的是用&隔开\n`)
JxncShareCodes = process.env.JXNC_SHARECODES.split('&');
} else if (process.env.JXNC_SHARECODES.indexOf('\n') > -1) {
console.log(`您的京喜农场助力码选择的是用换行隔开\n`)
JxncShareCodes = process.env.JXNC_SHARECODES.split('\n');
} else {
JxncShareCodes = process.env.JXNC_SHARECODES.split();
}
} else {
console.log(`由于您环境变量里面(JXNC_SHARECODES)未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
}
JxncShareCodes = JxncShareCodes.filter(item => !!item);
for (let i = 0; i < JxncShareCodes.length; i++) {
const index = (i + 1 === 1) ? '' : (i + 1);
exports['JxncShareCode' + index] = JxncShareCodes[i];
}
+36
View File
@@ -0,0 +1,36 @@
/*
东东萌宠互助码
此文件为Node.js专用其他用户请忽略
支持京东N个账号
*/
//云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
let PetShareCodes = [
'',//账号二的好友shareCode,不同好友中间用@符号隔开
]
// 从日志获取互助码
// const logShareCodes = require('./utils/jdShareCodes');
// if (logShareCodes.PETSHARECODES.length > 0 && !process.env.PETSHARECODES) {
// process.env.PETSHARECODES = logShareCodes.PETSHARECODES.join('&');
// }
// 判断github action里面是否有东东萌宠互助码
if (process.env.PETSHARECODES) {
if (process.env.PETSHARECODES.indexOf('&') > -1) {
console.log(`您的东东萌宠互助码选择的是用&隔开\n`)
PetShareCodes = process.env.PETSHARECODES.split('&');
} else if (process.env.PETSHARECODES.indexOf('\n') > -1) {
console.log(`您的东东萌宠互助码选择的是用换行隔开\n`)
PetShareCodes = process.env.PETSHARECODES.split('\n');
} else {
PetShareCodes = process.env.PETSHARECODES.split();
}
} else {
console.log(`由于您环境变量(PETSHARECODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
}
for (let i = 0; i < PetShareCodes.length; i++) {
const index = (i + 1 === 1) ? '' : (i + 1);
exports['PetShareCode' + index] = PetShareCodes[i];
}
+36
View File
@@ -0,0 +1,36 @@
/*
京东种豆得豆互助码
此文件为Node.js专用其他用户请忽略
支持京东N个账号
*/
//云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
let PlantBeanShareCodes = [
//账号二的好友shareCode,不同好友中间用@符号隔开
]
// 从日志获取互助码
// const logShareCodes = require('./utils/jdShareCodes');
// if (logShareCodes.PLANT_BEAN_SHARECODES.length > 0 && !process.env.PLANT_BEAN_SHARECODES) {
// process.env.PLANT_BEAN_SHARECODES = logShareCodes.PLANT_BEAN_SHARECODES.join('&');
// }
// 判断github action里面是否有种豆得豆互助码
if (process.env.PLANT_BEAN_SHARECODES) {
if (process.env.PLANT_BEAN_SHARECODES.indexOf('&') > -1) {
console.log(`您的种豆互助码选择的是用&隔开\n`)
PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split('&');
} else if (process.env.PLANT_BEAN_SHARECODES.indexOf('\n') > -1) {
console.log(`您的种豆互助码选择的是用换行隔开\n`)
PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split('\n');
} else {
PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split();
}
} else {
console.log(`由于您环境变量(PLANT_BEAN_SHARECODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
}
for (let i = 0; i < PlantBeanShareCodes.length; i++) {
const index = (i + 1 === 1) ? '' : (i + 1);
exports['PlantBeanShareCodes' + index] = PlantBeanShareCodes[i];
}
+298
View File
File diff suppressed because one or more lines are too long
+33
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
-975
View File
@@ -1,975 +0,0 @@
/*
cron "6 6 6 6 *" jd_CheckCK.js, tag:京东CK检测by-ccwav
*/
//详细说明参考 https://github.com/ccwav/QLScript2.
const $ = new Env('CK检测');
const notify = $.isNode() ? require('./sendNotify') : '';
//Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const got = require('got');
const {
getEnvs,
getEnvById,
DisableCk,
EnableCk,
getstatus
} = require('./function/ql');
const api = got.extend({
retry: {
limit: 0
},
responseType: 'json',
});
let ShowSuccess = "false",
CKAlwaysNotify = "false",
CKAutoEnable = "false",
NoWarnError = "false";
let MessageUserGp2 = "";
let MessageUserGp3 = "";
let MessageUserGp4 = "";
let MessageGp2 = "";
let MessageGp3 = "";
let MessageGp4 = "";
let MessageAll = "";
let userIndex2 = -1;
let userIndex3 = -1;
let userIndex4 = -1;
let IndexGp2 = 0;
let IndexGp3 = 0;
let IndexGp4 = 0;
let IndexAll = 0;
let TempErrorMessage = '',
TempSuccessMessage = '',
TempDisableMessage = '',
TempEnableMessage = '',
TempOErrorMessage = '';
let allMessage = '',
ErrorMessage = '',
SuccessMessage = '',
DisableMessage = '',
EnableMessage = '',
OErrorMessage = '';
let allMessageGp2 = '',
ErrorMessageGp2 = '',
SuccessMessageGp2 = '',
DisableMessageGp2 = '',
EnableMessageGp2 = '',
OErrorMessageGp2 = '';
let allMessageGp3 = '',
ErrorMessageGp3 = '',
SuccessMessageGp3 = '',
DisableMessageGp3 = '',
EnableMessageGp3 = '',
OErrorMessageGp3 = '';
let allMessageGp4 = '',
ErrorMessageGp4 = '',
SuccessMessageGp4 = '',
DisableMessageGp4 = '',
EnableMessageGp4 = '',
OErrorMessageGp4 = '';
let strAllNotify = "";
let strNotifyOneTemp = "";
let WP_APP_TOKEN_ONE = "";
if ($.isNode() && process.env.WP_APP_TOKEN_ONE) {
WP_APP_TOKEN_ONE = process.env.WP_APP_TOKEN_ONE;
}
let ReturnMessageTitle = '';
if ($.isNode() && process.env.BEANCHANGE_USERGP2) {
MessageUserGp2 = process.env.BEANCHANGE_USERGP2 ? process.env.BEANCHANGE_USERGP2.split('&') : [];
console.log(`检测到设定了分组推送2`);
}
if ($.isNode() && process.env.BEANCHANGE_USERGP3) {
MessageUserGp3 = process.env.BEANCHANGE_USERGP3 ? process.env.BEANCHANGE_USERGP3.split('&') : [];
console.log(`检测到设定了分组推送3`);
}
if ($.isNode() && process.env.BEANCHANGE_USERGP4) {
MessageUserGp4 = process.env.BEANCHANGE_USERGP4 ? process.env.BEANCHANGE_USERGP4.split('&') : [];
console.log(`检测到设定了分组推送4`);
}
if ($.isNode() && process.env.CHECKCK_SHOWSUCCESSCK) {
ShowSuccess = process.env.CHECKCK_SHOWSUCCESSCK;
}
if ($.isNode() && process.env.CHECKCK_CKALWAYSNOTIFY) {
CKAlwaysNotify = process.env.CHECKCK_CKALWAYSNOTIFY;
}
if ($.isNode() && process.env.CHECKCK_CKAUTOENABLE) {
CKAutoEnable = process.env.CHECKCK_CKAUTOENABLE;
}
if ($.isNode() && process.env.CHECKCK_CKNOWARNERROR) {
NoWarnError = process.env.CHECKCK_CKNOWARNERROR;
}
if ($.isNode() && process.env.CHECKCK_ALLNOTIFY) {
strAllNotify = process.env.CHECKCK_ALLNOTIFY;
/* if (strTempNotify.length > 0) {
for (var TempNotifyl in strTempNotify) {
strAllNotify += strTempNotify[TempNotifyl] + '\n';
}
} */
console.log(`检测到设定了温馨提示,将在推送信息中置顶显示...`);
strAllNotify = `\n【✨✨✨✨温馨提示✨✨✨✨】\n` + strAllNotify;
console.log(strAllNotify);
}
!(async() => {
const envs = await getEnvs();
if (!envs[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
});
return;
}
$.log(`\n默认不自动启用CK,开启变量CHECKCK_CKAUTOENABLE='true'`);
for (let i = 0; i < envs.length; i++) {
if (envs[i].value) {
var tempid=0;
if(envs[i]._id){
tempid=envs[i]._id;
}
if(envs[i].id){
tempid=envs[i].id;
}
cookie = await getEnvById(tempid);
$.UserName = (cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.UserName2 = decodeURIComponent($.UserName);
$.index = i + 1;
$.isLogin = true;
$.error = '';
$.NoReturn = '';
$.nickName = "";
TempErrorMessage = '';
TempSuccessMessage = '';
TempDisableMessage = '';
TempEnableMessage = '';
TempOErrorMessage = '';
console.log(`开始检测【京东账号${$.index}${$.UserName2} ....\n`);
if (MessageUserGp4) {
userIndex4 = MessageUserGp4.findIndex((item) => item === $.UserName);
}
if (MessageUserGp2) {
userIndex2 = MessageUserGp2.findIndex((item) => item === $.UserName);
}
if (MessageUserGp3) {
userIndex3 = MessageUserGp3.findIndex((item) => item === $.UserName);
}
if (userIndex2 != -1) {
console.log(`账号属于分组2`);
IndexGp2 += 1;
ReturnMessageTitle = `【账号${IndexGp2}🆔】${$.UserName2}`;
}
if (userIndex3 != -1) {
console.log(`账号属于分组3`);
IndexGp3 += 1;
ReturnMessageTitle = `【账号${IndexGp3}🆔】${$.UserName2}`;
}
if (userIndex4 != -1) {
console.log(`账号属于分组4`);
IndexGp4 += 1;
ReturnMessageTitle = `【账号${IndexGp4}🆔】${$.UserName2}`;
}
if (userIndex4 == -1 && userIndex2 == -1 && userIndex3 == -1) {
console.log(`账号没有分组`);
IndexAll += 1;
ReturnMessageTitle = `【账号${IndexAll}🆔】${$.UserName2}`;
}
await TotalBean();
if ($.NoReturn) {
console.log(`接口1检测失败,尝试使用接口2....\n`);
await isLoginByX1a0He();
} else {
if ($.isLogin) {
if (!$.nickName) {
console.log(`获取的别名为空,尝试使用接口2验证....\n`);
await isLoginByX1a0He();
} else {
console.log(`成功获取到别名: ${$.nickName},Pass!\n`);
}
}
}
if ($.error) {
console.log(`有错误,跳出....`);
TempOErrorMessage = $.error;
} else {
const strnowstatus = await getstatus(tempid);
if (strnowstatus == 99) {
strnowstatus = envs[i].status;
}
if (!$.isLogin) {
if (strnowstatus == 0) {
const DisableCkBody = await DisableCk(tempid);
if (DisableCkBody.code == 200) {
if ($.isNode() && WP_APP_TOKEN_ONE) {
strNotifyOneTemp = `京东账号: ${$.nickName || $.UserName2} 已失效,自动禁用成功!\n如果要继续挂机,请联系管理员重新登录账号,账号有效期为30天.`
if (strAllNotify)
strNotifyOneTemp += `\n` + strAllNotify;
await notify.sendNotifybyWxPucher(`${$.name}`, strNotifyOneTemp, `${$.UserName2}`);
}
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已失效,自动禁用成功!\n`);
TempDisableMessage = ReturnMessageTitle + ` (自动禁用成功!)\n`;
TempErrorMessage = ReturnMessageTitle + ` 已失效,自动禁用成功!\n`;
} else {
if ($.isNode() && WP_APP_TOKEN_ONE) {
strNotifyOneTemp = `京东账号: ${$.nickName || $.UserName2} 已失效!\n如果要继续挂机,请联系管理员重新登录账号,账号有效期为30天.`
if (strAllNotify)
strNotifyOneTemp += `\n` + strAllNotify;
await notify.sendNotifybyWxPucher(`${$.name}`, strNotifyOneTemp, `${$.UserName2}`);
}
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已失效,自动禁用失败!\n`);
TempDisableMessage = ReturnMessageTitle + ` (自动禁用失败!)\n`;
TempErrorMessage = ReturnMessageTitle + ` 已失效,自动禁用失败!\n`;
}
} else {
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已失效,已禁用!\n`);
TempErrorMessage = ReturnMessageTitle + ` 已失效,已禁用.\n`;
}
} else {
if (strnowstatus == 1) {
if (CKAutoEnable == "true") {
const EnableCkBody = await EnableCk(tempid);
if (EnableCkBody.code == 200) {
if ($.isNode() && WP_APP_TOKEN_ONE) {
await notify.sendNotifybyWxPucher(`${$.name}`, `京东账号: ${$.nickName || $.UserName2} 已恢复,自动启用成功!\n祝您挂机愉快...`, `${$.UserName2}`);
}
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已恢复,自动启用成功!\n`);
TempEnableMessage = ReturnMessageTitle + ` (自动启用成功!)\n`;
TempSuccessMessage = ReturnMessageTitle + ` (自动启用成功!)\n`;
} else {
if ($.isNode() && WP_APP_TOKEN_ONE) {
await notify.sendNotifybyWxPucher(`${$.name}`, `京东账号: ${$.nickName || $.UserName2} 已恢复,但自动启用失败!\n请联系管理员处理...`, `${$.UserName2}`);
}
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已恢复,但自动启用失败!\n`);
TempEnableMessage = ReturnMessageTitle + ` (自动启用失败!)\n`;
}
} else {
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已恢复,可手动启用!\n`);
TempEnableMessage = ReturnMessageTitle + ` 已恢复,可手动启用.\n`;
}
} else {
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 状态正常!\n`);
TempSuccessMessage = ReturnMessageTitle + `\n`;
}
}
}
if (userIndex2 != -1) {
ErrorMessageGp2 += TempErrorMessage;
SuccessMessageGp2 += TempSuccessMessage;
DisableMessageGp2 += TempDisableMessage;
EnableMessageGp2 += TempEnableMessage;
OErrorMessageGp2 += TempOErrorMessage;
}
if (userIndex3 != -1) {
ErrorMessageGp3 += TempErrorMessage;
SuccessMessageGp3 += TempSuccessMessage;
DisableMessageGp3 += TempDisableMessage;
EnableMessageGp3 += TempEnableMessage;
OErrorMessageGp3 += TempOErrorMessage;
}
if (userIndex4 != -1) {
ErrorMessageGp4 += TempErrorMessage;
SuccessMessageGp4 += TempSuccessMessage;
DisableMessageGp4 += TempDisableMessage;
EnableMessageGp4 += TempEnableMessage;
OErrorMessageGp4 += TempOErrorMessage;
}
if (userIndex4 == -1 && userIndex2 == -1 && userIndex3 == -1) {
ErrorMessage += TempErrorMessage;
SuccessMessage += TempSuccessMessage;
DisableMessage += TempDisableMessage;
EnableMessage += TempEnableMessage;
OErrorMessage += TempOErrorMessage;
}
}
console.log(`等待2秒....... \n`);
await $.wait(2 * 1000)
}
if ($.isNode()) {
if (MessageUserGp2) {
if (OErrorMessageGp2) {
allMessageGp2 += `👇👇👇👇👇检测出错账号👇👇👇👇👇\n` + OErrorMessageGp2 + `\n\n`;
}
if (DisableMessageGp2) {
allMessageGp2 += `👇👇👇👇👇自动禁用账号👇👇👇👇👇\n` + DisableMessageGp2 + `\n\n`;
}
if (EnableMessageGp2) {
if (CKAutoEnable == "true") {
allMessageGp2 += `👇👇👇👇👇自动启用账号👇👇👇👇👇\n` + EnableMessageGp2 + `\n\n`;
} else {
allMessageGp2 += `👇👇👇👇👇账号已恢复👇👇👇👇👇\n` + EnableMessageGp2 + `\n\n`;
}
}
if (ErrorMessageGp2) {
allMessageGp2 += `👇👇👇👇👇失效账号👇👇👇👇👇\n` + ErrorMessageGp2 + `\n\n`;
} else {
allMessageGp2 += `👇👇👇👇👇失效账号👇👇👇👇👇\n 一个失效的都没有呢,羡慕啊...\n\n`;
}
if (ShowSuccess == "true" && SuccessMessage) {
allMessageGp2 += `👇👇👇👇👇有效账号👇👇👇👇👇\n` + SuccessMessageGp2 + `\n`;
}
if (NoWarnError == "true") {
OErrorMessageGp2 = "";
}
if ($.isNode() && (EnableMessageGp2 || DisableMessageGp2 || OErrorMessageGp2 || CKAlwaysNotify == "true")) {
console.log("京东CK检测#2");
console.log(allMessageGp2);
if (strAllNotify)
allMessageGp2 += `\n` + strAllNotify;
await notify.sendNotify("京东CK检测#2", `${allMessageGp2}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
})
}
}
if (MessageUserGp3) {
if (OErrorMessageGp3) {
allMessageGp3 += `👇👇👇👇👇检测出错账号👇👇👇👇👇\n` + OErrorMessageGp3 + `\n\n`;
}
if (DisableMessageGp3) {
allMessageGp3 += `👇👇👇👇👇自动禁用账号👇👇👇👇👇\n` + DisableMessageGp3 + `\n\n`;
}
if (EnableMessageGp3) {
if (CKAutoEnable == "true") {
allMessageGp3 += `👇👇👇👇👇自动启用账号👇👇👇👇👇\n` + EnableMessageGp3 + `\n\n`;
} else {
allMessageGp3 += `👇👇👇👇👇账号已恢复👇👇👇👇👇\n` + EnableMessageGp3 + `\n\n`;
}
}
if (ErrorMessageGp3) {
allMessageGp3 += `👇👇👇👇👇失效账号👇👇👇👇👇\n` + ErrorMessageGp3 + `\n\n`;
} else {
allMessageGp3 += `👇👇👇👇👇失效账号👇👇👇👇👇\n 一个失效的都没有呢,羡慕啊...\n\n`;
}
if (ShowSuccess == "true" && SuccessMessage) {
allMessageGp3 += `👇👇👇👇👇有效账号👇👇👇👇👇\n` + SuccessMessageGp3 + `\n`;
}
if (NoWarnError == "true") {
OErrorMessageGp3 = "";
}
if ($.isNode() && (EnableMessageGp3 || DisableMessageGp3 || OErrorMessageGp3 || CKAlwaysNotify == "true")) {
console.log("京东CK检测#3");
console.log(allMessageGp3);
if (strAllNotify)
allMessageGp3 += `\n` + strAllNotify;
await notify.sendNotify("京东CK检测#3", `${allMessageGp3}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
})
}
}
if (MessageUserGp4) {
if (OErrorMessageGp4) {
allMessageGp4 += `👇👇👇👇👇检测出错账号👇👇👇👇👇\n` + OErrorMessageGp4 + `\n\n`;
}
if (DisableMessageGp4) {
allMessageGp4 += `👇👇👇👇👇自动禁用账号👇👇👇👇👇\n` + DisableMessageGp4 + `\n\n`;
}
if (EnableMessageGp4) {
if (CKAutoEnable == "true") {
allMessageGp4 += `👇👇👇👇👇自动启用账号👇👇👇👇👇\n` + EnableMessageGp4 + `\n\n`;
} else {
allMessageGp4 += `👇👇👇👇👇账号已恢复👇👇👇👇👇\n` + EnableMessageGp4 + `\n\n`;
}
}
if (ErrorMessageGp4) {
allMessageGp4 += `👇👇👇👇👇失效账号👇👇👇👇👇\n` + ErrorMessageGp4 + `\n\n`;
} else {
allMessageGp4 += `👇👇👇👇👇失效账号👇👇👇👇👇\n 一个失效的都没有呢,羡慕啊...\n\n`;
}
if (ShowSuccess == "true" && SuccessMessage) {
allMessageGp4 += `👇👇👇👇👇有效账号👇👇👇👇👇\n` + SuccessMessageGp4 + `\n`;
}
if (NoWarnError == "true") {
OErrorMessageGp4 = "";
}
if ($.isNode() && (EnableMessageGp4 || DisableMessageGp4 || OErrorMessageGp4 || CKAlwaysNotify == "true")) {
console.log("京东CK检测#4");
console.log(allMessageGp4);
if (strAllNotify)
allMessageGp4 += `\n` + strAllNotify;
await notify.sendNotify("京东CK检测#4", `${allMessageGp4}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
})
}
}
if (OErrorMessage) {
allMessage += `👇👇👇👇👇检测出错账号👇👇👇👇👇\n` + OErrorMessage + `\n\n`;
}
if (DisableMessage) {
allMessage += `👇👇👇👇👇自动禁用账号👇👇👇👇👇\n` + DisableMessage + `\n\n`;
}
if (EnableMessage) {
if (CKAutoEnable == "true") {
allMessage += `👇👇👇👇👇自动启用账号👇👇👇👇👇\n` + EnableMessage + `\n\n`;
} else {
allMessage += `👇👇👇👇👇账号已恢复👇👇👇👇👇\n` + EnableMessage + `\n\n`;
}
}
if (ErrorMessage) {
allMessage += `👇👇👇👇👇失效账号👇👇👇👇👇\n` + ErrorMessage + `\n\n`;
} else {
allMessage += `👇👇👇👇👇失效账号👇👇👇👇👇\n 一个失效的都没有呢,羡慕啊...\n\n`;
}
if (ShowSuccess == "true" && SuccessMessage) {
allMessage += `👇👇👇👇👇有效账号👇👇👇👇👇\n` + SuccessMessage + `\n`;
}
if (NoWarnError == "true") {
OErrorMessage = "";
}
if ($.isNode() && (EnableMessage || DisableMessage || OErrorMessage || CKAlwaysNotify == "true")) {
console.log("京东CK检测:");
console.log(allMessage);
if (strAllNotify)
allMessage += `\n` + strAllNotify;
await notify.sendNotify(`${$.name}`, `${allMessage}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
})
}
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
function TotalBean() {
return new Promise(async resolve => {
const options = {
url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
headers: {
Host: "me-api.jd.com",
Accept: "*/*",
Connection: "keep-alive",
Cookie: cookie,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42",
"Accept-Language": "zh-cn",
"Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
"Accept-Encoding": "gzip, deflate, br"
}
}
$.get(options, (err, resp, data) => {
try {
if (err) {
$.logErr(err)
$.nickName = decodeURIComponent($.UserName);
$.NoReturn = `${$.nickName} :` + `${JSON.stringify(err)}\n`;
} else {
if (data) {
data = JSON.parse(data);
if (data['retcode'] === "1001") {
$.isLogin = false; //cookie过期
$.nickName = decodeURIComponent($.UserName);
return;
}
if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
$.nickName = (data.data.userInfo.baseInfo.nickname);
} else {
$.nickName = decodeURIComponent($.UserName);
console.log("Debug Code:" + data['retcode']);
$.NoReturn = `${$.nickName} :` + `服务器返回未知状态,不做变动\n`;
}
} else {
$.nickName = decodeURIComponent($.UserName);
$.log('京东服务器返回空数据');
$.NoReturn = `${$.nickName} :` + `服务器返回空数据,不做变动\n`;
}
}
} catch (e) {
$.nickName = decodeURIComponent($.UserName);
$.logErr(e)
$.NoReturn = `${$.nickName} : 检测出错,不做变动\n`;
}
finally {
resolve();
}
})
})
}
function isLoginByX1a0He() {
return new Promise((resolve) => {
const options = {
url: 'https://plogin.m.jd.com/cgi-bin/ml/islogin',
headers: {
"Cookie": cookie,
"referer": "https://h5.m.jd.com/",
"User-Agent": "jdapp;iPhone;10.1.2;15.0;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
},
}
$.get(options, (err, resp, data) => {
try {
if (data) {
data = JSON.parse(data);
if (data.islogin === "1") {
console.log(`使用X1a0He写的接口加强检测: Cookie有效\n`)
} else if (data.islogin === "0") {
$.isLogin = false;
console.log(`使用X1a0He写的接口加强检测: Cookie无效\n`)
} else {
console.log(`使用X1a0He写的接口加强检测: 未知返回,不作变更...\n`)
$.error = `${$.nickName} :` + `使用X1a0He写的接口加强检测: 未知返回...\n`
}
}
} catch (e) {
console.log(e);
}
finally {
resolve();
}
});
});
}
function jsonParse(str) {
if (typeof str == "string") {
try {
return JSON.parse(str);
} catch (e) {
console.log(e);
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
return [];
}
}
}
// prettier-ignore
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)
}
-7
View File
File diff suppressed because one or more lines are too long
+283
View File
File diff suppressed because one or more lines are too long
+2600 -3
View File
File diff suppressed because one or more lines are too long
+766 -4
View File
File diff suppressed because one or more lines are too long
+1 -4
View File
@@ -114,10 +114,7 @@ async function bean() {
} }
} }
} else { } else {
// 完全无数据时才抛出异常,否则返回之前统计出来的数据 $.errorMsg = `数据异常`;
if (!todayArr.length && !yesterdayArr.length) {
$.errorMsg = `数据异常`;
}
// $.msg($.name, ``, `账号${$.index}${$.nickName}\n${$.errorMsg}`); // $.msg($.name, ``, `账号${$.index}${$.nickName}\n${$.errorMsg}`);
t = 1; t = 1;
} }
+15 -36
View File
@@ -1,19 +1,18 @@
# !/usr/bin/env python3 # !/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Modify : 2024/4/21 # Modify : 2022/9/30
# 京豆近7天输出表格统计 # 京豆近7天输出表格统计
# 用不着每天跑,定时自行设置吧,配合desi可指定账号 # 用不着每天跑,定时自行设置吧,配合desi可指定账号
# https://raw.githubusercontent.com/6dylan6/jdpro/main/jd_beans_7days.py # https://raw.githubusercontent.com/6dylan6/jdpro/main/jd_beans_7days.py
''' '''
new Env('豆子7天统计'); new Env('豆子7天统计');
8 8 29 2 * jd_beans_7days.py 8 8 30 9 * jd_beans_7days.py
''' '''
import requests import requests
import datetime import datetime
import random
import os,re,sys,json,time import os,re,sys,json,time
from urllib.parse import unquote,quote from urllib.parse import unquote
from datetime import timedelta from datetime import timedelta
from datetime import timezone from datetime import timezone
@@ -32,23 +31,7 @@ session = requests.session()
session.keep_alive = False session.keep_alive = False
url = "https://api.m.jd.com/api" url = "https://api.m.jd.com/api"
def getua():
global uuid,addressid,iosVer,iosV,clientVersion,iPhone,area,ADID,lng,lat
uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
addressid = ''.join(random.sample('1234567898647', 10))
iosVer = ''.join(random.sample(["15.1.1","14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1"], 1))
iosV = iosVer.replace('.', '_')
clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4"], 1))
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
lng='119.31991256596'+str(random.randint(100,999))
lat='26.1187118976'+str(random.randint(100,999))
UserAgent=''
if not UserAgent:
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
else:
return UserAgent
def gen_body(page): def gen_body(page):
body = { body = {
"beginDate": datetime.datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(SHA_TZ).strftime("%Y-%m-%d %H:%M:%S"), "beginDate": datetime.datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(SHA_TZ).strftime("%Y-%m-%d %H:%M:%S"),
@@ -187,8 +170,8 @@ def get_beans_7days(ck):
day_7 = True day_7 = True
page = 0 page = 0
headers = { headers = {
"Host": "bean.m.jd.com", "Host": "api.m.jd.com",
"User-Agent": getua(), "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 9 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.62 XWEB/2797 MMWEBSDK/201201 Mobile Safari/537.36 MMWEBID/7986 MicroMessenger/8.0.1840(0x2800003B) Process/appbrand4 WeChat/arm64 Weixin NetType/4G Language/zh_CN ABI/arm64 MiniProgramEnv/android",
"Content-Type": "application/x-www-form-urlencoded;", "Content-Type": "application/x-www-form-urlencoded;",
"Cookie": ck, "Cookie": ck,
} }
@@ -199,13 +182,11 @@ def get_beans_7days(ck):
beans_out = {key: 0 for key in days} beans_out = {key: 0 for key in days}
while day_7: while day_7:
page = page + 1 page = page + 1
url="https://bean.m.jd.com/beanDetail/detail.json?page="+str(page) url="https://api.m.jd.com/client.action?functionId=getJingBeanBalanceDetail&body=%7B%22pageSize%22%3A%2220%22%2C%22page%22%3A%22"+str(page)+"%22%7D&appid=ld"
data='body='+quote(str({"pageSize":"20","page":str(page)}))+'&appid=ld' resp = session.get(url, headers=headers, timeout=1000).text
resp = session.post(url, headers=headers, data=data ,timeout=1000).text
res = json.loads(resp) res = json.loads(resp)
if res['code'] == '0' : if res['code'] == '0' :
for i in res['jingDetailList']: for i in res['detailList']:
for date in days: for date in days:
if str(date) in i['date'] and int(i['amount']) > 0: if str(date) in i['date'] and int(i['amount']) > 0:
beans_in[str(date)] = beans_in[str(date)] + int(i['amount']) beans_in[str(date)] = beans_in[str(date)] + int(i['amount'])
@@ -218,7 +199,6 @@ def get_beans_7days(ck):
else: else:
print("未获取到数据,原因未知!!\n") print("未获取到数据,原因未知!!\n")
return {'code': 400, 'data': res} return {'code': 400, 'data': res}
#print(beans_in, beans_out, days)
return {'code': 200, 'data': [beans_in, beans_out, days]} return {'code': 200, 'data': [beans_in, beans_out, days]}
except Exception as e: except Exception as e:
print(str(e)) print(str(e))
@@ -228,17 +208,16 @@ def get_beans_7days(ck):
def get_total_beans(ck): def get_total_beans(ck):
try: try:
headers = { headers = {
"Host": "me-api.jd.com", "Host": "wq.jd.com",
"User-Agent": getua(), "User-Agent": "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",
"Content-Type": "application/x-www-form-urlencoded;", "Content-Type": "application/x-www-form-urlencoded;",
"Cookie": ck, "Cookie": ck,
#"Referer": 'https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2' "Referer": 'https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2'
} }
jurl = "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion" jurl = "https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2"
resp = requests.get(jurl, headers=headers).text resp = requests.post(jurl, headers=headers).text
res = json.loads(resp) res = json.loads(resp)
#print(res) return res['base']['jdNum']
return res['data']['assetInfo']['beanNum']
except Exception as e: except Exception as e:
printf(str(e)) printf(str(e))
-7
View File
File diff suppressed because one or more lines are too long
+18
View File
File diff suppressed because one or more lines are too long
+9
View File
File diff suppressed because one or more lines are too long
+399
View File
@@ -0,0 +1,399 @@
/*
京东超级盒子
更新时间2022-1-9
活动入口京东APP-搜索-超级盒子
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
============Quantumultx===============
[task_local]
#京东超级盒子
24 3,13 * * * https://raw.githubusercontent.com/msechen/script/main/jd_cjhz.js, tag=京东超级盒子, img-url=https://github.com/58xinian/icon/raw/master/jdgc.png, enabled=true
================Loon==============
[Script]
cron "24 3,13 * * *" script-path=https://raw.githubusercontent.com/msechen/script/main/jd_cjhz.js,tag=京东超级盒子
===============Surge=================
京东超级盒子 = type=cron,cronexp="24 3,13 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/msechen/script/main/jd_cjhz.js
============小火箭=========
京东超级盒子 = type=cron,script-path=https://raw.githubusercontent.com/msechen/script/main/jd_cjhz.js, cronexpr="24 3,13 * * *", timeout=3600, enable=true
*/
const $ = new Env('京东超级盒子');
//Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [],
cookie = '',
secretp = '',
joyToken = "";
$.shareCoseList = [];
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
})
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
} else {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
}
const JD_API_HOST = `https://api.m.jd.com/client.action`;
!(async () => {
console.log('活动入口:京东APP-搜索-超级盒子')
console.log('开箱目前结果为空气和红包,没发现豆子')
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
return;
}
await getToken();
cookiesArr = cookiesArr.map(ck => ck + `joyytoken=50084${joyToken};`)
$.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS
for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
if (!$.isLogin) {
$.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" });
continue
}
console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
console.log(`\n入口:app主页搜超级盒子\n`);
await main()
}
};
$.shareCoseList = [...new Set([...$.shareCoseList])]
//去助力与开箱
for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
if (!$.isLogin) {
$.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" });
continue
}
if ($.shareCoseList.length >= 2) {
for (let y = 0; y < $.shareCoseList.length; y++) {
console.log(`京东账号${$.index} ${$.nickName || $.UserName}去助力${$.shareCoseList[y]}`)
await helpShare({ "taskId": $.helpId, "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": $.shareCoseList[y] });
await $.wait(1000);
}
}
}
}
for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
if (!$.isLogin) {
$.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" });
continue
}
//开箱
console.log(`京东账号${$.index}去开箱`)
for (let y = 0; y < $.lotteryNumber; y++) {
console.log(`可以开箱${$.lotteryNumber}次 ==>>第${y+1}次开箱`)
await openBox({ "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": "" });
await $.wait(1000);
}
}
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
async function main() {
await superboxSupBoxHomePage({ "taskId": "", "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": "" })
console.log(`【京东账号${$.index}${$.nickName || $.UserName}互助码:${$.encryptPin}`)
await $.wait(1000);
await apTaskList({ "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": $.encryptPin });
if ($.allList) {
for (let i = 0; i < $.allList.length; i++) {
$.oneTask = $.allList[i];
if (["SHARE_INVITE"].includes($.oneTask.taskType)) {
$.helpId = $.oneTask.id;
$.helpLimit = $.oneTask.taskLimitTimes;
};
if (["BROWSE_SHOP"].includes($.oneTask.taskType) && $.oneTask.taskFinished === false) {
await apTaskDetail({ "taskId": $.oneTask.id, "taskType": $.oneTask.taskType, "channel": 4, "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": "7pcfSWHrAG9MKu3RKLl127VL5L4aIE1sZ1eRRdphpl8" });
await $.wait(1000)
for (let y = 0; y < ($.doList.status.finishNeed - $.doList.status.userFinishedTimes); y++) {
$.startList = $.doList.taskItemList[y];
$.itemName = $.doList.taskItemList[y].itemName;
console.log(`去浏览${$.itemName}`)
await apDoTask({ "taskId": $.allList[i].id, "taskType": $.allList[i].taskType, "channel": 4, "itemId": $.startList.itemId, "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": "7pcfSWHrAG9MKu3RKLl127VL5L4aIE1sZ1eRRdphpl8" })
await $.wait(1000)
}
}
}
} else {
console.log(`任务全部完成`)
}
}
//活动主页
function superboxSupBoxHomePage(body) {
return new Promise((resolve) => {
$.get(taskGetUrl('superboxSupBoxHomePage', body), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} superboxSupBoxHomePage API请求失败,请检查网路重试`)
} else {
data = JSON.parse(data);
if (data.code === 0) {
$.encryptPin = data.data.encryptPin;
$.shareCoseList.push($.encryptPin)
$.lotteryNumber = data.data.lotteryNumber
} else {
console.log(`superboxSupBoxHomePage${JSON.stringify(data)}\n`);
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
}
//获取任务列表
function apTaskList(body) {
return new Promise((resolve) => {
$.get(taskGetUrl('apTaskList', body), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} apTaskList API请求失败,请检查网路重试`)
} else {
data = JSON.parse(data);
if (data.code === 0) {
$.allList = data.data
//console.log(JSON.stringify($.allList[1]));
} else {
console.log(`apTaskList错误:${JSON.stringify(data)}\n`);
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
}
//获取任务分表
function apTaskDetail(body) {
return new Promise((resolve) => {
$.get(taskGetUrl('apTaskDetail', body), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} apTaskDetail API请求失败,请检查网路重试`)
} else {
data = JSON.parse(data);
if (data.code === 0) {
$.doList = data.data
//console.log(JSON.stringify($.doList));
} else {
console.log(`apTaskDetail错误:${JSON.stringify(data)}\n`);
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
}
//做任务
function apDoTask(body) {
return new Promise((resolve) => {
$.post(taskPostUrl('apDoTask', body), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} apDoTask API请求失败,请检查网路重试`)
} else {
data = JSON.parse(data);
//console.log(JSON.stringify(data));
if (data.success === true && data.code === 0) {
console.log(`浏览${$.itemName}完成\n已完成${data.data.userFinishedTimes}\n`)
} else if (data.success === false && data.code === 2005) {
console.log(`${data.data.errMsg}${data.data.userFinishedTimes}`)
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
}
//助力
function helpShare(body) {
return new Promise((resolve) => {
$.get(taskGetUrl('superboxSupBoxHomePage', body), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} superboxSupBoxHomePage API请求失败,请检查网路重试`)
} else {
data = JSON.parse(data);
//console.log(JSON.stringify(data));
if (data.success === true && data.code === 0) {
console.log(`助力成功\n\n`)
} else {
console.log(`助力失败:${JSON.stringify(data)}\n\n`)
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
}
//开盲盒
function openBox(body) {
return new Promise((resolve) => {
$.get(taskGetUrl('superboxOrdinaryLottery', body), (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} superboxOrdinaryLottery API请求失败,请检查网路重试`)
} else {
data = JSON.parse(data);
//console.log(JSON.stringify(data));
if (data.success === true && data.code === 0 && data.data.rewardType === 2) {
console.log(`开箱成功获得${data.data.discount}元红包\n\n`)
} else if (data.success === true && data.code === 0 && data.data.rewardType !== 2) {
console.log(`开箱成功应该获得了空气${JSON.stringify(data.data)}\n\n`)
} else {
console.log(`失败:${JSON.stringify(data)}\n\n`)
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
}
function getToken(timeout = 0) {
return new Promise((resolve) => {
setTimeout(() => {
let url = {
url: `https://bh.m.jd.com/gettoken`,
headers: {
'Content-Type': `text/plain;charset=UTF-8`
},
body: `content={"appname":"50084","whwswswws":"","jdkey":"","body":{"platform":"1"}}`
}
$.post(url, async (err, resp, data) => {
try {
data = JSON.parse(data);
joyToken = data.joyytoken;
console.log(`joyToken = ${data.joyytoken}`)
} catch (e) {
$.logErr(e, resp);
} finally {
resolve()
}
})
}, timeout)
})
}
function taskGetUrl(functionId, body = {}) {
return {
url: `${JD_API_HOST}?functionId=${functionId}&body=${JSON.stringify(body)}&_t=${Date.now()}&appid=activities_platform&client=wh5&clientVersion=1.0.0`,
//body: `functionId=${functionId}&body=${JSON.stringify(body)}&client=wh5&clientVersion=1.0.0&uuid=ef746bc0663f7ca06cdd1fa724c15451900039cf`,
headers: {
'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"),
'Content-Type': 'application/x-www-form-urlencoded',
'Host': 'api.m.jd.com',
'Cookie': cookie,
'Origin': 'https://prodev.m.jd.com',
'Referer': 'https://pro.m.jd.com/mall/active/j8U2SMhmw3aKgfWwYQfoRR4idTT/index.html?',
}
}
}
function taskPostUrl(functionId, body = {}) {
return {
url: `${JD_API_HOST}?functionId=${functionId}`,
body: `functionId=${functionId}&body=${JSON.stringify(body)}&_t=${Date.now()}&appid=activities_platform&client=wh5&clientVersion=1.0.0`,
headers: {
'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"),
'Content-Type': 'application/x-www-form-urlencoded',
'Host': 'api.m.jd.com',
'Cookie': cookie,
'Origin': 'https://prodev.m.jd.com',
'Referer': 'https://pro.m.jd.com/mall/active/j8U2SMhmw3aKgfWwYQfoRR4idTT/index.html?',
}
}
}
function jsonParse(str) {
if (typeof str == "string") {
try {
return JSON.parse(str);
} catch (e) {
console.log(e);
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
return [];
}
}
}
// prettier-ignore
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) }
-7
View File
File diff suppressed because one or more lines are too long
+302
View File
File diff suppressed because one or more lines are too long
+1288
View File
File diff suppressed because one or more lines are too long
+47 -1
View File
File diff suppressed because one or more lines are too long
+8
View File
File diff suppressed because one or more lines are too long
+13
View File
File diff suppressed because one or more lines are too long
+13
View File
File diff suppressed because one or more lines are too long
-6
View File
File diff suppressed because one or more lines are too long
-7
View File
File diff suppressed because one or more lines are too long
+207
View File
File diff suppressed because one or more lines are too long
-6
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+26
View File
File diff suppressed because one or more lines are too long
+26
View File
File diff suppressed because one or more lines are too long
+26
View File
File diff suppressed because one or more lines are too long
+24
View File
File diff suppressed because one or more lines are too long
+24
View File
File diff suppressed because one or more lines are too long
+24
View File
File diff suppressed because one or more lines are too long
-5
View File
File diff suppressed because one or more lines are too long
-15
View File
File diff suppressed because one or more lines are too long
-9
View File
File diff suppressed because one or more lines are too long
-25
View File
File diff suppressed because one or more lines are too long
+31
View File
File diff suppressed because one or more lines are too long
+257 -4
View File
File diff suppressed because one or more lines are too long
+9
View File
File diff suppressed because one or more lines are too long
+20
View File
File diff suppressed because one or more lines are too long
+82
View File
@@ -0,0 +1,82 @@
//20 8 10 4 * jd_farm_automation.js
console.log('默认种2级,如需调整请设置变量 M_JD_FARM_LEVEL\n使用率不高,指定(desi)账号运行\n')
const {Env} = require('./function/magic');
const $ = new Env('农场自动种植兑换');
let level = process.env.M_JD_FARM_LEVEL ? process.env.M_JD_FARM_LEVEL * 1 : 2
$.logic = async function () {
let info = await api('initForFarm',
{"version": 11, "channel": 3, "babelChannel": 0});
if (info.code !== '0') {
$.log('可能没开通农场或者黑透了!!!')
return
}
if (info.farmUserPro.treeState === 1) {
return
}
if (info.farmUserPro.treeState === 2) {
await $.wait(1000, 3000)
$.log(`${info.farmUserPro.name},种植时间:${$.formatDate(
info.farmUserPro.createTime)}`);
//成熟了
let coupon = await api('gotCouponForFarm',
{"version": 11, "channel": 3, "babelChannel": 0});
$.log(coupon)
info = await api('initForFarm',
{"version": 11, "channel": 3, "babelChannel": 0});
}
if (info.farmUserPro.treeState === 3) {
let hongBao = info.myHongBaoInfo.hongBao;
$.putMsg(`已兑换${hongBao.discount}红包,${$.formatDate(hongBao.endTime)}过期`)
}
let element = info.farmLevelWinGoods[level][0] || 0;
await $.wait(1000, 3000)
if (element) {
info = await api('choiceGoodsForFarm', {
"imageUrl": '',
"nickName": '',
"shareCode": '',
"goodsType": element.type,
"type": "0",
"version": 11,
"channel": 3,
"babelChannel": 0
});
if (info.code * 1 === 0) {
$.putMsg(`\n再次种植【${info.farmUserPro.name}`)
}
let a = await api('gotStageAwardForFarm',
{"type": "4", "version": 11, "channel": 3, "babelChannel": 0});
let b = await api('waterGoodForFarm',
{"type": "", "version": 11, "channel": 3, "babelChannel": 0});
let c = await api('gotStageAwardForFarm',
{"type": "1", "version": 11, "channel": 3, "babelChannel": 0});
}else{
$.log('种子已抢完,下次在来!!!\n')
}
};
$.run({wait: [2000, 3000]}).catch(reason => $.log(reason));
// noinspection DuplicatedCode
async function api(fn, body) {
let url = `https://api.m.jd.com/client.action?functionId=${fn}&body=${JSON.stringify(
body)}&client=apple&clientVersion=10.0.4&osVersion=13.7&appid=wh5&loginType=2&loginWQBiz=interact`
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓请求头↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
let headers = {
"Cookie": $.cookie,
"Connection": "keep-alive",
"Accept": "*/*",
"Host": "api.m.jd.com",
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.4(0x1800042c) NetType/4G Language/zh_CN miniProgram`,
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-cn"
}
let {data} = await $.request(url, headers)
await $.wait(1000, 3000)
return data;
}
+1277
View File
File diff suppressed because one or more lines are too long
+1286
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-22
View File
File diff suppressed because one or more lines are too long
-14
View File
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More