Skip to content

Commit c4c5361

Browse files
author
Nexq
committed
TEST
1 parent 7ad2d99 commit c4c5361

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+13521
-1051
lines changed

function/TS_USER_AGENTS.ts

+341
Large diffs are not rendered by default.

function/cache/index.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

function/common.js

+270
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
let request = require('request');
2+
let CryptoJS = require('crypto-js');
3+
let qs = require('querystring');
4+
let urls = require('url');
5+
let path = require('path');
6+
let notify = require('./sendNotify');
7+
let mainEval = require("./eval");
8+
let assert = require('assert');
9+
let jxAlgo = require("./jxAlgo");
10+
let config = require("./config");
11+
let user = {}
12+
try {
13+
user = require("./user")
14+
} catch (e) {}
15+
class env {
16+
constructor(name) {
17+
this.config = { ...config,
18+
...process.env,
19+
...user,
20+
};
21+
this.name = name;
22+
this.message = [];
23+
this.sharecode = [];
24+
this.code = [];
25+
this.timestamp = new Date().getTime();
26+
this.time = this.start = parseInt(this.timestamp / 1000);
27+
this.options = {
28+
'headers': {}
29+
};
30+
console.log(`\n🔔${this.name}, 开始!\n`)
31+
console.log(`=========== 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()} ===========\n`)
32+
}
33+
done() {
34+
let timestamp = new Date().getTime();
35+
let work = ((timestamp - this.timestamp) / 1000).toFixed(2)
36+
console.log(`=========================脚本执行完成,耗时${work}s============================\n`)
37+
console.log(`🔔${this.name}, 结束!\n`)
38+
}
39+
notify(array) {
40+
let text = '';
41+
for (let i of array) {
42+
text += `${i.user} -- ${i.msg}\n`
43+
}
44+
console.log(`\n=============================开始发送提醒消息=============================`)
45+
notify.sendNotify(this.name + "消息提醒", text)
46+
}
47+
wait(t) {
48+
return new Promise(e => setTimeout(e, t))
49+
}
50+
setOptions(params) {
51+
this.options = params;
52+
}
53+
setCookie(cookie) {
54+
this.options.headers.cookie = cookie
55+
}
56+
jsonParse(str) {
57+
try {
58+
return JSON.parse(str);
59+
} catch (e) {
60+
try {
61+
let data = this.match([/try\s*\{\w+\s*\(([^\)]+)/, /\w+\s*\(([^\)]+)/], str)
62+
return JSON.parse(data);
63+
} catch (ee) {
64+
try {
65+
let cb = this.match(/try\s*\{\s*(\w+)/, str)
66+
if (cb) {
67+
let func = "";
68+
let data = str.replace(cb, `func=`)
69+
eval(data);
70+
return func
71+
}
72+
} catch (eee) {
73+
return str
74+
}
75+
}
76+
}
77+
}
78+
curl(params, extra = '') {
79+
if (typeof(params) != 'object') {
80+
params = {
81+
'url': params
82+
}
83+
}
84+
params = Object.assign({ ...this.options
85+
}, params);
86+
params.method = params.body ? 'POST' : 'GET';
87+
if (params.hasOwnProperty('cookie')) {
88+
params.headers.cookie = params.cookie
89+
}
90+
if (params.hasOwnProperty('ua') || params.hasOwnProperty('useragent')) {
91+
params.headers['user-agent'] = params.ua
92+
}
93+
if (params.hasOwnProperty('referer')) {
94+
params.headers.referer = params.referer
95+
}
96+
if (params.hasOwnProperty('params')) {
97+
params.url += '?' + qs.stringify(params.params)
98+
}
99+
if (params.hasOwnProperty('form')) {
100+
params.method = 'POST'
101+
}
102+
return new Promise(resolve => {
103+
request(params, async (err, resp, data) => {
104+
try {
105+
if (params.console) {
106+
console.log(data)
107+
}
108+
this.source = this.jsonParse(data);
109+
if (extra) {
110+
this[extra] = this.source
111+
}
112+
} catch (e) {
113+
console.log(e, resp)
114+
} finally {
115+
resolve(data);
116+
}
117+
})
118+
})
119+
}
120+
dumps(dict) {
121+
return JSON.stringify(dict)
122+
}
123+
loads(str) {
124+
return JSON.parse(str)
125+
}
126+
notice(msg) {
127+
this.message.push({
128+
'index': this.index,
129+
'user': this.user,
130+
'msg': msg
131+
})
132+
}
133+
notices(msg, user, index = '') {
134+
this.message.push({
135+
'user': user,
136+
'msg': msg,
137+
'index': index
138+
})
139+
}
140+
urlparse(url) {
141+
return urls.parse(url, true, true)
142+
}
143+
md5(encryptString) {
144+
return CryptoJS.MD5(encryptString).toString()
145+
}
146+
haskey(data, key, value) {
147+
value = typeof value !== 'undefined' ? value : '';
148+
var spl = key.split('.');
149+
for (var i of spl) {
150+
i = !isNaN(i) ? parseInt(i) : i;
151+
try {
152+
data = data[i];
153+
} catch (error) {
154+
return '';
155+
}
156+
}
157+
if (data == undefined) {
158+
return ''
159+
}
160+
if (value !== '') {
161+
return data === value ? true : false;
162+
} else {
163+
return data
164+
}
165+
}
166+
match(pattern, string) {
167+
pattern = (pattern instanceof Array) ? pattern : [pattern];
168+
for (let pat of pattern) {
169+
// var match = string.match(pat);
170+
var match = pat.exec(string)
171+
if (match) {
172+
var len = match.length;
173+
if (len == 1) {
174+
return match;
175+
} else if (len == 2) {
176+
return match[1];
177+
} else {
178+
var r = [];
179+
for (let i = 1; i < len; i++) {
180+
r.push(match[i])
181+
}
182+
return r;
183+
}
184+
break;
185+
}
186+
// console.log(pat.exec(string))
187+
}
188+
return '';
189+
}
190+
matchall(pattern, string) {
191+
pattern = (pattern instanceof Array) ? pattern : [pattern];
192+
var match;
193+
var result = [];
194+
for (var pat of pattern) {
195+
while ((match = pat.exec(string)) != null) {
196+
var len = match.length;
197+
if (len == 1) {
198+
result.push(match);
199+
} else if (len == 2) {
200+
result.push(match[1]);
201+
} else {
202+
var r = [];
203+
for (let i = 1; i < len; i++) {
204+
r.push(match[i])
205+
}
206+
result.push(r);
207+
}
208+
}
209+
}
210+
return result;
211+
}
212+
compare(property) {
213+
return function(a, b) {
214+
var value1 = a[property];
215+
var value2 = b[property];
216+
return value1 - value2;
217+
}
218+
}
219+
filename(file, rename = '') {
220+
if (!this.runfile) {
221+
this.runfile = path.basename(file).replace(".js", '').replace(/-/g, '_')
222+
}
223+
if (rename) {
224+
rename = `_${rename}`;
225+
}
226+
return path.basename(file).replace(".js", rename).replace(/-/g, '_');
227+
}
228+
rand(n, m) {
229+
var random = Math.floor(Math.random() * (m - n + 1) + n);
230+
return random;
231+
}
232+
random(arr, num) {
233+
var temp_array = new Array();
234+
for (var index in arr) {
235+
temp_array.push(arr[index]);
236+
}
237+
var return_array = new Array();
238+
for (var i = 0; i < num; i++) {
239+
if (temp_array.length > 0) {
240+
var arrIndex = Math.floor(Math.random() * temp_array.length);
241+
return_array[i] = temp_array[arrIndex];
242+
temp_array.splice(arrIndex, 1);
243+
} else {
244+
break;
245+
}
246+
}
247+
return return_array;
248+
}
249+
compact(lists, keys) {
250+
let array = {};
251+
for (let i of keys) {
252+
if (lists[i]) {
253+
array[i] = lists[i];
254+
}
255+
}
256+
return array;
257+
}
258+
unique(arr) {
259+
return Array.from(new Set(arr));
260+
}
261+
end(args) {
262+
return args[args.length - 1]
263+
}
264+
}
265+
module.exports = {
266+
env,
267+
eval: mainEval,
268+
assert,
269+
jxAlgo,
270+
}

function/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {"ThreadJs":[],"invokeKey":"RtKLB8euDo7KwsO0"}

function/dylank.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

function/dylanv.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

function/dylanx.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

function/dylany.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

function/dylanz.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)