├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── AutoSignMachine.js ├── LICENSE ├── README.md ├── commands ├── 52pojie.js ├── bilibili.js ├── iqiyi.js ├── tasks │ ├── 52pojie │ │ ├── 52pojie.js │ │ └── sign.js │ ├── bilibili │ │ ├── AddCoinsForVideo.js │ │ ├── ExchangeSilver2Coin.js │ │ ├── LiveGetSignInfo.js │ │ ├── LiveSign.js │ │ ├── MangaSign.js │ │ ├── ReceiveVipPrivilege.js │ │ ├── account.js │ │ ├── bilibili.js │ │ ├── dailyTaskStatus.js │ │ ├── init.js │ │ ├── myWallet.js │ │ └── watchAndShareVideo.js │ ├── iqiyi │ │ ├── dailyBrowserClub.js │ │ ├── dailyFeed.js │ │ ├── dailyTask.js │ │ ├── dailyWatchVideo.js │ │ ├── init.js │ │ ├── iqiyi.js │ │ ├── signPoint.js │ │ └── signVip.js │ ├── unicom │ │ ├── Niujie.js │ │ ├── RSAUtils.js │ │ ├── book5video.js │ │ ├── commentSystem.js │ │ ├── dailyBaWangcard.js │ │ ├── dailyBcow.js │ │ ├── dailyBookLuckdraw.js │ │ ├── dailyBookRead.js │ │ ├── dailyCheapStorePage.js │ │ ├── dailyCourse.js │ │ ├── dailyEggachine.js │ │ ├── dailyFingerqd.js │ │ ├── dailyFingerqd2.js │ │ ├── dailyGrabdollPage.js │ │ ├── dailyLKMH.js │ │ ├── dailyTTliulan.js │ │ ├── dailyThreeSquirrels.js │ │ ├── dailyTurncards.js │ │ ├── dailyTurntablePage.js │ │ ├── dailyVideo.js │ │ ├── dailyVideoBook.js │ │ ├── dailyVideoFreeGoods.js │ │ ├── dailyVideoScratchcard.js │ │ ├── dailyYYQ.js │ │ ├── dailyYYY.js │ │ ├── dailylottery.js │ │ ├── dailylotteryintegral.js │ │ ├── dailysignin.js │ │ ├── fetchCoins.js │ │ ├── freeDownFloorAd.js │ │ ├── gameYearBox.js │ │ ├── handlers │ │ │ ├── PAES.js │ │ │ ├── dailyEvent.js │ │ │ ├── gameUtils.js │ │ │ └── myPhone.js │ │ ├── ingotsPage.js │ │ ├── init.js │ │ ├── integral.js │ │ ├── jflottery.js │ │ ├── jflotteryad.js │ │ ├── playGame.json │ │ ├── producGame.js │ │ ├── taocan.js │ │ ├── taskcallback.js │ │ ├── test.js │ │ ├── unicom.js │ │ └── woTree.js │ └── wps │ │ ├── clock_in.js │ │ └── wps.js ├── unicom.js └── wps.js ├── config ├── .env.sample └── .gitignore ├── default.json ├── docker-compose.yml ├── index.js ├── package-lock.json ├── package.json ├── serverless.yml ├── tscf.js └── utils ├── observersion.js ├── request.js ├── scheduler.js └── util.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | 7 | charset = utf-8 8 | 9 | indent_style = space 10 | 11 | indent_size = 2 12 | 13 | end_of_line = lf 14 | 15 | insert_final_newline = true 16 | 17 | trim_trailing_whitespace = true 18 | 19 | 20 | 21 | [*.md] 22 | 23 | insert_final_newline = false 24 | 25 | trim_trailing_whitespace = false 26 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | node: true, 4 | commonjs: true, 5 | es2021: true, 6 | }, 7 | extends: ["eslint:recommended", "plugin:prettier/recommended"], 8 | parserOptions: { 9 | es6: true, 10 | sourceType: "module", 11 | ecmaVersion: 12, 12 | }, 13 | // parser: "@babel/eslint-parser", 14 | rules: {}, 15 | }; 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .vscode 3 | yarn.lock 4 | 5 | jspm_packages 6 | 7 | .serverless 8 | demo.js -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "tabWidth": 2, 4 | "printWidth": 80, 5 | "semi": true, 6 | "singleQuote": false 7 | } -------------------------------------------------------------------------------- /AutoSignMachine.js: -------------------------------------------------------------------------------- 1 | const yargs = require("yargs/yargs"); 2 | // const { hideBin } = require('yargs/helpers') 3 | /** 4 | * 命令执行入口 5 | */ 6 | var AutoSignMachine_Run = (argv) => { 7 | yargs((argv || process.argv).slice(2)) 8 | .commandDir("commands") 9 | .demand(1) 10 | .config("config", "JSON配置文件路径") 11 | .help() 12 | .alias("h", "help") 13 | .locale("en") 14 | .showHelpOnFail(true, "使用--help查看有效选项") 15 | .epilog("copyright 2020 LunnLew").argv; 16 | }; 17 | module.exports = { 18 | run: AutoSignMachine_Run, 19 | }; 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 LunnLew 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > Due to a third-party risk dispute, this script stopped sharing 2 | > 3 | > 由于第三方风险争议,此脚本停止分享 4 | 5 | > 由于其他原因,该项目暂时停止维护 6 | # AutoSignMachine 7 | 8 | **一个自动执行任务的工具,通过它可以实现账号自动签到,自动领取权益等功能,帮助我们轻松升级。** 9 | 10 | ## bilibili签到任务 11 | **实现现B站帐号的每日自动观看、分享、投币视频,获取经验,每月自动领取会员权益等功能,帮助我们轻松升级会员到Lv6并赚取电池。** 12 | 13 | 详细功能目录如下: 14 | 15 | * **每天自动登录,获取经验** 16 | * **每天自动观看、分享、投币视频** 17 | * **每天漫画自动签到** 18 | * **每天自动直播签到,领取奖励** 19 | * **每天自动使用直播中心银瓜子兑换B币** 20 | * **每个月自动领取5张B币券和大会员权益** 21 | 22 | ```sh 23 | node index.js bilibili --cookies "b6*********4a581;" 24 | ``` 25 | 26 | ### docker部署 27 | ```sh 28 | # 构建 29 | docker build -t auto-sign-machine:latest -f docker/Dockerfile . 30 | # 运行 31 | docker run \ 32 | --name auto-sign-machine \ 33 | -d \ 34 | -e enable_bilibili=true \ 35 | -e DedeUserID=41*****1073 \ 36 | -e SESSDATA=05*********333*b1 \ 37 | -e bili_jct=b6*********4a581 \ 38 | auto-sign-machine:latest 39 | ``` 40 | 41 | ## 52pojie签到任务 42 | **实现现52pojie帐号的每日签到任务。** 43 | 44 | ```sh 45 | node index.js 52pojie --htVD_2132_auth b22d**********************aNjr --htVD_2132_saltkey Jc***********I 46 | ``` 47 | 48 | ### docker部署 49 | ```sh 50 | # 构建 51 | docker build -t auto-sign-machine:latest -f docker/Dockerfile . 52 | # 运行 53 | docker run \ 54 | --name auto-sign-machine \ 55 | -d \ 56 | --label traefik.enable=false \ 57 | -e enable_52pojie=true \ 58 | -e htVD_2132_auth=b******************jr \ 59 | -e htVD_2132_saltkey=Jc************I \ 60 | auto-sign-machine:latest 61 | ``` 62 | 、 63 | ## iqiyi签到任务 64 | **实现现iqiyi帐号的每日签到任务。** 65 | 详细功能目录如下: 66 | 67 | * **普通用户每天自动获取积分** 68 | * **vip用户每日签到随机成长值及积分** 69 | * **vip用户每日浏览会员俱乐部+1成长值** 70 | 71 | ```sh 72 | node index.js iqiyi --P00001 b********jr --P00PRU 12***24 --QC005 5f******6fe --dfp Jc************I 73 | ``` 74 | 75 | ### docker部署 76 | ```sh 77 | # 构建 78 | docker build -t auto-sign-machine:latest -f docker/Dockerfile . 79 | # 运行 80 | docker run \ 81 | --name auto-sign-machine \ 82 | -d \ 83 | --label traefik.enable=false \ 84 | -e enable_iqiyi=true \ 85 | -e P00001=b********jr \ 86 | -e P00PRU=12***24 \ 87 | -e QC005=5f******6fe \ 88 | -e dfp=Jc************I \ 89 | auto-sign-machine:latest 90 | ``` 91 | 92 | 93 | 、 94 | ## 联通APP签到任务 95 | **实现现联通帐号的每日签到任务。** 96 | 详细功能目录如下: 97 | 98 | * **每日签到积分** 99 | * **冬奥积分活动** 100 | * **每日定向积分** 101 | * **每日游戏楼层宝箱** 102 | * **每日抽奖** 103 | * **首页-游戏-娱乐中心-沃之树** 104 | * **首页-小说-阅读越有礼打卡赢话费** 105 | * **首页-小说-读满10章赢好礼** 106 | * **首页-小说-读满10章赢好礼-看视频领2积分** 107 | * **首页-签到有礼-免流量得福利-3积分天天拿(阅读打卡)** 108 | * **首页-小说-阅读福利抽大奖** 109 | * **首页-签到有礼-免费领-浏览领积分** 110 | * **首页-签到有礼-免费拿-看视频夺宝** 111 | * **首页-签到有礼-免费抽** 112 | * **首页-签到有礼-赚更多福利** 113 | * **首页-游戏-娱乐中心-每日打卡** 114 | * **每日游戏时长-天天领取3G流量包** 115 | * **首页-积分查询-游戏任务** 116 | 117 | ```sh 118 | node index.js unicom --user 131*******12 --password 11****11 --appid f7af****ebb 119 | ``` 120 | 121 | ### docker部署 122 | ```sh 123 | # 构建 124 | docker build -t auto-sign-machine:latest -f docker/Dockerfile . 125 | # 运行(cookies和账号密码两种方式二选一) 126 | docker run \ 127 | --name auto-sign-machine \ 128 | -d \ 129 | --label traefik.enable=false \ 130 | -e enable_unicom=true \ 131 | -e user=131*******12 \ 132 | -e password=11****11 \ 133 | -e appid=f7af****ebb \ 134 | auto-sign-machine:latest 135 | ``` 136 | 137 | ### 注意 138 | #### cron中`%`号需要转义`\%` 139 | 140 | ### 脚本运行机制 141 | 任务并非在一次命令执行时全部执行完毕,任务创建时会根据某个时间段,将所有任务分配到该时间段内的随机的某个时间点,然后使用定时任务定时运行脚本入口,内部子任务的运行时机依赖于任务配置项的运行时间及延迟时间,这种机制意味着,只有当脚本的运行时间在当前定时任务运行时间之前,脚本子任务才有可能有选择的被调度出来运行 142 | 143 | ### crontab 任务示例 144 | 在4-23小时之间每隔三十分钟尝试运行可运行的脚本子任务 145 | ```txt 146 | */30 4-23 * * * /bin/node /workspace/AutoSignMachine/index.js unicom --user 1******5 --password 7****** --appid 1************9 147 | ``` 148 | 149 | ### 多用户配置 150 | 启用`--accountSn`表示账户序号,例如`1,2`, 则将提取`option-sn`选项的值,例如`user-1`,`user-2` 151 | 152 | ### 配置文件示例 153 | 启用`--config /path/to/mycfg.json`表示配置文件 154 | ```json 155 | { 156 | "accountSn": "1,2", 157 | "user-1": "22******1", 158 | "password-1": "31******1", 159 | "appid-1": "41******1", 160 | "user-2": "25******1", 161 | "password-3": "72******1", 162 | "appid-2": "92******1" 163 | } 164 | ``` 165 | 166 | ### 运行测试 167 | ```sh 168 | ## 立即模式, 一次性执行所有任务,仅建议测试任务是否正常时运行,该方式无法重试周期任务 169 | ## 该模式不缓存cookie信息,频繁使用将可能导致账号安全警告 170 | #增加 --tryrun 171 | 172 | ## 指定任务模式,可以指定仅需要运行的子任务,多用户使用规则参看`多用户配置` 173 | #增加 --tasks taskName1,taskName2,taskName3 174 | ``` 175 | 176 | ### GitHub Actions 运行问题 177 | 暂未处理GitHub Actions支持 178 | 179 | -------------------------------------------------------------------------------- /commands/52pojie.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const { scheduler } = require("../utils/scheduler"); 3 | 4 | exports.command = "52pojie"; 5 | 6 | exports.describe = "52pojie签到任务"; 7 | 8 | exports.builder = function (yargs) { 9 | return yargs 10 | .option("htVD_2132_auth", { 11 | describe: "cookie项htVD_2132_auth的值", 12 | type: "string", 13 | }) 14 | .option("htVD_2132_saltkey", { 15 | describe: "cookie项htVD_2132_saltkey的值", 16 | type: "string", 17 | }) 18 | .help() 19 | .showHelpOnFail(true, "使用--help查看有效选项") 20 | .epilog("copyright 2020 LunnLew"); 21 | }; 22 | 23 | exports.handler = async function (argv) { 24 | var command = argv._[0]; 25 | var accounts = []; 26 | if ("accountSn" in argv && argv.accountSn) { 27 | let accountSns = argv.accountSn.split(","); 28 | for (let sn of accountSns) { 29 | if ("htVD_2132_auth-" + sn in argv) { 30 | let account = { 31 | htVD_2132_auth: argv["htVD_2132_auth-" + sn], 32 | htVD_2132_saltkey: argv["htVD_2132_saltkey-" + sn], 33 | tasks: argv["tasks-" + sn], 34 | }; 35 | if ("tryrun-" + sn in argv) { 36 | account["tryrun"] = true; 37 | } 38 | accounts.push(account); 39 | } 40 | } 41 | } else { 42 | accounts.push({ 43 | ...argv, 44 | }); 45 | } 46 | console.log("总账户数", accounts.length); 47 | for (let account of accounts) { 48 | await require(path.join(__dirname, "tasks", command, command)) 49 | .start({ 50 | cookies: { 51 | htVD_2132_auth: account.htVD_2132_auth, 52 | htVD_2132_saltkey: account.htVD_2132_saltkey, 53 | }, 54 | options: {}, 55 | }) 56 | .catch((err) => console.log("52pojie签到任务:", err.message)); 57 | let hasTasks = await scheduler.hasWillTask(command, { 58 | tryrun: "tryrun" in argv, 59 | taskKey: account.htVD_2132_auth, 60 | }); 61 | if (hasTasks) { 62 | scheduler 63 | .execTask(command, account.tasks) 64 | .catch((err) => console.log("52pojie签到任务:", err.message)) 65 | .finally(() => { 66 | console.log("当前任务执行完毕!"); 67 | }); 68 | } else { 69 | console.log("暂无可执行任务!"); 70 | } 71 | } 72 | }; 73 | -------------------------------------------------------------------------------- /commands/bilibili.js: -------------------------------------------------------------------------------- 1 | 2 | const path = require('path') 3 | const { scheduler } = require('../utils/scheduler') 4 | 5 | exports.command = 'bilibili' 6 | 7 | exports.describe = 'bilibili签到任务' 8 | 9 | exports.builder = function (yargs) { 10 | return yargs 11 | .option('cookies', { 12 | describe: 'cookies', 13 | type: 'string' 14 | }) 15 | .option('username', { 16 | describe: '登陆账号', 17 | type: 'string' 18 | }) 19 | .option('password', { 20 | describe: '登陆密码', 21 | type: 'string' 22 | }) 23 | .option('NumberOfCoins', { 24 | describe: '视频投币的目标数量', 25 | default: 5, 26 | type: 'number' 27 | }) 28 | .option('CoinsForVideo', { 29 | describe: '每个视频投币数量,最多2', 30 | default: 1, 31 | type: 'number' 32 | }) 33 | .option('SelectLike', { 34 | describe: '视频投币时是否点赞', 35 | default: true, 36 | type: 'boolean' 37 | }) 38 | .option('DayOfReceiveVipPrivilege', { 39 | describe: '指定的某一天取得会员权益', 40 | default: 1, 41 | type: 'number' 42 | }) 43 | .help() 44 | .showHelpOnFail(true, '使用--help查看有效选项') 45 | .epilog('copyright 2020 LunnLew'); 46 | } 47 | 48 | exports.handler = async function (argv) { 49 | var command = argv._[0] 50 | var accounts = [] 51 | if ('accountSn' in argv && argv.accountSn) { 52 | let accountSns = argv.accountSn.split(',') 53 | for (let sn of accountSns) { 54 | if (('username-' + sn) in argv) { 55 | let account = { 56 | cookies: argv['cookies-' + sn], 57 | NumberOfCoins: argv['NumberOfCoins-' + sn], 58 | CoinsForVideo: argv['CoinsForVideo-' + sn], 59 | SelectLike: argv['SelectLike-' + sn], 60 | username: argv['username-' + sn] + '', 61 | password: argv['password-' + sn] + '', 62 | tasks: argv['tasks-' + sn] 63 | } 64 | if (('tryrun-' + sn) in argv) { 65 | account['tryrun'] = true 66 | } 67 | accounts.push(account) 68 | } 69 | } 70 | } else { 71 | accounts.push({ 72 | cookies: argv['cookies'], 73 | NumberOfCoins: argv['NumberOfCoins'], 74 | CoinsForVideo: argv['CoinsForVideo'], 75 | SelectLike: argv['SelectLike'], 76 | username: argv['username'] + '', 77 | password: argv['password'] + '', 78 | tasks: argv['tasks'] 79 | }) 80 | } 81 | console.log('总账户数', accounts.length) 82 | for (let account of accounts) { 83 | await require(path.join(__dirname, 'tasks', command, command)).start({ 84 | cookies: account.cookies, 85 | options: { 86 | NumberOfCoins: account.NumberOfCoins, 87 | CoinsForVideo: account.CoinsForVideo, 88 | SelectLike: account.SelectLike, 89 | username: account.username, 90 | password: account.password, 91 | } 92 | }).catch(err => console.log("bilibili签到任务:", err.message)) 93 | let hasTasks = await scheduler.hasWillTask(command, { 94 | tryrun: 'tryrun' in argv, 95 | taskKey: account.username 96 | }) 97 | if (hasTasks) { 98 | scheduler.execTask(command, account.tasks).catch(err => console.log("bilibili签到任务:", err.message)).finally(() => { 99 | console.log('当前任务执行完毕!') 100 | }) 101 | } else { 102 | console.log('暂无可执行任务!') 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /commands/iqiyi.js: -------------------------------------------------------------------------------- 1 | 2 | const path = require('path') 3 | const { scheduler } = require('../utils/scheduler') 4 | 5 | exports.command = 'iqiyi' 6 | 7 | exports.describe = 'iqiyi签到任务' 8 | 9 | exports.builder = function (yargs) { 10 | return yargs 11 | .option('P00001', { 12 | describe: 'Cookie中P00001的值', 13 | default: '', 14 | type: 'string' 15 | }) 16 | .option('P00PRU', { 17 | describe: 'Cookie中P00PRU的值', 18 | default: '', 19 | type: 'string' 20 | }) 21 | .option('dfp', { 22 | describe: 'Cookie中_dfp的值', 23 | default: '', 24 | type: 'string' 25 | }) 26 | .help() 27 | .showHelpOnFail(true, '使用--help查看有效选项') 28 | .epilog('copyright 2020 LunnLew'); 29 | } 30 | 31 | exports.handler = async function (argv) { 32 | var command = argv._[0] 33 | var accounts = [] 34 | if ('accountSn' in argv && argv.accountSn) { 35 | let accountSns = argv.accountSn.split(',') 36 | for (let sn of accountSns) { 37 | if (('P00PRU-' + sn) in argv) { 38 | let account = { 39 | P00001: argv['P00001-' + sn], 40 | P00003: argv['P00003-' + sn], 41 | P00PRU: argv['P00PRU-' + sn] + '', 42 | QC005: argv['QC005-' + sn], 43 | dfp: argv['dfp-' + sn], 44 | tasks: argv['tasks-' + sn] 45 | } 46 | if (('tryrun-' + sn) in argv) { 47 | account['tryrun'] = true 48 | } 49 | accounts.push(account) 50 | } 51 | } 52 | } else { 53 | accounts.push({ 54 | P00001: argv['P00001'], 55 | P00003: argv['P00003'], 56 | P00PRU: argv['P00PRU'] + '', 57 | QC005: argv['QC005'], 58 | dfp: argv['dfp'], 59 | tasks: argv['tasks'] 60 | }) 61 | } 62 | console.log('总账户数', accounts.length) 63 | for (let account of accounts) { 64 | await require(path.join(__dirname, 'tasks', command, command)).start({ 65 | cookies: { 66 | P00001: account.P00001, 67 | P00003: account.P00003, 68 | P00PRU: account.P00PRU, 69 | QC005: account.QC005, 70 | _dfp: account.dfp 71 | }, 72 | options: {} 73 | }).catch(err => console.log("iqiyi签到任务:", err.message)) 74 | let hasTasks = await scheduler.hasWillTask(command, { 75 | tryrun: 'tryrun' in argv, 76 | taskKey: account.P00PRU 77 | }) 78 | if (hasTasks) { 79 | scheduler.execTask(command, account.tasks).catch(err => console.log("iqiyi签到任务:", err.message)).finally(() => { 80 | console.log('当前任务执行完毕!') 81 | }) 82 | } else { 83 | console.log('暂无可执行任务!') 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /commands/tasks/52pojie/52pojie.js: -------------------------------------------------------------------------------- 1 | const _request = require("../../../utils/request"); 2 | const { scheduler } = require("../../../utils/scheduler"); 3 | var start = async (params) => { 4 | const { cookies, options } = params; 5 | 6 | let init = async (request, savedCookies) => { 7 | if (!savedCookies) { 8 | if ( 9 | !cookies || 10 | !("htVD_2132_auth" in cookies) || 11 | !cookies["htVD_2132_auth"] 12 | ) { 13 | throw new Error("需要提供htVD_2132_auth参数"); 14 | } 15 | 16 | if (!("htVD_2132_saltkey" in cookies) || !cookies["htVD_2132_saltkey"]) { 17 | throw new Error("需要提供htVD_2132_saltkey参数"); 18 | } 19 | return { 20 | request: _request(cookies), 21 | }; 22 | } else { 23 | return { 24 | request, 25 | }; 26 | } 27 | }; 28 | let taskOption = { 29 | init, 30 | }; 31 | 32 | await scheduler.regTask( 33 | "dailySign", 34 | async (request) => { 35 | await require("./sign")(request); 36 | }, 37 | taskOption 38 | ); 39 | }; 40 | module.exports = { 41 | start, 42 | }; 43 | -------------------------------------------------------------------------------- /commands/tasks/52pojie/sign.js: -------------------------------------------------------------------------------- 1 | const iconv = require("iconv-lite"); 2 | const cheerio = require("cheerio"); 3 | 4 | var loadSign = async (axios, url) => { 5 | let chunks = []; 6 | let str = await new Promise((resolve, reject) => { 7 | axios 8 | .request({ 9 | url: url, 10 | responseType: "stream", 11 | }) 12 | .then((res) => { 13 | res.data.on("data", (chunk) => { 14 | chunks.push(chunk); 15 | }); 16 | res.data.on("end", () => { 17 | let buffer = Buffer.concat(chunks); 18 | let str = iconv.decode(buffer, "gbk"); 19 | resolve(str); 20 | }); 21 | }); 22 | }); 23 | let $ = cheerio.load(str); 24 | let msg = $("#messagetext").text(); 25 | return msg; 26 | }; 27 | 28 | module.exports = async (axios) => { 29 | let msg = await loadSign( 30 | axios, 31 | "https://www.52pojie.cn/home.php?mod=task&do=apply&id=2" 32 | ); 33 | if (msg.indexOf("需要先登录才能继续本操作") !== -1) { 34 | console.log("需要先登录才能继续本操作,跳过本期任务"); 35 | return; 36 | } 37 | if (msg.indexOf("本期您已申请过此任务") !== -1) { 38 | console.log("本期您已申请过此任务,跳过本期任务"); 39 | return; 40 | } 41 | msg = await loadSign( 42 | axios, 43 | "https://www.52pojie.cn/home.php?mod=task&do=draw&id=2" 44 | ); 45 | console.log("52pojie签到:", msg); 46 | }; 47 | -------------------------------------------------------------------------------- /commands/tasks/bilibili/AddCoinsForVideo.js: -------------------------------------------------------------------------------- 1 | const MaxNumberOfDonateCoins = 5 2 | const MaxCoinsForVideo = 2 3 | 4 | var GetNeedDonateCoins = async (axios, options) => { 5 | let alreadyCoins = 0 6 | let needCoins = 0 7 | let result = await todayCoins(axios) 8 | if (result.code === 0) { 9 | alreadyCoins = result.data / 10 10 | } 11 | // 目标投币 12 | let targetCoins = options.NumberOfCoins > MaxNumberOfDonateCoins 13 | ? MaxNumberOfDonateCoins 14 | : options.NumberOfCoins 15 | console.log("目标投币:", targetCoins) 16 | if (targetCoins > alreadyCoins) { 17 | needCoins = targetCoins - alreadyCoins; 18 | } 19 | console.log("需要投币:", needCoins) 20 | 21 | result = await todayCoinBalance(axios) 22 | return { 23 | alreadyCoins, 24 | needCoins, 25 | targetCoins, 26 | coinBalance: result.data.money 27 | }; 28 | } 29 | 30 | var todayCoins = (axios) => { 31 | return new Promise((resolve, reject) => { 32 | axios.request({ 33 | headers:{ 34 | origin: 'https://account.bilibili.com', 35 | referer: 'https://account.bilibili.com/account/home' 36 | }, 37 | url: `https://api.bilibili.com/x/web-interface/coin/today/exp`, 38 | method: 'get' 39 | }).then(res => { 40 | console.log("今日已获得投币经验: " + res.data.data); 41 | resolve(res.data) 42 | }).catch(reject) 43 | }) 44 | } 45 | 46 | var todayCoinBalance = (axios) => { 47 | return new Promise((resolve, reject) => { 48 | axios.request({ 49 | headers:{ 50 | origin: 'https://account.bilibili.com', 51 | referer: 'https://account.bilibili.com/account/home' 52 | }, 53 | url: `https://account.bilibili.com/site/getCoin`, 54 | method: 'post' 55 | }).then(res => { 56 | console.log("当前硬币余额:" + res.data.data.money); 57 | resolve(res.data) 58 | }).catch(reject) 59 | }) 60 | } 61 | 62 | var fetchVideo = (axios) => { 63 | return new Promise((resolve, reject) => { 64 | let rids = [1, 3, 4, 5, 160, 22, 119] 65 | let days = [1, 3, 7] 66 | let rid = rids[Math.floor(Math.random() * rids.length)] 67 | let day = days[Math.floor(Math.random() * days.length)] 68 | axios.request({ 69 | headers:{ 70 | origin: 'https://account.bilibili.com', 71 | referer: 'https://account.bilibili.com/account/home' 72 | }, 73 | url: `https://api.bilibili.com/x/web-interface/ranking/region?rid=${rid}&day=${day}` 74 | }).then(res => { 75 | let result = res.data 76 | if (result.code === 0) { 77 | resolve(result.data[Math.floor(Math.random() * result.data.length)]) 78 | } else { 79 | resolve() 80 | } 81 | }).catch(reject) 82 | }) 83 | } 84 | 85 | var TryGetNotDonatedVideo = async (axios) => { 86 | let tryCount = 0 87 | let video = undefined 88 | do { 89 | video = await fetchVideo(axios) 90 | tryCount++; 91 | if (video) { 92 | let result = IsDonatedCoinsForVideo(axios, video) 93 | if (!result) { 94 | break 95 | } 96 | } 97 | let s = Math.floor(Math.random() * 20) 98 | console.log('等待%s秒再继续', s) 99 | await new Promise((resolve, reject) => setTimeout(resolve, s * 1000)) 100 | } while (tryCount <= 10) 101 | return video 102 | } 103 | 104 | var IsDonatedCoinsForVideo = (axios, video) => { 105 | return new Promise((resolve, reject) => { 106 | axios.request({ 107 | headers:{ 108 | origin: 'https://account.bilibili.com', 109 | referer: 'https://account.bilibili.com/account/home' 110 | }, 111 | url: `https://api.bilibili.com/x/web-interface/archive/coins?aid=${video.aid}`, 112 | method: 'get' 113 | }).then(res => { 114 | if(!res.data.data){ 115 | throw new Error('获取视频投币状态失败') 116 | } 117 | resolve(res.data.data.multiply) 118 | }).catch(reject) 119 | }) 120 | } 121 | var AddCoinForVideo = (axios, video, options) => { 122 | let { CoinsForVideo, SelectLike } = options 123 | let bili_jct = undefined 124 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 125 | if (item.indexOf('bili_jct') === 0) { 126 | bili_jct = item.split("=").pop() 127 | } 128 | }) 129 | return new Promise((resolve, reject) => { 130 | 131 | // 视频投币 132 | let targetCoins = CoinsForVideo > MaxCoinsForVideo 133 | ? MaxCoinsForVideo 134 | : CoinsForVideo 135 | 136 | let params = { 137 | 'aid': video.aid, 138 | 'multiply': targetCoins, 139 | 'select_like': SelectLike ? 1 : 0, 140 | 'cross_domain': "true", 141 | 'csrf': bili_jct 142 | } 143 | axios.request({ 144 | headers: { 145 | "referer": "https://www.bilibili.com", 146 | "origin": "https://www.bilibili.com", 147 | "content-type": "application/x-www-form-urlencoded", 148 | }, 149 | url: `https://api.bilibili.com/x/web-interface/coin/add`, 150 | method: 'post', 151 | params 152 | }).then(res => { 153 | resolve(res.data) 154 | }).catch((rr) => { 155 | console.log(rr.response) 156 | reject() 157 | }) 158 | }) 159 | } 160 | var tryAddCoinForVideo = async (axios, options) => { 161 | let video = await TryGetNotDonatedVideo(axios) 162 | let result = {} 163 | if (video) { 164 | console.log("正在为“%s”投币", video.title) 165 | result = await AddCoinForVideo(axios, video, options) 166 | } 167 | return { 168 | result, 169 | video 170 | } 171 | } 172 | 173 | module.exports = async (axios, options) => { 174 | const { alreadyCoins, targetCoins, needCoins, coinBalance } = await GetNeedDonateCoins(axios, options) 175 | return new Promise(async (resolve, reject) => { 176 | if (needCoins <= 0) { 177 | console.log("随机视频投币:已完成投币任务,今天不需要再投啦"); 178 | } else { 179 | console.log("还需再投%s枚硬币", needCoins); 180 | if (coinBalance <= 0) { 181 | console.log("因硬币余额不足,今日暂不执行投币任务"); 182 | } else { 183 | //余额小于目标投币数,按余额投 184 | if (coinBalance < needCoins) { 185 | needCoins = coinBalance 186 | console.log("因硬币余额不足,目标投币数调整为: %s", needCoins); 187 | } 188 | let successCoins = 0; 189 | let tryCount = 0; 190 | while (successCoins < needCoins && tryCount <= 10) { 191 | let { result, video } = await tryAddCoinForVideo(axios, options) 192 | if (video) { 193 | if (result.code !== 0) { 194 | console.log("为“%s”投币失败,原因:%s", video.title, result.message); 195 | } else { 196 | console.log("为“%s”投币成功", video.title); 197 | successCoins = successCoins + options.CoinsForVideo; 198 | } 199 | } 200 | tryCount++; 201 | if (tryCount > 10) { 202 | console.log("尝试投币次数超过10次,投币任务终止"); 203 | break 204 | } 205 | let s = Math.floor(Math.random() * 20) 206 | console.log('等待%s秒再继续', s) 207 | await new Promise((resolve, reject) => setTimeout(resolve, s * 1000)) 208 | } 209 | let resultCoinBalance = await todayCoinBalance(axios) 210 | console.log("投币任务完成,余额为: " + resultCoinBalance.data.money); 211 | } 212 | } 213 | resolve() 214 | }) 215 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/ExchangeSilver2Coin.js: -------------------------------------------------------------------------------- 1 | module.exports = async (axios) => { 2 | return new Promise((resolve, reject) => { 3 | axios.request({ 4 | headers:{ 5 | "referer": "https://www.bilibili.com", 6 | "origin": "https://www.bilibili.com", 7 | }, 8 | url: `https://api.live.bilibili.com/pay/v1/Exchange/silver2coin`, 9 | method: 'get' 10 | }).then(res => { 11 | console.log("银瓜子兑换硬币:", res.data.message) 12 | resolve(res.data) 13 | }).catch(reject) 14 | }) 15 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/LiveGetSignInfo.js: -------------------------------------------------------------------------------- 1 | module.exports = (axios) => { 2 | return new Promise((resolve, reject) => { 3 | axios.request({ 4 | headers:{ 5 | "referer": "https://live.bilibili.com", 6 | "origin": "https://live.bilibili.com", 7 | }, 8 | url: 'https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/WebGetSignInfo' 9 | }).then(res => { 10 | let result = res.data 11 | if (result.code !== 0) { 12 | console.log('获取当月直播签到状态失败', result.message) 13 | } else { 14 | console.log('获取当月直播签到状态成功 ','累计签到'+result.data.hadSignDays+'/'+result.data.allDays) 15 | resolve(result.data) 16 | } 17 | }).catch(reject) 18 | }) 19 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/LiveSign.js: -------------------------------------------------------------------------------- 1 | module.exports = async (axios) => { 2 | return new Promise((resolve, reject) => { 3 | axios.request({ 4 | headers:{ 5 | "referer": "https://www.bilibili.com", 6 | "origin": "https://www.bilibili.com", 7 | }, 8 | url: `https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign`, 9 | method: 'get' 10 | }).then(res => { 11 | if (res.data.code === 0) { 12 | console.log("直播中心签到:", '签到成功') 13 | } else { 14 | console.log("直播中心签到:", res.data.message) 15 | } 16 | resolve(res.data) 17 | }).catch(reject) 18 | }) 19 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/MangaSign.js: -------------------------------------------------------------------------------- 1 | module.exports = async (axios) => { 2 | let platform = "ios" 3 | return new Promise((resolve, reject) => { 4 | axios.request({ 5 | headers:{ 6 | "referer": "https://www.bilibili.com", 7 | "origin": "https://www.bilibili.com", 8 | }, 9 | url: `https://manga.bilibili.com/twirp/activity.v1.Activity/ClockIn?platform=${platform}`, 10 | method: 'post' 11 | }).then(res => { 12 | resolve(res.data) 13 | }).catch(err => { 14 | console.log("漫画签到:今日已签到过,无法重复签到") 15 | resolve() 16 | })// 400 clockin clockin is duplicat 17 | }) 18 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/ReceiveVipPrivilege.js: -------------------------------------------------------------------------------- 1 | const dayjs = require('dayjs') 2 | 3 | var ReceiveVipPrivilege = async (axios, type) => { 4 | let bili_jct = undefined 5 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 6 | if (item.indexOf('bili_jct') === 0) { 7 | bili_jct = item.split("=").pop() 8 | } 9 | }) 10 | return new Promise((resolve, reject) => { 11 | axios.request({ 12 | headers:{ 13 | "referer": "https://www.bilibili.com", 14 | "origin": "https://www.bilibili.com", 15 | }, 16 | url: `https://api.bilibili.com/x/vip/privilege/receive?type=${type}&csrf=${bili_jct}`, 17 | method: 'post' 18 | }).then(res => { 19 | if (res.data.code == 0) { 20 | if (type == 1) { 21 | console.log("领取年度大会员每月赠送的B币券成功"); 22 | } else if (type == 2) { 23 | console.log("领取大会员福利/权益成功"); 24 | } 25 | } else { 26 | console.log("领取年度大会员每月赠送的B币券/大会员福利失败,原因:%s", res.data.message); 27 | } 28 | resolve(res.data) 29 | }).catch(err => { 30 | resolve() 31 | }) 32 | }) 33 | } 34 | 35 | module.exports = async (axios, options) => { 36 | const {userInfo, DayOfReceiveVipPrivilege} = options 37 | if (userInfo.vipStatus) { 38 | if (DayOfReceiveVipPrivilege != 0) { 39 | let day = dayjs().date() 40 | if (day == DayOfReceiveVipPrivilege) { 41 | if (userInfo.vipType == 2) { 42 | await ReceiveVipPrivilege(axios, 1) 43 | await ReceiveVipPrivilege(axios, 2) 44 | } else { 45 | console.log("普通会员和月度大会员每月不赠送B币券,所以不需要领取权益喽"); 46 | } 47 | } else { 48 | console.log("目标领取日期为%s号,今天是%s号,跳过领取任务", DayOfReceiveVipPrivilege, day); 49 | } 50 | } else { 51 | console.log("已配置为不进行自动领取会员权益,跳过领取任务"); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/account.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | const os = require('os') 3 | const path = require('path') 4 | const fs = require('fs-extra') 5 | const { getCookies, saveCookies } = require('../../../utils/util') 6 | 7 | const app_key = 'bca7e84c2d947ac6' 8 | var calc_sign = (params) => { 9 | let str = `${params}60698ba2f68e01ce44738920a0ffe768` 10 | return crypto.createHash('md5').update(str).digest('hex'); 11 | } 12 | var transParams = (data) => { 13 | let params = new URLSearchParams(); 14 | for (let item in data) { 15 | params.append(item, data['' + item + '']); 16 | } 17 | return params; 18 | }; 19 | function w() { 20 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 21 | , t = []; 22 | return Object.keys(e).forEach((function (a) { 23 | t.push("".concat(a, "=").concat(encodeURIComponent(e[a]))) 24 | } 25 | )), 26 | t.join("&") 27 | } 28 | // 创建加密算法 29 | const rsapublicKeyEncode = function (data, publicKey) { 30 | let crypted = crypto.publicEncrypt({ 31 | key: publicKey, 32 | padding: crypto.constants.RSA_PKCS1_PADDING 33 | }, Buffer.from(data)).toString('base64'); 34 | return crypted; 35 | }; 36 | var account = { 37 | tokenFile: path.join(os.homedir(), '.AutoSignMachine', 'tokenFile.json'), 38 | getLoginPublicKey: async (axios) => { 39 | let res = await axios.request({ 40 | headers: { 41 | "referer": "https://passport.bilibili.com/", 42 | "origin": "https://passport.bilibili.com", 43 | }, 44 | url: `https://passport.bilibili.com/api/oauth2/getKey`, 45 | method: 'post', 46 | data: transParams({ 47 | appkey: app_key, 48 | sign: calc_sign(`appkey=${app_key}`) 49 | }) 50 | }) 51 | let result = res.data 52 | if (result.code !== 0) { 53 | throw new Error('获取公钥失败') 54 | } 55 | return result.data 56 | }, 57 | getCaptcha: async (axios) => { 58 | let res = await axios.request({ 59 | headers: { 60 | "referer": "https://passport.bilibili.com/", 61 | "origin": "https://passport.bilibili.com", 62 | }, 63 | responseType: "arraybuffer", 64 | url: `https://passport.bilibili.com/captcha`, 65 | method: 'get' 66 | }) 67 | return Buffer.from( 68 | new Uint8Array(res.data).reduce( 69 | (data, byte) => data + String.fromCharCode(byte), 70 | "" 71 | ), 'binary').toString('base64') 72 | }, 73 | getCrackCaptcha: async (axios, image_base64) => { 74 | let res = await axios.request({ 75 | headers: { 76 | "user-agent": "Mozilla/5.0 BiliDroid/6.4.0 (bbcallen@gmail.com) os/android model/M1903F11I mobi_app/android build/6040500 channel/bili innerVer/6040500 osVer/9.0.0 network/2", 77 | "referer": "https://bili.dev/", 78 | "origin": "https://bili.dev", 79 | "Content-Type": 'application/json' 80 | }, 81 | url: `https://bili.dev:2233/captcha`, 82 | method: 'post', 83 | data: { 84 | image: image_base64 85 | } 86 | }) 87 | let result = res.data 88 | if (result.code !== 0) { 89 | throw new Error('获取验证码识别结果失败') 90 | } 91 | return result.message 92 | }, 93 | getInfoByTokenAndSetCookies: async (axios, options) => { 94 | const { mid, access_token } = options 95 | var params = { 96 | access_key: access_token, 97 | appkey: app_key, 98 | ts: new Date().getTime() 99 | } 100 | let sign = calc_sign(w(params)) 101 | let res = await axios.request({ 102 | headers: { 103 | "referer": "https://passport.bilibili.com/", 104 | "origin": "https://passport.bilibili.com", 105 | }, 106 | url: `https://passport.bilibili.com/api/v2/oauth2/info?` + w(params) + '&sign=' + sign, 107 | method: 'get' 108 | }) 109 | 110 | params = { 111 | access_key: access_token, 112 | appkey: app_key, 113 | gourl: "https://account.bilibili.com/account/home", 114 | ts: new Date().getTime() 115 | } 116 | sign = calc_sign(w(params)) 117 | res = await axios.request({ 118 | headers: { 119 | "cookie": res.config.headers.cookie + ";DedeUserID=" + mid, 120 | "referer": "https://passport.bilibili.com/", 121 | "origin": "https://passport.bilibili.com", 122 | }, 123 | url: `https://passport.bilibili.com/api/login/sso?` + w(params) + '&sign=' + sign, 124 | method: 'get' 125 | }) 126 | if (res.status !== 200) { 127 | throw new Error('获取登录状态失败') 128 | } else { 129 | const { config } = res 130 | await saveCookies('bilibili_' + (options.username || 'default'), '', config.jar) 131 | } 132 | }, 133 | loginByPassword: async (axios, options) => { 134 | account.tokenFile = path.join(os.homedir(), '.AutoSignMachine', 'tokenFile_bilibili_' + (options.username || 'default') + '.json') 135 | let tokenJson 136 | if (fs.existsSync(account.tokenFile)) { 137 | let token = JSON.parse(fs.readFileSync(account.tokenFile).toString('utf-8')) 138 | let time = new Date().getTime() 139 | // 将过期 140 | if (token.expires_in < time + 60 * 60 * 24 && token.expires_in > time) { 141 | // TODO 刷新token 142 | tokenJson = token 143 | } else if (token.expires_in > time) { 144 | tokenJson = token 145 | } else { 146 | // 过期不处理 147 | } 148 | } 149 | if (tokenJson) { 150 | await account.getInfoByTokenAndSetCookies(axios, { 151 | ...options, 152 | ...tokenJson 153 | }) 154 | return tokenJson 155 | } 156 | let { key, hash } = await account.getLoginPublicKey(axios) 157 | let img = await account.getCaptcha(axios) 158 | let captcha = await account.getCrackCaptcha(axios, img) 159 | var params = { 160 | actionKey: 'appkey', 161 | appkey: app_key, 162 | captcha: captcha, 163 | password: rsapublicKeyEncode(hash + options.password, key.toString('ascii')), 164 | username: options.username 165 | } 166 | let sign = calc_sign(w(params)) 167 | 168 | let res = await axios.request({ 169 | headers: { 170 | "referer": "https://passport.bilibili.com/", 171 | "origin": "https://passport.bilibili.com", 172 | }, 173 | url: `https://passport.bilibili.com/api/v2/oauth2/login`, 174 | method: 'post', 175 | data: transParams(params) + '&sign=' + sign 176 | }) 177 | if (res.data.code === -449) { 178 | // 服务繁忙,更换api登录 179 | params = { 180 | access_key: '', 181 | actionKey: 'appkey', 182 | appkey: app_key, 183 | build: 6040500, 184 | captcha: captcha, 185 | challenge: '', 186 | channel: 'bili', 187 | cookies: '', 188 | device: 'phone', 189 | mobi_app: 'android', 190 | password: rsapublicKeyEncode(hash + options.password, key.toString('ascii')), 191 | permission: 'ALL', 192 | platform: 'android', 193 | seccode: '', 194 | subid: 1, 195 | ts: new Date().getTime(), 196 | username: options.username, 197 | validate: '' 198 | } 199 | sign = calc_sign(w(params)) 200 | res = await axios.request({ 201 | headers: { 202 | "referer": "https://passport.bilibili.com/", 203 | "origin": "https://passport.bilibili.com", 204 | }, 205 | url: `https://passport.bilibili.com/api/v3/oauth2/login`, 206 | method: 'post', 207 | data: transParams(params) + '&sign=' + sign 208 | }) 209 | } 210 | if (res.data.code !== 0) { 211 | throw new Error(res.data.message) 212 | } 213 | if (res.data.data.status === 2) { 214 | throw new Error(res.data.data.message) 215 | } 216 | tokenJson = { 217 | ...res.data.data.token_info, 218 | expires_in: res.data.data.token_info.expires_in + new Date().getTime() 219 | } 220 | fs.ensureFileSync(account.tokenFile) 221 | fs.writeFileSync(account.tokenFile, JSON.stringify(tokenJson)) 222 | await account.getInfoByTokenAndSetCookies(axios, { 223 | ...options, 224 | ...tokenJson 225 | }) 226 | return tokenJson 227 | } 228 | } 229 | module.exports = account 230 | -------------------------------------------------------------------------------- /commands/tasks/bilibili/bilibili.js: -------------------------------------------------------------------------------- 1 | const _request = require('../../../utils/request') 2 | const { scheduler } = require('../../../utils/scheduler') 3 | const { getCookies, saveCookies } = require('../../../utils/util') 4 | var start = async (params) => { 5 | const { cookies, options } = params 6 | 7 | let init = async (request, savedCookies) => { 8 | let userInfo = await require('./init')(request, { 9 | ...params, 10 | cookies: savedCookies || cookies 11 | }) 12 | return { 13 | request, 14 | data: { 15 | userInfo 16 | } 17 | } 18 | } 19 | let taskOption = { 20 | init 21 | } 22 | 23 | // 每日观看分享视频 24 | await scheduler.regTask('watchAndShareVideo', async (request) => { 25 | let dailyTaskStatus = await require('./dailyTaskStatus')(request) 26 | if (!dailyTaskStatus.watch || !dailyTaskStatus.share) { 27 | await require('./watchAndShareVideo')(request, dailyTaskStatus) 28 | } else { 29 | console.log('每日观看分享视频已完成') 30 | } 31 | }, taskOption) 32 | 33 | // 每日视频投币 34 | await scheduler.regTask('AddCoinsForVideo', async (request) => { 35 | let dailyTaskStatus = await require('./dailyTaskStatus')(request) 36 | if (!dailyTaskStatus.coins) { 37 | await require('./AddCoinsForVideo')(request, options) 38 | } else { 39 | console.log('每日视频投币已完成') 40 | } 41 | }, taskOption) 42 | 43 | // 漫画签到 44 | await scheduler.regTask('MangaSign', async (request) => { 45 | await require('./MangaSign')(request) 46 | }, taskOption) 47 | 48 | // 直播签到 49 | await scheduler.regTask('LiveSign', async (request) => { 50 | let SignInfo = await require('./LiveGetSignInfo')(request) 51 | if (!SignInfo.status) { 52 | await require('./LiveSign')(request) 53 | } else { 54 | console.log('今日已进行直播签到') 55 | } 56 | }, taskOption) 57 | 58 | // 银瓜子兑换硬币 59 | await scheduler.regTask('ExchangeSilver2Coin', async (request) => { 60 | let WalletInfo = await require('./myWallet')(request) 61 | if (WalletInfo.silver >= 700) { 62 | await require('./ExchangeSilver2Coin')(request) 63 | } else { 64 | console.log('银瓜子不足700无法兑换为硬币') 65 | } 66 | }, taskOption) 67 | 68 | // vip会员任务 - 年度大会员 69 | await scheduler.regTask('ReceiveVipPrivilege', async (request, data) => { 70 | const { userInfo } = data 71 | await require('./ReceiveVipPrivilege')(request, { 72 | ...options, 73 | userInfo 74 | }) 75 | }, taskOption) 76 | 77 | } 78 | module.exports = { 79 | start 80 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/dailyTaskStatus.js: -------------------------------------------------------------------------------- 1 | module.exports = (axios) => { 2 | return new Promise((resolve, reject) => { 3 | axios 4 | .request({ 5 | headers: { 6 | referer: "https://account.bilibili.com/account/home", 7 | origin: "https://www.bilibili.com", 8 | }, 9 | url: "https://api.bilibili.com/x/member/web/exp/reward", 10 | method: "get", 11 | }) 12 | .then((res) => { 13 | let result = res.data; 14 | if (result.code !== 0) { 15 | console.log("获取每日任务状态失败", result.message); 16 | throw new Error("获取每日任务状态失败:" + result.message); 17 | } else { 18 | console.log( 19 | "获取每日任务状态成功 ", 20 | "每日登录+5" + (result.data.login ? "完成" : "未完成"), 21 | "每日观看视频+5" + (result.data.watch ? "完成" : "未完成"), 22 | "每日投币+50" + (result.data.coins ? "完成" : "未完成"), 23 | "每日分享视频+5" + (result.data.share ? "完成" : "未完成") 24 | ); 25 | resolve(result.data); 26 | } 27 | }) 28 | .catch(reject); 29 | }); 30 | }; 31 | -------------------------------------------------------------------------------- /commands/tasks/bilibili/init.js: -------------------------------------------------------------------------------- 1 | const EveryDayExp = 5 + 5 + 50 + 5 2 | 3 | var checkInfo = async (axios) => { 4 | const res = await axios.request({ 5 | headers: { 6 | "referer": "https://passport.bilibili.com/", 7 | "origin": "https://passport.bilibili.com", 8 | }, 9 | url: 'https://api.bilibili.com/x/web-interface/nav', 10 | method: 'get' 11 | }) 12 | return res 13 | } 14 | module.exports = async (axios, params) => { 15 | const { options, cookies } = params 16 | 17 | let result 18 | 19 | try { 20 | let res = await checkInfo(axios) 21 | result = res.data 22 | } catch (err) { 23 | console.log('获取信息失败') 24 | } 25 | 26 | // 重要:密码账户登录易出现 您的账号存在高危异常行为,为了您的账号安全,请验证手机号后登录帐号 提示,建议使用cookies 27 | if (Object.prototype.toString.call(result) !== '[object Object]' || !result || result.code !== 0) { 28 | console.log('cookies凭据访问失败,将使用账户密码登录') 29 | if (options['username']) { 30 | if (!('password' in options) || !options['password']) { 31 | throw new Error("需要提供登陆密码") 32 | } 33 | } else if (!cookies) { 34 | throw new Error("需要提供登录信息,使用密码账号或者cookies") 35 | } 36 | await require('./account').loginByPassword(axios, options) 37 | res = await checkInfo(axios) 38 | result = res.data 39 | } 40 | 41 | if (result.code !== 0 || !result.data.isLogin) { 42 | throw new Error(result.message) 43 | } else { 44 | let userInfo = result.data 45 | console.log(`获取用户状态成功 用户名:%s,硬币余额:%s,当前等级Lv%s,经验值为:%s,下级经验值为:%s`, userInfo.uname.substr(0, 2) + "********", userInfo.money, userInfo.level_info.current_level, userInfo.level_info.current_exp, userInfo.level_info.next_exp) 46 | if (userInfo.level_info.current_level < 6) { 47 | console.log(`距离升级到Lv%s还有: %s天`, userInfo.level_info.current_level + 1, new Number((userInfo.level_info.next_exp - userInfo.level_info.current_exp) / EveryDayExp).toFixed(2)) 48 | } 49 | return userInfo 50 | } 51 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/myWallet.js: -------------------------------------------------------------------------------- 1 | module.exports = (axios) => { 2 | return new Promise((resolve, reject) => { 3 | axios.request({ 4 | headers:{ 5 | "referer": "https://live.bilibili.com", 6 | "origin": "https://live.bilibili.com", 7 | }, 8 | url: 'https://api.live.bilibili.com/pay/v2/Pay/myWallet?need_bp=1&need_metal=1&platform=pc' 9 | }).then(res => { 10 | let result = res.data 11 | if (result.code !== 0) { 12 | console.log('获取钱包信息失败', result.message) 13 | } else { 14 | console.log('获取钱包信息成功 B币%s,硬币%s,银瓜子%s,金瓜子%s',result.data.bp,result.data.metal,result.data.silver,result.data.gold) 15 | resolve(result.data) 16 | } 17 | }).catch(reject) 18 | }) 19 | } -------------------------------------------------------------------------------- /commands/tasks/bilibili/watchAndShareVideo.js: -------------------------------------------------------------------------------- 1 | var fetchVideo = (axios) => { 2 | return new Promise((resolve, reject) => { 3 | let rids = [1, 3, 4, 5, 160, 22, 119] 4 | let days = [1, 3, 7] 5 | let rid = rids[Math.floor(Math.random() * rids.length)] 6 | let day = days[Math.floor(Math.random() * days.length)] 7 | axios.request({ 8 | headers: { 9 | "referer": "https://www.bilibili.com", 10 | "origin": "https://www.bilibili.com", 11 | }, 12 | url: `https://api.bilibili.com/x/web-interface/ranking/region?rid=${rid}&day=${day}` 13 | }).then(res => { 14 | let result = res.data 15 | if (result.code === 0) { 16 | resolve(result.data[Math.floor(Math.random() * result.data.length)]) 17 | } else { 18 | throw new Error('获取随机视频失败' + result.message) 19 | } 20 | }).catch(reject) 21 | }) 22 | } 23 | 24 | var WatchVideo = (axios, videoInfo) => { 25 | return new Promise((resolve, reject) => { 26 | let playedTime = Math.floor(Math.random() * 90) 27 | axios.request({ 28 | headers: { 29 | "referer": "https://www.bilibili.com", 30 | "origin": "https://www.bilibili.com", 31 | }, 32 | url: `https://api.bilibili.com/x/click-interface/web/heartbeat?aid=${videoInfo.aid}&played_time=${playedTime}`, 33 | method: 'post' 34 | }).then(res => { 35 | if (res.data.code == 0) { 36 | console.log("视频播放成功,已观看到第%s秒", playedTime); 37 | } else { 38 | console.log("视频播放失败,原因:%s", res.data.message); 39 | } 40 | resolve(res.data) 41 | }).catch(reject) 42 | }) 43 | } 44 | 45 | var ShareVideo = (axios, videoInfo, bili_jct) => { 46 | return new Promise((resolve, reject) => { 47 | axios.request({ 48 | headers: { 49 | "referer": "https://www.bilibili.com", 50 | "origin": "https://www.bilibili.com", 51 | }, 52 | url: `https://api.bilibili.com/x/web-interface/share/add?aid=${videoInfo.aid}&csrf=${bili_jct}`, 53 | method: 'post' 54 | }).then(res => { 55 | if (res.data.code == 0) { 56 | console.log("视频分享成功"); 57 | } else { 58 | console.log("视频分享失败,原因:%s", res.data.message); 59 | } 60 | resolve(res.data) 61 | }).catch(reject) 62 | }) 63 | } 64 | 65 | module.exports = async (axios, dailyTaskStatus) => { 66 | let videoInfo = undefined 67 | let bili_jct = undefined 68 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 69 | if (item.indexOf('bili_jct') === 0) { 70 | bili_jct = item.split("=").pop() 71 | } 72 | }) 73 | return new Promise(async (resolve, reject) => { 74 | if (!dailyTaskStatus.watch || !dailyTaskStatus.share) { 75 | videoInfo = await fetchVideo(axios) 76 | } 77 | if (videoInfo) { 78 | if (!dailyTaskStatus.watch) 79 | await WatchVideo(axios, videoInfo); 80 | else 81 | console.log("今天已经观看过了,不需要再看啦"); 82 | 83 | if (!dailyTaskStatus.share) 84 | await ShareVideo(axios, videoInfo, bili_jct); 85 | else 86 | console.log("今天已经分享过了,不要再分享啦"); 87 | } 88 | resolve() 89 | }) 90 | } -------------------------------------------------------------------------------- /commands/tasks/iqiyi/dailyBrowserClub.js: -------------------------------------------------------------------------------- 1 | 2 | function w () { 3 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 4 | , t = []; 5 | return Object.keys(e).forEach((function (a) { 6 | t.push("".concat(a, "=").concat(e[a])) 7 | } 8 | )), 9 | t.join("&") 10 | } 11 | 12 | module.exports = async (axios) => { 13 | console.log('浏览会员俱乐部任务') 14 | 15 | let P00001 = undefined 16 | let QC005 = undefined 17 | let dfp = undefined 18 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 19 | if (item.indexOf('P00001') === 0) { 20 | P00001 = item.split("=").pop() 21 | } 22 | if (item.indexOf('QC005') === 0) { 23 | QC005 = item.split("=").pop() 24 | } 25 | if (item.indexOf('_dfp') === 0) { 26 | dfp = item.split("=").pop().split("@")[0] 27 | } 28 | }) 29 | 30 | var p = { 31 | 'P00001': P00001, 32 | 'taskCode': 'b6e688905d4e7184', 33 | 'platform': 'b6c13e26323c537d', 34 | 'lang': 'zh_CN', 35 | 'app_lm': 'cn' 36 | } 37 | let res = await axios.request({ 38 | headers: { 39 | "referer": "https://www.iqiyi.com", 40 | "origin": "https://www.iqiyi.com" 41 | }, 42 | url: "".concat("https://tc.vip.iqiyi.com/taskCenter/task/joinTask", "?").concat(w(p)), 43 | }) 44 | if(res.data.code==='A00000'){ 45 | console.log('领取浏览会员俱乐部任务成功') 46 | 47 | await axios.request({ 48 | headers: { 49 | "referer": "https://www.iqiyi.com", 50 | "origin": "https://www.iqiyi.com" 51 | }, 52 | url: "https://www.iqiyi.com/kszt/pcwnewclub.html" 53 | }) 54 | 55 | var a = { 56 | P00001: P00001, 57 | taskCode: 'b6e688905d4e7184', 58 | dfp: dfp, 59 | platform: 'b6c13e26323c537d', 60 | lang: 'zh_CN', 61 | app_lm: 'cn', 62 | deviceID: QC005, 63 | token: '', 64 | multiReward: 1, 65 | fv: 'bed99b2cf5722bfe' 66 | } 67 | 68 | let res = await axios.request({ 69 | headers: { 70 | "referer": "https://www.iqiyi.com", 71 | "origin": "https://www.iqiyi.com" 72 | }, 73 | url: "".concat("https://tc.vip.iqiyi.com/taskCenter/task/getTaskRewards", "?").concat(w(a)), 74 | method: 'post' 75 | }) 76 | data = res.data.data 77 | if (res.data.code === 'A00000' && data.length) { 78 | console.log('浏览会员俱乐部任务:', "签到成功!成长值+1点") 79 | } else { 80 | console.log('浏览会员俱乐部任务:', res.data.message||"无") 81 | } 82 | 83 | } else { 84 | console.log('领取浏览会员俱乐部任务失败:', res.data.msg) 85 | } 86 | } -------------------------------------------------------------------------------- /commands/tasks/iqiyi/dailyFeed.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | function k(e, t) { 3 | var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {} 4 | , n = a.split 5 | , c = void 0 === n ? "|" : n 6 | , r = a.sort 7 | , s = void 0 === r || r 8 | , o = a.splitSecretKey 9 | , i = void 0 !== o && o 10 | , l = s ? Object.keys(t).sort() : Object.keys(t) 11 | , u = l.map((function (e) { 12 | return "".concat(e, "=").concat(t[e]) 13 | } 14 | )).join(c) + (i ? c : "") + e; 15 | return g(u) 16 | } 17 | function g(e) { 18 | return crypto.createHash("md5").update(e, "utf8").digest("hex") 19 | } 20 | 21 | function w() { 22 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 23 | , t = []; 24 | return Object.keys(e).forEach((function (a) { 25 | t.push("".concat(a, "=").concat(e[a])) 26 | } 27 | )), 28 | t.join("&") 29 | } 30 | 31 | module.exports = async (axios) => { 32 | console.log('访问热点首页') 33 | 34 | let { config } = await axios.request({ 35 | headers: { 36 | "referer": "https://www.iqiyi.com", 37 | "origin": "https://www.iqiyi.com" 38 | }, 39 | url: "https://www.iqiyi.com/feed/?vfrm=pcw_my&vfrmblk=body_jf&vfrmrst=702091_jf_rd" 40 | }) 41 | 42 | let user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36' 43 | 44 | let cookiesJson = config.jar.toJSON() 45 | let P00001 = cookiesJson.cookies.find(i => i.key == 'P00001') 46 | P00001 = P00001.value 47 | let P00PRU = cookiesJson.cookies.find(i => i.key == 'P00PRU') 48 | P00PRU = P00PRU.value 49 | let dfp = cookiesJson.cookies.find(i => i.key == '_dfp') 50 | dfp = dfp.value.split("@")[0] 51 | 52 | var a = { 53 | 'agenttype': '1', 54 | 'agentversion': '0', 55 | 'appKey': 'basic_pcw', 56 | 'appver': '0', 57 | 'authCookie': P00001, 58 | 'channelCode': 'paopao_pcw', 59 | 'dfp': dfp, 60 | 'scoreType': '1', 61 | 'srcplatform': '1', 62 | 'typeCode': 'point', 63 | 'userId': P00PRU, 64 | 'user_agent': user_agent, 65 | 'verticalCode': 'iQIYI' 66 | } 67 | 68 | var c = k("UKobMjDMsDoScuWOfp6F", a, { 69 | split: "|", 70 | sort: !0, 71 | splitSecretKey: !0 72 | }) 73 | 74 | let res = await axios.request({ 75 | headers: { 76 | "referer": "https://www.iqiyi.com", 77 | "origin": "https://www.iqiyi.com" 78 | }, 79 | url: "".concat("https://community.iqiyi.com/openApi/task/complete", "?").concat(w(a), "&sign=").concat(c), 80 | method: 'post' 81 | }) 82 | 83 | data = res.data.data 84 | if (res.data.code === 'A0000' && data.length) { 85 | console.log('访问热点首页:', "签到成功!") 86 | } else { 87 | console.log('访问热点首页:', res.data.message || "无") 88 | } 89 | 90 | // a = { 91 | // 'agenttype': '1', 92 | // 'agentversion': '0', 93 | // 'appKey': 'basic_pcw', 94 | // 'appver': '0', 95 | // 'authCookie': P00001, 96 | // 'channelCode': 'paopao_pcw', 97 | // 'dfp': dfp, 98 | // 'scoreType': '1', 99 | // 'srcplatform': '1', 100 | // 'typeCode': 'point', 101 | // 'userId': P00PRU, 102 | // 'user_agent': user_agent, 103 | // 'verticalCode': 'iQIYI' 104 | // } 105 | 106 | // c = k("UKobMjDMsDoScuWOfp6F", a, { 107 | // split: "|", 108 | // sort: !0, 109 | // splitSecretKey: !0 110 | // }) 111 | 112 | // res = await axios.request({ 113 | // headers: { 114 | // "referer": "https://www.iqiyi.com", 115 | // "origin": "https://www.iqiyi.com" 116 | // }, 117 | // url: "".concat("https://community.iqiyi.com/openApi/score/getReward", "?").concat(w(a), "&sign=").concat(c), 118 | // method: 'post' 119 | // }) 120 | // data = res.data.data 121 | // if (res.data.code === 'A00000' && data.length) { 122 | // console.log('访问热点首页:', "签到成功!成长值+" + data.score + "1点") 123 | // } else { 124 | // console.log('访问热点首页:', res.data.message || "无") 125 | // } 126 | 127 | } -------------------------------------------------------------------------------- /commands/tasks/iqiyi/dailyTask.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | 3 | function w() { 4 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 5 | , t = []; 6 | return Object.keys(e).forEach((function (a) { 7 | t.push("".concat(a, "=").concat(e[a])) 8 | } 9 | )), 10 | t.join("&") 11 | } 12 | 13 | var task = { 14 | getTasks: async (axios) => { 15 | console.log('查询每日任务列表') 16 | let P00001 = undefined 17 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 18 | if (item.indexOf('P00001') === 0) { 19 | P00001 = item.split("=").pop() 20 | } 21 | }) 22 | let { data } = await axios.request({ 23 | headers: { 24 | "referer": "https://www.iqiyi.com", 25 | "origin": "https://www.iqiyi.com" 26 | }, 27 | url: `https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask`, 28 | method: 'get', 29 | params: { 30 | P00001: P00001 31 | } 32 | }) 33 | if (data.code === 'A00000') { 34 | console.log('获取成功') 35 | return data.data 36 | } else { 37 | console.log(data.msg) 38 | } 39 | }, 40 | getTaskStatus: async (axios, taskIds) => { 41 | console.log('查询每日任务状态') 42 | let P00001 = undefined 43 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 44 | if (item.indexOf('P00001') === 0) { 45 | P00001 = item.split("=").pop() 46 | } 47 | }) 48 | var a = taskIds 49 | , i = a.join(",") 50 | , n = crypto.createHash("md5").update((new Date).getTime() + Math.floor(999999999 * Math.random()) + '', "utf8").digest("hex") 51 | , r = { 52 | appname: "PCW", 53 | messageId: n, 54 | version: "2.0", 55 | invokeType: 'outer_https', 56 | lang: "zh_cn", 57 | P00001: P00001, 58 | taskCode: i, 59 | newH5: "1", 60 | fv: "bed99b2cf5722bfe" 61 | }; 62 | let { data } = await axios.request({ 63 | headers: { 64 | "referer": "https://www.iqiyi.com", 65 | "origin": "https://www.iqiyi.com" 66 | }, 67 | url: `https://tc.vip.iqiyi.com/taskCenter/task/getTaskStatus`, 68 | method: 'get', 69 | params: r 70 | }) 71 | if (data.code === 'A00000') { 72 | console.log('获取成功') 73 | return data.data 74 | } else { 75 | console.log(data.msg) 76 | } 77 | }, 78 | joinTasks: async (axios, tasks) => { 79 | console.log('开始参与任务') 80 | let P00001 = undefined 81 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 82 | if (item.indexOf('P00001') === 0) { 83 | P00001 = item.split("=").pop() 84 | } 85 | }) 86 | let params = { 87 | 'P00001': P00001, 88 | 'taskCode': 'b6e688905d4e7184', 89 | 'platform': 'b6c13e26323c537d', 90 | 'lang': 'zh_CN', 91 | 'app_lm': 'cn' 92 | } 93 | for (let task of tasks) { 94 | params['taskCode'] = task.taskCode 95 | let { data } = await axios.request({ 96 | headers: { 97 | "referer": "https://www.iqiyi.com", 98 | "origin": "https://www.iqiyi.com" 99 | }, 100 | url: `https://tc.vip.iqiyi.com/taskCenter/task/joinTask`, 101 | method: 'get', 102 | params: params 103 | }) 104 | if (data.code === 'A00000') { 105 | console.log(`参与任务[${task.taskTitle}]:`, '成功') 106 | } else { 107 | console.log(`参与任务[${task.taskTitle}]:`, data.msg) 108 | } 109 | } 110 | }, 111 | getTaskReward: async (axios, taskn, a) => { 112 | let { data } = await axios.request({ 113 | headers: { 114 | "referer": "https://www.iqiyi.com", 115 | "origin": "https://www.iqiyi.com" 116 | }, 117 | url: "".concat("https://tc.vip.iqiyi.com/taskCenter/task/getTaskRewards", "?").concat(w(a)), 118 | method: 'post' 119 | }) 120 | if (data.code === 'A00000') { 121 | console.log(`完成任务[${taskn.taskCode}, ${taskn.taskTitle}]:`, '成功') 122 | data.dataNew.length ? console.log(data.dataNew.map(i => i.name + i.value).join(',')) : '' 123 | } else if ("Q00700" === data.code) { 124 | console.log(`Q00700:跳过任务[${taskn.taskCode}, ${taskn.taskTitle}]:`) 125 | // await task.getTaskReward(axios, taskn, { 126 | // ...a, 127 | // token: data.data.token 128 | // }) 129 | } else { 130 | console.log(`完成任务[${taskn.taskCode}, ${taskn.taskTitle}]:`, data.msg) 131 | } 132 | }, 133 | completeTasks: async (axios, tasks) => { 134 | console.log('开始完成任务') 135 | let P00001 = undefined 136 | let QC005 = undefined 137 | let dfp = undefined 138 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 139 | if (item.indexOf('P00001') === 0) { 140 | P00001 = item.split("=").pop() 141 | } 142 | if (item.indexOf('QC005') === 0) { 143 | QC005 = item.split("=").pop() 144 | } 145 | if (item.indexOf('_dfp') === 0) { 146 | dfp = item.split("=").pop().split("@")[0] 147 | } 148 | }) 149 | var a = { 150 | P00001: P00001, 151 | taskCode: 'b6e688905d4e7184', 152 | dfp: dfp, 153 | platform: 'b6c13e26323c537d', 154 | lang: 'zh_CN', 155 | app_lm: 'cn', 156 | deviceID: QC005, 157 | token: '', 158 | multiReward: 1, 159 | fv: 'bed99b2cf5722bfe' 160 | } 161 | for (let taskn of tasks) { 162 | a['taskCode'] = taskn.taskCode 163 | await task.getTaskReward(axios, taskn, a) 164 | } 165 | } 166 | } 167 | 168 | module.exports = task -------------------------------------------------------------------------------- /commands/tasks/iqiyi/dailyWatchVideo.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | function k(e, t) { 3 | var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {} 4 | , n = a.split 5 | , c = void 0 === n ? "|" : n 6 | , r = a.sort 7 | , s = void 0 === r || r 8 | , o = a.splitSecretKey 9 | , i = void 0 !== o && o 10 | , l = s ? Object.keys(t).sort() : Object.keys(t) 11 | , u = l.map((function (e) { 12 | return "".concat(e, "=").concat(t[e]) 13 | } 14 | )).join(c) + (i ? c : "") + e; 15 | return g(u) 16 | } 17 | function g(e) { 18 | return crypto.createHash("md5").update(e, "utf8").digest("hex") 19 | } 20 | 21 | function w() { 22 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 23 | , t = []; 24 | return Object.keys(e).forEach((function (a) { 25 | t.push("".concat(a, "=").concat(e[a])) 26 | } 27 | )), 28 | t.join("&") 29 | } 30 | 31 | module.exports = { 32 | getRndVideo: async (axios) => { 33 | return new Promise((resolve, reject) => { 34 | axios.request({ 35 | headers: { 36 | "referer": "https://list.iqiyi.com/", 37 | "origin": "https://list.iqiyi.com", 38 | }, 39 | url: `https://pcw-api.iqiyi.com/search/recommend/list?channel_id=2&data_type=1&mode=4&page_id=1&ret_num=48`, 40 | method: 'get' 41 | }).then(res => { 42 | let result = res.data 43 | if (result.code !== 'A00000') { 44 | throw new Error('获取视频列表失败') 45 | } 46 | resolve(result.data.list) 47 | }).catch(reject) 48 | }) 49 | }, 50 | reportPlayTime: async (axios) => { 51 | let videos = await module.exports.getRndVideo(axios) 52 | let isComplete = false 53 | for (let video of videos) { 54 | let res = await axios.get(video.playUrl) 55 | let str = res.data.substr(res.data.indexOf("param['tvid']") + 15, 30) 56 | let tvid = str.match(/\"(\d.*)\"/)[1] 57 | res = await axios.request({ 58 | headers: { 59 | "referer": video.playUrl, 60 | "origin": "https://www.iqiyi.com", 61 | }, 62 | url: `https://l-rcd.iqiyi.com/apis/qiyirc/getvplay?tvId=${tvid}&agent_type=1`, 63 | method: 'get' 64 | }) 65 | if (res.data.indexOf('A00000') === -1) { 66 | continue 67 | } 68 | let history = JSON.parse(res.data) 69 | let videoPlayTime = (history.data && history.data.videoPlayTime) ? history.data.videoPlayTime : 1 70 | console.log('videoPlayTime', videoPlayTime) 71 | do { 72 | let report = `https://l-rcd.iqiyi.com/apis/qiyirc/setrc.php?tvId=${tvid}&terminalId=11&agent_type=1&videoPlayTime=${videoPlayTime}` 73 | videoPlayTime = videoPlayTime + 300 + parseInt(Math.random() * 30) 74 | res = await axios.request({ 75 | headers: { 76 | "referer": video.playUrl, 77 | "origin": "https://www.iqiyi.com", 78 | }, 79 | url: report, 80 | method: 'get' 81 | }) 82 | if (res.data.indexOf('A00000') === -1) { 83 | continue 84 | } 85 | console.log('上报播放时长', video.name, videoPlayTime) 86 | await new Promise((resolve, reject) => { 87 | setTimeout(resolve, 20 * 1000) 88 | }) 89 | } while (videoPlayTime <= 35 * 60) 90 | 91 | let cookiesJson = res.config.jar.toJSON() 92 | let P00001 = cookiesJson.cookies.find(i => i.key == 'P00001') 93 | P00001 = P00001.value 94 | let P00PRU = cookiesJson.cookies.find(i => i.key == 'P00PRU') 95 | P00PRU = P00PRU.value 96 | let dfp = cookiesJson.cookies.find(i => i.key == '_dfp') 97 | dfp = dfp.value.split("@")[0] 98 | 99 | var a = { 100 | 'agenttype': '1', 101 | 'agentversion': '0', 102 | 'appKey': 'basic_pcw', 103 | 'appver': '0', 104 | 'authCookie': P00001, 105 | 'srcplatform': '1', 106 | 'typeCode': 'point', 107 | 'userId': P00PRU, 108 | 'verticalCode': 'iQIYI' 109 | } 110 | console.log('查询观看视频任务状态') 111 | var c = k("UKobMjDMsDoScuWOfp6F", a, { 112 | split: "|", 113 | sort: !0, 114 | splitSecretKey: !0 115 | }) 116 | 117 | res = await axios.request({ 118 | headers: { 119 | "referer": "https://www.iqiyi.com", 120 | "origin": "https://www.iqiyi.com" 121 | }, 122 | url: "".concat("https://community.iqiyi.com/openApi/task/list", "?").concat(w(a), "&sign=").concat(c), 123 | method: 'post' 124 | }) 125 | 126 | if (res.data.code !== 'A00000') { 127 | console.log(res.data.message) 128 | continue 129 | } else { 130 | let it = res.data.data[0].find(i => i.channelCode === 'view_pcw') 131 | console.log('任务进度:已完成', it.processCount, '次') 132 | if (it.processCount >= 3) { 133 | isComplete = true 134 | break 135 | } 136 | } 137 | } 138 | if (!isComplete) { 139 | throw new Error('本次执行尚未完成视频观看任务,等待下次尝试') 140 | } 141 | }, 142 | } -------------------------------------------------------------------------------- /commands/tasks/iqiyi/init.js: -------------------------------------------------------------------------------- 1 | module.exports = (axios) => { 2 | return new Promise((resolve, reject) => { 3 | axios.request({ 4 | headers: { 5 | "referer": "https://www.iqiyi.com", 6 | "origin": "https://www.iqiyi.com" 7 | }, 8 | url: 'https://pcw-api.iqiyi.com/passport/user/userinfodetail' 9 | }).then(res => { 10 | let result = res.data 11 | if (result.code !== 'A00000' || !('nickname' in result.data.userInfo)) { 12 | throw new Error(result.message||result.data.verifyInfo.msg) 13 | } else { 14 | let userInfo = result.data 15 | console.log(`获取用户状态成功 nickname:%s`,userInfo.userInfo.nickname.substr(0, 2) + "********") 16 | resolve(userInfo) 17 | } 18 | }).catch(reject) 19 | }) 20 | } -------------------------------------------------------------------------------- /commands/tasks/iqiyi/iqiyi.js: -------------------------------------------------------------------------------- 1 | const _request = require('../../../utils/request') 2 | const { scheduler } = require('../../../utils/scheduler') 3 | var start = async (params) => { 4 | const { cookies, options } = params 5 | 6 | let init = async (request, savedCookies) => { 7 | if (!savedCookies) { 8 | if (!('P00001' in cookies) || !cookies['P00001']) { 9 | throw new Error("需要提供P00001参数") 10 | } 11 | if (!('P00PRU' in cookies) || !cookies['P00PRU']) { 12 | throw new Error("需要提供P00001参数") 13 | } 14 | if (!('_dfp' in cookies) || !cookies['_dfp']) { 15 | throw new Error("需要提供_dfp参数") 16 | } 17 | return { 18 | request: _request(cookies) 19 | } 20 | } else { 21 | return { 22 | request 23 | } 24 | } 25 | } 26 | let taskOption = { 27 | init 28 | } 29 | 30 | // 普通用户积分签到 31 | await scheduler.regTask('signPoint', async (request) => { 32 | await require('./signPoint')(request) 33 | }, taskOption) 34 | 35 | // 日常任务 36 | await scheduler.regTask('dailyTask', async (request) => { 37 | let { tasks } = await require('./dailyTask').getTasks(request) 38 | let { daily } = tasks 39 | await require('./dailyTask').joinTasks(request, daily) 40 | await require('./dailyTask').completeTasks(request, daily) 41 | }, taskOption) 42 | 43 | // vip 用户成长值签到 44 | 45 | // vip签到任务 46 | await scheduler.regTask('signVip', async (request) => { 47 | let userinfo = await require('./init')(request) 48 | if (userinfo.vipInfo.status === '1') { 49 | let isNotSign = await require('./signVip').querySignInfo(request) 50 | if (isNotSign) { 51 | await require('./signVip').vipSign(request) 52 | } 53 | } else { 54 | console.log('非vip会员跳过vip签到任务') 55 | } 56 | }, taskOption) 57 | 58 | // 浏览会员俱乐部任务 59 | await scheduler.regTask('dailyBrowserClub', async (request) => { 60 | let userinfo = await require('./init')(request) 61 | if (userinfo.vipInfo.status === '1') { 62 | await require('./dailyBrowserClub')(request) 63 | } else { 64 | console.log('非vip会员跳过浏览会员俱乐部任务') 65 | } 66 | }, taskOption) 67 | 68 | // 访问热点首页 69 | await scheduler.regTask('dailyFeed', async (request) => { 70 | let userinfo = await require('./init')(request) 71 | if (userinfo.vipInfo.status === '1') { 72 | await require('./dailyFeed')(request) 73 | } else { 74 | console.log('非vip会员跳过访问热点首页') 75 | } 76 | }, taskOption) 77 | 78 | // 每日观看视频30分钟3次 79 | await scheduler.regTask('dailyWatchVideo', async (request) => { 80 | let userinfo = await require('./init')(request) 81 | if (userinfo.vipInfo.status === '1') { 82 | // await require('./dailyWatchVideo').reportPlayTime(request) 83 | } else { 84 | console.log('非vip会员跳过每日观看视频30分钟3次') 85 | } 86 | }, taskOption) 87 | 88 | 89 | } 90 | module.exports = { 91 | start 92 | } -------------------------------------------------------------------------------- /commands/tasks/iqiyi/signPoint.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | function k (e, t) { 3 | var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {} 4 | , n = a.split 5 | , c = void 0 === n ? "|" : n 6 | , r = a.sort 7 | , s = void 0 === r || r 8 | , o = a.splitSecretKey 9 | , i = void 0 !== o && o 10 | , l = s ? Object.keys(t).sort() : Object.keys(t) 11 | , u = l.map((function (e) { 12 | return "".concat(e, "=").concat(t[e]) 13 | } 14 | )).join(c) + (i ? c : "") + e; 15 | return g(u) 16 | } 17 | function g (e) { 18 | return crypto.createHash("md5").update(e, "utf8").digest("hex") 19 | } 20 | function w () { 21 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 22 | , t = []; 23 | return Object.keys(e).forEach((function (a) { 24 | t.push("".concat(a, "=").concat(e[a])) 25 | } 26 | )), 27 | t.join("&") 28 | } 29 | module.exports = async (axios) => { 30 | console.log('普通用户积分签到') 31 | 32 | let P00001 = undefined 33 | let P00PRU = undefined 34 | let dfp = undefined 35 | let user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36' 36 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 37 | if (item.indexOf('P00001') === 0) { 38 | P00001 = item.split("=").pop() 39 | } 40 | if (item.indexOf('P00PRU') === 0) { 41 | P00PRU = item.split("=").pop() 42 | } 43 | if (item.indexOf('_dfp') === 0) { 44 | dfp = item.split("=").pop().split("@")[0] 45 | } 46 | }) 47 | var a = { 48 | agenttype: "1", 49 | agentversion: "0", 50 | appKey: "basic_pcw", 51 | appver: "0", 52 | authCookie: P00001, 53 | channelCode: "sign_pcw", 54 | dfp: dfp, 55 | scoreType: "1", 56 | srcplatform: "1", 57 | typeCode: "point", 58 | userId: P00PRU, 59 | user_agent: user_agent, 60 | verticalCode: "iQIYI" 61 | } 62 | var c = k("UKobMjDMsDoScuWOfp6F", a, { 63 | split: "|", 64 | sort: !0, 65 | splitSecretKey: !0 66 | }) 67 | let res = await axios.request({ 68 | headers: { 69 | "referer": "https://www.iqiyi.com", 70 | "origin": "https://www.iqiyi.com" 71 | }, 72 | url: "".concat("https://community.iqiyi.com/openApi/score/add", "?").concat(w(a), "&sign=").concat(c), 73 | method: 'post' 74 | }) 75 | let result = res.data 76 | 77 | if (result.code === 'A00000') { 78 | let data = result.data[0] 79 | if (result.code === 'A00000') { 80 | if (data.code === 'A0000') { 81 | console.log('积分签到:', '积分变动增加' + data.score) 82 | } else { 83 | console.log('积分签到:', data.message) 84 | } 85 | } else { 86 | console.log('积分签到:', result.message) 87 | } 88 | } else { 89 | console.log('积分签到:', result.message) 90 | } 91 | } -------------------------------------------------------------------------------- /commands/tasks/iqiyi/signVip.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | var moment = require('moment'); 3 | function k(e, t) { 4 | var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {} 5 | , n = a.split 6 | , c = void 0 === n ? "|" : n 7 | , r = a.sort 8 | , s = void 0 === r || r 9 | , o = a.splitSecretKey 10 | , i = void 0 !== o && o 11 | , l = s ? Object.keys(t).sort() : Object.keys(t) 12 | , u = l.map((function (e) { 13 | return "".concat(e, "=").concat(t[e]) 14 | } 15 | )).join(c) + (i ? c : "") + e; 16 | return g(u) 17 | } 18 | function g(e) { 19 | return crypto.createHash("md5").update(e, "utf8").digest("hex") 20 | } 21 | function w() { 22 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 23 | , t = []; 24 | return Object.keys(e).forEach((function (a) { 25 | t.push("".concat(a, "=").concat(e[a])) 26 | } 27 | )), 28 | t.join("&") 29 | } 30 | var sign = { 31 | querySignInfo: async (axios) => { 32 | console.log('查询签到状态') 33 | let P00001 = undefined 34 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 35 | if (item.indexOf('P00001') === 0) { 36 | P00001 = item.split("=").pop() 37 | } 38 | }) 39 | var a = moment().format('YYYYMMDDHHmmss') 40 | , i = crypto.createHash("md5").update(a, "utf8").digest("hex") 41 | , n = { 42 | P00001: P00001, 43 | platform: "b6c13e26323c537d", 44 | lang: "zh_CN", 45 | app_lm: "cn", 46 | deviceID: "", 47 | version: "", 48 | messageId: "PCW_" + i 49 | }; 50 | let { data } = await axios.request({ 51 | headers: { 52 | "referer": "https://www.iqiyi.com", 53 | "origin": "https://www.iqiyi.com" 54 | }, 55 | url: `https://tc.vip.iqiyi.com/taskCenter/task/querySignInfo`, 56 | method: 'get', 57 | params: n 58 | }) 59 | if (data.code === 'A00000') { 60 | let { isSign, continueSignDaysSum, todayGrowth } = data.data 61 | console.log(isSign === 'yes' ? `今日已签到,连续签到${continueSignDaysSum}天,成长值+${todayGrowth}` : '今日还未签到') 62 | return isSign !== 'yes' 63 | } else { 64 | console.log(data.msg) 65 | } 66 | }, 67 | vipSign: async (axios) => { 68 | console.log('进行VIP签到') 69 | let P00001 = undefined 70 | let QC005 = undefined 71 | axios.defaults.headers.Cookie.split('; ').forEach(item => { 72 | if (item.indexOf('P00001') === 0) { 73 | P00001 = item.split("=").pop() 74 | } 75 | if (item.indexOf('QC005') === 0) { 76 | QC005 = item.split("=").pop() 77 | } 78 | }) 79 | var a = { 80 | P00001: P00001, 81 | app_lm: 'cn', 82 | deviceID: QC005, 83 | fv: 'bed99b2cf5722bfe', 84 | lang: 'zh_CN', 85 | platform: 'b6c13e26323c537d', 86 | version: '' 87 | } 88 | let res = await axios.request({ 89 | headers: { 90 | "referer": "https://www.iqiyi.com", 91 | "origin": "https://www.iqiyi.com" 92 | }, 93 | url: "".concat("https://tc.vip.iqiyi.com/taskCenter/task/userSign", "?").concat(w(a)), 94 | method: 'post' 95 | }) 96 | data = res.data.data 97 | if (res.data.code === 'A00000') { 98 | console.log('成长值签到:', "签到成功!成长值+" + data.rewardMap.growth + "点,积分+" + data.rewardMap.integral + "点!", res.data.msg, '已连续签到:', data.signReached, '天') 99 | } else { 100 | console.log('成长值签到:', res.data.msg) 101 | if (data) { 102 | console.log('已连续签到:', data.continueSignDaysSum, '天') 103 | } 104 | } 105 | } 106 | } 107 | 108 | module.exports = sign -------------------------------------------------------------------------------- /commands/tasks/unicom/Niujie.js: -------------------------------------------------------------------------------- 1 | var transParams = (data) => { 2 | let params = new URLSearchParams(); 3 | for (let item in data) { 4 | params.append(item, data["" + item + ""]); 5 | } 6 | return params; 7 | }; 8 | 9 | var Niujie = { 10 | // 转盘抽奖3次-1000牛气抽1次 11 | CalfLottery: async (axios, options) => { 12 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} `; 13 | let n = 3; 14 | do { 15 | console.log("第", n, "次"); 16 | let { data } = await axios.request({ 17 | headers: { 18 | "user-agent": useragent, 19 | referer: "https://img.client.10010.com/2021springfestival/index.html", 20 | origin: "https://img.client.10010.com", 21 | }, 22 | url: `https://m.client.10010.com/Niujie/calf/CalfLottery`, 23 | method: "POST", 24 | }); 25 | console.log(data); 26 | await new Promise((resolve, reject) => setTimeout(resolve, 2500)); 27 | } while (--n); 28 | }, 29 | // 牛气如意-秒杀抢兑 30 | spikePrize: async (axios, options) => { 31 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} `; 32 | let prizes = [ 33 | { 34 | name: "vivos7", 35 | prizeId: "21013015030315978", 36 | }, 37 | { 38 | name: "8折充值券", 39 | prizeId: "21013123452511221", 40 | }, 41 | { 42 | name: "10G流量日包", 43 | prizeId: "21013015071318307", 44 | }, 45 | { 46 | name: "腾讯视频会员", 47 | prizeId: "21012919443117040", 48 | }, 49 | ]; 50 | for (let prize of prizes) { 51 | console.log("尝试抢兑", prize.name); 52 | let { data } = await axios.request({ 53 | headers: { 54 | "user-agent": useragent, 55 | referer: "https://img.client.10010.com/2021springfestival/index.html", 56 | origin: "https://img.client.10010.com", 57 | }, 58 | url: `https://m.client.10010.com/Niujie/imazamox/spikePrize`, 59 | method: "POST", 60 | data: transParams({ 61 | prizeId: prize.prizeId, 62 | }), 63 | }); 64 | console.log(data); 65 | } 66 | }, 67 | getTaskList: async (axios, options) => { 68 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} `; 69 | console.log("获取牛气任务中"); 70 | let { data } = await axios.request({ 71 | headers: { 72 | "user-agent": useragent, 73 | referer: "https://img.client.10010.com/2021springfestival/index.html", 74 | origin: "https://img.client.10010.com", 75 | }, 76 | url: `https://m.client.10010.com/Niujie/task/getTaskList`, 77 | method: "POST", 78 | }); 79 | return data.data; 80 | }, 81 | doNiuqiTask: async (axios, options) => { 82 | const { task } = options; 83 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} `; 84 | console.log("完成牛气任务中"); 85 | let { data } = await axios.request({ 86 | headers: { 87 | "user-agent": useragent, 88 | referer: "https://img.client.10010.com/2021springfestival/index.html", 89 | origin: "https://img.client.10010.com", 90 | }, 91 | url: `https://m.client.10010.com/Niujie/task/doTask`, 92 | method: "POST", 93 | data: transParams({ 94 | taskId: task.taskId, 95 | }), 96 | }); 97 | await axios.request({ 98 | headers: { 99 | "user-agent": useragent, 100 | referer: "https://img.client.10010.com/2021springfestival/index.html", 101 | origin: "https://img.client.10010.com", 102 | }, 103 | url: task.taskUrl, 104 | method: "get", 105 | }); 106 | console.log(data); 107 | await new Promise((resolve, reject) => setTimeout(resolve, 500)); 108 | }, 109 | doNiuqiTasks: async (axios, options) => { 110 | let tasklist = await Niujie.getTaskList(axios, options); 111 | tasklist = tasklist.filter((t) => t.taskStatus === "1"); 112 | if (!tasklist.length) { 113 | console.log("每天领取牛气任务已完成,跳过"); 114 | } 115 | for (let task of tasklist) { 116 | console.log("去完成", task.taskName); 117 | await Niujie.doNiuqiTask(axios, { 118 | ...options, 119 | task, 120 | }); 121 | } 122 | }, 123 | doTask: async (axios, options) => { 124 | await Niujie.doNiuqiTasks(axios, options); 125 | await Niujie.CalfLottery(axios, options); 126 | }, 127 | receiveCalf: async (axios, options) => { 128 | console.log("开始领取牛气值"); 129 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} `; 130 | await axios.request({ 131 | headers: { 132 | "user-agent": useragent, 133 | origin: "https://img.client.10010.com", 134 | }, 135 | url: "https://img.client.10010.com/2021springfestival/index.html", 136 | method: "get", 137 | }); 138 | let shops = [ 139 | "BdShopVenue", 140 | "CfShopVenue", 141 | "DpShopVenue", 142 | "FGShopVenue", 143 | "JjShopVenue", 144 | "HqShopVenue", 145 | "NqShopVenue", 146 | "WzShopVenue", 147 | "XxShopVenue", 148 | ]; 149 | for (let shop of shops) { 150 | let { data } = await axios.request({ 151 | headers: { 152 | "user-agent": useragent, 153 | referer: "https://img.client.10010.com/2021springfestival/index.html", 154 | origin: "https://img.client.10010.com", 155 | }, 156 | url: "https://m.client.10010.com/Niujie/calf/receiveCalf?shop=" + shop, 157 | method: "get", 158 | }); 159 | console.log(data.message); 160 | await new Promise((resolve, reject) => setTimeout(resolve, 500)); 161 | } 162 | console.log("本轮牛气值领取完毕"); 163 | }, 164 | }; 165 | 166 | module.exports = Niujie; 167 | -------------------------------------------------------------------------------- /commands/tasks/unicom/book5video.js: -------------------------------------------------------------------------------- 1 | //看书里面的5个视频 2 | //活动入口:主页-小说标签-任意一本小说内页章节中间 3 | var crypto = require("crypto"); 4 | var sign = (data) => { 5 | let str = "integralofficial&"; 6 | let params = []; 7 | data.forEach((v, i) => { 8 | if (v) { 9 | params.push("arguments" + (i + 1) + v); 10 | } 11 | }); 12 | return crypto 13 | .createHash("md5") 14 | .update(str + params.join("&")) 15 | .digest("hex"); 16 | }; 17 | let account = { 18 | yhTaskId: "5a6dd5106495402d9dcc5e801f3171b3", 19 | yhChannel: "GGPD", 20 | accountChannel: "517050707", 21 | accountUserName: "517050707", 22 | accountPassword: "a123456", 23 | accountToken: "4640b530b3f7481bb5821c6871854ce5", 24 | }; 25 | var book5video = { 26 | query: async (request, options) => { 27 | let params = { 28 | arguments1: "AC20200521222721", // acid 29 | arguments2: account.yhChannel, // yhChannel 30 | arguments3: account.yhTaskId, // yhTaskId menuId 31 | arguments4: new Date().getTime(), // time 32 | arguments6: "", 33 | netWay: "Wifi", 34 | version: `android@8.0102`, 35 | }; 36 | params["sign"] = sign([ 37 | params.arguments1, 38 | params.arguments2, 39 | params.arguments3, 40 | params.arguments4, 41 | ]); 42 | return await require("./taskcallback").query(request, { 43 | ...options, 44 | params, 45 | }); 46 | }, 47 | doTask: async (request, options) => { 48 | console.log("🐀 看书看累了看看广告..."); 49 | let { 50 | num, 51 | jar 52 | } = await book5video.query(request, options); 53 | // console.log(num); 54 | 55 | if (!num) { 56 | console.log("🐀 看书中广告得积分: 今日已完成"); 57 | return; 58 | } 59 | do { 60 | // console.log("还有", num, "次"); 61 | let params = { 62 | arguments1: "AC20200521222721", // acid 63 | arguments2: account.yhChannel, // yhChannel 64 | arguments3: account.yhTaskId, // yhTaskId menuId 65 | arguments4: new Date().getTime(), // time 66 | arguments6: "", 67 | arguments7: "woyuedu", 68 | arguments8: "a123456", 69 | arguments9: "", 70 | orderId: crypto 71 | .createHash("md5") 72 | .update(new Date().getTime() + "") 73 | .digest("hex"), 74 | netWay: "Wifi", 75 | remark: "章节视频得积分", 76 | version: `android@8.0102`, 77 | //orderId: "0923fca6d5ffb8ec017fc6b3cbc5c9c0", 78 | }; 79 | params["sign"] = sign([ 80 | params.arguments1, 81 | params.arguments2, 82 | params.arguments3, 83 | params.arguments4, 84 | ]); 85 | await require("./taskcallback").doTask(request, { 86 | ...options, 87 | params, 88 | jar, 89 | }); 90 | 91 | let s = Math.floor(Math.random() * 30); 92 | console.log("☕ 等待%s秒再继续", s); 93 | // eslint-disable-next-line no-unused-vars 94 | await new Promise((resolve, reject) => setTimeout(resolve, s * 1000)); 95 | } while (--num); 96 | }, 97 | }; 98 | 99 | module.exports = book5video; 100 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyBaWangcard.js: -------------------------------------------------------------------------------- 1 | var crypto = require("crypto"); 2 | var moment = require("moment"); 3 | const gameEvents = require("./handlers/dailyEvent"); 4 | let { sign } = require("./handlers/PAES.js"); 5 | const { sleep, UnicomRequest, encodePhone } = require("./handlers/gameUtils"); 6 | // 霸王餐刮刮卡 7 | let dailyBaWangcard = { 8 | getOpenPlatLine: gameEvents.getOpenPlatLine( 9 | `https://m.client.10010.com/mobileService/openPlatform/openPlatLine.htm?to_url=https://wxapp.msmds.cn/h5/react_web/unicom/luckCardPage&duanlianjieabc=tbkd2`, 10 | { base: "msmds" } 11 | ), 12 | doTask: async (axios, options) => { 13 | console.log("🤔 刮刮霸王餐开始..."); 14 | let phone = encodePhone(options.user); 15 | let cookies = await dailyBaWangcard.getOpenPlatLine(axios, options); 16 | let times = await dailyBaWangcard.getScratchCardNum(axios, options, { 17 | ...cookies, 18 | phone, 19 | }); 20 | await dailyBaWangcard.postScratch( 21 | axios, 22 | options, 23 | { ...cookies, phone }, 24 | times 25 | ); 26 | }, 27 | getScratchCardNum: async ( 28 | axios, 29 | options, 30 | // eslint-disable-next-line no-unused-vars 31 | { ecs_token, searchParams, jar1, phone } 32 | ) => { 33 | let request = new UnicomRequest(axios, options); 34 | let result = await request.postMsmds( 35 | "https://wxapp.msmds.cn/jplus/api/scratchCardRecord/getScratchCardNum", 36 | { 37 | channelId: "unicom_scratch_card", 38 | phone: phone, 39 | token: ecs_token, 40 | }, 41 | { 42 | referer: `https://wxapp.msmds.cn/`, 43 | origin: "https://wxapp.msmds.cn", 44 | } 45 | ); 46 | if (result.data.code !== 200) { 47 | throw new Error("❌ something errors: ", result.data.msg); 48 | } 49 | return { 50 | freeTimes: result.data.data.surplusNum, 51 | advertTimes: result.data.data.canLookVideo 52 | ? 4 - result.data.data.playNum 53 | : 0, 54 | }; 55 | }, 56 | postScratch: async ( 57 | axios, 58 | options, 59 | { ecs_token, searchParams, jar1, phone }, 60 | { freeTimes, advertTimes } 61 | ) => { 62 | do { 63 | console.log( 64 | "已消耗机会", 65 | 1 + 4 - (freeTimes + advertTimes), 66 | "剩余免费机会", 67 | freeTimes, 68 | "看视频广告机会", 69 | advertTimes 70 | ); 71 | if (!freeTimes && advertTimes) { 72 | console.log("视频补充"); 73 | let params = { 74 | arguments1: "AC20200716103629", // acid 75 | arguments2: "GGPD", // yhChannel 76 | arguments3: "9e368d7f6c474cc8a1491d6a9fabad45", // yhTaskId menuId 77 | arguments4: new Date().getTime(), // time 78 | arguments6: "517050707", 79 | arguments7: "517050707", 80 | arguments8: "123456", 81 | arguments9: "4640b530b3f7481bb5821c6871854ce5", 82 | netWay: "Wifi", 83 | remark1: "签到小游戏刮刮卡", 84 | remark: "签到页小游戏", 85 | version: `android@8.0102`, 86 | codeId: 945363379, 87 | }; 88 | params["sign"] = sign([ 89 | params.arguments1, 90 | params.arguments2, 91 | params.arguments3, 92 | params.arguments4, 93 | ]); 94 | params["orderId"] = crypto 95 | .createHash("md5") 96 | .update(new Date().getTime() + "") 97 | .digest("hex"); 98 | params["arguments4"] = new Date().getTime(); 99 | console.log("看视频广告中..."); 100 | let result = await require("./taskcallback").reward(axios, { 101 | ...options, 102 | params, 103 | jar: jar1, 104 | }); 105 | console.log(`广告ID:`, result["orderId"]); 106 | let body = { 107 | channelId: "unicom_scratch_card", 108 | phone: phone, 109 | num: advertTimes, 110 | token: ecs_token, 111 | videoOrderNo: params["orderId"], 112 | }; 113 | let request = new UnicomRequest(axios, options); 114 | let timestamp = moment().format("YYYYMMDDHHmmss"); 115 | let { data } = await request.postMsmds( 116 | "https://wxapp.msmds.cn/jplus/api/scratchCardRecord/addScratchCardNum", 117 | body, 118 | { 119 | referer: `https://wxapp.msmds.cn/h5/react_web/unicom/luckCardPage?source=unicom&type=06&ticket=${searchParams.ticket}&version=android@8.0102×tamp=${timestamp}&desmobile=${options.user}&num=0&postage=${searchParams.postage}&duanlianjieabc=tbkd2&userNumber=${options.user}`, 120 | } 121 | ); 122 | 123 | console.log("观看视频得机会..."); 124 | await sleep(30); 125 | if (data.code !== 200) { 126 | console.log("提交任务失败", data.msg); 127 | break; 128 | } else { 129 | console.log("提交任务成功", `${data.data.msg}`); 130 | } 131 | advertTimes--; 132 | } else { 133 | freeTimes--; 134 | } 135 | 136 | let body = { 137 | channelId: "unicom_scratch_card", 138 | phone: phone, 139 | token: ecs_token, 140 | flag: "", 141 | taskId: "", 142 | }; 143 | // https://wxapp.msmds.cn/h5/react_web/unicom/luckCardPage?ticket=nep4v4jza360c1dc9a946b8c51c892d7f3af8f02jadbs3o7&type=06&version=iphone_c@8.0102×tamp=20210214112354&desmobile=这是电话号码&num=0&postage=494bef815366a0e8007c66d19f38ec07&duanlianjieabc=tbkd2&userNumber=这是电话号码 144 | let request = new UnicomRequest(axios, options); 145 | let timestamp = moment().format("YYYYMMDDHHmmss"); 146 | let { data } = await request.postMsmds( 147 | "https://wxapp.msmds.cn/jplus/api/scratchCardRecord/scratchCard", 148 | body, 149 | { 150 | referer: `https://wxapp.msmds.cn/h5/react_web/unicom/luckCardPage?source=unicom&type=06&ticket=${searchParams.ticket}&version=android@8.0102×tamp=${timestamp}&desmobile=${options.user}&num=0&postage=${searchParams.postage}&duanlianjieabc=tbkd2&userNumber=${options.user}`, 151 | } 152 | ); 153 | console.log( 154 | "🎉 刮刮卡结果:", 155 | data.data.msg, 156 | data.data.giftNum ? `+${data.data.giftNum}积分` : "" 157 | ); 158 | if (data.data["canDouble"]) { 159 | console.log("准备翻倍积分..."); 160 | await sleep(30); 161 | await dailyBaWangcard.lookVideoDouble(axios, options); 162 | } 163 | await sleep(15); 164 | //对循环多跑一次 165 | } while (freeTimes >= 0 || advertTimes > 0); 166 | }, 167 | lookVideoDouble: gameEvents.lookVideoDouble( 168 | { 169 | arguments1: "AC20200716103629", 170 | arguments2: "GGPD", 171 | arguments3: "9e368d7f6c474cc8a1491d6a9fabad45", 172 | arguments4: new Date().getTime(), 173 | arguments6: "517050707", 174 | netWay: "Wifi", 175 | version: `android@8.0102`, 176 | }, 177 | { 178 | arguments1: "AC20200716103629", // acid 179 | arguments2: "GGPD", // yhChannel 180 | arguments3: "9e368d7f6c474cc8a1491d6a9fabad45", // yhTaskId menuId 181 | arguments4: new Date().getTime(), // time 182 | arguments6: "517050707", 183 | arguments7: "517050707", 184 | arguments8: "123456", 185 | arguments9: "4640b530b3f7481bb5821c6871854ce5", 186 | orderId: crypto 187 | .createHash("md5") 188 | .update(new Date().getTime() + "") 189 | .digest("hex"), 190 | netWay: "Wifi", 191 | remark: "签到小游戏翻倍得积分", 192 | version: `android@8.0102`, 193 | codeId: 945689604, 194 | }, 195 | "刮刮卡" 196 | ), 197 | }; 198 | 199 | module.exports = dailyBaWangcard; 200 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyBcow.js: -------------------------------------------------------------------------------- 1 | let crypto = require("crypto"); 2 | let moment = require("moment"); 3 | let AES = require("./handlers/PAES.js"); 4 | const useragent = require("./handlers/myPhone").useragent; 5 | const gameEvents = require("./handlers/dailyEvent"); 6 | const referer = 7 | "https://m.jf.10010.com/cms/yuech/unicom-integral-ui/yuech-qd/bcow/index.html?jump=sign"; 8 | /** 9 | * 入口:首页=>签到=>免费抽 赢牛拿奖 10 | */ 11 | let bcow; 12 | module.exports = bcow = { 13 | doTask: async (axios, options) => { 14 | console.log("🔔 开始翻牛牌\n"); 15 | let cookies = await bcow.getOpenPlatLine(axios, options); 16 | let data = await bcow.postFreeLoginRock(axios, options, cookies); 17 | await bcow.postTimesDrawForPrize(axios, options, cookies, data); 18 | }, 19 | getOpenPlatLine: gameEvents.getOpenPlatLine( 20 | `https://m.client.10010.com/mobileService/openPlatform/openPlatLine.htm?to_url=https://m.jf.10010.com/jf-order/avoidLogin/forActive/ncow&duanlianjieabc=tbLlf` 21 | ), 22 | postFreeLoginRock: gameEvents.postFreeLoginRock(referer, "Ac-yccnk"), 23 | postTimesDrawForPrize: async ( 24 | axios, 25 | options, 26 | // eslint-disable-next-line no-unused-vars 27 | { jfid, searchParams, jar1 }, 28 | { activity, Authorization, freeTimes, advertTimes } 29 | ) => { 30 | do { 31 | let orderId = ""; 32 | console.log( 33 | "已消耗机会", 34 | 1 + 4 - (freeTimes + advertTimes), 35 | "剩余免费机会", 36 | freeTimes, 37 | "看视频广告机会", 38 | advertTimes 39 | ); 40 | 41 | if (!freeTimes && !advertTimes) { 42 | console.log("没有游戏次数"); 43 | break; 44 | } 45 | 46 | // let currentTimes = 1 + 4 - (freeTimes + advertTimes) + 1; 47 | 48 | let p1 = { 49 | activityId: activity.activityId, 50 | currentTimes: freeTimes, 51 | type: "免费", 52 | }; 53 | 54 | //check game time information 55 | if (!freeTimes && advertTimes) { 56 | let params = { 57 | arguments1: "AC20200611152252", 58 | arguments2: "GGPD", 59 | arguments3: "627292f1243148159c58fd58917c3e67", 60 | arguments4: new Date().getTime(), 61 | arguments6: "517050707", 62 | arguments7: "517050707", 63 | arguments8: "123456", 64 | arguments9: "4640b530b3f7481bb5821c6871854ce5", 65 | netWay: "Wifi", 66 | remark1: "签到翻牛牌活动", 67 | remark: "签到看视频翻倍得积分", 68 | version: `android@8.0102`, 69 | codeId: 945689604, 70 | }; 71 | params["sign"] = AES.sign([ 72 | params.arguments1, 73 | params.arguments2, 74 | params.arguments3, 75 | params.arguments4, 76 | params.arguments6, 77 | params.arguments7, 78 | params.arguments8, 79 | params.arguments9, 80 | ]); 81 | params["orderId"] = crypto 82 | .createHash("md5") 83 | .update(new Date().getTime() + "") 84 | .digest("hex"); 85 | params["arguments4"] = new Date().getTime(); 86 | 87 | await require("./taskcallback").reward(axios, { 88 | ...options, 89 | params, 90 | jar: jar1, 91 | }); 92 | 93 | let timestamp = moment().format("YYYYMMDDHHmmss"); 94 | await axios.request({ 95 | headers: { 96 | "user-agent": useragent(options), 97 | referer: `https://img.client.10010.com/`, 98 | }, 99 | url: `https://m.jf.10010.com/jf-order/avoidLogin/forActive/ncow?ticket=${searchParams.ticket}&type=02&version=android@8.0102×tamp=${timestamp}&desmobile=${options.user}&num=0&postage=${searchParams.postage}&duanlianjieabc=tbLlf&userNumber=${options.user}`, 100 | method: "GET", 101 | }); 102 | 103 | orderId = params["orderId"]; 104 | p1 = { 105 | activityId: activity.activityId, 106 | currentTimes: advertTimes, 107 | type: "广告", 108 | orderId: orderId, 109 | phoneType: "android", 110 | version: "8.0102", 111 | }; 112 | advertTimes--; 113 | // eslint-disable-next-line no-unused-vars 114 | } else { 115 | freeTimes--; 116 | } 117 | 118 | //join the game 119 | let params = gameEvents.encodeParams(p1, true); 120 | let res = await axios 121 | .request({ 122 | baseURL: "https://m.jf.10010.com/", 123 | headers: { 124 | Authorization: `Bearer ${Authorization}`, 125 | "user-agent": useragent(options), 126 | referer, 127 | origin: "https://m.jf.10010.com", 128 | "Content-Type": "application/json;charset=UTF-8", 129 | }, 130 | url: `/jf-yuech/api/gameResultV2/timesDrawForPrize`, 131 | method: "post", 132 | data: params, 133 | }) 134 | .catch((err) => console.log(err)); 135 | 136 | let result = res.data; 137 | if (result.code !== 0) { 138 | console.log("翻牛牌送好礼:", result.message); 139 | } else { 140 | console.log( 141 | "翻牛牌送好礼:", 142 | result.data.drawResultPO !== null 143 | ? result.data.drawResultPO.prizeName 144 | : "未中奖" 145 | ); 146 | if ( 147 | result.data.drawResultPO !== null && 148 | result.data.drawResultPO.doublingStatus 149 | ) { 150 | console.log("🌈 提交积分翻倍"); 151 | await bcow.lookVideoDouble(axios, { 152 | ...options, 153 | }); 154 | await bcow.lookVideoDoubleResult(axios, { 155 | ...options, 156 | Authorization, 157 | activityId: activity.activityId, 158 | winningRecordId: result.data.drawResultPO.winningRecordId, 159 | }); 160 | } 161 | } 162 | } while (freeTimes || advertTimes); 163 | }, 164 | lookVideoDouble: async (axios, options) => { 165 | let params = { 166 | arguments1: "AC20200611152252", 167 | arguments2: "GGPD", 168 | arguments3: "627292f1243148159c58fd58917c3e67", 169 | arguments4: new Date().getTime(), 170 | arguments6: "517050707", 171 | arguments7: "517050707", 172 | arguments8: "123456", 173 | arguments9: "4640b530b3f7481bb5821c6871854ce5", 174 | netWay: "Wifi", 175 | remark1: "签到翻牛牌活动", 176 | remark: "签到看视频翻倍得积分", 177 | version: `android@8.0102`, 178 | codeId: 945689604, 179 | }; 180 | params["sign"] = AES.sign([ 181 | params.arguments1, 182 | params.arguments2, 183 | params.arguments3, 184 | params.arguments4, 185 | ]); 186 | let { num, jar } = await require("./taskcallback").query(axios, { 187 | ...options, 188 | params, 189 | }); 190 | 191 | if (!num) { 192 | console.log("签到小游戏翻牛牌: 今日已完成"); 193 | return; 194 | } 195 | 196 | params = { 197 | arguments1: "AC20200611152252", // acid 198 | arguments2: "GGPD", // yhChannel 199 | arguments3: "627292f1243148159c58fd58917c3e67", // yhTaskId menuId 200 | arguments4: new Date().getTime(), // time 201 | arguments6: "", 202 | arguments7: "", 203 | arguments8: "", 204 | arguments9: "", 205 | orderId: crypto 206 | .createHash("md5") 207 | .update(new Date().getTime() + "") 208 | .digest("hex"), 209 | netWay: "Wifi", 210 | remark: "签到小游戏翻牛牌", 211 | version: `android@8.0100`, 212 | codeId: 945689604, 213 | }; 214 | params["sign"] = AES.sign([ 215 | params.arguments1, 216 | params.arguments2, 217 | params.arguments3, 218 | params.arguments4, 219 | ]); 220 | await require("./taskcallback").doTask(axios, { 221 | ...options, 222 | params, 223 | jar, 224 | }); 225 | }, 226 | lookVideoDoubleResult: gameEvents.lookVideoDoubleResult("翻牛牌送好礼"), 227 | }; 228 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyBookLuckdraw.js: -------------------------------------------------------------------------------- 1 | var crypto = require("crypto"); 2 | var CryptoJS = require("crypto-js"); 3 | const { RSAUtils } = require("./RSAUtils"); 4 | 5 | var transParams = (data) => { 6 | let params = new URLSearchParams(); 7 | for (let item in data) { 8 | params.append(item, data["" + item + ""]); 9 | } 10 | return params; 11 | }; 12 | 13 | var sign = (data) => { 14 | let str = "integralofficial&"; 15 | let params = []; 16 | data.forEach((v, i) => { 17 | if (v) { 18 | params.push("arguments" + (i + 1) + v); 19 | } 20 | }); 21 | return crypto 22 | .createHash("md5") 23 | .update(str + params.join("&")) 24 | .digest("hex"); 25 | }; 26 | 27 | var dailyBookLuckdraw = { 28 | oauthMethod: async (axios, options) => { 29 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} `; 30 | let { data } = await axios.request({ 31 | headers: { 32 | "user-agent": useragent, 33 | referer: `https://img.client.10010.com/`, 34 | origin: "https://img.client.10010.com", 35 | }, 36 | url: `https://m.client.10010.com/finderInterface/woReadOauth/?typeCode=oauthMethod`, 37 | method: "GET", 38 | }); 39 | return data.data.key; 40 | }, 41 | login: async (axios, options) => { 42 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} `; 43 | 44 | //密码加密 45 | var modulus = 46 | "00D9C7EE8B8C599CD75FC2629DBFC18625B677E6BA66E81102CF2D644A5C3550775163095A3AA7ED9091F0152A0B764EF8C301B63097495C7E4EA7CF2795029F61229828221B510AAE9A594CA002BA4F44CA7D1196697AEB833FD95F2FA6A5B9C2C0C44220E1761B4AB1A1520612754E94C55DC097D02C2157A8E8F159232ABC87"; 47 | var exponent = "010001"; 48 | var key = RSAUtils.getKeyPair(exponent, "", modulus); 49 | let phonenum = RSAUtils.encryptedString(key, options.user); 50 | let { data, config } = await axios.request({ 51 | headers: { 52 | "user-agent": useragent, 53 | "X-Requested-With": "com.sinovatech.unicom.ui", 54 | }, 55 | url: `https://m.iread.wo.cn/touchextenernal/common/shouTingLogin.action`, 56 | method: "POST", 57 | data: transParams({ 58 | phonenum, 59 | }), 60 | }); 61 | let jar = config.jar; 62 | let cookiesJson = jar.toJSON(); 63 | let diwert = cookiesJson.cookies.find((i) => i.key == "diwert"); 64 | let useraccount = cookiesJson.cookies.find((i) => i.key == "useraccount"); 65 | if (!useraccount || !diwert) { 66 | throw new Error("获取用户信息失败"); 67 | } 68 | 69 | await axios.request({ 70 | headers: { 71 | "user-agent": useragent, 72 | }, 73 | jar, 74 | url: `http://m.iread.wo.cn/touchextenernal/seeadvertluckdraw/index.action?channelid=18000018&yw_code=&desmobile=${options.user}&version=android@8.0100`, 75 | method: "GET", 76 | }); 77 | 78 | return { 79 | jar, 80 | }; 81 | }, 82 | doTask: async (axios, options) => { 83 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} `; 84 | let Authorization = await dailyBookLuckdraw.oauthMethod(axios, options); 85 | let { jar } = await dailyBookLuckdraw.login(axios, { 86 | ...options, 87 | Authorization, 88 | }); 89 | 90 | let times = 5; 91 | do { 92 | if (times < 5) { 93 | let params = { 94 | arguments1: "AC20200521222721", 95 | arguments2: "GGPD", 96 | arguments3: "", 97 | arguments4: new Date().getTime(), 98 | arguments6: "", 99 | arguments7: "", 100 | arguments8: "", 101 | arguments9: "", 102 | netWay: "Wifi", 103 | remark: "阅读每日读书福利广告1", 104 | remark1: "阅读每日读书福利广告1", 105 | version: `android@8.0100`, 106 | codeId: 945535424, 107 | }; 108 | 109 | params["sign"] = sign([ 110 | params.arguments1, 111 | params.arguments2, 112 | params.arguments3, 113 | params.arguments4, 114 | ]); 115 | params["orderId"] = crypto 116 | .createHash("md5") 117 | .update(new Date().getTime() + "") 118 | .digest("hex"); 119 | params["arguments4"] = new Date().getTime(); 120 | 121 | await require("./taskcallback").reward(axios, { 122 | ...options, 123 | params, 124 | jar, 125 | }); 126 | } 127 | 128 | let res = await axios 129 | .request({ 130 | headers: { 131 | "user-agent": useragent, 132 | }, 133 | jar, 134 | url: `http://m.iread.wo.cn/touchextenernal/seeadvertluckdraw/doDraw.action`, 135 | method: "POST", 136 | data: transParams({ 137 | acticeindex: "NzJBQTQxMEE2QzQwQUE2MDYxMEI5MDNGQjFEMEEzODI=", 138 | }), 139 | }) 140 | .catch((err) => { 141 | if (err.response.status !== 200) { 142 | console.log("访问错误", err.response.statusText); 143 | throw new Error( 144 | "访问错误:" + 145 | [err.response.status, err.response.statusText].join("-") 146 | ); 147 | } 148 | }); 149 | let result = res.data; 150 | if (result.code === "0000") { 151 | console.log("阅读每日读书福利抽奖", result.prizedesc); 152 | } else if (result.code === "9999") { 153 | console.log("阅读每日读书福利抽奖", result.message); 154 | break; 155 | } else { 156 | console.log("阅读每日读书福利抽奖", result.message); 157 | } 158 | 159 | console.log("等待15秒再继续"); 160 | await new Promise((resolve, reject) => setTimeout(resolve, 15 * 1000)); 161 | } while (--times); 162 | }, 163 | }; 164 | 165 | module.exports = dailyBookLuckdraw; 166 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyBookRead.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | var sign = (data) => { 3 | let str = 'integralofficial&' 4 | let params = [] 5 | data.forEach((v, i) => { 6 | if (v) { 7 | params.push('arguments' + (i + 1) + v) 8 | } 9 | }); 10 | return crypto.createHash('md5').update(str + params.join('&')).digest('hex') 11 | } 12 | let account = { 13 | yhTaskId: "93273c65ee2048c29b8e630a4b456cf0", 14 | yhChannel: "GGPD", 15 | accountChannel: "517050707", 16 | accountUserName: "517050707", 17 | accountPassword: "123456", 18 | accountToken: "4640b530b3f7481bb5821c6871854ce5", 19 | } 20 | var dailyTTliulan = { 21 | query: async (request, options) => { 22 | let params = { 23 | 'arguments1': 'AC20200521222721', // acid 24 | 'arguments2': account.yhChannel, // yhChannel 25 | 'arguments3': account.yhTaskId, // yhTaskId menuId 26 | 'arguments4': new Date().getTime(), // time 27 | 'arguments6': account.accountChannel, 28 | 'netWay': 'Wifi', 29 | 'version': `android@8.0100`, 30 | } 31 | params['sign'] = sign([params.arguments1, params.arguments2, params.arguments3, params.arguments4]) 32 | return await require('./taskcallback').query(request, { 33 | ...options, 34 | params 35 | }) 36 | }, 37 | doTask: async (request, options) => { 38 | let { num, jar } = await dailyTTliulan.query(request, options) 39 | if (!num) { 40 | console.log('阅读计时器任务得积分: 今日已完成') 41 | return 42 | } 43 | do { 44 | console.log('第', num, '次') 45 | let params = { 46 | 'arguments1': 'AC20200521222721', // acid 47 | 'arguments2': account.yhChannel, // yhChannel 48 | 'arguments3': account.yhTaskId, // yhTaskId menuId 49 | 'arguments4': new Date().getTime(), // time 50 | 'arguments6': account.accountChannel, 51 | 'arguments7': account.accountUserName, 52 | 'arguments8': account.accountPassword, 53 | 'arguments9': account.accountToken, 54 | 'orderId': crypto.createHash('md5').update(new Date().getTime() + '').digest('hex'), 55 | 'netWay': 'Wifi', 56 | 'remark': '阅读计时器任务得积分', 57 | 'version': `android@8.0100`, 58 | 'codeId': 945535616 59 | } 60 | params['sign'] = sign([params.arguments1, params.arguments2, params.arguments3, params.arguments4]) 61 | await require('./taskcallback').doTask(request, { 62 | ...options, 63 | params, 64 | jar 65 | }) 66 | let s = Math.floor(Math.random() * 20) 67 | console.log('等待%s秒再继续', s) 68 | await new Promise((resolve, reject) => setTimeout(resolve, s * 1000)) 69 | } while (--num) 70 | } 71 | } 72 | 73 | module.exports = dailyTTliulan -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyEggachine.js: -------------------------------------------------------------------------------- 1 | let crypto = require("crypto"); 2 | let CryptoJS = require("crypto-js"); 3 | let moment = require("moment"); 4 | 5 | module.exports = eggachine = { 6 | doTask: async (axios, options) => { 7 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0102,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:}`; 8 | let searchParams = {}; 9 | let result = await axios 10 | .request({ 11 | baseURL: "https://m.client.10010.com/", 12 | headers: { 13 | "user-agent": useragent, 14 | referer: `https://img.client.10010.com/`, 15 | origin: "https://img.client.10010.com", 16 | }, 17 | url: `https://m.client.10010.com/mobileService/openPlatform/openPlatLine.htm?to_url=https://m.jf.10010.com/jf-order/avoidLogin/forActive/ncow&duanlianjieabc=tbLlf`, 18 | url: `https://m.client.10010.com/mobileService/openPlatform/openPlatLine.htm?to_url=https://m.jf.10010.com/jf-order/avoidLogin/forActive/stxyndj`, 19 | method: "GET", 20 | transformResponse: (data, headers) => { 21 | if ("location" in headers) { 22 | let uu = new URL(headers.location); 23 | let pp = {}; 24 | for (let p of uu.searchParams) { 25 | pp[p[0]] = p[1]; 26 | } 27 | if ("ticket" in pp) { 28 | searchParams = pp; 29 | } 30 | } 31 | return data; 32 | }, 33 | }) 34 | .catch((err) => console.log(err)); 35 | let jar1 = result.config.jar; 36 | 37 | let cookiesJson = jar1.toJSON(); 38 | console.log(cookiesJson); 39 | let ecs_token = cookiesJson.cookies.find((i) => i.key == "ecs_token"); 40 | if (!ecs_token) { 41 | throw new Error("ecs_token缺失"); 42 | } 43 | ecs_token = ecs_token.value; 44 | let jfid = cookiesJson.cookies.find((i) => i.key == "_jf_id"); 45 | if (!jfid) { 46 | throw new Error("jfid缺失"); 47 | } 48 | jfid = jfid.value; 49 | }, 50 | }; 51 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyTTliulan.js: -------------------------------------------------------------------------------- 1 | var crypto = require("crypto"); 2 | var sign = (data) => { 3 | let str = "integralofficial&"; 4 | let params = []; 5 | data.forEach((v, i) => { 6 | if (v) { 7 | params.push("arguments" + (i + 1) + v); 8 | } 9 | }); 10 | return crypto 11 | .createHash("md5") 12 | .update(str + params.join("&")) 13 | .digest("hex"); 14 | }; 15 | let account = { 16 | yhTaskId: "6c54032f662c4d2bb576872ed408232c", 17 | yhChannel: "GGPD", 18 | accountChannel: "517050707", 19 | accountUserName: "517050707", 20 | accountPassword: "123456", 21 | accountToken: "4640b530b3f7481bb5821c6871854ce5", 22 | }; 23 | var dailyTTliulan = { 24 | query: async (request, options) => { 25 | let params = { 26 | arguments1: "AC20200814162815", // acid 27 | arguments2: account.yhChannel, // yhChannel 28 | arguments3: account.yhTaskId, // yhTaskId menuId 29 | arguments4: new Date().getTime(), // time 30 | arguments6: account.accountChannel, 31 | netWay: "Wifi", 32 | version: `android@8.0100`, 33 | }; 34 | params["sign"] = sign([ 35 | params.arguments1, 36 | params.arguments2, 37 | params.arguments3, 38 | params.arguments4, 39 | ]); 40 | return await require("./taskcallback").query(request, { 41 | ...options, 42 | params, 43 | }); 44 | }, 45 | doTask: async (request, options) => { 46 | let { num, jar } = await dailyTTliulan.query(request, options); 47 | if (!num) { 48 | console.log("手厅浏览有礼发积分: 今日已完成"); 49 | return; 50 | } 51 | do { 52 | console.log("第", num, "次"); 53 | let params = { 54 | arguments1: "AC20200814162815", // acid 55 | arguments2: account.yhChannel, // yhChannel 56 | arguments3: account.yhTaskId, // yhTaskId menuId 57 | arguments4: new Date().getTime(), // time 58 | arguments6: account.accountChannel, 59 | arguments7: account.accountUserName, 60 | arguments8: account.accountPassword, 61 | arguments9: account.accountToken, 62 | orderId: crypto 63 | .createHash("md5") 64 | .update(new Date().getTime() + "") 65 | .digest("hex"), 66 | netWay: "Wifi", 67 | remark: "手厅浏览有礼发积分", 68 | version: `android@8.0100`, 69 | codeId: 945535616, 70 | }; 71 | params["sign"] = sign([ 72 | params.arguments1, 73 | params.arguments2, 74 | params.arguments3, 75 | params.arguments4, 76 | ]); 77 | await require("./taskcallback").doTask(request, { 78 | ...options, 79 | params, 80 | jar, 81 | }); 82 | 83 | let s = Math.floor(Math.random() * 20); 84 | console.log("等待%s秒再继续", s); 85 | await new Promise((resolve, reject) => setTimeout(resolve, s * 1000)); 86 | } while (--num); 87 | }, 88 | }; 89 | 90 | module.exports = dailyTTliulan; 91 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyThreeSquirrels.js: -------------------------------------------------------------------------------- 1 | var crypto = require("crypto"); 2 | var sign = (data) => { 3 | let str = "integralofficial&"; 4 | let params = []; 5 | data.forEach((v, i) => { 6 | if (v) { 7 | params.push("arguments" + (i + 1) + v); 8 | } 9 | }); 10 | return crypto 11 | .createHash("md5") 12 | .update(str + params.join("&")) 13 | .digest("hex"); 14 | }; 15 | let account = { 16 | yhTaskId: "10e36b51060a46499e48082656602bf8", 17 | yhChannel: "GGPD", 18 | accountChannel: "517050707", 19 | accountUserName: "517050707", 20 | accountPassword: "123456", 21 | accountToken: "4640b530b3f7481bb5821c6871854ce5", 22 | }; 23 | var threeSquirrels = { 24 | query: async (request, options) => { 25 | let params = { 26 | arguments1: "AC20200624091508", // acid 27 | arguments2: account.yhChannel, // yhChannel 28 | arguments3: account.yhTaskId, // yhTaskId menuId 29 | arguments4: new Date().getTime(), // time 30 | arguments6: account.accountChannel, 31 | netWay: "Wifi", 32 | version: `android@8.0102`, 33 | }; 34 | params["sign"] = sign([ 35 | params.arguments1, 36 | params.arguments2, 37 | params.arguments3, 38 | params.arguments4, 39 | ]); 40 | return await require("./taskcallback").query(request, { 41 | ...options, 42 | params, 43 | }); 44 | }, 45 | doTask: async (request, options) => { 46 | console.log("🐀 三只松鼠看视频得积分..."); 47 | let { num, jar } = await threeSquirrels.query(request, options); 48 | if (!num) { 49 | console.log("🐀 三只松鼠看视频得积分: 今日已完成"); 50 | return; 51 | } 52 | do { 53 | console.log("第", num, "次"); 54 | let params = { 55 | arguments1: "AC20200624091508", // acid 56 | arguments2: account.yhChannel, // yhChannel 57 | arguments3: account.yhTaskId, // yhTaskId menuId 58 | arguments4: new Date().getTime(), // time 59 | arguments6: "", 60 | arguments7: "", 61 | arguments8: "", 62 | arguments9: "", 63 | orderId: crypto 64 | .createHash("md5") 65 | .update(new Date().getTime() + "") 66 | .digest("hex"), 67 | netWay: "Wifi", 68 | remark: "支付页", 69 | version: `android@8.0100`, 70 | codeId: 945535636, 71 | }; 72 | params["sign"] = sign([ 73 | params.arguments1, 74 | params.arguments2, 75 | params.arguments3, 76 | params.arguments4, 77 | ]); 78 | await require("./taskcallback").doTask(request, { 79 | ...options, 80 | params, 81 | jar, 82 | }); 83 | 84 | let s = Math.floor(Math.random() * 20); 85 | console.log("☕ 等待%s秒再继续", s); 86 | // eslint-disable-next-line no-unused-vars 87 | await new Promise((resolve, reject) => setTimeout(resolve, s * 1000)); 88 | } while (--num); 89 | }, 90 | }; 91 | 92 | module.exports = threeSquirrels; 93 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyVideo.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | var sign = (data) => { 3 | let str = 'integralofficial&' 4 | let params = [] 5 | data.forEach((v, i) => { 6 | if (v) { 7 | params.push('arguments' + (i + 1) + v) 8 | } 9 | }); 10 | return crypto.createHash('md5').update(str + params.join('&')).digest('hex') 11 | } 12 | let account = { 13 | yhTaskId: "734225b6ec9946cca3bcdc6a6e14fc1f", 14 | yhChannel: "GGPD", 15 | accountChannel: "517050707", 16 | accountUserName: "517050707", 17 | accountPassword: "123456", 18 | accountToken: "4640b530b3f7481bb5821c6871854ce5", 19 | } 20 | var dailyVideo = { 21 | query: async (request, options) => { 22 | let params = { 23 | 'arguments1': 'AC20200624091508', // acid 24 | 'arguments2': account.yhChannel, // yhChannel 25 | 'arguments3': account.yhTaskId, // yhTaskId menuId 26 | 'arguments4': new Date().getTime(), // time 27 | 'arguments6': account.accountChannel, 28 | 'netWay': 'Wifi', 29 | 'version': `android@8.0100` 30 | } 31 | params['sign'] = sign([params.arguments1, params.arguments2, params.arguments3, params.arguments4]) 32 | return await require('./taskcallback').query(request, { 33 | ...options, 34 | params 35 | }) 36 | }, 37 | doTask: async (request, options) => { 38 | let { num, jar } = await dailyVideo.query(request, options) 39 | if (!num) { 40 | console.log('签到看视频得积分: 今日已完成') 41 | return 42 | } 43 | do { 44 | console.log('第', num, '次') 45 | let params = { 46 | 'arguments1': 'AC20200624091508', // acid 47 | 'arguments2': account.yhChannel, // yhChannel 48 | 'arguments3': account.yhTaskId, // yhTaskId menuId 49 | 'arguments4': new Date().getTime(), // time 50 | 'arguments6': '', 51 | 'arguments7': '', 52 | 'arguments8': '', 53 | 'arguments9': '', 54 | 'orderId': crypto.createHash('md5').update(new Date().getTime() + '').digest('hex'), 55 | 'netWay': 'Wifi', 56 | 'remark': '签到看视频得积分', 57 | 'version': `android@8.0100`, 58 | 'codeId': 945535616 59 | } 60 | params['sign'] = sign([params.arguments1, params.arguments2, params.arguments3, params.arguments4]) 61 | await require('./taskcallback').doTask(request, { 62 | ...options, 63 | params, 64 | jar 65 | }) 66 | 67 | let s = Math.floor(Math.random() * 20) 68 | console.log('等待%s秒再继续', s) 69 | await new Promise((resolve, reject) => setTimeout(resolve, s * 1000)) 70 | } while (--num) 71 | } 72 | } 73 | 74 | module.exports = dailyVideo -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyVideoFreeGoods.js: -------------------------------------------------------------------------------- 1 | var crypto = require("crypto"); 2 | var moment = require("moment"); 3 | const gameEvents = require("./handlers/dailyEvent"); 4 | let { encryptPhone, sign, encrypt } = require("./handlers/PAES.js"); 5 | const { useragent } = require("./handlers/myPhone"); 6 | const { 7 | transParams, 8 | sleep, 9 | UnicomRequest, 10 | encodePhone, 11 | } = require("./handlers/gameUtils"); 12 | // 签到小游戏买什么都省免费夺宝 [夺宝大挑战] 13 | 14 | var dailyVideoFreeGoods = { 15 | // eslint-disable-next-line no-unused-vars 16 | getGoodsList: async (axios, options, { ecs_token, searchParams, jar1 }) => { 17 | let phone = encodePhone(options.user); 18 | let request = new UnicomRequest(axios, options); 19 | let body = { 20 | fromType: "22", 21 | status: "0", 22 | pageNo: "1", 23 | pageSize: "30", 24 | channelId: "LT_channel", 25 | phone: phone, 26 | token: ecs_token, 27 | sourceCode: "lt_freeTake", 28 | }; 29 | let res = await request.postMsmds( 30 | "https://wxapp.msmds.cn/jplus/api/channel/integral/free/goods/findAll", 31 | body 32 | ); 33 | let result = res.data; 34 | return { 35 | goods: result.data.goodsList.data, 36 | freeTimes: result.data.freeTimes, 37 | leftTimes: result.data.leftTimes, 38 | time: result.data.time, 39 | getFreeTime: result.data.getFreeTime, 40 | sameGoodsMaxTimes: result.data.sameGoodsMaxTimes, 41 | }; 42 | }, 43 | getOpenPlatLine: gameEvents.getOpenPlatLine( 44 | `https://m.client.10010.com/mobileService/openPlatform/openPlatLine.htm?to_url=https://wxapp.msmds.cn/h5/react_web/unicom/freeTakePage`, 45 | { base: "msmds" } 46 | ), 47 | doTask: async (axios, options) => { 48 | console.log("🔔 开始夺宝大挑战\n"); 49 | let cookies = await dailyVideoFreeGoods.getOpenPlatLine(axios, options); 50 | let { 51 | goods, 52 | freeTimes, 53 | leftTimes, 54 | time, 55 | // eslint-disable-next-line no-unused-vars 56 | getFreeTime, 57 | // eslint-disable-next-line no-unused-vars 58 | sameGoodsMaxTimes, 59 | } = await dailyVideoFreeGoods.getGoodsList(axios, options, cookies); 60 | console.log( 61 | "签到小游戏买什么都省免费夺宝", 62 | `剩余机会(${leftTimes}/${freeTimes})` 63 | ); 64 | 65 | if (!leftTimes) { 66 | if (time) { 67 | console.log( 68 | `签到小游戏买什么都省免费夺宝: 剩余机会不足,等待下一轮,` + 69 | moment().add(time, "seconds").format("YYYY-MM-DD HH:mm:ss") + 70 | " 后可再次尝试" 71 | ); 72 | } 73 | } 74 | 75 | let params = { 76 | arguments1: "", 77 | arguments2: "", 78 | arguments3: "", 79 | arguments4: new Date().getTime(), 80 | arguments6: "", 81 | arguments7: "", 82 | arguments8: "", 83 | arguments9: "", 84 | netWay: "Wifi", 85 | remark: "签到页小游戏", 86 | version: `android@8.0102`, 87 | codeId: 945535689, 88 | }; 89 | params["sign"] = sign([ 90 | params.arguments1, 91 | params.arguments2, 92 | params.arguments3, 93 | params.arguments4, 94 | ]); 95 | 96 | let phone = encodePhone(options.user); 97 | 98 | // 同一期商品最多3次机会,每4小时可获得5次机会 99 | console.log("注意本接口只获取积分!"); 100 | console.log("抽奖时,可能会出现[不存在的奖品],此状态为无库存"); 101 | let desc = (key) => { 102 | return (m, n) => { 103 | let a = m[key].replace("积分", ""); 104 | let b = n[key].replace("积分", ""); 105 | return b - a; 106 | }; 107 | }; 108 | let items = goods.filter((item) => { 109 | if (item.goodsName.indexOf("积分") > -1) { 110 | return item; 111 | } 112 | }); 113 | for (let good of items.sort(desc("goodsName"))) { 114 | if (good.id !== null && good.goodsName.indexOf("积分") > -1) { 115 | console.log("开始抽奖: ", good.goodsName); 116 | params["orderId"] = crypto 117 | .createHash("md5") 118 | .update(new Date().getTime() + "") 119 | .digest("hex"); 120 | params["arguments4"] = new Date().getTime(); 121 | 122 | //请求抽奖次数情况 123 | console.log("查询抽奖时效"); 124 | let timestamp = moment().format("YYYYMMDDHHmmss"); 125 | let body = { 126 | channelId: "LT_channel", 127 | phone: phone, 128 | token: cookies.ecs_token, 129 | sourceCode: "lt_freeTake", 130 | }; 131 | let request = new UnicomRequest(axios, options); 132 | let result = await request.getMsmds( 133 | "https://wxapp.msmds.cn/jplus/api/channel/integral/free/goods/getTimes", 134 | body, 135 | { 136 | referer: `https://wxapp.msmds.cn/h5/react_web/unicom/freeTakeGoodDetail/${good.id}?source=unicom&type=02&ticket=${cookies.searchParams.ticket}&version=android@8.0100×tamp=${timestamp}&desmobile=${options.user}&num=0&postage=${cookies.searchParams.postage}&userNumber=${options.user}`, 137 | origin: "https://wxapp.msmds.cn", 138 | } 139 | ); 140 | // console.log(result.data); 141 | if (result.data.data.time) { 142 | console.log( 143 | `已处于限制期,` + 144 | moment() 145 | .add(result.data.data.time, "seconds") 146 | .format("YYYY-MM-DD HH:mm:ss") + 147 | " 后可再次尝试,跳过" 148 | ); 149 | continue; 150 | } 151 | await sleep(30); 152 | console.log("查询抽奖接口"); 153 | result = await require("./taskcallback").reward(axios, { 154 | ...options, 155 | params, 156 | jar: cookies.jar1, 157 | }); 158 | 159 | timestamp = moment().format("YYYYMMDDHHmmss"); 160 | body = { 161 | channelId: "LT_channel", 162 | code: "", 163 | flag: "", 164 | id: good.id, 165 | phone: phone, 166 | sourceCode: "lt_freeTake", 167 | taskId: "", 168 | token: cookies.ecs_token, 169 | videoOrderNo: params.orderId, 170 | }; 171 | result = await request.postMsmds( 172 | "https://wxapp.msmds.cn/jplus/api/channel/integral/free/goods/doFreeGoods", 173 | body, 174 | { 175 | referer: `https://wxapp.msmds.cn/h5/react_web/unicom/freeTakeGoodDetail/${good.id}?source=unicom&type=02&ticket=${cookies.searchParams.ticket}&version=android@8.0102×tamp=${timestamp}&desmobile=${options.user}&num=0&postage=${cookies.searchParams.postage}&userNumber=${options.user}`, 176 | origin: "https://wxapp.msmds.cn", 177 | } 178 | ); 179 | // console.log(result.data); 180 | if (result.data.code !== 2000) { 181 | console.log(result.data.msg); 182 | } else { 183 | if (result.data.data.luckCode) { 184 | console.log("提交任务成功", `券码:${result.data.data.luckCode}`); 185 | } else if (result.data.data.time) { 186 | throw new Error( 187 | `已处于限制期,` + 188 | moment() 189 | .add(result.data.data.time, "seconds") 190 | .format("YYYY-MM-DD HH:mm:ss") + 191 | " 后可再次尝试" 192 | ); 193 | } else { 194 | console.log("提交任务成功"); 195 | } 196 | } 197 | await sleep(25); 198 | } 199 | } 200 | }, 201 | }; 202 | 203 | module.exports = dailyVideoFreeGoods; 204 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyVideoScratchcard.js: -------------------------------------------------------------------------------- 1 | var crypto = require("crypto"); 2 | const useragent = require("./handlers/myPhone").useragent; 3 | const gameEvents = require("./handlers/dailyEvent"); 4 | // 疯狂刮刮乐 5 | var transParams = (data) => { 6 | let params = new URLSearchParams(); 7 | for (let item in data) { 8 | params.append(item, data["" + item + ""]); 9 | } 10 | return params; 11 | }; 12 | function w() { 13 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, 14 | t = []; 15 | return ( 16 | Object.keys(e).forEach(function (a) { 17 | t.push("".concat(a, "=").concat(encodeURIComponent(e[a]))); 18 | }), 19 | t.join("&") 20 | ); 21 | } 22 | var sign = (data) => { 23 | let str = "integralofficial&"; 24 | let params = []; 25 | data.forEach((v, i) => { 26 | if (v) { 27 | params.push("arguments" + (i + 1) + v); 28 | } 29 | }); 30 | return crypto 31 | .createHash("md5") 32 | .update(str + params.join("&")) 33 | .digest("hex"); 34 | }; 35 | 36 | function encryption(data, key) { 37 | var iv = ""; 38 | var cipherEncoding = "base64"; 39 | var cipher = crypto.createCipheriv("aes-128-ecb", key, iv); 40 | cipher.setAutoPadding(true); 41 | return Buffer.concat([cipher.update(data), cipher.final()]).toString( 42 | cipherEncoding 43 | ); 44 | } 45 | 46 | var dailyVideoScratchcard = { 47 | getGoodsList: async (axios, options) => { 48 | let phone = encryption(options.user, "gb6YCccUvth75Tm2"); 49 | let result = await axios.request({ 50 | headers: { 51 | "user-agent": useragent(options), 52 | referer: `https://wxapp.msmds.cn/`, 53 | origin: "https://wxapp.msmds.cn", 54 | }, 55 | url: `https://wxapp.msmds.cn/jplus/h5/channelScratchCard/findAllCard`, 56 | method: "GET", 57 | params: transParams({ 58 | channelId: "LT_channel", 59 | phone: phone, 60 | token: options.ecs_token, 61 | sourceCode: "lt_scratchcard", 62 | }), 63 | }); 64 | return result.data.data.allCards.filter((c) => !c.status); 65 | }, 66 | getOpenPlatLine: gameEvents.getOpenPlatLine( 67 | `https://m.client.10010.com/mobileService/openPlatform/openPlatLine.htm?to_url=https://wxapp.msmds.cn/h5/react_web/unicom/scratchcardPage?source=unicom&duanlianjieabc=tbkR2`, 68 | { base: "msmds" } 69 | ), 70 | doTask: async (axios, options) => { 71 | console.log("🤔 刮刮卡游玩开始..."); 72 | let { ecs_token, jar1 } = await dailyVideoScratchcard.getOpenPlatLine( 73 | axios, 74 | options 75 | ); 76 | let phone = encryption(options.user, "gb6YCccUvth75Tm2"); 77 | let goods = await dailyVideoScratchcard.getGoodsList(axios, { 78 | ...options, 79 | ecs_token, 80 | phone, 81 | }); 82 | 83 | let params = { 84 | arguments1: "AC20200716103629", 85 | arguments2: "GGPD", 86 | arguments3: "79b0275d6a5742ce96af76a663cde0ab", 87 | arguments4: new Date().getTime(), 88 | arguments6: "517050707", 89 | arguments7: "517050707", 90 | arguments8: "123456", 91 | arguments9: "4640b530b3f7481bb5821c6871854ce5", 92 | netWay: "Wifi", 93 | remark: "签到小游戏幸运刮刮卡", 94 | version: `android@8.0102`, 95 | codeId: 945597742, 96 | }; 97 | params["sign"] = sign([ 98 | params.arguments1, 99 | params.arguments2, 100 | params.arguments3, 101 | params.arguments4, 102 | ]); 103 | 104 | if (goods.length) { 105 | for (let good of goods) { 106 | console.log("开始处理: ", good.name); 107 | params["orderId"] = crypto 108 | .createHash("md5") 109 | .update(new Date().getTime() + "") 110 | .digest("hex"); 111 | params["arguments4"] = new Date().getTime(); 112 | 113 | let result = await require("./taskcallback").reward(axios, { 114 | ...options, 115 | params, 116 | jar: jar1, 117 | }); 118 | let a = { 119 | channelId: "LT_channel", 120 | phone: phone, 121 | token: ecs_token, 122 | cardId: good.id, 123 | sourceCode: "lt_scratchcard", 124 | }; 125 | result = await axios.request({ 126 | headers: { 127 | "user-agent": useragent(options), 128 | referer: `https://wxapp.msmds.cn/h5/react_web/unicom/scratchcardItemPage`, 129 | origin: "https://wxapp.msmds.cn", 130 | }, 131 | url: 132 | `https://wxapp.msmds.cn/jplus/h5/channelScratchCard/doScratchCard?` + 133 | w(a), 134 | method: "GET", 135 | }); 136 | if (result.data.code !== 200) { 137 | console.log(result.data.msg); 138 | } else { 139 | console.log( 140 | "提交任务成功", 141 | `+${result.data.data.prizeType ? result.data.data.integral : 0}` 142 | ); 143 | let a = { 144 | channelId: "LT_channel", 145 | phone: phone, 146 | token: ecs_token, 147 | id: good.id, 148 | sourceCode: "lt_scratchcard", 149 | }; 150 | console.log("测试 视频翻倍"); 151 | result = await axios.request({ 152 | headers: { 153 | "user-agent": useragent(options), 154 | referer: `https://wxapp.msmds.cn/h5/react_web/unicom/scratchcardItemPage`, 155 | origin: "https://wxapp.msmds.cn", 156 | }, 157 | url: `https://wxapp.msmds.cn/jplus/h5/channelScratchCard/lookVideoDouble`, 158 | method: "POST", 159 | data: w(a), 160 | }); 161 | 162 | await dailyVideoScratchcard.lookVideoDouble(axios, { 163 | ...options, 164 | }); 165 | } 166 | console.log("等待35秒再继续"); 167 | // eslint-disable-next-line no-unused-vars 168 | await new Promise((resolve, reject) => setTimeout(resolve, 35 * 1000)); 169 | } 170 | } else { 171 | console.log("暂无可刮得商品"); 172 | } 173 | }, 174 | lookVideoDouble: gameEvents.lookVideoDouble( 175 | { 176 | arguments1: "AC20200716103629", 177 | arguments2: "GGPD", 178 | arguments3: "79b0275d6a5742ce96af76a663cde0ab", 179 | arguments4: new Date().getTime(), 180 | arguments6: "517050707", 181 | arguments7: "517050707", 182 | arguments8: "123456", 183 | arguments9: "4640b530b3f7481bb5821c6871854ce5", 184 | netWay: "Wifi", 185 | remark1: "签到小游戏幸运刮刮卡", 186 | remark: "签到看视频翻倍得积分", 187 | version: `android@8.0102`, 188 | codeId: 945689604, 189 | }, 190 | { 191 | arguments1: "AC20200716103629", // acid 192 | arguments2: "GGPD", // yhChannel 193 | arguments3: "79b0275d6a5742ce96af76a663cde0ab", // yhTaskId menuId 194 | arguments4: new Date().getTime(), // time 195 | arguments6: "517050707", 196 | arguments7: "517050707", 197 | arguments8: "123456", 198 | arguments9: "4640b530b3f7481bb5821c6871854ce5", 199 | orderId: crypto 200 | .createHash("md5") 201 | .update(new Date().getTime() + "") 202 | .digest("hex"), 203 | netWay: "Wifi", 204 | remark: "签到小游戏翻倍得积分", 205 | version: `android@8.0102`, 206 | codeId: 945689604, 207 | }, 208 | "幸运刮刮卡" 209 | ), 210 | lookVideoDoubleResult: gameEvents.lookVideoDoubleResult("幸运刮刮卡"), 211 | }; 212 | 213 | module.exports = dailyVideoScratchcard; 214 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailyYYQ.js: -------------------------------------------------------------------------------- 1 | var crypto = require("crypto"); 2 | let AES = require("./handlers/PAES"); 3 | const useragent = require("./handlers/myPhone").useragent; 4 | const gameEvents = require("./handlers/dailyEvent"); 5 | let referer = 6 | "https://m.jf.10010.com/cms/yuech/unicom-integral-ui/eggachine/index.html?id=Ac-da377d4512124eb49cc3ea4e0d25e379"; 7 | /** 8 | * 欢乐摇摇球 9 | * 入口:首页=>签到=>免费抽 摇一摇 10 | * 11 | */ 12 | 13 | let dailyYYQ = { 14 | doTask: async (axios, options) => { 15 | console.log("🔔 开始欢乐摇摇球\n"); 16 | let cookies = await dailyYYQ.getOpenPlatLine(axios, options); 17 | let data = await dailyYYQ.postFreeLogin(axios, options, cookies); 18 | await dailyYYQ.postGame(axios, options, cookies, data); 19 | }, 20 | getOpenPlatLine: gameEvents.getOpenPlatLine( 21 | `https://m.client.10010.com/mobileService/openPlatform/openPlatLine.htm?to_url=https://m.jf.10010.com/jf-order/avoidLogin/forActive/stxyndj` 22 | ), 23 | postFreeLogin: gameEvents.postFreeLogin( 24 | referer, 25 | "Ac-da377d4512124eb49cc3ea4e0d25e379" 26 | ), 27 | postGame: async ( 28 | axios, 29 | options, 30 | // eslint-disable-next-line no-unused-vars 31 | { jfid, searchParams, jar1 }, 32 | { activity, Authorization, freeTimes, advertTimes } 33 | ) => { 34 | let times = 5; 35 | // /jf-yuech/api/integralLogs/surplusFreeGame?activityId=Ac-da377d4512124eb49cc3ea4e0d25e379 36 | do { 37 | let orderId = ""; 38 | console.log( 39 | "已消耗机会", 40 | 1 + 4 - (freeTimes + advertTimes), 41 | "剩余免费机会", 42 | freeTimes, 43 | "看视频广告机会", 44 | advertTimes 45 | ); 46 | 47 | //广告试听 48 | let res = await axios.request({ 49 | headers: { 50 | Authorization: `Bearer ${Authorization}`, 51 | "user-agent": useragent(options), 52 | referer: 53 | "https://m.jf.10010.com/cms/yuech/unicom-integral-ui/eggachine/index.html?id=" + 54 | activity.activityId, 55 | origin: "https://img.jf.10010.com", 56 | }, 57 | url: `https://m.jf.10010.com/jf-yuech/api/gameResult/advertFreeGame?activityId=${activity.activityId}`, 58 | method: "get", 59 | }); 60 | 61 | if (res.data.code !== 0) { 62 | console.log("签到小游戏视频买扭蛋机: " + res.data.message); 63 | break; 64 | } 65 | 66 | if (times < 5) { 67 | let params = { 68 | arguments1: "AC20200611152252", 69 | arguments2: "", 70 | arguments3: "", 71 | arguments4: new Date().getTime(), 72 | arguments6: "", 73 | arguments7: "", 74 | arguments8: "", 75 | arguments9: "", 76 | netWay: "Wifi", 77 | remark: "签到小游戏买扭蛋机2", 78 | version: `android@8.0102`, 79 | codeId: 945535686, 80 | }; 81 | 82 | params["sign"] = AES.sign([ 83 | params.arguments1, 84 | params.arguments2, 85 | params.arguments3, 86 | params.arguments4, 87 | ]); 88 | params["orderId"] = crypto 89 | .createHash("md5") 90 | .update(new Date().getTime() + "") 91 | .digest("hex"); 92 | params["arguments4"] = new Date().getTime(); 93 | 94 | await require("./taskcallback").reward(axios, { 95 | ...options, 96 | params, 97 | jar: jar1, 98 | }); 99 | 100 | orderId = params["orderId"]; 101 | } 102 | //join the game 103 | let t = { 104 | activityId: activity.activityId, 105 | version: 8.0102, 106 | orderId: orderId, 107 | phoneType: "android", 108 | }; 109 | let params = gameEvents.encodeParams(t, true); 110 | res = await axios.request({ 111 | headers: { 112 | Authorization: `Bearer ${Authorization}`, 113 | "user-agent": useragent(options), 114 | referer: 115 | "https://m.jf.10010.com/cms/yuech/unicom-integral-ui/eggachine/index.html?id=Ac-da377d4512124eb49cc3ea4e0d25e379", 116 | origin: "https://m.jf.10010.com", 117 | }, 118 | url: `https://m.jf.10010.com/jf-yuech/api/gameResult/twisingLuckDraw`, 119 | method: "post", 120 | data: params, 121 | }); 122 | let result = res.data; 123 | if (result.code !== 0) { 124 | console.log("❌ 快乐摇摇球:", result.message); 125 | } else { 126 | console.log("🎉 快乐摇摇球:", result.data.prizeName); 127 | if (result.data.doublingStatus) { 128 | console.log("🎉 提交积分翻倍"); 129 | await dailyYYQ.lookVideoDouble(axios, { 130 | ...options, 131 | }); 132 | await dailyYYQ.lookVideoDoubleResult(axios, { 133 | ...options, 134 | Authorization, 135 | activityId: activity.activityId, 136 | winningRecordId: result.data.winningRecordId, 137 | }); 138 | } 139 | } 140 | 141 | console.log("在看视频,等待35秒再继续"); 142 | // eslint-disable-next-line no-unused-vars 143 | await new Promise((resolve, reject) => setTimeout(resolve, 35 * 1000)); 144 | } while (--times); 145 | }, 146 | lookVideoDouble: async (axios, options) => { 147 | let params = { 148 | arguments1: "AC20200611152252", // acid 149 | arguments2: "GGPD", // yhChannel 150 | arguments3: "73e3907bbf9c4748b2fe9a053cee5e82", // yhTaskId menuId 151 | arguments4: new Date().getTime(), // time 152 | arguments6: "517050707", 153 | netWay: "Wifi", 154 | version: `android@8.0100`, 155 | }; 156 | params["sign"] = AES.sign([ 157 | params.arguments1, 158 | params.arguments2, 159 | params.arguments3, 160 | params.arguments4, 161 | ]); 162 | let { num, jar } = await require("./taskcallback").query(axios, { 163 | ...options, 164 | params, 165 | }); 166 | 167 | if (!num) { 168 | console.log("签到小游戏买扭蛋机2: 今日已完成"); 169 | return; 170 | } 171 | params = { 172 | arguments1: "AC20200611152252", // acid 173 | arguments2: "GGPD", // yhChannel 174 | arguments3: "73e3907bbf9c4748b2fe9a053cee5e82", // yhTaskId menuId 175 | arguments4: new Date().getTime(), // time 176 | arguments6: "", 177 | arguments7: "", 178 | arguments8: "", 179 | arguments9: "", 180 | orderId: crypto 181 | .createHash("md5") 182 | .update(new Date().getTime() + "") 183 | .digest("hex"), 184 | netWay: "Wifi", 185 | remark: "签到小游戏买扭蛋机2", 186 | version: `android@8.0100`, 187 | codeId: 945535686, 188 | }; 189 | params["sign"] = AES.sign([ 190 | params.arguments1, 191 | params.arguments2, 192 | params.arguments3, 193 | params.arguments4, 194 | ]); 195 | await require("./taskcallback").doTask(axios, { 196 | ...options, 197 | params, 198 | jar, 199 | }); 200 | }, 201 | lookVideoDoubleResult: gameEvents.lookVideoDoubleResult( 202 | "签到小游戏买扭蛋机2" 203 | ), 204 | }; 205 | 206 | module.exports = dailyYYQ; 207 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailylottery.js: -------------------------------------------------------------------------------- 1 | 2 | var dailylottery = { 3 | encryptmobile: async (axios, options) => { 4 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} ` 5 | let res = await axios.request({ 6 | baseURL: 'https://m.client.10010.com/', 7 | headers: { 8 | "user-agent": useragent, 9 | "referer": `https://img.client.10010.com/jifenshangcheng/Directional?from=9110001000%E2%80%8B&yw_code=&desmobile=${options.user}&version=android%408.0100`, 10 | "origin": "https://img.client.10010.com" 11 | }, 12 | url: `/dailylottery/static/textdl/userLogin?flag=1&floortype=tbanner&from=9110001000%E2%80%8B&oneid=undefined&twoid=undefined`, 13 | method: 'get' 14 | }) 15 | let result = res.data 16 | let encryptmobile = result.substr(result.indexOf('encryptmobile=') + 14, 32) 17 | return encryptmobile 18 | }, 19 | doTask: async (axios, options) => { 20 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} ` 21 | let encryptmobile = await dailylottery.encryptmobile(axios, options) 22 | 23 | let res = await axios.request({ 24 | baseURL: 'https://m.client.10010.com/', 25 | headers: { 26 | "user-agent": useragent, 27 | "referer": "https://img.client.10010.com/", 28 | "origin": "https://img.client.10010.com" 29 | }, 30 | url: `/dailylottery/static/active/findActivityInfo?areaCode=085&groupByType=&mobile=${encryptmobile}`, 31 | method: 'GET' 32 | }) 33 | 34 | let acid = res.data.acCode 35 | let usableAcFreq = res.data.acFrequency.usableAcFreq 36 | do { 37 | res = await axios.request({ 38 | baseURL: 'https://m.client.10010.com/', 39 | headers: { 40 | "user-agent": useragent, 41 | "referer": "https://img.client.10010.com/", 42 | "origin": "https://img.client.10010.com" 43 | }, 44 | url: `/dailylottery/static/doubleball/choujiang?usernumberofjsp=${encryptmobile}`, 45 | method: 'post' 46 | }) 47 | let result = res.data 48 | if (result.Rsptype === '6666') { 49 | console.log('抽奖失败', result.RspMsg) 50 | break 51 | } else { 52 | console.log(result.RspMsg) 53 | } 54 | 55 | console.log('在看视频,不要着急,等待35秒再继续') 56 | await new Promise((resolve, reject) => setTimeout(resolve, 35 * 1000)) 57 | 58 | } while (--usableAcFreq) 59 | } 60 | } 61 | module.exports = dailylottery 62 | -------------------------------------------------------------------------------- /commands/tasks/unicom/dailylotteryintegral.js: -------------------------------------------------------------------------------- 1 | 2 | var dailylotteryintegral = { 3 | encryptmobile: async (axios, options) => { 4 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} ` 5 | let res = await axios.request({ 6 | baseURL: 'https://m.client.10010.com/', 7 | headers: { 8 | "user-agent": useragent, 9 | "referer": `https://img.client.10010.com/jifenshangcheng/Directional?from=9110001000%E2%80%8B&yw_code=&desmobile=${options.user}&version=android%408.0100`, 10 | "origin": "https://img.client.10010.com" 11 | }, 12 | url: `/dailylottery/static/textdl/userLogin?flag=1&floortype=tbanner&from=9110001000%E2%80%8B&oneid=undefined&twoid=undefined`, 13 | method: 'get' 14 | }) 15 | let result = res.data 16 | let encryptmobile = result.substr(result.indexOf('encryptmobile=') + 14, 32) 17 | return encryptmobile 18 | }, 19 | doTask: async (axios, options) => { 20 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} ` 21 | let encryptmobile = await dailylotteryintegral.encryptmobile(axios, options) 22 | 23 | let res = await axios.request({ 24 | baseURL: 'https://m.client.10010.com/', 25 | headers: { 26 | "user-agent": useragent, 27 | "referer": "https://img.client.10010.com/", 28 | "origin": "https://img.client.10010.com" 29 | }, 30 | url: `/dailylottery/static/integral/choujiang?usernumberofjsp=${encryptmobile}`, 31 | method: 'post' 32 | }) 33 | let result = res.data 34 | if ('id' in result) { 35 | console.log('获得奖品', result.RspMsg) 36 | } else { 37 | console.log('抽奖失败', result.RspMsg) 38 | } 39 | 40 | } 41 | } 42 | module.exports = dailylotteryintegral -------------------------------------------------------------------------------- /commands/tasks/unicom/dailysignin.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto'); 2 | var CryptoJS = require("crypto-js"); 3 | 4 | // 快乐摇摇球 5 | var transParams = (data) => { 6 | let params = new URLSearchParams(); 7 | for (let item in data) { 8 | params.append(item, data['' + item + '']); 9 | } 10 | return params; 11 | }; 12 | 13 | var sign = (data) => { 14 | let str = 'integralofficial&' 15 | let params = [] 16 | data.forEach((v, i) => { 17 | if (v) { 18 | params.push('arguments' + (i + 1) + v) 19 | } 20 | }); 21 | return crypto.createHash('md5').update(str + params.join('&')).digest('hex') 22 | } 23 | 24 | var dailysignin = { 25 | getIntegral: async (axios, options) => { 26 | const useragent = `okhttp/4.4.0` 27 | let { data } = await axios.request({ 28 | baseURL: 'https://act.10010.com/', 29 | headers: { 30 | "user-agent": useragent, 31 | "referer": "https://img.client.10010.com", 32 | "origin": "https://img.client.10010.com" 33 | }, 34 | url: `/SigninApp/signin/getIntegral`, 35 | method: 'post' 36 | }) 37 | if (data.status !== '0000') { 38 | throw new Error(result.msg) 39 | } else { 40 | if (data.status === '0000') { 41 | console.log('用户已有累计积分:' + data.data.integralTotal) 42 | } else { 43 | throw new Error('获取积分信息失败') 44 | } 45 | } 46 | return data.data 47 | }, 48 | query: async (axios, options) => { 49 | const useragent = `okhttp/4.4.0` 50 | let { data } = await axios.request({ 51 | baseURL: 'https://act.10010.com/', 52 | headers: { 53 | "user-agent": useragent, 54 | "referer": "https://img.client.10010.com", 55 | "origin": "https://img.client.10010.com" 56 | }, 57 | url: `/SigninApp/signin/getContinuous`, 58 | method: 'post' 59 | }) 60 | return data 61 | }, 62 | daySign: async (axios, options) => { 63 | const useragent = `okhttp/4.4.0` 64 | let { data, config } = await axios.request({ 65 | baseURL: 'https://act.10010.com/', 66 | headers: { 67 | "user-agent": useragent, 68 | "referer": "https://img.client.10010.com", 69 | "origin": "https://img.client.10010.com" 70 | }, 71 | url: `/SigninApp/signin/daySign`, 72 | method: 'post' 73 | }) 74 | return { 75 | data, 76 | config 77 | } 78 | }, 79 | doTask: async (axios, options) => { 80 | let { integralTotal } = await dailysignin.getIntegral(axios, options) 81 | let result = await dailysignin.query(axios, options) 82 | if (result.status === '0000') { 83 | if (result.data.todaySigned === '1') { 84 | let { data, config } = await dailysignin.daySign(axios, options) 85 | if (data.status === '0000') { 86 | console.log('积分签到成功+' + (data.data.newCoin - integralTotal) + '积分', '总积分:' + data.data.newCoin) 87 | if (data.data.doubleShowFlag) { 88 | await dailysignin.lookVideoDouble(axios, { 89 | ...options, 90 | jar: config.jar 91 | }) 92 | } 93 | } else { 94 | console.log('积分签到失败', data.msg) 95 | } 96 | } else { 97 | console.log('今日已签到') 98 | } 99 | } else { 100 | console.log('获取签到状态失败', result.msg) 101 | } 102 | }, 103 | lookVideoDouble: async (axios, options) => { 104 | const { jar } = options 105 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:}` 106 | let params = { 107 | 'arguments1': '', 108 | 'arguments2': '', 109 | 'arguments3': '', 110 | 'arguments4': new Date().getTime(), 111 | 'arguments6': '', 112 | 'arguments7': '', 113 | 'arguments8': '', 114 | 'arguments9': '', 115 | 'netWay': 'Wifi', 116 | 'remark1': '签到看视频翻倍得积分', 117 | 'remark': '签到积分翻倍', 118 | 'version': `android@8.0100`, 119 | 'codeId': 945535743 120 | } 121 | params['sign'] = sign([params.arguments1, params.arguments2, params.arguments3, params.arguments4]) 122 | params['orderId'] = crypto.createHash('md5').update(new Date().getTime() + '').digest('hex') 123 | 124 | await require('./taskcallback').reward(axios, { 125 | ...options, 126 | params, 127 | jar 128 | }) 129 | 130 | let { data } = await axios.request({ 131 | baseURL: 'https://act.10010.com/', 132 | headers: { 133 | "user-agent": useragent, 134 | "referer": "https://img.client.10010.com", 135 | "origin": "https://img.client.10010.com" 136 | }, 137 | url: `/SigninApp/signin/bannerAdPlayingLogo`, 138 | method: 'post' 139 | }) 140 | if (data.status === '0000') { 141 | console.log('积分翻倍成功:', data.data.prizeCount) 142 | } else { 143 | console.log('积分翻倍失败:', data.msg) 144 | } 145 | } 146 | } 147 | 148 | module.exports = dailysignin -------------------------------------------------------------------------------- /commands/tasks/unicom/fetchCoins.js: -------------------------------------------------------------------------------- 1 | const { UnicomComponent, transParams } = require("./handlers/gameUtils"); 2 | const moment = require("moment"); 3 | moment.locale("zh-cn"); 4 | let fetchCoins = { 5 | doTask: async (axios, options) => { 6 | let request = new UnicomComponent(axios, options, "积分查询"); 7 | let { data } = await request.get({ 8 | url: 9 | "https://m.client.10010.com/welfare-mall-front/mobile/show/flDetail/v1/0", 10 | body: transParams({ 11 | reqtime: new Date().getTime(), 12 | cliver: "", 13 | reqdata: "{}", 14 | }), 15 | method: "POST", 16 | headers: { 17 | origin: `https://img.client.10010.com`, 18 | referer: `https://img.client.10010.com/jifenshangcheng/jifen?loginType=0&scopeType=fl`, 19 | }, 20 | }); 21 | if (data.code !== "0") { 22 | console.log("查询出错: ", data.msg); 23 | return; 24 | } 25 | let availablescore = data.resdata.score.availablescore; 26 | let startDate = moment().startOf("days"); 27 | let consumeCoins = 0; 28 | let awardCoins = 0; 29 | data.resdata.detail.forEach((v) => { 30 | if (startDate.isBefore(v.createTime)) 31 | if (v.books_oper_type === "1") { 32 | consumeCoins += v.books_number; 33 | } else { 34 | awardCoins += v.books_number; 35 | } 36 | }); 37 | console.log("💰 今日积分获得:", awardCoins); 38 | console.log("💰 今日积分消费:", consumeCoins); 39 | console.log("💰 当前积分合计:", availablescore); 40 | }, 41 | }; 42 | module.exports = fetchCoins; 43 | -------------------------------------------------------------------------------- /commands/tasks/unicom/gameYearBox.js: -------------------------------------------------------------------------------- 1 | 2 | const { default: PQueue } = require('p-queue'); 3 | 4 | var transParams = (data) => { 5 | let params = new URLSearchParams(); 6 | for (let item in data) { 7 | params.append(item, data['' + item + '']); 8 | } 9 | return params; 10 | }; 11 | 12 | 13 | var gameYearBox = { 14 | games: async (axios, options) => { 15 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} ` 16 | let { data, config } = await axios.request({ 17 | headers: { 18 | "user-agent": useragent, 19 | "referer": "https://img.client.10010.com/newyeargame/index.html?channelID=04", 20 | "origin": "https://img.client.10010.com" 21 | }, 22 | url: `https://m.client.10010.com/game_year_activity`, 23 | method: 'POST', 24 | data: transParams({ 25 | 'methodType': 'games', 26 | 'clientVersion': '8.0102', 27 | 'deviceType': 'Android' 28 | }) 29 | }) 30 | return { 31 | games: data.data, 32 | jar: config.jar 33 | } 34 | }, 35 | query_box_info: async (axios, options) => { 36 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} ` 37 | let { data } = await axios.request({ 38 | headers: { 39 | "user-agent": useragent, 40 | "referer": "https://img.client.10010.com/newyeargame/index.html?channelID=04", 41 | "origin": "https://img.client.10010.com" 42 | }, 43 | url: `https://m.client.10010.com/game_year_activity`, 44 | method: 'POST', 45 | data: transParams({ 46 | 'methodType': 'query_box_info', 47 | 'clientVersion': '8.0102', 48 | 'deviceType': 'Android' 49 | }) 50 | }) 51 | return data.data 52 | }, 53 | box_get_reward: async (axios, options) => { 54 | const useragent = `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:${options.user}};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:} ` 55 | let { data } = await axios.request({ 56 | headers: { 57 | "user-agent": useragent, 58 | "referer": "https://img.client.10010.com/newyeargame/index.html?channelID=04", 59 | "origin": "https://img.client.10010.com" 60 | }, 61 | url: `https://m.client.10010.com/game_year_activity`, 62 | method: 'POST', 63 | data: transParams({ 64 | 'methodType': 'box_get_reward', 65 | 'clientVersion': '8.0102', 66 | 'deviceType': 'Android', 67 | "boxFlag": options.boxFlag 68 | }) 69 | }) 70 | if (data.code === '0000') { 71 | console.log(data.desc, data.data.reward_type, data.data.reward_val) 72 | } else { 73 | console.log(data.desc) 74 | } 75 | }, 76 | doTask: async (axios, options) => { 77 | let boxinfo = await gameYearBox.query_box_info(axios, options) 78 | let boxs = [{ 79 | 'name': 'first_box', 80 | 'duration': 10, 81 | 'boxFlag': 1 82 | }, { 83 | 'name': 'second_box', 84 | 'duration': 20, 85 | 'boxFlag': 2 86 | }, { 87 | 'name': 'third_box', 88 | 'duration': 30, 89 | 'boxFlag': 3 90 | }, { 91 | 'name': 'fourth_box', 92 | 'duration': 60, 93 | 'boxFlag': 4 94 | }] 95 | for (let box of boxs) { 96 | if (boxinfo[box.name] === '0') { 97 | console.log('领取宝箱中,尝试达成宝箱条件') 98 | let producGame = require('./producGame') 99 | let { games, jar } = await gameYearBox.games(axios, options) 100 | let queue = new PQueue({ concurrency: 2 }); 101 | console.log('调度任务中', '并发数', 2) 102 | let n = Math.floor((box.duration - parseInt(boxinfo.total_duration_num)) / 6) + 1 103 | console.log('预计再游玩', n * 6, '分钟') 104 | for (let game of games) { 105 | queue.add(async () => { 106 | console.log(game.name) 107 | await producGame.gameverify(axios, { 108 | ...options, 109 | jar, 110 | game 111 | }) 112 | await producGame.gamerecord(axios, { 113 | ...options, 114 | gameId: game.game_id 115 | }) 116 | await producGame.playGame(axios, { 117 | ...options, 118 | jar, 119 | game: { 120 | ...game, 121 | gameCode: game.game_code 122 | } 123 | }) 124 | }) 125 | --n 126 | if (n <= 0) { 127 | break 128 | } 129 | } 130 | await queue.onIdle() 131 | await gameYearBox.query_box_info(axios, options) 132 | await gameYearBox.box_get_reward(axios, { 133 | ...options, 134 | boxFlag: box.boxFlag 135 | }) 136 | } else if (boxinfo[box.name] === '1') { 137 | console.log('领取宝箱中') 138 | await gameYearBox.box_get_reward(axios, { 139 | ...options, 140 | boxFlag: box.boxFlag 141 | }) 142 | } else if (boxinfo[box.name] === '2') { 143 | console.log('已领取,跳过') 144 | } 145 | } 146 | } 147 | } 148 | 149 | module.exports = gameYearBox -------------------------------------------------------------------------------- /commands/tasks/unicom/handlers/PAES.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 预处理AES算法集 3 | * 4 | */ 5 | 6 | let crypto = require("crypto"); 7 | let CryptoJS = require("crypto-js"); 8 | 9 | let sign = (data) => { 10 | let str = "integralofficial&"; 11 | let params = []; 12 | data.forEach((v, i) => { 13 | if (v) { 14 | params.push("arguments" + (i + 1) + v); 15 | } 16 | }); 17 | return crypto 18 | .createHash("md5") 19 | .update(str + params.join("&")) 20 | .digest("hex"); 21 | }; 22 | // prettier-ignore 23 | const charset = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", 24 | "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", 25 | "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", 26 | "r", "s", "t", "u", "v", "w", "x", "y", "z"]; 27 | 28 | let secretkeyArray = () => { 29 | for (var e = [], i = 0x0; 0x05 > i; i++) { 30 | for (var n = "", s = 0x0; 0x10 > s; s++) { 31 | let a = Math.floor(0x3e * Math.random()); 32 | n += charset[a]; 33 | } 34 | e.push(n); 35 | } 36 | return e; 37 | }; 38 | 39 | let encrypt = function (word, keyStr) { 40 | let key = CryptoJS.enc.Utf8.parse(keyStr); 41 | let srcs = CryptoJS.enc.Utf8.parse(word); 42 | let encrypted = CryptoJS.AES.encrypt(srcs, key, { 43 | mode: CryptoJS.mode.ECB, 44 | padding: CryptoJS.pad.Pkcs7, 45 | }); 46 | return encrypted.toString(); 47 | }; 48 | 49 | let decrypt = function (word, keyStr) { 50 | let key = CryptoJS.enc.Utf8.parse(keyStr); 51 | let decrypted = CryptoJS.AES.decrypt(word, key, { 52 | mode: CryptoJS.mode.ECB, 53 | padding: CryptoJS.pad.Pkcs7, 54 | }); 55 | return decrypted.toString(CryptoJS.enc.Utf8); 56 | }; 57 | 58 | let encryptPhone = (data, key) => { 59 | var iv = ""; 60 | var cipherEncoding = "base64"; 61 | var cipher = crypto.createCipheriv("aes-128-ecb", key, iv); 62 | cipher.setAutoPadding(true); 63 | return Buffer.concat([cipher.update(data), cipher.final()]).toString( 64 | cipherEncoding 65 | ); 66 | }; 67 | let newjiamarr = () => { 68 | for (var e = [], k = "", t = charset, i = 0x0; 0x4 > i; i++) { 69 | for (var n = "", s = 0x0; 0x10 > s; s++) { 70 | let a = Math.floor(0x3e * Math.random()); 71 | n += t[a]; 72 | } 73 | e.push(n), (k += n.substring(0x0, 0x4)); 74 | } 75 | return { 76 | arr: e, 77 | zfc: k, 78 | }; 79 | }; 80 | module.exports = { 81 | secretkeyArray, 82 | encrypt, 83 | decrypt, 84 | newjiamarr, 85 | sign, 86 | encryptPhone, 87 | }; 88 | -------------------------------------------------------------------------------- /commands/tasks/unicom/handlers/gameUtils.js: -------------------------------------------------------------------------------- 1 | let AES = require("./PAES"); 2 | let { useragent } = require("./myPhone"); 3 | let gameEvents = require("./dailyEvent"); 4 | let crypto = require("crypto"); 5 | 6 | let transParams = (data) => { 7 | let params = new URLSearchParams(); 8 | for (let item in data) { 9 | params.append(item, data["" + item + ""]); 10 | } 11 | return params; 12 | }; 13 | let sleep = async (seconds) => { 14 | console.log(`☕ 等待${seconds}秒再继续`); 15 | // eslint-disable-next-line no-unused-vars 16 | return new Promise((resolve) => setTimeout(resolve, seconds * 1000)); 17 | }; 18 | 19 | let generateOrderid = () => { 20 | return crypto 21 | .createHash("md5") 22 | .update(new Date().getTime() + "") 23 | .digest("hex"); 24 | }; 25 | /** 26 | * 加密用户电话号码 27 | * @param {string} phone 明文电话号码 28 | */ 29 | let encodePhone = (phone) => { 30 | return AES.encryptPhone(phone, "gb6YCccUvth75Tm2"); 31 | }; 32 | /** 33 | * 各平台游戏请求封装 34 | */ 35 | const Referer_msmds = `https://wxapp.msmds.cn/`; 36 | const Origin_msmds = `https://wxapp.msmds.cn/`; 37 | class UnicomRequest { 38 | axios; 39 | options; 40 | constructor(axios, options) { 41 | this.axios = axios; 42 | this.options = options; 43 | } 44 | async postMsmds( 45 | url, 46 | data, 47 | headers = { 48 | referer: null, 49 | origin: null, 50 | }, 51 | USER_AGENTS = null 52 | ) { 53 | return await this.axios.request({ 54 | headers: { 55 | "user-agent": USER_AGENTS ? USER_AGENTS : useragent(this.options), 56 | referer: headers.referer ? headers.referer : Referer_msmds, 57 | origin: headers.origin ? headers.origin : Origin_msmds, 58 | }, 59 | url, 60 | method: "POST", 61 | data: transParams(data), 62 | }); 63 | } 64 | async post( 65 | url, 66 | data, 67 | headers = { referer: null, origin: null, Authorization: null }, 68 | USER_AGENTS = null 69 | ) { 70 | return await this.axios.request({ 71 | headers: { 72 | "user-agent": USER_AGENTS ? USER_AGENTS : useragent(this.options), 73 | referer: headers.referer ? headers.referer : Referer_msmds, 74 | origin: headers.origin ? headers.origin : Origin_msmds, 75 | Authorization: headers.Authorization ? headers.Authorization : "", 76 | }, 77 | url, 78 | method: "POST", 79 | data: data, 80 | }); 81 | } 82 | async getMsmds( 83 | url, 84 | data, 85 | headers = { referer: null, origin: null }, 86 | USER_AGENTS = null 87 | ) { 88 | return await this.axios.request({ 89 | // baseURL: "https://m.client.10010.com/", 90 | headers: { 91 | "user-agent": USER_AGENTS ? USER_AGENTS : useragent(this.options), 92 | referer: headers.referer ? headers.referer : Referer_msmds, 93 | origin: headers.origin ? headers.origin : Origin_msmds, 94 | }, 95 | url, 96 | method: "GET", 97 | params: transParams(data), 98 | }); 99 | } 100 | async get( 101 | url, 102 | data, 103 | headers = { referer: null, origin: null }, 104 | USER_AGENTS = null 105 | ) { 106 | return await this.axios.request({ 107 | // baseURL: "https://m.client.10010.com/", 108 | headers: { 109 | "user-agent": USER_AGENTS ? USER_AGENTS : useragent(this.options), 110 | referer: headers.referer ? headers.referer : Referer_msmds, 111 | origin: headers.origin ? headers.origin : Origin_msmds, 112 | }, 113 | url, 114 | method: "GET", 115 | params: data, 116 | }); 117 | } 118 | } 119 | /** 120 | * 针对通用活动业务封装后得组件库 121 | */ 122 | class UnicomComponent { 123 | axios; 124 | options; 125 | UA; 126 | phone; 127 | task = {}; 128 | taskname; 129 | cookies; 130 | channelId; 131 | headers; 132 | constructor(axios, options, taskname, platform = "", appversion = "8.0102") { 133 | this.axios = axios; 134 | this.options = options; 135 | this.options.appversion = appversion; 136 | this.phone = encodePhone(this.options.user); 137 | this.UA = useragent(this.options); 138 | this.platform = platform; 139 | this.taskname = taskname; 140 | } 141 | /** 142 | * 业务注册 143 | * @param {string}} title 业务项目 144 | * @param {*} callback 回调 145 | */ 146 | do(title, callback) { 147 | this.task[title] = callback; 148 | return this.task[title]; 149 | } 150 | /** 151 | * 平台登录入口 152 | * @param {string} url 登录请求URL 153 | */ 154 | login(url) { 155 | this.cookies = gameEvents 156 | .getOpenPlatLine( 157 | url.indexOf("openPlatLine.htm") > -1 158 | ? url 159 | : `https://m.client.10010.com/mobileService/openPlatform/openPlatLine.htm?to_url=${url}`, 160 | { base: this.platform }, 161 | (cookies) => { 162 | this.cookies = cookies; 163 | } 164 | ) 165 | .call(this, this.axios, this.options); 166 | // this.do("login", cb); 167 | return this.cookies; 168 | } 169 | postFreeLoginGuess(referer, freeLoginId, cookies = null, callback = null) { 170 | return gameEvents 171 | .postFreeLoginGuessWithCallBack(referer, freeLoginId, callback) 172 | .call(this, this.axios, this.options, cookies); 173 | } 174 | // avoidLogin() 175 | setChannelId(channelId) { 176 | this.channelId = channelId; 177 | } 178 | // async do(title) { 179 | // return await this.task[title].call(this, this.axios, this.options); 180 | // } 181 | 182 | async getinfo( 183 | data = { url, body, method: "POST", headers: { referer: "", options: "" } }, 184 | callback = null 185 | ) { 186 | let { url, body, method, headers } = data; 187 | return this.do("getinfo", async (axios, options) => { 188 | let request = new UnicomRequest(axios, options); 189 | let result; 190 | if (method === "POST") { 191 | result = await request.postMsmds(url, body, headers, this.UA); 192 | } else { 193 | result = await request.getMsmds(url, body, headers, this.UA); 194 | } 195 | if (result.data.code !== 200) { 196 | throw new Error("❌ something errors: ", result.data.msg); 197 | } 198 | if (typeof callback != "function") { 199 | return result; 200 | } else { 201 | return callback(result); 202 | } 203 | }).call(this, this.axios, this.options); 204 | } 205 | 206 | async get( 207 | data = { url, body, method: "POST", headers: { referer: "", origin: "" } }, 208 | callback = null 209 | ) { 210 | let { url, body, method, headers } = data; 211 | return this.do("getinfo", async (axios, options) => { 212 | let request = new UnicomRequest(axios, options); 213 | let result; 214 | if (method === "POST") { 215 | result = await request.post(url, body, headers, this.UA); 216 | } else { 217 | result = await request.get(url, body, headers, this.UA); 218 | } 219 | if (typeof callback == "function") { 220 | result.data = callback(result.data); 221 | } 222 | return result; 223 | }).call(this, this.axios, this.options); 224 | } 225 | getPhoneAsync(encodePhone = true) { 226 | return () => { 227 | encodePhone ? this.phone : this.options.user; 228 | }; 229 | } 230 | getPhone(encodePhone = true) { 231 | return encodePhone ? this.phone : this.options.user; 232 | } 233 | setHeaders(headers) { 234 | this.headers = headers; 235 | return this; 236 | } 237 | getToken() { 238 | let { ecs_token } = this.cookies; 239 | return ecs_token; 240 | } 241 | } 242 | 243 | module.exports = { 244 | transParams, 245 | sleep, 246 | encodePhone, 247 | UnicomRequest, 248 | UnicomComponent, 249 | generateOrderid, 250 | }; 251 | 252 | //OLD=>NEW 253 | // eslint-disable-next-line no-unused-vars 254 | -------------------------------------------------------------------------------- /commands/tasks/unicom/handlers/myPhone.js: -------------------------------------------------------------------------------- 1 | const util = require("util"); 2 | 3 | /** 4 | * pick a random user-agent 5 | * @param {object} options must be included appversion and user 6 | */ 7 | const useragent = (options) => { 8 | let USER_AGENTS = [...USER_AGENTS_ANDROID]; 9 | return util.format( 10 | USER_AGENTS[randomNumber(0, USER_AGENTS.length)], 11 | options.appversion || "8.0102", 12 | options.user 13 | ); 14 | }; 15 | 16 | // androidCodeId: "945757409", 17 | // iosCodeId: "945757412", 18 | const getCodeId = (useragent) => { 19 | return useragent.indexOf("Android") != -1 ? 945757409 : 945757412; 20 | }; 21 | 22 | // `Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36;devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:};unicom{version:android@8.0102,desmobile:${options.user}}`; 23 | const USER_AGENTS_ANDROID = [ 24 | // "Mozilla/5.0 (Linux; Android 7.1.2; SM-G977N Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:android@%s,desmobile:%s};devicetype{deviceBrand:samsung,deviceModel:SM-G977N};{yw_code:}", 25 | "Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1-wesley_iui-19.08.24; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36; unicom{version:android@%s,desmobile:%s};devicetype{deviceBrand:Xiaomi,deviceModel:MI 6};{yw_code:}", 26 | "Mozilla/5.0 (Linux; Android 10; V1981A Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.96 Mobile Safari/537.36; unicom{version:android@%s,desmobile:%s};devicetype{deviceBrand:vivo,deviceModel:V1981A};{yw_code:}", 27 | "Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36; unicom{version:android@%s,desmobile:%s};devicetype{deviceBrand:Xiaomi,deviceModel:MI 6};{yw_code:}", //小米6 28 | "Mozilla/5.0 (Linux; Android 10; EVR-AL00 Build/HUAWEIEVR-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.186 Mobile Safari/537.36; unicom{version:android@%s,desmobile:%s};devicetype{deviceBrand:HUAWEI,deviceModel:EVR-AL00};{yw_code:}", //华为Mate 20 X 29 | "Mozilla/5.0 (Linux; Android 9; JKM-AL00b Build/HUAWEIJKM-AL00b; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045130 Mobile Safari/537.3; unicom{version:android@%s,desmobile:%s};devicetype{deviceBrand:HUAWEI,deviceModel:JKM-AL00b};{yw_code:}", //华为nova4 30 | "Mozilla/5.0 (Linux; Android 10; CLT-AL00 Build/HUAWEICLT-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36; unicom{version:android@%s,desmobile:%s};devicetype{deviceBrand:HUAWEI,deviceModel:HUAWEICLT-AL00};{yw_code:}", 31 | "Mozilla/5.0 (Linux; Android 8.1.0; PBAM00 Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36; unicom{version:android@%s,desmobile:%s};devicetype{deviceBrand:OPPO,deviceModel:PBAM00};{yw_code:}", //OPPO A5 32 | ]; 33 | // eslint-disable-next-line no-unused-vars 34 | const USER_AGENTS_IOS = [ 35 | "Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 unicom{version:iphone_c@%s,desmobile:%s}{systemVersion:dis}{yw_code:}", 36 | "Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 unicom{version:iphone_c@%s,desmobile:%s}{systemVersion:dis}{yw_code:}", 37 | "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 unicom{version:iphone_c@%s,desmobile:%s}{systemVersion:dis}{yw_code:}", 38 | "Mozilla/5.0 (iPhone; CPU iPhone OS 12_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 unicom{version:iphone_c@%s,desmobile:%s}{systemVersion:dis}{yw_code:}", 39 | ]; 40 | function randomNumber(min = 0, max = 100) { 41 | return Math.min(Math.floor(min + Math.random() * (max - min)), max); 42 | } 43 | 44 | module.exports = { 45 | useragent, 46 | randomNumber, 47 | getCodeId, 48 | }; 49 | -------------------------------------------------------------------------------- /commands/tasks/unicom/init.js: -------------------------------------------------------------------------------- 1 | const { saveCookies } = require("../../../utils/util"); 2 | var crypto = require("crypto"); 3 | var moment = require("moment"); 4 | moment.locale("zh-cn"); 5 | const { useragent } = require("./handlers/myPhone"); 6 | // 联通APP版本 7 | const unicom_version = "8.0100"; 8 | 9 | const publicKey = `-----BEGIN PUBLIC KEY----- 10 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDc+CZK9bBA9IU+gZUOc6 11 | FUGu7yO9WpTNB0PzmgFBh96Mg1WrovD1oqZ+eIF4LjvxKXGOdI79JRdve9 12 | NPhQo07+uqGQgE4imwNnRx7PFtCRryiIEcUoavuNtuRVoBAm6qdB0Srctg 13 | aqGfLgKvZHOnwTjyNqjBUxzMeQlEC2czEMSwIDAQAB 14 | -----END PUBLIC KEY-----`.toString("ascii"); 15 | 16 | // 创建加密算法 17 | const rsapublicKeyEncode = function (data) { 18 | let crypted = crypto 19 | .publicEncrypt( 20 | { 21 | key: publicKey, 22 | padding: crypto.constants.RSA_PKCS1_PADDING, 23 | }, 24 | Buffer.from(data) 25 | ) 26 | .toString("base64"); 27 | return crypted; 28 | }; 29 | 30 | var transParams = (data) => { 31 | let params = new URLSearchParams(); 32 | for (let item in data) { 33 | params.append(item, data["" + item + ""]); 34 | } 35 | return params; 36 | }; 37 | 38 | // prettier-ignore 39 | var chars = ["1", "2", "3", "4", "5", "6", "7", "8", "9","0","a","b","c","d","e","f"]; 40 | function generateMixed(n) { 41 | let res = ""; 42 | for (var i = 0; i < n; i++) { 43 | var id = Math.floor(16 * Math.random()); 44 | res += chars[id]; 45 | } 46 | return res; 47 | } 48 | 49 | module.exports = async (axios, params) => { 50 | let { cookies, options } = params; 51 | let token_online; 52 | let appId; 53 | let data; 54 | const UA = useragent(options); 55 | 56 | if (cookies) { 57 | let res = await axios.request({ 58 | baseURL: "https://m.client.10010.com", 59 | headers: { 60 | "user-agent": UA, 61 | referer: "https://m.client.10010.com", 62 | origin: "https://m.client.10010.com", 63 | }, 64 | url: `/mobileService/customer/query/getMyUnicomDateTotle.htm`, 65 | method: "post", 66 | }); 67 | data = res.data; 68 | let config = res.config; 69 | let cookiesJson = config.jar.toJSON(); 70 | token_online = cookiesJson.cookies.find((i) => i.key == "token_online"); 71 | if (token_online) { 72 | token_online = token_online.value; 73 | } else { 74 | token_online = undefined; 75 | } 76 | appId = cookiesJson.cookies.find((i) => i.key == "appId"); 77 | if (appId) { 78 | appId = appId.value || options.appid; 79 | } else { 80 | appId = undefined; 81 | } 82 | } 83 | 84 | if ( 85 | Object.prototype.toString.call(data) !== "[object Object]" || 86 | !data || 87 | !("phone" in data) 88 | ) { 89 | console.log("cookies凭据访问失败,将使用账户密码登录"); 90 | if (!("appid" in options) || !options["appid"]) { 91 | throw new Error("需要提供appid"); 92 | } 93 | if (options["user"]) { 94 | if (!("password" in options) || !options["password"]) { 95 | throw new Error("需要提供登陆密码"); 96 | } 97 | } else if (!cookies) { 98 | throw new Error("需要提供登录信息,使用密码账号或者cookies"); 99 | } 100 | const deviceId = generateMixed(32); 101 | var params1 = { 102 | // ChinaunicomMobileBusiness 103 | appId: appId || options.appid, 104 | deviceBrand: "samsung", 105 | deviceCode: deviceId + "", 106 | deviceId: deviceId + "", 107 | deviceModel: "SM-G977N", 108 | deviceOS: "android7.1.2", 109 | isRemberPwd: "true", 110 | keyVersion: "", 111 | mobile: rsapublicKeyEncode(options.user), 112 | netWay: "Wifi", 113 | password: rsapublicKeyEncode(options.password), 114 | pip: "172.16.70.15", 115 | provinceChanel: "general", 116 | simCount: "0", 117 | timestamp: moment().format("YYYYMMDDHHmmss"), 118 | version: `android@${unicom_version}`, 119 | yw_code: "", 120 | }; 121 | const { data, config } = await axios.request({ 122 | baseURL: "https://m.client.10010.com", 123 | headers: { 124 | "user-agent": UA, 125 | referer: "https://m.client.10010.com", 126 | origin: "https://m.client.10010.com", 127 | }, 128 | url: `/mobileService/login.htm`, 129 | method: "post", 130 | data: transParams(params1), 131 | }); 132 | if (data.code !== "0") { 133 | throw new Error("登陆失败:" + data.dsc); 134 | } 135 | cookies = "token_online=" + data.token_online + "; appId=" + data.appId; 136 | await saveCookies( 137 | "unicom_" + (options.user || "default"), 138 | cookies, 139 | config.jar 140 | ); 141 | console.log("获得登录状态成功"); 142 | } else { 143 | const deviceId = generateMixed(32); 144 | params = { 145 | appId: appId, 146 | deviceBrand: "samsung", 147 | deviceCode: deviceId, 148 | deviceId: deviceId, 149 | deviceModel: "SM-G977N", 150 | deviceOS: "android7.1.2", 151 | netWay: "Wifi", 152 | platformToken: "0867442035025655300000391200CN01", 153 | pushPlatform: "samsung", 154 | reqtime: new Date().getTime(), 155 | token_online: token_online, 156 | version: `android@${unicom_version}`, 157 | }; 158 | if (!params.appId) { 159 | throw new Error("appId参数无效"); 160 | } 161 | if (!params.token_online) { 162 | throw new Error("token_online参数无效"); 163 | } 164 | const { data, config } = await axios 165 | .request({ 166 | baseURL: "https://m.client.10010.com", 167 | headers: { 168 | "user-agent": UA, 169 | referer: "https://m.client.10010.com", 170 | origin: "https://m.client.10010.com", 171 | }, 172 | url: `/mobileService/onLine.htm`, 173 | method: "post", 174 | data: transParams(params), 175 | }) 176 | .catch((err) => console.log(err)); 177 | 178 | if (data.code !== "0") { 179 | console.log(data.dsc); 180 | } 181 | cookies += "; token_online=" + data.token_online + "; appId=" + data.appId; 182 | await saveCookies( 183 | "unicom_" + (options.user || "default"), 184 | cookies, 185 | config.jar 186 | ); 187 | console.log("获得登录状态成功"); 188 | } 189 | }; 190 | -------------------------------------------------------------------------------- /commands/tasks/unicom/playGame.json: -------------------------------------------------------------------------------- 1 | { 2 | "nested": { 3 | "a": { 4 | "fields": { 5 | "key": { 6 | "type": "string", 7 | "id": 1 8 | }, 9 | "value": { 10 | "type": "string", 11 | "id": 2 12 | } 13 | } 14 | }, 15 | "b": { 16 | "fields": { 17 | "method": { 18 | "type": "string", 19 | "id": 1 20 | }, 21 | "iv": { 22 | "type": "int32", 23 | "id": 2 24 | } 25 | } 26 | }, 27 | "JudgeTimingBusiBuff": { 28 | "fields": { 29 | "Seq": { 30 | "type": "int64", 31 | "id": 1 32 | }, 33 | "qua": { 34 | "type": "string", 35 | "id": 2 36 | }, 37 | "deviceInfo": { 38 | "type": "string", 39 | "id": 3 40 | }, 41 | "busiBuff": { 42 | "type": "JudgeTiming", 43 | "id": 4 44 | }, 45 | "traceid": { 46 | "type": "string", 47 | "id": 5 48 | }, 49 | "Module": { 50 | "type": "string", 51 | "id": 6 52 | }, 53 | "Cmdname": { 54 | "type": "string", 55 | "id": 7 56 | }, 57 | "loginSig": { 58 | "type": "C0011a", 59 | "id": 8 60 | }, 61 | "Crypto": { 62 | "type": "b", 63 | "id": 9 64 | }, 65 | "Extinfo": { 66 | "type": "int32", 67 | "id": 10 68 | }, 69 | "contentType": { 70 | "type": "int32", 71 | "id": 11 72 | } 73 | } 74 | }, 75 | "GetAppInfoByLinkBusiBuff": { 76 | "fields": { 77 | "Seq": { 78 | "type": "int64", 79 | "id": 1 80 | }, 81 | "qua": { 82 | "type": "string", 83 | "id": 2 84 | }, 85 | "deviceInfo": { 86 | "type": "string", 87 | "id": 3 88 | }, 89 | "busiBuff": { 90 | "type": "bytes", 91 | "id": 4 92 | }, 93 | "traceid": { 94 | "type": "string", 95 | "id": 5 96 | }, 97 | "Module": { 98 | "type": "string", 99 | "id": 6 100 | }, 101 | "Cmdname": { 102 | "type": "string", 103 | "id": 7 104 | }, 105 | "loginSig": { 106 | "type": "C0011a", 107 | "id": 8 108 | }, 109 | "Crypto": { 110 | "type": "b", 111 | "id": 9 112 | }, 113 | "Extinfo": { 114 | "type": "int32", 115 | "id": 10 116 | }, 117 | "contentType": { 118 | "type": "int32", 119 | "id": 11 120 | } 121 | } 122 | }, 123 | "d": { 124 | "fields": { 125 | "Seq": { 126 | "type": "int32", 127 | "id": 1 128 | }, 129 | "retCode": { 130 | "type": "int64", 131 | "id": 2 132 | }, 133 | "errMsg": { 134 | "type": "bytes", 135 | "id": 3 136 | }, 137 | "busiBuff": { 138 | "type": "bytes", 139 | "id": 4 140 | }, 141 | "Extinfo": { 142 | "rule": "repeated", 143 | "type": "a", 144 | "id": 5 145 | } 146 | } 147 | }, 148 | "C0011a": { 149 | "fields": { 150 | "uin": { 151 | "type": "string", 152 | "id": 1 153 | }, 154 | "sig": { 155 | "type": "string", 156 | "id": 2 157 | }, 158 | "platform": { 159 | "type": "string", 160 | "id": 3 161 | }, 162 | "type": { 163 | "type": "int32", 164 | "id": 4 165 | }, 166 | "appid": { 167 | "type": "string", 168 | "id": 5 169 | }, 170 | "openid": { 171 | "type": "string", 172 | "id": 6 173 | }, 174 | "sessionkey": { 175 | "type": "bytes", 176 | "id": 7 177 | }, 178 | "Extinfo": { 179 | "rule": "repeated", 180 | "type": "a", 181 | "id": 8 182 | } 183 | } 184 | }, 185 | "q2b": { 186 | "fields": { 187 | "mapInfo": { 188 | "rule": "repeated", 189 | "type": "a", 190 | "id": 1 191 | }, 192 | "attachInfo": { 193 | "type": "string", 194 | "id": 2 195 | } 196 | } 197 | }, 198 | "JudgeTiming": { 199 | "fields": { 200 | "extInfo": { 201 | "type": "q2b", 202 | "id": 1 203 | }, 204 | "appid": { 205 | "type": "string", 206 | "id": 2 207 | }, 208 | "factType": { 209 | "type": "int32", 210 | "id": 3 211 | }, 212 | "duration": { 213 | "type": "int32", 214 | "id": 4 215 | }, 216 | "reportTime": { 217 | "type": "int64", 218 | "id": 5 219 | }, 220 | "afterCertify": { 221 | "type": "int32", 222 | "id": 6 223 | }, 224 | "appType": { 225 | "type": "int32", 226 | "id": 7 227 | }, 228 | "scene": { 229 | "type": "int32", 230 | "id": 8 231 | }, 232 | "totalTime": { 233 | "type": "int32", 234 | "id": 9 235 | }, 236 | "launchId": { 237 | "type": "string", 238 | "id": 10 239 | }, 240 | "via": { 241 | "type": "string", 242 | "id": 11 243 | }, 244 | "AdsTotalTime": { 245 | "type": "int32", 246 | "id": 12 247 | }, 248 | "hostExtInfo": { 249 | "type": "string", 250 | "id": 13 251 | } 252 | } 253 | }, 254 | "GetAppInfoByLink": { 255 | "fields": { 256 | "link": { 257 | "type": "string", 258 | "id": 1 259 | }, 260 | "linkType": { 261 | "type": "int32", 262 | "id": 2 263 | } 264 | } 265 | } 266 | } 267 | } -------------------------------------------------------------------------------- /commands/tasks/unicom/taocan.js: -------------------------------------------------------------------------------- 1 | //套餐看视频得积分 2 | //活动入口:主页-套餐页面-2个视频 3 | var crypto = require("crypto"); 4 | var sign = (data) => { 5 | let str = "integralofficial&"; 6 | let params = []; 7 | data.forEach((v, i) => { 8 | if (v) { 9 | params.push("arguments" + (i + 1) + v); 10 | } 11 | }); 12 | return crypto 13 | .createHash("md5") 14 | .update(str + params.join("&")) 15 | .digest("hex"); 16 | }; 17 | let account = { 18 | yhTaskId: "8a6437e839494400b7ff34327759448f", 19 | yhChannel: "GGPD", 20 | accountChannel: "517050707", 21 | accountUserName: "517050707", 22 | accountPassword: "123456", 23 | accountToken: "4640b530b3f7481bb5821c6871854ce5", 24 | }; 25 | var taocan = { 26 | query: async (request, options) => { 27 | let params = { 28 | arguments1: "AC20201013153418", // acid 29 | arguments2: account.yhChannel, // yhChannel 30 | arguments3: account.yhTaskId, // yhTaskId menuId 31 | arguments4: new Date().getTime(), // time 32 | arguments6: account.accountChannel, 33 | netWay: "Wifi", 34 | version: `android@8.0102`, 35 | }; 36 | params["sign"] = sign([ 37 | params.arguments1, 38 | params.arguments2, 39 | params.arguments3, 40 | params.arguments4, 41 | ]); 42 | return await require("./taskcallback").query(request, { 43 | ...options, 44 | params, 45 | }); 46 | }, 47 | doTask: async (request, options) => { 48 | console.log("🐀 看视频广告中..."); 49 | let { num, jar } = await taocan.query(request, options); 50 | // console.log(num); 51 | 52 | if (!num) { 53 | console.log("🐀 看广告得积分: 今日已完成"); 54 | return; 55 | } 56 | do { 57 | // console.log("还有", num, "次"); 58 | let params = { 59 | arguments1: "AC20201013153418", // acid 60 | arguments2: account.yhChannel, // yhChannel 61 | arguments3: account.yhTaskId, // yhTaskId menuId 62 | arguments4: new Date().getTime(), // time 63 | arguments6: account.accountUserName, 64 | arguments7: account.accountUserName, 65 | arguments8: account.accountPassword, 66 | arguments9: "4640b530b3f7481bb5821c6871854ce5", 67 | orderId: crypto 68 | .createHash("md5") 69 | .update(new Date().getTime() + "") 70 | .digest("hex"), 71 | netWay: "Wifi", 72 | remark: "套餐变更看视频得积分", 73 | version: `android@8.0102`, 74 | //orderId: "0923fca6d5ffb8ec017fc6b3cbc5c9c0", 75 | }; 76 | params["sign"] = sign([ 77 | params.arguments1, 78 | params.arguments2, 79 | params.arguments3, 80 | params.arguments4, 81 | ]); 82 | await require("./taskcallback").doTask(request, { 83 | ...options, 84 | params, 85 | jar, 86 | }); 87 | 88 | let s = Math.floor(Math.random() * 30); 89 | console.log("☕ 等待%s秒再继续", s); 90 | // eslint-disable-next-line no-unused-vars 91 | await new Promise((resolve, reject) => setTimeout(resolve, s * 1000)); 92 | } while (--num); 93 | }, 94 | }; 95 | 96 | module.exports = taocan; 97 | -------------------------------------------------------------------------------- /commands/tasks/unicom/taskcallback.js: -------------------------------------------------------------------------------- 1 | var crypto = require("crypto"); 2 | var transParams = (data) => { 3 | let params = new URLSearchParams(); 4 | for (let item in data) { 5 | params.append(item, data["" + item + ""]); 6 | } 7 | return params; 8 | }; 9 | 10 | //data 是准备加密的字符串,key是你的密钥 11 | 12 | function encryption(data, key) { 13 | var iv = ""; 14 | var cipherEncoding = "base64"; 15 | var cipher = crypto.createCipheriv("aes-128-ecb", key, iv); 16 | cipher.setAutoPadding(true); 17 | return Buffer.concat([cipher.update(data), cipher.final()]).toString( 18 | cipherEncoding 19 | ); 20 | } 21 | 22 | //data 是你的准备解密的字符串,key是你的密钥 23 | // eslint-disable-next-line no-unused-vars 24 | function decryption(data, key) { 25 | var iv = ""; 26 | var clearEncoding = "utf8"; 27 | var cipherEncoding = "base64"; 28 | var decipher = crypto.createDecipheriv("aes-128-ecb", key, iv); 29 | decipher.setAutoPadding(true); 30 | return Buffer.concat([ 31 | decipher.update(data, cipherEncoding), 32 | decipher.final(), 33 | ]).toString(clearEncoding); 34 | } 35 | 36 | function a(str) { 37 | str = str + str; 38 | return str.substr(8, 16); 39 | } 40 | 41 | var taskcallback = { 42 | // 查询活动状态 43 | query: async (axios, options) => { 44 | let { params } = options; 45 | const useragent = `ChinaUnicom4.x/1.0 CFNetwork/1209 Darwin/20.2.0`; 46 | 47 | let { data, config } = await axios.request({ 48 | baseURL: "https://m.client.10010.com/", 49 | headers: { 50 | "user-agent": useragent, 51 | referer: `https://m.client.10010.com`, 52 | origin: "https://m.client.10010.com", 53 | }, 54 | url: `/taskcallback/taskfilter/query`, 55 | method: "POST", 56 | data: transParams(params), 57 | }); 58 | console.log(data); 59 | if (data.code === "0000") { 60 | console.log( 61 | data.timeflag === "1" 62 | ? `今日参加活动已达上限(${data.achieve}/${data.allocation}次)` 63 | : `活动可参加(${data.achieve}/${data.allocation}次)` 64 | ); 65 | return { 66 | num: parseInt(data.allocation) - parseInt(data.achieve), 67 | jar: config.jar, 68 | }; 69 | } else { 70 | console.log("查询出错", data.desc); 71 | return false; 72 | } 73 | }, 74 | reward: async (axios, options) => { 75 | let { params, jar } = options; 76 | let cookiesJson = jar.toJSON(); 77 | let ecs_token = cookiesJson.cookies.find((i) => i.key == "ecs_token"); 78 | if (!ecs_token) { 79 | throw new Error("ecs_token缺失"); 80 | } 81 | ecs_token = ecs_token.value; 82 | let orderId = 83 | params.orderId || 84 | crypto 85 | .createHash("md5") 86 | .update(new Date().getTime() + "") 87 | .digest("hex"); 88 | let codeId = parseInt(params.codeId || 945535616); 89 | let app_id = "5049584"; 90 | let media_extra = [ 91 | ecs_token, 92 | options.user, 93 | "android", 94 | params.arguments1, 95 | params.arguments2, 96 | orderId, // orderId 97 | codeId, //codeId 98 | params.remark, 99 | "Wifi", 100 | ]; 101 | 102 | var data = { 103 | oversea_version_type: 0, 104 | reward_name: `android-${params.remark1 || params.remark}-激励视频`, 105 | reward_amount: 1, 106 | network: 4, 107 | // "latitude": 26.611770629882812, 108 | // "longitude": 106.63581085205078, 109 | sdk_version: "3.3.0.3", 110 | user_agent: 111 | "Mozilla/5.0 (Linux; Android 9; VKY-AL00 Build/HUAWEIVKY-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.198 Mobile Safari/537.36", 112 | extra: { 113 | // "ad_slot_type": 7, 114 | // "oaid": "ebdde3b9-def7-6cc3-fdfe-9bfff7ce4126", 115 | // "language": "golang", 116 | // "ug_creative_id": "", 117 | // "ad_id": 1687489184287789, 118 | // "creative_id": 1687493310795863, 119 | // "convert_id": 1682419505842179, 120 | // "uid": 95981094553, 121 | // "ad_type": 1, 122 | // "pricing": 9, 123 | // "ut": 12, 124 | // "version_code": "8.1", 125 | // "device_id": 50137151117, 126 | // "width": 360, 127 | // "height": 640, 128 | // "mac": "10:44:00:73:74:BF", 129 | // "uuid": "867442035025655", 130 | // "uuid_md5": "8a4dac2481580bd94f8c4b17787b74cd", 131 | // "os": "android", 132 | // "client_ip": "111.121.67.62", 133 | // "open_udid": "", 134 | // "os_type": null, 135 | // "app_name": "手机营业厅", 136 | // "device_type": "VKY-AL00", 137 | // "os_version": "9", 138 | // "app_id": "5049584", 139 | // "template_id": 0, 140 | // "template_rate": 0, 141 | // "promotion_type": 0, 142 | // "img_gen_type": 0, 143 | // "img_md5": "", 144 | // "source_type": 1, 145 | // "pack_time": "{pack_time}", 146 | // "cid": 1687493310795863, 147 | // "interaction_type": 4, 148 | // "src_type": "app", 149 | // "package_name": "com.sinovatech.unicom.ui", 150 | // "pos": 5, 151 | // "landing_type": 3, 152 | // "is_sdk": true, 153 | // "is_dsp_ad": false, 154 | // "imei": "867442035025655", 155 | // "req_id": "e9da96b1-2d0c-49d0-b5b0-3fd6540d22d4u2997", 156 | rit: codeId, 157 | }, 158 | media_extra: encodeURI(media_extra.join("|")), 159 | video_duration: 28.143, 160 | play_start_ts: new Date().getTime() - 32 * 1000, 161 | play_end_ts: 0, 162 | duration: 28143, 163 | user_id: app_id, 164 | trans_id: crypto 165 | .createHash("md5") 166 | .update(new Date().getTime() + "") 167 | .digest("hex"), 168 | }; 169 | 170 | let key = crypto 171 | .createHash("md5") 172 | .update(new Date().getTime() + "") 173 | .digest("hex") 174 | .substr(8, 16); 175 | let t = JSON.stringify(data).replace(/\//g, "\\/"); //.replace('"{pack_time}"', '1.609770734935479E9') 176 | let m = encryption(t, a(key)).replace(/(.{76})/g, "$1\n"); 177 | m = "2" + key + m; 178 | 179 | var message = { 180 | message: m, 181 | cypher: 2, 182 | }; 183 | // let s = a(message.message.substr(1, 16)) 184 | // console.log(decryption(message.message.replace(/\n/g, '').substr(17), s)) 185 | // process.exit(0) 186 | 187 | const useragent = `VADNetAgent/0`; 188 | let res = await axios.request({ 189 | headers: { 190 | "user-agent": useragent, 191 | "Content-Type": "application/json; charset=utf-8", 192 | }, 193 | url: `https://api-access.pangolin-sdk-toutiao.com/api/ad/union/sdk/reward_video/reward/`, 194 | method: "POST", 195 | data: message, 196 | }); 197 | data = res.data; 198 | // console.log(data); 199 | // s = a(data.message.substr(1, 16)); 200 | // console.log(decryption(data.message.replace(/\n/g, "").substr(17), s)); 201 | if ("code" in data) { 202 | console.log(data); 203 | throw new Error("获取激励信息出错"); 204 | } 205 | 206 | return { 207 | orderId, 208 | }; 209 | }, 210 | // 提交任务 211 | doTask: async (axios, options) => { 212 | let result = await taskcallback.reward(axios, options); 213 | let params = options.params; 214 | params["orderId"] = result["orderId"]; 215 | delete params.codeId; 216 | const useragent = `okhttp/4.4.0`; 217 | // const useragent = ` ChinaUnicom4.x/1.0 CFNetwork/1209 Darwin/20.2.0`; 218 | let { data } = await axios.request({ 219 | baseURL: "https://m.client.10010.com/", 220 | headers: { 221 | "user-agent": useragent, 222 | referer: `https://m.client.10010.com/`, 223 | origin: "https://m.client.10010.com", 224 | }, 225 | url: `/taskcallback/taskfilter/dotasks`, 226 | method: "POST", 227 | data: transParams(params), 228 | }); 229 | console.log(data); 230 | if (data.code === "0000") { 231 | console.log("提交任务成功", data.prizeName + "+" + data.prizeCount); 232 | } else { 233 | console.log("提交任务出错", data.desc); 234 | } 235 | }, 236 | }; 237 | module.exports = taskcallback; 238 | -------------------------------------------------------------------------------- /commands/tasks/unicom/test.js: -------------------------------------------------------------------------------- 1 | const { UnicomComponent } = require("./handlers/gameUtils"); 2 | // 霸王餐刮刮卡 3 | let testDemo = { 4 | doTask: async (axios, options) => { 5 | //配置平台信息参数axios, options必填,3:游戏活动名,4:平台种类 6 | let test = new UnicomComponent(axios, options, "测试游戏", "msmds"); 7 | await testDemo.login(test); 8 | let data = await testDemo.getinfo(test); 9 | console.log(data); 10 | }, 11 | login: async (request) => { 12 | return await request.login( 13 | `https://wxapp.msmds.cn/h5/react_web/unicom/luckCardPage&duanlianjieabc=tbkd2` 14 | ); 15 | }, 16 | getinfo: async (request) => { 17 | //请求配置参数 18 | let requestConfig = { 19 | url: 20 | "https://wxapp.msmds.cn/jplus/api/scratchCardRecord/getScratchCardNum", 21 | body: { 22 | channelId: "unicom_scratch_card", 23 | phone: request.getPhone(), 24 | token: request.getToken(), 25 | }, 26 | method: "POST", 27 | headers: { 28 | referer: `https://wxapp.msmds.cn/`, 29 | origin: "https://wxapp.msmds.cn", 30 | }, 31 | }; 32 | return await request.getinfo(requestConfig, (result) => { 33 | console.log(result.data); 34 | return { 35 | freeTimes: result.data.data.surplusNum, 36 | advertTimes: result.data.data.canLookVideo 37 | ? 4 - result.data.data.playNum 38 | : 0, 39 | }; 40 | }); 41 | }, 42 | }; 43 | 44 | module.exports = testDemo; 45 | -------------------------------------------------------------------------------- /commands/tasks/wps/clock_in.js: -------------------------------------------------------------------------------- 1 | // https://zt.wps.cn/2018/clock_in 2 | 3 | var isInTime = function (e, t) { 4 | var n = (new Date).getHours(); 5 | return n >= e && n < t 6 | } 7 | // 打卡领会员-仅自动邀请 8 | var clockIn = { 9 | doTask: async (axios, options) => { 10 | // https://zt.wps.cn/2018/clock_in/api/get_data?member=wps 11 | let { data } = await axios.request({ 12 | url: `https://zt.wps.cn/2018/clock_in`, 13 | method: 'get' 14 | }).catch(err => console.log(err)) 15 | let datamodel = data.match(/datamodel\s*=\s(.*?);/)[1] 16 | datamodel = JSON.parse(datamodel) 17 | console.log(`当前用户${datamodel.username},打卡奖励倍数${datamodel.times}倍,昨日是否签到${datamodel.is_sign_up_yesterday},今日是否打卡${datamodel.is_clock_in}`) 18 | if (datamodel.isSignUpYesterday) { 19 | if (datamodel.is_clock_in) { 20 | console.log('今日已打卡,跳过') 21 | return 22 | } else if (!isInTime(6, 13)) { 23 | console.log('不在6-13时间段内,跳过') 24 | return 25 | } 26 | } else { 27 | console.log('昨日未签到,开始报名挑战') 28 | } 29 | 30 | if (!datamodel.is_sign_up) { 31 | console.log('今天尚未报名,开始报名') 32 | let t = (new Date).getTime() 33 | let { data: sd } = await axios.request({ 34 | url: `https://zt.wps.cn/2018/clock_in/api/sign_up?sid=${datamodel.userinfo.userid}&from=&csource=&_t=${t}&_=${t}`, 35 | method: 'get' 36 | }).catch(err => console.log(err)) 37 | if (sd.result === 'error') { 38 | console.log('需要绑定相关信息,请访问【https://zt.wps.cn/2018/clock_in】绑定相关信息后在操作,跳过') 39 | return 40 | } 41 | } else { 42 | console.log('今天已报名') 43 | } 44 | console.log('开始邀请人员参与挑战') 45 | 46 | let invite_sid = [ 47 | 'V02S2UBSfNlvEprMOn70qP3jHPDqiZU00a7ef4a800341c7c3b', 48 | 'V02StVuaNcoKrZ3BuvJQ1FcFS_xnG2k00af250d4002664c02f', 49 | 'V02SWIvKWYijG6Rggo4m0xvDKj1m7ew00a8e26d3002508b828', 50 | 'V02Sr3nJ9IicoHWfeyQLiXgvrRpje6E00a240b890023270f97', 51 | 'V02SBsNOf4sJZNFo4jOHdgHg7-2Tn1s00a338776000b669579', 52 | 'V02S2oI49T-Jp0_zJKZ5U38dIUSIl8Q00aa679530026780e96', 53 | 'V02ShotJqqiWyubCX0VWTlcbgcHqtSQ00a45564e002678124c', 54 | 'V02SFiqdXRGnH5oAV2FmDDulZyGDL3M00a61660c0026781be1', 55 | 'V02S7tldy5ltYcikCzJ8PJQDSy_ElEs00a327c3c0026782526', 56 | 'V02SPoOluAnWda0dTBYTXpdetS97tyI00a16135e002684bb5c', 57 | 'V02Sb8gxW2inr6IDYrdHK_ywJnayd6s00ab7472b0026849b17', 58 | 'V02SwV15KQ_8n6brU98_2kLnnFUDUOw00adf3fda0026934a7f', 59 | 'V02SC1mOHS0RiUBxeoA8NTliH2h2NGc00a803c35002693584d' 60 | ] 61 | for (let sid of invite_sid) { 62 | try { 63 | let res = await axios.request({ 64 | headers: { "sid": sid }, 65 | url: `http://zt.wps.cn/2018/clock_in/api/invite`, 66 | method: 'post', 67 | data: `invite_userid=${datamodel.userinfo.userid}` 68 | }).catch(err => console.log(err)) 69 | let td = res.data 70 | if (td.result === 'error') { 71 | console.log(`邀请[${sid}]失败`, td.msg) 72 | } else { 73 | console.log(`邀请[${sid}]成功`, td.msg) 74 | } 75 | console.log(`延时等待`) 76 | await new Promise((resolve, reject) => setTimeout(resolve, 500)) 77 | } catch (err) { 78 | console.log(err) 79 | } 80 | } 81 | 82 | // let { data: clock_in } = await axios.request({ 83 | // headers: { "sid": sid }, 84 | // url: `http://zt.wps.cn/2018/clock_in/api/clock_in?member=wps`, 85 | // method: 'get' 86 | // }).catch(err => console.log(err)) 87 | } 88 | } 89 | module.exports = clockIn -------------------------------------------------------------------------------- /commands/tasks/wps/wps.js: -------------------------------------------------------------------------------- 1 | const { scheduler } = require('../../../utils/scheduler') 2 | const _request = require('../../../utils/request') 3 | 4 | var start = async (params) => { 5 | const { cookies, options } = params 6 | 7 | let init = async (request, savedCookies) => { 8 | if (!savedCookies) { 9 | if (!cookies || !('wps_sid' in cookies) || !cookies['wps_sid']) { 10 | throw new Error("需要提供wps_sid参数") 11 | } 12 | if (!('csrf' in cookies) || !cookies['csrf']) { 13 | throw new Error("需要提供csrf参数") 14 | } 15 | return { 16 | request: _request(cookies) 17 | } 18 | } else { 19 | return { 20 | request 21 | } 22 | } 23 | } 24 | let taskOption = { 25 | init 26 | } 27 | 28 | await scheduler.regTask('wps_clock_in', async (request) => { 29 | await require('./clock_in').doTask(request, options) 30 | }, { 31 | startHours: 6, 32 | endHours: 8, 33 | ...taskOption 34 | }) 35 | 36 | } 37 | module.exports = { 38 | start 39 | } -------------------------------------------------------------------------------- /commands/unicom.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const tasklist = require("../utils/observersion"); 3 | const { scheduler } = require("../utils/scheduler"); 4 | 5 | exports.command = "unicom"; 6 | 7 | exports.describe = "unicom任务"; 8 | const UNICOM_USERNAME = "UNICOM_USERNAME"; 9 | const UNICOM_PASSWORD = "UNICOM_PASSWORD"; 10 | const UNICOM_APPID = "UNICOM_APPID"; 11 | String.prototype.replaceWithMask = function (start, end) { 12 | return this.substr(0, start) + "******" + this.substr(-end, end); 13 | }; 14 | let env = require("dotenv").config({ 15 | path: path.resolve(__dirname, "../config", ".env"), 16 | }).parsed; 17 | if (!env) { 18 | throw new Error("missing env file,please check it as well"); 19 | } 20 | exports.builder = function (yargs) { 21 | return yargs 22 | .option("leftTasks", { 23 | describe: "剩余任务统计", 24 | type: "boolean", 25 | }) 26 | .option("tasks", { 27 | describe: "任务执行项", 28 | type: "string", 29 | }) 30 | .help() 31 | .showHelpOnFail(true, "使用--help查看有效选项") 32 | .epilog("copyright 2020 LunnLew"); 33 | }; 34 | 35 | let getAccount = (data, cb = null) => { 36 | let account = []; 37 | let users = data[UNICOM_USERNAME].split(",").map((i) => i.trim()); 38 | let pwd = data[UNICOM_PASSWORD].split(",").map((i) => i.trim()); 39 | let appid = data[UNICOM_APPID].split(",").map((i) => i.trim()); 40 | if (!users.length || !pwd.length || users.length !== pwd.length) { 41 | throw new Error("Please check your usernames and passwords in env file"); 42 | } 43 | if ( 44 | Object.prototype.toString.call(users) !== "[object Array]" && 45 | Object.prototype.toString.call(pwd) !== "[object Array]" 46 | ) { 47 | throw new Error("usernames and passwords are illegal"); 48 | } 49 | users.forEach((user, i) => { 50 | account.push({ user: user, password: pwd[i], appid: appid[i] }); 51 | }); 52 | return typeof cb === "function" ? cb(account) : account; 53 | }; 54 | exports.handler = async function (argv) { 55 | var command = argv._[0]; 56 | var accounts = []; 57 | accounts = getAccount(env, (data) => { 58 | data.map((i) => { 59 | if ("tasks" in argv) i.tasks = argv["tasks"]; 60 | }); 61 | return data; 62 | }); 63 | console.log("总账户数", accounts.length); 64 | for (let account of accounts) { 65 | if ("leftTasks" in argv) { 66 | let tmp = tasklist 67 | .getTasks({ command: command, taskKey: account.user }) 68 | .unfinished() 69 | .toString(); 70 | console.log(`账号${account.user.replaceWithMask(2, 3)}未完成任务汇总: `); 71 | console.log(tmp); 72 | } else { 73 | await require(path.join(__dirname, "tasks", command, command)) 74 | .start({ 75 | cookies: account.cookies, 76 | options: { 77 | appid: account.appid, 78 | user: account.user, 79 | password: account.password, 80 | }, 81 | }) 82 | .catch((err) => console.log(" unicom任务:", err)); 83 | let hasTasks = await scheduler.hasWillTask(command, { 84 | tryrun: "tryrun" in argv, 85 | taskKey: account.user, 86 | }); 87 | if (hasTasks) { 88 | scheduler 89 | .execTask(command, account.tasks) 90 | .catch((err) => console.log("unicom任务:", err)) 91 | .finally(() => { 92 | console.log("当前任务执行完毕!"); 93 | }); 94 | } else { 95 | console.log("暂无可执行任务!"); 96 | } 97 | } 98 | } 99 | }; 100 | -------------------------------------------------------------------------------- /commands/wps.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const { scheduler } = require("../utils/scheduler"); 3 | 4 | exports.command = "wps"; 5 | 6 | exports.describe = "wps签到任务"; 7 | 8 | exports.builder = function (yargs) { 9 | return yargs 10 | .option("wps_sid", { 11 | describe: "cookie项wps_sid的值", 12 | type: "string", 13 | }) 14 | .option("csrf", { 15 | describe: "cookie项csrf的值", 16 | type: "string", 17 | }) 18 | .help() 19 | .showHelpOnFail(true, "使用--help查看有效选项") 20 | .epilog("copyright 2020 LunnLew"); 21 | }; 22 | 23 | exports.handler = async function (argv) { 24 | var command = argv._[0]; 25 | var accounts = []; 26 | if ("accountSn" in argv && argv.accountSn) { 27 | let accountSns = argv.accountSn.split(","); 28 | for (let sn of accountSns) { 29 | if ("wps_sid-" + sn in argv) { 30 | let account = { 31 | wps_sid: argv["wps_sid-" + sn], 32 | csrf: argv["csrf-" + sn], 33 | tasks: argv["tasks-" + sn], 34 | }; 35 | if ("tryrun-" + sn in argv) { 36 | account["tryrun"] = true; 37 | } 38 | accounts.push(account); 39 | } 40 | } 41 | } else { 42 | accounts.push({ 43 | ...argv, 44 | }); 45 | } 46 | console.log("总账户数", accounts.length); 47 | for (let account of accounts) { 48 | await require(path.join(__dirname, "tasks", command, command)) 49 | .start({ 50 | cookies: { 51 | wps_sid: account.wps_sid, 52 | csrf: account.csrf, 53 | }, 54 | options: {}, 55 | }) 56 | .catch((err) => console.log("wps签到任务:", err.message)); 57 | let hasTasks = await scheduler.hasWillTask(command, { 58 | tryrun: "tryrun" in argv, 59 | taskKey: account.wps_sid, 60 | }); 61 | if (hasTasks) { 62 | scheduler 63 | .execTask(command, account.tasks) 64 | .catch((err) => console.log("wps签到任务:", err.message)) 65 | .finally(() => { 66 | console.log("当前任务执行完毕!"); 67 | }); 68 | } else { 69 | console.log("暂无可执行任务!"); 70 | } 71 | } 72 | }; 73 | -------------------------------------------------------------------------------- /config/.env.sample: -------------------------------------------------------------------------------- 1 | # Unicom acounts 2 | UNICOM_USERNAME = '' 3 | UNICOM_PASSWORD = '' 4 | UNICOM_APPID = '' 5 | -------------------------------------------------------------------------------- /config/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !.env.sample 4 | 5 | -------------------------------------------------------------------------------- /default.json: -------------------------------------------------------------------------------- 1 | { 2 | "accountSn": "1", 3 | "user-1": "1*****1", 4 | "password-1": "1*****1", 5 | "appid-1": "1*****1" 6 | } -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | asm_unicom: 4 | container_name: asm_unicom 5 | build: 6 | context: ./ 7 | dockerfile: docker/Dockerfile 8 | volumes: 9 | - ./:/AutoSignMachine #同步脚本地址 10 | restart: always 11 | tty: true 12 | network_mode: "bridge" 13 | hostname: asm_unicom 14 | environment: 15 | - enable_unicom=true #签到开关 false / true 16 | - user=123456 # 输入用户手机号 17 | - password=123456 #输入用户密码 18 | - appid=FFFFFFFF #输入手机端APPID 19 | asm_bili: 20 | container_name: asm_bili 21 | build: 22 | context: ./ 23 | dockerfile: docker/Dockerfile 24 | volumes: 25 | - ./:/AutoSignMachine #同步脚本地址 26 | restart: always 27 | tty: true 28 | network_mode: "bridge" 29 | environment: 30 | - enable_bilibili=false #签到开关 31 | - DedeUserID= # 32 | - SESSDATA= # 33 | - bili_jct= # 34 | 35 | asm52pojie: 36 | container_name: asm52pojie 37 | build: 38 | context: ./ 39 | dockerfile: docker/Dockerfile 40 | volumes: 41 | - ./:/AutoSignMachine #同步脚本地址 42 | restart: always 43 | tty: true 44 | network_mode: "bridge" 45 | environment: 46 | - enable_52pojie=false #签到开关 47 | - htVD_2132_auth= # 48 | - htVD_2132_saltkey= # 49 | 50 | asm_iqiyi: 51 | container_name: asm_iqiyi 52 | build: 53 | context: ./ 54 | dockerfile: docker/Dockerfile 55 | volumes: 56 | - ./:/AutoSignMachine #同步脚本地址 57 | restart: always 58 | tty: true 59 | network_mode: "bridge" 60 | environment: 61 | - enable_iqiyi=false #签到开关 62 | - P00001= # 63 | - P00PRU= # 64 | - QC005= # 65 | - dfp= # 66 | 67 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | (async () => { 2 | require("./AutoSignMachine.js").run(); 3 | })(); 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auto-sign-machine", 3 | "version": "1.0.0", 4 | "description": "自动签到机器人", 5 | "main": "index.js", 6 | "repository": "https://github.com/lunnlew/AutoSignMachine.git", 7 | "author": "lunnlew", 8 | "license": "MIT", 9 | "dependencies": { 10 | "axios": "^0.21.1", 11 | "axios-cookiejar-support": "^1.0.1", 12 | "cheerio": "^1.0.0-rc.3", 13 | "crypto": "^1.0.1", 14 | "crypto-js": "^4.0.0", 15 | "dayjs": "^1.9.6", 16 | "dotenv": "^8.2.0", 17 | "fs-extra": "^9.0.1", 18 | "iconv-lite": "^0.6.2", 19 | "moment": "^2.29.1", 20 | "p-queue": "^6.6.2", 21 | "protobufjs": "^6.10.2", 22 | "qs": "^6.9.4", 23 | "tough-cookie": "^4.0.0", 24 | "yargs": "^16.1.0" 25 | }, 26 | "devDependencies": { 27 | "@babel/eslint-parser": "^7.12.16", 28 | "eslint": "^7.20.0", 29 | "eslint-config-prettier": "^7.2.0", 30 | "eslint-plugin-prettier": "^3.3.1", 31 | "prettier": "2.2.1", 32 | "serverless-tencent-scf": "^0.1.7" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /serverless.yml: -------------------------------------------------------------------------------- 1 | service: auto-sign-matchine 2 | 3 | provider: # provider information 4 | name: tencent 5 | runtime: Nodejs12.16 # Nodejs8.9 or Nodejs6.10 6 | credentials: ~/credentials 7 | 8 | # you can overwrite defaults here 9 | # stage: dev 10 | # cosBucket: DEFAULT 11 | # role: QCS_SCFExcuteRole 12 | # memorySize: 256 13 | # timeout: 10 14 | # region: ap-shanghai 15 | # environment: 16 | # variables: 17 | # ENV_FIRST: env1 18 | # ENV_SECOND: env2 19 | # vpcConfig: 20 | # vpcId: test 21 | # subnetId: test 22 | 23 | plugins: 24 | - serverless-tencent-scf 25 | 26 | # you can add packaging information here 27 | #package: 28 | # include: 29 | # - include-me.js 30 | # - include-me-dir/** 31 | # exclude: 32 | # - exclude-me.js 33 | # - exclude-me-dir/** 34 | 35 | # 免费用户执行时长不得超过900秒 36 | 37 | functions: 38 | task1: 39 | handler: tscf.main_handler 40 | runtime: Nodejs12.16 41 | memorySize: 256 42 | timeout: 900 43 | environment: 44 | variables: 45 | cmd: unicom 46 | config: default.json 47 | tasks: dailysignin,winterTwo,dxIntegralEveryDay,dailygamebox,dailylotteryintegral,dailywoTree,dailyLiuLan,dailycomment,producGameSignin 48 | events: 49 | - timer: 50 | name: timer 51 | parameters: 52 | cronExpression: '10 9-10 * * *' 53 | enable: true 54 | task2: 55 | handler: tscf.main_handler 56 | runtime: Nodejs12.16 57 | memorySize: 256 58 | timeout: 900 59 | environment: 60 | variables: 61 | cmd: unicom 62 | config: default.json 63 | tasks: dailygameflow 64 | events: 65 | - timer: 66 | name: timer 67 | parameters: 68 | cronExpression: '*/30 7-23 * * *' 69 | enable: true 70 | task3: 71 | handler: tscf.main_handler 72 | runtime: Nodejs12.16 73 | memorySize: 256 74 | timeout: 900 75 | environment: 76 | variables: 77 | cmd: unicom 78 | config: default.json 79 | tasks: dailygameIntegral 80 | events: 81 | - timer: 82 | name: timer 83 | parameters: 84 | cronExpression: '*/30 7-23 * * *' 85 | enable: true 86 | task4: 87 | handler: tscf.main_handler 88 | runtime: Nodejs12.16 89 | memorySize: 256 90 | timeout: 900 91 | environment: 92 | variables: 93 | cmd: unicom 94 | config: default.json 95 | tasks: todayDailyTask 96 | events: 97 | - timer: 98 | name: timer 99 | parameters: 100 | cronExpression: '*/30 22 * * *' 101 | enable: true -------------------------------------------------------------------------------- /tscf.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // see https://github.com/serverless/serverless/blob/master/README_CN.md#how-to-install-a-service 4 | 5 | exports.main_handler = (event, context, callback) => { 6 | let argv = process.argv; 7 | argv[2] = process.env.cmd; 8 | argv[3] = "--config"; 9 | argv[4] = process.env.USER_CODE_ROOT + "/" + process.env.config; 10 | argv[5] = "--tasks"; 11 | argv[6] = process.env.tasks; 12 | console.log(argv.join(" ")); 13 | if (!process.env.tasks) { 14 | callback(null, "必须单独指定任务"); 15 | } else { 16 | require("./AutoSignMachine.js").run(argv); 17 | callback(null, "触发任务执行成功"); 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /utils/observersion.js: -------------------------------------------------------------------------------- 1 | let path = require("path"); 2 | const os = require("os"); 3 | const fs = require("fs"); 4 | let observersion = { 5 | observable: true, 6 | directory: path.join(os.homedir(), ".AutoSignMachine"), 7 | tasks: null, 8 | unfinishedTask: null, 9 | getTasks: ({ taskKey, command }) => { 10 | let taskFile = path.join( 11 | observersion.directory, 12 | `taskFile_${command}_${taskKey}.json` 13 | ); 14 | if (fs.existsSync(taskFile)) { 15 | let tasks = fs.readFileSync(taskFile).toString("utf-8"); 16 | observersion.tasks = JSON.parse(tasks); 17 | } 18 | return observersion; 19 | }, 20 | unfinished: () => { 21 | if (!observersion.tasks) { 22 | throw new Error("No tasks"); 23 | } 24 | observersion.tasks = observersion.tasks.queues.filter((v) => { 25 | if (v.taskState === 0) { 26 | return v; 27 | } 28 | }); 29 | return observersion; 30 | }, 31 | toString: () => { 32 | let tmpArray = []; 33 | observersion.tasks.forEach((v) => { 34 | tmpArray.push(v.taskName); 35 | }); 36 | return tmpArray.join(","); 37 | }, 38 | toJson: () => { 39 | return observersion.tasks; 40 | }, 41 | }; 42 | 43 | module.exports = observersion; 44 | -------------------------------------------------------------------------------- /utils/request.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const axiosCookieJarSupport = require("axios-cookiejar-support").default; 3 | const tough = require("tough-cookie"); 4 | axiosCookieJarSupport(axios); 5 | 6 | const err = (error) => { 7 | return Promise.reject(error); 8 | }; 9 | 10 | var parseDefaultCookie = function (cookies) { 11 | let cookie = []; 12 | if (Object.prototype.toString.call(cookies) == "[object String]") { 13 | cookie = cookies ? [cookies] : []; 14 | } else if (Object.prototype.toString.call(cookies) == "[object Object]") { 15 | Object.keys(cookies).forEach((item) => { 16 | cookie.push(item + "=" + cookies[item]); 17 | }); 18 | } 19 | return cookie.join("; "); 20 | }; 21 | 22 | var setCookieString = function (jar, cookies, config) { 23 | let url; 24 | if (config.url.indexOf("http") === 0) { 25 | url = config.url; 26 | } else { 27 | url = config.baseURL + config.url; 28 | } 29 | let uuuu = new URL(url); 30 | // console.log('setCookieString for', uuuu.origin) 31 | cookies = parseDefaultCookie(cookies); 32 | if (Object.prototype.toString.call(cookies) == "[object String]") { 33 | cookies.length && 34 | cookies.split("; ").forEach((cookie) => { 35 | jar.setCookieSync(cookie, uuuu.origin + "/", {}); 36 | }); 37 | } 38 | return jar; 39 | }; 40 | 41 | module.exports = (cookies) => { 42 | const service = axios.create({ 43 | headers: { 44 | Cookie: parseDefaultCookie(cookies), 45 | }, 46 | jar: new tough.CookieJar(), 47 | timeout: 60000, 48 | withCredentials: true, 49 | }); 50 | service.interceptors.request.use(async (config) => { 51 | if (!("user-agent" in config.headers)) { 52 | config.headers["user-agent"] = 53 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"; 54 | } 55 | let jar = config.jar; 56 | if (!jar) { 57 | jar = new tough.CookieJar(); 58 | } else { 59 | config.headers["Cookie"] = ""; 60 | } 61 | config.jar = setCookieString(jar, cookies, config); 62 | return config; 63 | }, err); 64 | service.interceptors.response.use(async (response) => { 65 | return response; 66 | }, err); 67 | return service; 68 | }; 69 | -------------------------------------------------------------------------------- /utils/util.js: -------------------------------------------------------------------------------- 1 | const os = require("os"); 2 | const path = require("path"); 3 | const fs = require("fs-extra"); 4 | 5 | module.exports = { 6 | async delCookiesFile(key) { 7 | let dir = path.join(os.homedir(), ".AutoSignMachine"); 8 | if ( 9 | "TENCENTCLOUD_RUNENV" in process.env && 10 | process.env.TENCENTCLOUD_RUNENV === "SCF" 11 | ) { 12 | dir = path.join("/tmp", ".AutoSignMachine"); 13 | } 14 | if (!fs.existsSync(dir)) { 15 | fs.mkdirpSync(dir); 16 | } 17 | let cookieFile = path.join(dir, "cookieFile_" + key + ".txt"); 18 | if (fs.existsSync(cookieFile)) { 19 | fs.unlinkSync(cookieFile); 20 | } 21 | }, 22 | getCookies: (key) => { 23 | let dir = path.join(os.homedir(), ".AutoSignMachine"); 24 | let cookies = ""; 25 | if ( 26 | "TENCENTCLOUD_RUNENV" in process.env && 27 | process.env.TENCENTCLOUD_RUNENV === "SCF" 28 | ) { 29 | dir = path.join("/tmp", ".AutoSignMachine"); 30 | } 31 | if (!fs.existsSync(dir)) { 32 | fs.mkdirpSync(dir); 33 | } 34 | let cookieFile = path.join(dir, "cookieFile_" + key + ".txt"); 35 | if (fs.existsSync(cookieFile)) { 36 | cookies = fs.readFileSync(cookieFile).toString("utf-8"); 37 | } 38 | return cookies; 39 | }, 40 | saveCookies: (key, cookies, cookiesJar) => { 41 | let dir = path.join(os.homedir(), ".AutoSignMachine"); 42 | if ( 43 | "TENCENTCLOUD_RUNENV" in process.env && 44 | process.env.TENCENTCLOUD_RUNENV === "SCF" 45 | ) { 46 | dir = path.join("/tmp", ".AutoSignMachine"); 47 | } 48 | if (!fs.existsSync(dir)) { 49 | fs.mkdirpSync(dir); 50 | } 51 | let cookieFile = path.join(dir, "cookieFile_" + key + ".txt"); 52 | let allcookies = {}; 53 | if (cookies) { 54 | cookies.split("; ").map((c) => { 55 | let item = c.split("="); 56 | allcookies[item[0]] = item[1] || ""; 57 | }); 58 | } 59 | if (cookiesJar) { 60 | cookiesJar.toJSON().cookies.map((c) => { 61 | allcookies[c.key] = c.value || ""; 62 | }); 63 | } 64 | let cc = []; 65 | for (let key in allcookies) { 66 | cc.push({ 67 | key: key, 68 | value: allcookies[key] || "", 69 | }); 70 | } 71 | fs.ensureFileSync(cookieFile); 72 | fs.writeFileSync( 73 | cookieFile, 74 | cc.map((c) => c.key + "=" + c.value).join("; ") 75 | ); 76 | }, 77 | buildUnicomUserAgent: (options, tplname) => { 78 | var tpl = { 79 | p: 80 | "Mozilla/5.0 (Linux; Android {android_version}; {deviceModel} Build/{buildSn}; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36; unicom{version:{unicom_version},desmobile:{desmobile}};devicetype{deviceBrand:{deviceBrand},deviceModel:{deviceModel}};{yw_code:}", 81 | }; 82 | var rdm = { 83 | android_version: "7.1.2", 84 | unicom_version: "android@8.0100", 85 | deviceBrand: "samsung", 86 | deviceModel: "SM-G977N", 87 | buildSn: "LMY48Z", 88 | desmobile: options.user, 89 | }; 90 | var fmt = (str, params) => { 91 | for (let key in params) { 92 | str = str.replace(new RegExp("\\{" + key + "\\}", "g"), params[key]); 93 | } 94 | return str; 95 | }; 96 | return fmt(tpl[tplname], Object.assign(rdm, options)); 97 | }, 98 | }; 99 | --------------------------------------------------------------------------------