掌上天津极速版签到脚本
const $ = new Env('掌上天津极速版'); const ckName = 'zstjjsb_data'; const Notify = 1; //0为关闭通知,1为打开通知,默认为1 let envSplitor = ['@', '\n']; //多账号分隔符 let strSplitor = '&'; //多变量分隔符 const CryptoJS = require('crypto-js'); let scriptVersionNow = '0.0.1';
let msg = '';
async function start() { await getVersion('smallfawn/QLScriptPublic@main/zstjjsb.js'); await getNotice();
let taskall = [];
for (let user of $.userList) {
if (user.ckStatus) {
taskall.push(await user.task());
$.DoubleLog(`等待10s`)
await $.wait(10000);
}
}
await Promise.all(taskall);
}
class UserInfo {
constructor(str) {
this.index = ++$.userIdx;
this.userId = str.split(strSplitor)[0]; //单账号多变量分隔符
this.salf = str.split(strSplitor)[1];
this.ckStatus = true;
}
async task() {
$.DoubleLog(------ 第[${this.index}]个账号 ------)
await this.sign_info()
}
encode(str) {
//var b = new Buffer(str);
var b = Buffer.from(str);
var s = b.toString('base64');
var s = s.replace(///g, '_')
return s
}
getmac() {
var mac = '';
for (var i = 0; i < 6; i++) {
var randomByte = Math.floor(Math.random() * 256);
var hexString = randomByte.toString(16).toUpperCase();
mac += (hexString.length === 1 ? '0' + hexString : hexString) + ':';
}
mac = mac.slice(0, -1); // 去掉最后一个冒号
return mac;
}
async sign_info() {
let timestamp = Math.round(new Date().getTime() / 1000).toString();
let macs = this.getmac()
let mac = encodeURIComponent(macs)
let s = 'brand=OPPO&client=android&deviceInfo=OPPO_PCAM00_2021040100_10&interfaceVersion=v2.8&lat=30.1&lng=114.2&mac=' + macs + '&model=PCAM00&privacyStatus=1®ion=天津市&salf=' + this.salf + '×tamp=' + timestamp + '&uid=' + this.userId + '&userId=' + this.userId + '&version=2.8.4&versionCode=154'
s = this.encode(s)
let signs = CryptoJS.HmacSHA1(s, '1s_vsegymTasdgKxiKvRz5vDlyzmc92A_H6A8zg6I').toString().toUpperCase()
try {
let options = {
method: 'POST',
url: 'http://bbs.zaitianjin.net/zstj/v2.8/index.php',
headers: {
'Content-Yype': 'application/x-www-form-urlencoded',
'Host': 'bbs.zaitianjin.net',
'Connection': 'Keep-Alive',
'Accept-Encoding': 'gzip',
'User-Agent': 'okhttp/4.9.3'
},
body: 'c=User&lng=114.2&privacyStatus=1&sign=' + signs + '&interfaceVersion=v2.8&version=2.8.4&userId=' + this.userId + '&m=signInfo&mac=' + mac + '&versionCode=154&deviceInfo=OPPO_PCAM00_2021040100_10&uid=' + this.userId + '&client=android&model=PCAM00®ion=%E5%A4%A9%E6%B4%A5%E5%B8%82&salf=' + this.salf + '&brand=OPPO&lat=30.1×tamp=' + timestamp
}, result = await httpRequest(options);
//console.log(options);
//console.log(result);
if (result['code'] == 1) {
$.DoubleLog(账号[${this.index}] 签到天数: ${result['data']['signDays']}🎉);
$.DoubleLog(账号[${this.index}] 累计签到天数: ${result['data']['signAllDays']})
$.DoubleLog(账号[${this.index}] 今日是否签到: ${result['data']['signStatue']})
$.DoubleLog(账号[${this.index}] 连续签到7天奖励: ${result['data']['signData']})
if (result['data']['signStatue'] == false) {
await this.sign()
}
} else {
$.DoubleLog(账号[${this.index}] 失败 ❌);
//console.log(options);
//console.log(result);
}
} catch (e) {
console.log(e);
}
}
async sign() {
let timestamp = Math.round(new Date().getTime() / 1000).toString();
let macs = this.getmac()
let mac = encodeURIComponent(macs)
let s = 'brand=OPPO&client=android&deviceInfo=OPPO_PCAM00_2021040100_10&interfaceVersion=v2.8&lat=30.1&lng=114.2&mac=' + macs + '&model=PCAM00&privacyStatus=1®ion=天津市&salf=' + this.salf + '×tamp=' + timestamp + '&uid=' + this.userId + '&userId=' + this.userId + '&version=2.8.4&versionCode=154'
s = this.encode(s)
let signs = CryptoJS.HmacSHA1(s, '1s_vsegymTasdgKxiKvRz5vDlyzmc92A_H6A8zg6I').toString().toUpperCase()
try {
let options = {
method: 'POST',
url: 'http://bbs.zaitianjin.net/zstj/v2.8/index.php',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Host': 'bbs.zaitianjin.net',
'Connection': 'Keep-Alive',
'Accept-Encoding': 'gzip',
'User-Agent': 'okhttp/4.9.3'
},
body: 'c=Credit&lng=114.2&privacyStatus=1&sign=' + signs + '&interfaceVersion=v2.8&version=2.8.4&userId=' + this.userId + '&m=sign&mac=' + mac + '&versionCode=154&deviceInfo=OPPO_PCAM00_2021040100_10&uid=' + this.userId + '&client=android&model=PCAM00®ion=%E5%A4%A9%E6%B4%A5%E5%B8%82&salf=' + this.salf + '&brand=OPPO&lat=30.1×tamp=' + timestamp
}, result = await httpRequest(options);
//console.log(options);
//console.log(result);
if (result['code'] == 1) {
$.DoubleLog(`账号[${this.index}] 签到成功🎉`);
} else {
$.DoubleLog(`账号[${this.index}] 签到:失败 ❌ `);
//console.log(options);
//console.log(result);
}
} catch (e) {
console.log(e);
}
}
}
!(async () => { if (!(await checkEnv())) return; if ($.userList.length > 0) { await start(); } await $.SendMsg(msg); })().catch((e) => console.log(e)).finally(() => $.done());
//******************************************************** /**
- 变量检查与处理
- @returns
*/
async function checkEnv() {
let userCookie = ($.isNode() ? process.env[ckName] : $.getdata(ckName)) || '';
//let userCount = 0;
if (userCookie) {
// console.log(userCookie);
let e = envSplitor[0];
for (let o of envSplitor)
if (userCookie.indexOf(o) > -1) {
e = o;
break;
}
for (let n of userCookie.split(e)) n && $.userList.push(new UserInfo(n));
//userCount = $.userList.length;
} else {
console.log('未找到CK');
return;
}
return console.log(
共找到${$.userList.length}个账号), true; //true == !0 }
/////////////////////////////////////////////////////////////////////////////////////
function httpRequest(options, method = null) {
method = options.method ? options.method.toLowerCase() : options.body ? 'post' : 'get';
return new Promise((resolve) => {
$[method](options, (err, resp, data) => {
if (err) {
//console.log(resp)
console.log(${method}请求失败);
$.logErr(err);
} else {
//console.log(resp)
//console.log(data)
if (data) {
try { data = JSON.parse(data); } catch (error) { }
resolve(data);
} else {
console.log(请求api返回数据为空,请检查自身原因);
}
}
resolve();
});
});
}
/**
- 获取远程版本
/
function getVersion(scriptUrl, timeout = 3 * 1000) {
return new Promise((resolve) => {
const options = { url:
https://fastly.jsdelivr.net/gh/${scriptUrl}}; $.get(options, (err, resp, data) => { try { const regex = /scriptVersionNow\s=\s*(['"])([\d.]+)\1/; const match = data.match(regex); const scriptVersionLatest = match ? match[2] : ''; console.log(\n====== 当前版本:${scriptVersionNow} 📌 最新版本:${scriptVersionLatest} ======); } catch (e) { $.logErr(e, resp); } resolve(); }, timeout); }); } function getNotice() { return new Promise((resolve) => { const options = { url: 'https://fastly.jsdelivr.net/gh/smallfawn/QLScriptPublic/notice/notice.json', headers: { 'User-Agent': 'okhttp/4.9.3', 'Content-Type': 'application/x-www-form-urlencoded' } }; $.get(options, async (err, resp, data) => { try { const result = JSON.parse(data); const noticeVersion = result.version; const noticeContent = result.content; const noticeUrl = result.url; if (noticeVersion && noticeVersion !== $.getdata('noticeVersion')) { $.setdata(noticeVersion, 'noticeVersion'); if (noticeUrl && noticeUrl !== '') { $.msg($.name,📣新通知:${noticeContent},🔗${noticeUrl}); } else { $.msg($.name, '📣新通知', noticeContent); } $.log(\n====== 📣新通知 ======\n${noticeContent}`); } } catch (e) { $.logErr(e, resp); } resolve(); }); });
原文地址: https://www.cveoy.top/t/topic/pk7o 著作权归作者所有。请勿转载和采集!