Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. //hahahha
  2.  
  3. process.setMaxListeners(0);
  4. process.on('uncaughtException', function(e){});
  5.  
  6. // Agents
  7.  
  8. var httpsagent = require('https-proxy-agent');
  9.  
  10. //Request
  11.  
  12. var request = require('request');
  13. var WebSocket = require('ws');
  14.  
  15. //Load text files & colors
  16.  
  17. var colors = require('colors');
  18. var fs = require('fs'); fs.open("proxyw.txt", 'a', 666, function(e, id) {global.id = id });
  19. var proxies = fs.readFileSync('proxy.txt').toString().split("\n");
  20.  
  21. console.log("Loaded: " + proxies.length.toString().red.bold);
  22.  
  23. proxies = proxies.filter(function(elem, pos) {
  24.  
  25. return proxies.indexOf(elem) == pos;
  26. })
  27.  
  28. console.log("Remove duplicates. Proxies now: " + proxies.length.toString().green.bold +"\n Starting...".green.bold);
  29.  
  30. //=====================
  31.  
  32. var i = 0;
  33. var pc = 0;
  34.  
  35. //=====================
  36. //
  37. // Ex. node checker 50
  38. // ;p
  39. //=====================
  40.  
  41. var proxy_ms = process.argv[2] ? process.argv[2] : 100;
  42.  
  43.  
  44. class Checker {
  45.  
  46. constructor(data) {
  47.  
  48. this.data = data;
  49.  
  50. this.servers = [
  51.  
  52. "ws://game08.na.alis.io:5022",
  53. "ws://game01.eu.alis.io:5016",
  54. "ws://game02.eu.alis.io:5010",
  55. "ws://game08.na.alis.io:5017",
  56. "ws://game01.eu.alis.io:5003",
  57. "ws://game01.eu.alis.io:5009",
  58. "ws://game01.eu.alis.io:5011",
  59. "ws://game01.eu.alis.io:5016",
  60. "ws://game02.eu.alis.io:5002",
  61. "ws://game02.eu.alis.io:5004",
  62. "ws://game02.eu.alis.io:5010",
  63. "ws://game02.eu.alis.io:5015",
  64. "ws://game02.eu.alis.io:5017",
  65. "ws://game03.eu.alis.io:5001",
  66. "ws://game03.eu.alis.io:5005",
  67. "ws://game03.eu.alis.io:5014",
  68. "ws://game03.eu.alis.io:5018",
  69. "ws://game04.eu.alis.io:5006",
  70. "ws://game04.eu.alis.io:5008",
  71. "ws://game04.eu.alis.io:5013",
  72. "ws://game05.eu.alis.io:5007",
  73. "ws://game05.eu.alis.io:5012",
  74. "ws://game05.eu.alis.io:5019",
  75. "ws://game05.eu.alis.io:5020"
  76. ];
  77. }
  78.  
  79. test(ip) {
  80.  
  81. var self = this;
  82.  
  83. request({
  84. url: 'http://alis.io',
  85. agent: new httpsagent('http://' + ip),
  86. headers: {
  87. 'Accept-Language': 'pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4',
  88. 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.89 Safari/537.35',
  89. 'Accept-Encoding': 'gzip, deflate, sdch'
  90. }
  91. },
  92. function(error, response, body) {
  93. console.log("Working proxy: " + pc.toString().green + " Current: " + i + " / " + proxies.length);
  94.  
  95. if (!error && response.headers["set-cookie"]) {
  96.  
  97. self.test_ws(ip, response.headers["set-cookie"]);
  98. }
  99. });
  100. }
  101.  
  102. test_ws(ip, cookie) {
  103.  
  104. var ws = null;
  105. var ws = new WebSocket(this.servers[Math.floor(Math.random()*this.servers.length)], {
  106. agent: new httpsagent('http://' + ip),
  107. origin: 'http://alis.io',
  108. headers: {
  109. 'Origin' : 'http://alis.io',
  110. 'Accept-Language': 'pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4',
  111. 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.89 Safari/537.35',
  112. 'Accept-Encoding': 'gzip, deflate, sdch',
  113. 'Cookie' : cookie
  114. }
  115. });
  116.  
  117. ws.onopen = function() {
  118. pc++;
  119. fs.write(global.id, ip + '\n', null, 'utf8', function() {
  120.  
  121. console.log("Working proxy: " + pc + " Current: " + i + " / " + proxies.length);
  122. });
  123.  
  124. ws.close()
  125. }
  126.  
  127. ws.onclose = function(e){}
  128.  
  129. ws.onerror = function(e){}
  130.  
  131. setTimeout(()=>{
  132.  
  133. ws.close();
  134. ws = null;
  135. }, proxy_ms + 10);
  136. }
  137. }
  138.  
  139. var proxy = new Checker();
  140.  
  141. function myLoop () {
  142. setTimeout(function () {
  143.  
  144. i++;
  145.  
  146. if (i < proxies.length) {
  147.  
  148. proxy.test(proxies[i]);
  149. myLoop();
  150. }
  151. if(i === proxies.length || i === proxies.length-1){
  152.  
  153. console.log("Done... Proxy checker by " + "l3mpik".red);
  154. process.exit();
  155. }
  156. }, proxy_ms);
  157. }
  158.  
  159. myLoop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement