From 298350b6fa1601de0600893da49329c8f4b0a552 Mon Sep 17 00:00:00 2001 From: smallfawn <101914820+smallfawn@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:24:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=9B=B4=E6=96=B0=E7=A6=8F=E7=94=B0E?= =?UTF-8?q?=E5=AE=B6=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftej.js | 976 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 976 insertions(+) create mode 100644 ftej.js diff --git a/ftej.js b/ftej.js new file mode 100644 index 0000000..c699431 --- /dev/null +++ b/ftej.js @@ -0,0 +1,976 @@ + +/* +福田e家 +ftej '账号#密码' +偶尔会报错 多定时两次就好了 +*/ + +const $ = new Env("福田e家"); +//let envSplitor = ['\n','@','#'] +const fs = require('fs') +let httpResult, httpReq, httpResp +const ckFile1 = 'ftej.txt' +const ckName = 'ftej' +let userCookie = [] +try { + userCookie = userCookie.concat(fs.readFileSync(`./${ckFile1}`,'utf-8').split('\n')||[]) + console.log(`ck文件[ ${ckFile1} ]加载成功`) + this.mxr = true +} catch (e) { + console.log(`未发现本地文件 调用青龙环境变量`) + this.mxr = false +} +let mxr=this.mxr +if (this.mxr == false){ + try { + userCookie = userCookie.concat((($.isNode() ? process.env[ckName] : $.getdata(ckName))||'')?.split('\n')||[]) + console.log(`环境变量[ ${ckName} ]加载成功`) + } catch (e) { + //console.log(e) + } +} + +let userList = [] +let userIdx = 0 +let userCount = 0 +let time = Math.round( Date.now()) + +/////////////////////////////////////////////////////////////////// +class UserInfo { + constructor(str) { + this.index = ++userIdx + + this.valid = false + + try { + this.ck = str.split('#') + this.user = phoneNum(`${this.ck[0]}`) + this.ckValid = true + } catch (e) { + + } + } + + + async cashck() { + try { + let url = `https://czyl.foton.com.cn/ehomes-new/homeManager/getLoginMember`; + let body =`{"password":"${this.ck[1]}","version_name":"","version_auth":"","device_id":"","device_model":"","ip":"","name":"${this.ck[0]}","version_code":"180","deviceSystemVersion":"","device_type":"0"}`; +//console.log(body) + let h = { + "Host": "czyl.foton.com.cn", + "Content-Type": "application/json;charset\u003dutf-8", + } + let urlObject = popu(url, h, body) + await httpRequest('post', urlObject) + let result = httpResult; + // console.log(result) + if (result.code == 200) { + console.log(`账号 ${this.user} 登录成功 `) + this.token = result.data.token + this.memberComplexCode = result.data.memberComplexCode + this.uid = result.data.uid + this.memberID = result.data.memberID + if(result.data.signIn== "未签到"){ + await this.sign() + } + // await $.wait(3000); + await this.getTaskList()//每日关注 + // await $.wait(3000); + await this.grxx() + }else{ + console.log(`账号 ${this.user} 登录失败 `) + } + } catch (e) { + console.log(e) + } finally { + return Promise.resolve(1); + } + } + //任务列表 + async getTaskList() { + let tim = Math.round( Date.now()) + try { + let url = `https://czyl.foton.com.cn/ehomes-new/homeManager/api/Member/getTaskList`; + let body = `{"memberId":"${this.memberID}","userId":"${this.uid}","userType":"61","uid":"${this.uid}","mobile":"${this.ck[0]}","tel":"${this.ck[0]}","brandName":"","seriesName":"","token":"ebf76685e48d4e14a9de6fccc76483e3","safeEnc":${tim-20220000},"businessId":1}`; + + + let h = { + "user-agent": "web", + "Content-Type": "application/json; charset\u003dutf-8", + "token": "", + "host": "czyl.foton.com.cn" + } + //console.log(body) + let urlObject = popu(url, h, body) + await httpRequest('post', urlObject) + let result = httpResult; + // console.log(result) + if (result.code == 200) { + if (result.data[4].completeNum == 0) { + await this.sign()//签到 + }else if (result.data[4].completeNum ==1 ){ + console.log(`账号 ${this.user} ${result.data[4].ruleName} 已完成 `) + } + if (result.data[5].completeNum == 0) { + await this.fx()//分享 + }else if (result.data[5].completeNum ==1 ){ + console.log(`账号 ${this.user} ${result.data[6].ruleName} 已完成 `) + } + if (result.data[6].completeNum == 0) { + await this.topicList()//发帖 + }else if (result.data[6].completeNum ==1 ){ + console.log(`账号 ${this.user} ${result.data[6].ruleName} 已完成 `) + } + if (result.data[8].completeNum == 0) { + await this.follow2nd()//关注 + }else if (result.data[8].completeNum ==1 ){ + console.log(`账号 ${this.user} ${result.data[8].ruleName} 已完成 `) + } + if (result.data[7].completeNum == 0) { + await this.comment2nd()//评论 + }else if (result.data[7].completeNum ==1 ){ + console.log(`账号 ${this.user} ${result.data[7].ruleName} 已完成 `) + } + } + } catch (e) { + console.log(e) + } finally { + return Promise.resolve(1); + } + } + async sign() { + let time1 = Math.round( Date.now()) + try { + let url = `https://czyl.foton.com.cn/ehomes-new/homeManager/api/bonus/signActivity2nd`; + let body = `{"memberId":"${this.memberComplexCode}","userId":"${this.uid}","userType":"61","uid":"${this.uid}","mobile":"${this.ck[0]}","tel":"${this.ck[0]}","brandName":"","seriesName":"","token":"ebf76685e48d4e14a9de6fccc76483e3","safeEnc":${time1-20220000},"businessId":1}`; + let h = { + "Host": "czyl.foton.com.cn", + "Content-Type": "application/json;charset\u003dutf-8", + "token": ``, + } + //console.log(body) + let urlObject = popu(url, h, body) + await httpRequest('post', urlObject) + let result = httpResult; + //console.log(result) + if (result.code == 200) { + console.log(`账号 ${this.user} 签到成功获得积分 ${result.data.data.integral} `) + } else if (result.code == 500) { + console.log(`账号 ${this.user} 今日已经签到`) + } + } catch (e) { + console.log(e) + } finally { + return Promise.resolve(1); + } + } + + //关注列表 + async postList() { + let time2 = Math.round( Date.now()) + try { + let url = `https://czyl.foton.com.cn/ehomes-new/ehomesCommunity/api/post/nowPostList`; + let body = ` {"memberId":"${this.memberID}","userId":"${this.uid}","userType":"61","uid":"${this.uid}","mobile":"${this.ck[0]}","tel":"${this.ck[0]}","brandName":"","seriesName":"","token":"ebf76685e48d4e14a9de6fccc76483e3","safeEnc":${time2-20220000},"businessId":1,"pageNumber":1,"pageSize":30,"follow":"1"}`; + let h = { + "user-agent": "web", + "Content-Type": "application/json; charset\u003dutf-8", + "token": "", + "host": "czyl.foton.com.cn" + } + //console.log(body) + let urlObject = popu(url, h, body) + await httpRequest('post', urlObject) + let result = httpResult; + // console.log(result) + if (result.code == 200) { + for (let i=1;i { + if (typeof $request !== "undefined") { + await GetRewrite() + } else { + + if (!(await checkEnv())) return; + + + + if (userList.length > 0) { + console.log('\n------- 福田e家-------\n') + taskall = [] + for (let user of userList) { + taskall.push(user.cashck()) + } + await Promise.all(taskall) + console.log('\n------- 卡车生活-------\n') + taskall = [] + for (let user of userList) { + taskall.push(user.kclogin()) + } + await Promise.all(taskall) + } + + } +})() + .catch((e) => console.log(e)) + .finally(() => $.done()) + +/////////////////////////////////////////////////////////////////// +async function GetRewrite() { + +} + + +function checkEnv() { + if(userCookie) { + for(let userCookies of userCookie) { + if(userCookies) userList.push(new UserInfo(userCookies)) + } + userCount = userList.length + } else { + console.log(`未找到CK`) + return false; + } + + console.log(`\n共找到${userCount}个账号`) + return true +} + + + +//////////////////////////////////////////////////////////////////// +function popu(url, h, body = '') { + let host = url.replace('//', '/').split('/')[1] + let urlObject = { + url: url, + headers: h, + timeout: 5000, + } + if (body) { + urlObject.body = body + } + + return urlObject; +} + + +async function httpRequest(method, url) { + httpResult = null, httpReq = null, httpResp = null; + return new Promise((resolve) => { + $.send(method, url, async (err, req, resp) => { + try { + httpReq = req; + httpResp = resp; + if (err) { + } else { + if (resp.body) { + if (typeof resp.body == "object") { + httpResult = resp.body; + } else { + try { + httpResult = JSON.parse(resp.body); + } catch (e) { + httpResult = resp.body; + } + } + } + } + } catch (e) { + console.log(e); + } finally { + resolve(); + } + }); + }); +} +//////////////////////////////////////////////////////////////////// +function randomArr(arr) { + return arr[parseInt(Math.random() * arr.length, 10)]; +} +function phoneNum(phone_num) { + if (phone_num.length == 11) { + let data = phone_num.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2"); + return data; + } else { + return phone_num; + } +} +//MD5加密 +function MD5_Encrypt(a) { + function b(a, b) { + return a << b | a >>> 32 - b + } + + function c(a, b) { + var c, d, e, f, g; + return e = 2147483648 & a, + f = 2147483648 & b, + c = 1073741824 & a, + d = 1073741824 & b, + g = (1073741823 & a) + (1073741823 & b), + c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : + g ^ e ^ f + } + + function d(a, b, c) { + return a & b | ~a & c + } + + function e(a, b, c) { + return a & c | b & ~c + } + + function f(a, b, c) { + return a ^ b ^ c + } + + function g(a, b, c) { + return b ^ (a | ~c) + } + + function h(a, e, f, g, h, i, j) { + return a = c(a, c(c(d(e, f, g), h), j)), + c(b(a, i), e) + } + + function i(a, d, f, g, h, i, j) { + return a = c(a, c(c(e(d, f, g), h), j)), + c(b(a, i), d) + } + + function j(a, d, e, g, h, i, j) { + return a = c(a, c(c(f(d, e, g), h), j)), + c(b(a, i), d) + } + + function k(a, d, e, f, h, i, j) { + return a = c(a, c(c(g(d, e, f), h), j)), + c(b(a, i), d) + } + + function l(a) { + for (var b, c = a.length, d = c + 8, e = (d - d % 64) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = + 0; c > i;) + b = (i - i % 4) / 4, + h = i % 4 * 8, + g[b] = g[b] | a.charCodeAt(i) << h, + i++; + return b = (i - i % 4) / 4, + h = i % 4 * 8, + g[b] = g[b] | 128 << h, + g[f - 2] = c << 3, + g[f - 1] = c >>> 29, + g + } + + function m(a) { + var b, c, d = "", + e = ""; + for (c = 0; 3 >= c; c++) + b = a >>> 8 * c & 255, + e = "0" + b.toString(16), + d += e.substr(e.length - 2, 2); + return d + } + + function n(a) { + a = a.replace(/\r\n/g, "\n"); + for (var b = "", c = 0; c < a.length; c++) { + var d = a.charCodeAt(c); + 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), + b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), + b += String.fromCharCode(d >> 6 & 63 | 128), + b += String.fromCharCode(63 & d | 128)) + } + return b + } + + var o, p, q, r, s, t, u, v, w, x = [], + y = 7, + z = 12, + A = 17, + B = 22, + C = 5, + D = 9, + E = 14, + F = 20, + G = 4, + H = 11, + I = 16, + J = 23, + K = 6, + L = 10, + M = 15, + N = 21; + for (a = n(a), + x = l(a), + t = 1732584193, + u = 4023233417, + v = 2562383102, + w = 271733878, + o = 0; o < x.length; o += 16) + p = t, + q = u, + r = v, + s = w, + t = h(t, u, v, w, x[o + 0], y, 3614090360), + w = h(w, t, u, v, x[o + 1], z, 3905402710), + v = h(v, w, t, u, x[o + 2], A, 606105819), + u = h(u, v, w, t, x[o + 3], B, 3250441966), + t = h(t, u, v, w, x[o + 4], y, 4118548399), + w = h(w, t, u, v, x[o + 5], z, 1200080426), + v = h(v, w, t, u, x[o + 6], A, 2821735955), + u = h(u, v, w, t, x[o + 7], B, 4249261313), + t = h(t, u, v, w, x[o + 8], y, 1770035416), + w = h(w, t, u, v, x[o + 9], z, 2336552879), + v = h(v, w, t, u, x[o + 10], A, 4294925233), + u = h(u, v, w, t, x[o + 11], B, 2304563134), + t = h(t, u, v, w, x[o + 12], y, 1804603682), + w = h(w, t, u, v, x[o + 13], z, 4254626195), + v = h(v, w, t, u, x[o + 14], A, 2792965006), + u = h(u, v, w, t, x[o + 15], B, 1236535329), + t = i(t, u, v, w, x[o + 1], C, 4129170786), + w = i(w, t, u, v, x[o + 6], D, 3225465664), + v = i(v, w, t, u, x[o + 11], E, 643717713), + u = i(u, v, w, t, x[o + 0], F, 3921069994), + t = i(t, u, v, w, x[o + 5], C, 3593408605), + w = i(w, t, u, v, x[o + 10], D, 38016083), + v = i(v, w, t, u, x[o + 15], E, 3634488961), + u = i(u, v, w, t, x[o + 4], F, 3889429448), + t = i(t, u, v, w, x[o + 9], C, 568446438), + w = i(w, t, u, v, x[o + 14], D, 3275163606), + v = i(v, w, t, u, x[o + 3], E, 4107603335), + u = i(u, v, w, t, x[o + 8], F, 1163531501), + t = i(t, u, v, w, x[o + 13], C, 2850285829), + w = i(w, t, u, v, x[o + 2], D, 4243563512), + v = i(v, w, t, u, x[o + 7], E, 1735328473), + u = i(u, v, w, t, x[o + 12], F, 2368359562), + t = j(t, u, v, w, x[o + 5], G, 4294588738), + w = j(w, t, u, v, x[o + 8], H, 2272392833), + v = j(v, w, t, u, x[o + 11], I, 1839030562), + u = j(u, v, w, t, x[o + 14], J, 4259657740), + t = j(t, u, v, w, x[o + 1], G, 2763975236), + w = j(w, t, u, v, x[o + 4], H, 1272893353), + v = j(v, w, t, u, x[o + 7], I, 4139469664), + u = j(u, v, w, t, x[o + 10], J, 3200236656), + t = j(t, u, v, w, x[o + 13], G, 681279174), + w = j(w, t, u, v, x[o + 0], H, 3936430074), + v = j(v, w, t, u, x[o + 3], I, 3572445317), + u = j(u, v, w, t, x[o + 6], J, 76029189), + t = j(t, u, v, w, x[o + 9], G, 3654602809), + w = j(w, t, u, v, x[o + 12], H, 3873151461), + v = j(v, w, t, u, x[o + 15], I, 530742520), + u = j(u, v, w, t, x[o + 2], J, 3299628645), + t = k(t, u, v, w, x[o + 0], K, 4096336452), + w = k(w, t, u, v, x[o + 7], L, 1126891415), + v = k(v, w, t, u, x[o + 14], M, 2878612391), + u = k(u, v, w, t, x[o + 5], N, 4237533241), + t = k(t, u, v, w, x[o + 12], K, 1700485571), + w = k(w, t, u, v, x[o + 3], L, 2399980690), + v = k(v, w, t, u, x[o + 10], M, 4293915773), + u = k(u, v, w, t, x[o + 1], N, 2240044497), + t = k(t, u, v, w, x[o + 8], K, 1873313359), + w = k(w, t, u, v, x[o + 15], L, 4264355552), + v = k(v, w, t, u, x[o + 6], M, 2734768916), + u = k(u, v, w, t, x[o + 13], N, 1309151649), + t = k(t, u, v, w, x[o + 4], K, 4149444226), + w = k(w, t, u, v, x[o + 11], L, 3174756917), + v = k(v, w, t, u, x[o + 2], M, 718787259), + u = k(u, v, w, t, x[o + 9], N, 3951481745), + t = c(t, p), + u = c(u, q), + v = c(v, r), + w = c(w, s); + var O = m(t) + m(u) + m(v) + m(w); + return O.toLowerCase() +} +function Env(a, b) { + return "undefined" != typeof process && JSON.stringify(process.env).indexOf("xxx") > -1 && process.exit(0), new class { + constructor(a, b) { + this.name = a, this.notifyStr = "", this.startTime = (new Date).getTime(), Object.assign(this, b), console.log(`${this.name} 开始运行: +`) + } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } getdata(b) { let a = this.getval(b); if (/^@/.test(b)) { let [, c, f] = /^@(.*?)\.(.*?)$/.exec(b), d = c ? this.getval(c) : ""; if (d) try { let e = JSON.parse(d); a = e ? this.lodash_get(e, f, "") : a } catch (g) { a = "" } } return a } setdata(c, d) { let a = !1; if (/^@/.test(d)) { let [, b, e] = /^@(.*?)\.(.*?)$/.exec(d), f = this.getval(b), i = b ? "null" === f ? null : f || "{}" : "{}"; try { let g = JSON.parse(i); this.lodash_set(g, e, c), a = this.setval(JSON.stringify(g), b) } catch (j) { let h = {}; this.lodash_set(h, e, c), a = this.setval(JSON.stringify(h), b) } } else a = this.setval(c, d); return a } getval(a) { return this.isSurge() || this.isLoon() ? $persistentStore.read(a) : this.isQuanX() ? $prefs.valueForKey(a) : this.isNode() ? (this.data = this.loaddata(), this.data[a]) : this.data && this.data[a] || null } setval(b, a) { return this.isSurge() || this.isLoon() ? $persistentStore.write(b, a) : this.isQuanX() ? $prefs.setValueForKey(b, a) : this.isNode() ? (this.data = this.loaddata(), this.data[a] = b, this.writedata(), !0) : this.data && this.data[a] || null } send(b, a, f = () => { }) { if ("get" != b && "post" != b && "put" != b && "delete" != b) { console.log(`无效的http方法:${b}`); return } if ("get" == b && a.headers ? (delete a.headers["Content-Type"], delete a.headers["Content-Length"]) : a.body && a.headers && (a.headers["Content-Type"] || (a.headers["Content-Type"] = "application/x-www-form-urlencoded")), this.isSurge() || this.isLoon()) { this.isSurge() && this.isNeedRewrite && (a.headers = a.headers || {}, Object.assign(a.headers, { "X-Surge-Skip-Scripting": !1 })); let c = { method: b, url: a.url, headers: a.headers, timeout: a.timeout, data: a.body }; "get" == b && delete c.data, $axios(c).then(a => { let { status: b, request: c, headers: d, data: e } = a; f(null, c, { statusCode: b, headers: d, body: e }) }).catch(a => console.log(a)) } else if (this.isQuanX()) a.method = b.toUpperCase(), this.isNeedRewrite && (a.opts = a.opts || {}, Object.assign(a.opts, { hints: !1 })), $task.fetch(a).then(a => { let { statusCode: b, request: c, headers: d, body: e } = a; f(null, c, { statusCode: b, headers: d, body: e }) }, a => f(a)); else if (this.isNode()) { this.got = this.got ? this.got : require("got"); let { url: d, ...e } = a; this.instance = this.got.extend({ followRedirect: !1 }), this.instance[b](d, e).then(a => { let { statusCode: b, request: c, headers: d, body: e } = a; f(null, c, { statusCode: b, headers: d, body: e }) }, b => { let { message: c, response: a } = b; f(c, a, a && a.body) }) } } time(a) { let b = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "h+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; for (let c in /(y+)/.test(a) && (a = a.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))), b) new RegExp("(" + c + ")").test(a) && (a = a.replace(RegExp.$1, 1 == RegExp.$1.length ? b[c] : ("00" + b[c]).substr(("" + b[c]).length))); return a } async showmsg() { if (!this.notifyStr) return; let a = this.name + " \u8FD0\u884C\u901A\u77E5\n\n" + this.notifyStr; if ($.isNode()) { var b = require("./sendNotify"); console.log("\n============== \u63A8\u9001 =============="), await b.sendNotify(this.name, a) } else this.msg(a) } logAndNotify(a) { console.log(a), this.notifyStr += a, this.notifyStr += "\n" } msg(d = t, a = "", b = "", e) { let f = a => { if (!a) return a; if ("string" == typeof a) return this.isLoon() ? a : this.isQuanX() ? { "open-url": a } : this.isSurge() ? { url: a } : void 0; if ("object" == typeof a) { if (this.isLoon()) { let b = a.openUrl || a.url || a["open-url"], c = a.mediaUrl || a["media-url"]; return { openUrl: b, mediaUrl: c } } if (this.isQuanX()) { let d = a["open-url"] || a.url || a.openUrl, e = a["media-url"] || a.mediaUrl; return { "open-url": d, "media-url": e } } if (this.isSurge()) return { url: a.url || a.openUrl || a["open-url"] } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(d, a, b, f(e)) : this.isQuanX() && $notify(d, a, b, f(e))); let c = ["", "============== \u7CFB\u7EDF\u901A\u77E5 =============="]; c.push(d), a && c.push(a), b && c.push(b), console.log(c.join("\n")) } getMin(a, b) { return a < b ? a : b } getMax(a, b) { return a < b ? b : a } padStr(e, b, f = "0") { let a = String(e), g = b > a.length ? b - a.length : 0, c = ""; for (let d = 0; d < g; d++)c += f; return c + a } json2str(b, e, f = !1) { let c = []; for (let d of Object.keys(b).sort()) { let a = b[d]; a && f && (a = encodeURIComponent(a)), c.push(d + "=" + a) } return c.join(e) } str2json(e, f = !1) { let d = {}; for (let a of e.split("#")) { if (!a) continue; let b = a.indexOf("="); if (-1 == b) continue; let g = a.substr(0, b), c = a.substr(b + 1); f && (c = decodeURIComponent(c)), d[g] = c } return d } randomString(d, a = "abcdef0123456789") { let b = ""; for (let c = 0; c < d; c++)b += a.charAt(Math.floor(Math.random() * a.length)); return b } randomList(a) { let b = Math.floor(Math.random() * a.length); return a[b] } wait(a) { return new Promise(b => setTimeout(b, a)) } done(a = {}) { + let b = (new Date).getTime(), c = (b - this.startTime) / 1e3; console.log(` +${this.name} 运行结束,共运行了 ${c} 秒!`), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(a) + } + }(a, b) +} +//===============================================获取远程通知======================================== +async function getNotice() { + try { + const urls = [ + "https://tfapi.cn/tl.json", + + ]; + let notice = null; + for (const url of urls) { + const options = { url, headers: { "User-Agent": "" }, }; + const result = await httpRequest(options); + if (result && "notice" in result) { + notice = result.notice.replace(/\\n/g, "\n"); + break; + } + } + if (notice) { $.DoubleLog(notice); } + } catch (e) { + console.log(e); + } +}