-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutils.js
More file actions
45 lines (40 loc) · 1.6 KB
/
utils.js
File metadata and controls
45 lines (40 loc) · 1.6 KB
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
const fetch = require('node-fetch');
const fs = require('fs')
module.exports.check = async function (host, callback) {
const token = new Buffer('4e2a5f729d156591784ac3313e9b5560').toString('base64');
fetch(`http://${host}/whoami.php?key=${token}&command=mother`).then(async res=>{
const response = JSON.parse(await res.text());
if(response.type=='ok') callback(1, host);
}).catch(e=>{
console.log(e);
callback(0, host, e);
});
}
module.exports.checklicense = function (token, callback){
fetch('https://api.void.cf/validate?token='+token).then(async res=>{
callback(await res.text());
});
}
module.exports.ReCheckNodes = function () {
const {check} = require('./utils');
fs.readFile('./nodes.txt', 'utf8' , (err, data) => {
if (err) {console.error(err);return}
fs.writeFile('./nodes.txt', ``, err => {})
let nodes = data.split('\n'); nodes.pop();
nodes.forEach(node => {
check(node, function (status, host) {
console.log(status, host);
if (status == 1) {
fs.readFile('./nodes.txt', 'utf8', (err, data) => {
if (err) {console.error(err);return}
if (data.includes(host)) {return;} else {
fs.writeFile('./nodes.txt', `${host}\n`, {flag: 'a+'}, err => {
if (err) {console.error(err);return}
})
}
})
}
})
})
})
}