-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathcheck.js
178 lines (155 loc) · 6.03 KB
/
check.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
const {
getEnvsByName,
DisableCk,
EnableCk,
updateEnv,
updateEnv11,
getEnvByUserId
} = require("./ql");
const {
wait,
checkCk,
validateCarmeWithType,
invalidCookieNotify,
getUserInfo,
runOne,
getCookieMap
} = require("./common.js");
const _0x11f78e = require("moment");
function _0x543ec4(_0x3fdeea, _0x4dabab) {
return Math.floor(Math.random() * (_0x4dabab - _0x3fdeea + 1) + _0x3fdeea);
}
function reorderCookie(s) {
const order = ["cookie2", "sgcookie", "unb", "USERID", "SID", "token", "utdid", "deviceId", "umt", "phone", "pwd"];
const cookies = s.split(';');
const cookieDict = {};
cookies.forEach(cookie => {
const keyValue = cookie.split('=', 2);
if (keyValue.length === 2) {
const key = keyValue[0].trim();
const value = keyValue[1].trim();
cookieDict[key] = value;
}
});
const reorderedCookies = [];
order.forEach(key => {
if (cookieDict.hasOwnProperty(key)) {
reorderedCookies.push(`${key}=${cookieDict[key]}`);
}
});
return reorderedCookies.join(';') + ';';
}
function _0x389941(_0x1daaab) {
let _0x59299c = "";
for (let [_0x7cf76, _0x5050e8] of _0x1daaab) {
_0x59299c += _0x7cf76 + "=" + _0x5050e8 + ";";
}
return _0x59299c;
}
async function _0x179175(data, context, options) {
let result1 = await runOne(context, options);
const msg = result1.msg;
const responseData = result1.result;
if (responseData) {
if (responseData.code === 3000) {
let parsedData = JSON.parse(responseData.returnValue.data);
let token = parsedData.autoLoginToken;
let cookie2 = responseData.returnValue.sid;
let unb = responseData.returnValue.hid;
const expiryTimestamp = parsedData.expires;
const expiryDate = _0x11f78e(expiryTimestamp * 1000).format("YYYY-MM-DD HH:mm:ss");
let cookieMap = getCookieMap(context);
let updatedContext = await runOne(context, cookieMap.get("SID"));
if (!updatedContext) {
return;
}
cookieMap.set('cookie2', cookie2);
cookieMap.set('token', token);
cookieMap.set('unb', unb);
let ck666 = _0x389941(cookieMap);
let updatedEnvironment = reorderCookie(ck666);
if (data.id) {
await updateEnv11(updatedEnvironment, data.id, data.remarks);
} else {
await updateEnv(updatedEnvironment, data._id, data.remarks);
}
let userID = cookieMap.get("USERID");
let userEnvironment = await getEnvByUserId(userID);
let successMessage = `${msg}: ${expiryDate}`;
console.log(successMessage);
return successMessage;
} else {
if (responseData.message) {
console.log(responseData.message);
} else {
console.log(response.ret[0]);
}
return null;
}
} else {
console.log(msg);
}
}
(async function _0x1f3fe2() {
const aleo = process.env.ELE_CARME;
await validateCarmeWithType(aleo, 1);
const pragati = await getEnvsByName("elmck");
for (let mackala = 0; mackala < pragati.length; mackala++) {
let athel = pragati[mackala].value;
if (!athel) {
console.log(" ❌无效用户信息, 请重新获取ck");
} else {
try {
var houda = 0;
if (pragati[mackala]._id) {
houda = pragati[mackala]._id;
}
if (pragati[mackala].id) {
houda = pragati[mackala].id;
}
athel = athel.replace(/\s/g, "");
let lavante = await checkCk(athel, mackala);
if (!lavante) {
let deshaune = await _0x179175(pragati[mackala], athel);
if (deshaune && deshaune.indexOf("刷新成功") !== -1) {
await EnableCk(houda);
console.log("第", mackala + 1, "账号正常😁\n");
} else {
const lakeyah = await DisableCk(houda);
if (lakeyah.code === 200) {
console.log("第", mackala + 1, "账号失效!已🈲用");
} else {
console.log("第", mackala + 1, "账号失效!请重新登录!!!😭");
}
await invalidCookieNotify(athel, pragati[mackala].remarks);
}
} else {
let amirr = await getUserInfo(athel);
if (!amirr.encryptMobile) {
let rudolphe = await _0x179175(pragati[mackala], athel);
if (rudolphe && rudolphe.indexOf("刷新成功") !== -1) {
await EnableCk(houda);
console.log("第", mackala + 1, "账号正常😁\n");
} else {
const jericca = await DisableCk(houda);
if (jericca.code === 200) {
console.log("第", mackala + 1, "账号失效!已🈲用");
} else {
console.log("第", mackala + 1, "账号失效!请重新登录!!!😭");
}
}
await invalidCookieNotify(athel, pragati[mackala].remarks);
} else {
await _0x179175(pragati[mackala], athel, getCookieMap(athel).get("SID"));
await EnableCk(houda);
console.log("第", mackala + 1, "账号正常🎉🎉\n");
}
}
} catch (hannelore) {
console.log(hannelore);
}
}
await wait(_0x543ec4(1, 3));
}
process.exit(0);
}());