-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateProxyList.js
executable file
·121 lines (107 loc) · 3.71 KB
/
updateProxyList.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
//Updating all available proxies every 15 minutes
const fs = require('fs')
const {spawnSync} = require('child_process');
var ProxyVerifier = require('proxy-verifier');
var geoip = require('geoip-lite')
var y = require('events').EventEmitter.prototype._maxListeners = 1000;
//Updating Proxy Source
function updateProxySource() {
const child = spawnSync('node', ['getProxies.js']);
console.log('Proxy source updated!');
}
var proxyArray = new Array();
exports.proxyArray = proxyArray;
var proxyIndex = 0;
exports.proxyIndex = proxyIndex;
//Update proxies from fate0 File
function updateFate0Proxies() {
console.log('Rogue That, Fate0');
var content = fs.readFileSync('fate0Proxies.txt', 'utf8');
var fate0proxy = content.split('\n');
//console.log('proxies length is ' + fate0proxy.length);
for(var n = 0; n < fate0proxy.length - 1; n++) {
proxyArray.push(fate0proxy[n]);
console.log('Got ' + proxyArray.length + ' proxies available now.');
}
}
//Update proxies from chill File
function updateChillProxies() {
console.log('Rogue That, Chill');
var content = fs.readFileSync('proxies.txt', 'utf8');
var fate0proxy = content.split('\n');
//console.log('proxies length is ' + fate0proxy.length);
for(var n = 0; n < fate0proxy.length - 1; n++) {
proxyArray.push(fate0proxy[n]);
console.log('Got ' + proxyArray.length + ' proxies available now.');
}
}
//Update proxies from proxies24
function update24Proxies() {
console.log('Rogue That, 24');
var content = fs.readFileSync('Proxies24.txt', 'utf8');
var fate0proxy = content.split('\n');
//console.log('proxies length is ' + fate0proxy.length);
for(var n = 0; n < fate0proxy.length - 1; n++) {
proxyArray.push(fate0proxy[n]);
console.log('Got ' + proxyArray.length + ' proxies available now.');
}
}
//Check proxies
var checkedProxies = new Array();
function check(proxyT) {
var valid = false;
var proxy = {
ipAddress: proxyT.split(':')[0],
port: proxyT.split(':')[1],
protocol: 'http'
};
ProxyVerifier.testAll(proxy, function(error, result) {
if (error) {
// Some unusual error occurred.
} else {
//console.log('Proxy:' + proxyT + '' + JSON.stringify(result));
if(result.protocols.http.ok && result.anonymityLevel == 'elite') {
if(geoip.lookup(proxyT.split(':')[0])) {
if(geoip.lookup(proxyT.split(':')[0])) {
console.log(geoip.lookup(proxyT.split(':')[0]).country);
checkedProxies.push(proxyT);
console.log('Valid Proxy Found ' + proxyT);
console.log(JSON.stringify(result));
console.log(checkedProxies.length + ' Valid Proxies in Pool!!!');
}
}
}
}
});
return valid;
}
//Update total avaiable proxy list
function updateTotalProxies () {
console.log('Enemy down');
updateProxySource();
updateFate0Proxies();
updateChillProxies();
update24Proxies();
setTimeout(function(){
var uniqProxy = [ ...new Set(proxyArray) ];
proxyArray.length = 0;
console.log(uniqProxy.length + ' Proxies Found!');
checkedProxies.length = 0;
for(var n = 0; n < uniqProxy.length; n++) {
check(uniqProxy[n]);
}
},60000);
setTimeout(function(){
fs.writeFileSync('totalProxyList.txt', '', 'utf8');
for(var n = 0; n < checkedProxies.length; n++) {
fs.appendFile('totalProxyList.txt', checkedProxies[n] + '\n', function(err) {
if (err) throw err;
});
}
}, 850000)
}
////////////////////////////////////////////////////////////////////////////////
updateTotalProxies();
setInterval(function() {
updateTotalProxies();
}, 900000)