forked from libccy/noname
-
Notifications
You must be signed in to change notification settings - Fork 9
/
phantom.js
29 lines (28 loc) · 629 Bytes
/
phantom.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
var fs = require('fs');
var webpage = require('webpage')
var load = function(id){
var page = webpage.create();
page.settings.userAgent = 'NonameServer';
page.open('file:https://'+fs.workingDirectory+'/index.html?server='+id, function(status) {
if(status !== 'success') {
console.log(fs.workingDirectory);
console.log('Unable to access network');
}
setInterval(function(){
if(page.evaluate(function(){
if(!lib.node||!lib.node.clients||!lib.node.clients.length){
return true;
}
else{
return false;
}
})){
page.close();
load(id);
}
},600000);
});
}
load(1);
load(2);
load(3);